1. 15 Feb, 2013 6 commits
  2. 14 Feb, 2013 25 commits
    • David S. Miller's avatar
      net: Don't write to current task flags on every packet received. · 9754e293
      David S. Miller authored
      Even for non-pfmalloc SKBs, __netif_receive_skb() will do a
      tsk_restore_flags() on current unconditionally.
      
      Make __netif_receive_skb() a shim around the existing code, renamed to
      __netif_receive_skb_core().  Let __netif_receive_skb() wrap the
      __netif_receive_skb_core() call with the task flag modifications, if
      necessary.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9754e293
    • Claudiu Manoil's avatar
      gianfar: Fix and cleanup Rx FCB indication · ba779711
      Claudiu Manoil authored
      This fixes a less obvious error on one hand, and prevents futher
      similar errors by disambiguating and optimizing RxFCB indication,
      on the other hand.
      
      The error consists in NETIF_F_HW_VLAN_TX flag being used as an
      indication of Rx FCB insertion. This happened as soon gfar_uses_fcb(),
      which despite its name indicates Rx FCB insertion, started
      incorporating is_vlan_on().
      is_vlan_on(), on the other hand, is also a misleading construct because
      we need to differentiate b/w hw VLAN extraction/VLEX (marked by VLAN_RX
      flag) and hw VLAN insertion/VLINS (VLAN_TX flag), which are different
      mechanisms using different types of FCBs.
      
      The hw spec for the RxFCB feature is as follows:
      In the case of RxBD rings, FCBs (Frame Control Block) are inserted by
      the eTSEC whenever RCTRL[PRSDEP] is set to a non-zero value. Only one
      FCB is inserted per frame (in the buffer pointed to by the RxBD with
      bit F set). TOE acceleration for receive is enabled for all rx frames
      in this case.
      
      This patch introduces priv->uses_rxfcb field to quickly signal RxFCB
      insertion in accordance with the specification above.
      
      The dependency on FSL_GIANFAR_DEV_HAS_TIMER was also eliminated as
      another source of confusion. The actual dependency is to priv->hwts_rx_en.
      Upon changing priv->hwts_rx_en via IOCTL, the gfar device is being
      restarted and on init_mac() the priv->hwts_rx_en flag determines RxFCB
      insertion, and rctrl is programmed accordingly. The patch takes care
      of this case too.
      
      Though maybe not as self documenting as the inlining version uses_fcb(),
      priv->uses_rxfcb has the main purpose to quickly signal, on the hot path,
      that the incoming frame has a *Rx* FCB block inserted which needs to be
      pulled out before passing the skb to the stack. This is a performance
      critical operation, it needs to happen fast, that's why uses_rxfcb is
      placed in the first cacheline of gfar_private.
      This is also why a cached rctrl cannot be used instead: 1) because
      we don't have 32 bits available in the first cacheline of gfar_priv
      (but only 16); 2) bit operations are expensive on the hot path.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ba779711
    • Claudiu Manoil's avatar
      gianfar: Remove wrong buffer size conditioning to VLAN h/w offload · 13f228da
      Claudiu Manoil authored
      The controller's ref manual states clearly that when the hw Rx vlan
      offload feature is enabled, meaning that the VLEX bit from RCTRL is
      correctly enabled, then the hw performs automatic VLAN tag extraction
      and deletion from the ethernet frames. So there's no point in trying to
      increase the rx buff size when rxvlan is on, as the frame is actually
      smaller.
      And the Tx vlan hw accel feature (VLINS) has nothing to do with rx buff
      size computation.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      13f228da
    • Claudiu Manoil's avatar
      gianfar: gfar_process_frame returns void · 61db26c6
      Claudiu Manoil authored
      No return code is expected from gfar_process_frame(), hence
      change it to return void.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61db26c6
    • Claudiu Manoil's avatar
      gianfar: GRO_DROP is unlikely · bd9e89f2
      Claudiu Manoil authored
      The change is significant since it affects the rx hot path.
      Paul observed and documented the effects at asm level, see
      below:
      
      "It turns out that it does make a difference, since gfar_process_frame
      gets inlined, and so the increment code gets moved out of line (I have
      marked the if statment with * and the increment code within "-----"):
      
        ------------------------- as is currently ------------------
           4d14:       80 61 00 18     lwz     r3,24(r1)
           4d18:       7f c4 f3 78     mr      r4,r30
           4d1c:       48 00 00 01     bl      4d1c <gfar_clean_rx_ring+0x10c>
        *  4d20:       2f 83 00 04     cmpwi   cr7,r3,4
           4d24:       40 9e 00 1c     bne-    cr7,4d40
      <gfar_clean_rx_ring+0x130>
              ----------------------------
           4d28:       81 3c 01 f8     lwz     r9,504(r28)
           4d2c:       81 5c 01 fc     lwz     r10,508(r28)
           4d30:       31 4a 00 01     addic   r10,r10,1
           4d34:       7d 29 01 94     addze   r9,r9
           4d38:       91 3c 01 f8     stw     r9,504(r28)
           4d3c:       91 5c 01 fc     stw     r10,508(r28)
              ----------------------------
           4d40:       a0 1f 00 24     lhz     r0,36(r31)
           4d44:       81 3f 00 00     lwz     r9,0(r31)
           4d48:       7f a4 eb 78     mr      r4,r29
           4d4c:       7f e3 fb 78     mr      r3,r31
      
        -------------------------- unlikely ------------------------
           4d14:       80 61 00 18     lwz     r3,24(r1)
           4d18:       7f c4 f3 78     mr      r4,r30
           4d1c:       48 00 00 01     bl      4d1c <gfar_clean_rx_ring+0x10c>
        *  4d20:       2f 83 00 04     cmpwi   cr7,r3,4
           4d24:       41 9e 03 94     beq-    cr7,50b8
      <gfar_clean_rx_ring+0x4a8>
           4d28:       a0 1f 00 24     lhz     r0,36(r31)
           4d2c:       81 3f 00 00     lwz     r9,0(r31)
           4d30:       7f a4 eb 78     mr      r4,r29
           4d34:       7f e3 fb 78     mr      r3,r31
      [...]
           50b8:       81 3c 01 f8     lwz     r9,504(r28)
           50bc:       81 5c 01 fc     lwz     r10,508(r28)
           50c0:       31 4a 00 01     addic   r10,r10,1
           50c4:       7d 29 01 94     addze   r9,r9
           50c8:       91 3c 01 f8     stw     r9,504(r28)
           50cc:       91 5c 01 fc     stw     r10,508(r28)
           50d0:       4b ff fc 58     b       4d28 <gfar_clean_rx_ring+0x118>
      
      So, the increment does actually get moved ~1k away."
      
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd9e89f2
    • Claudiu Manoil's avatar
      gianfar: Cleanup and optimize struct gfar_private · b597d20d
      Claudiu Manoil authored
      Group run-time critical fields within the 1st cacheline (32B)
      followed by the tx|rx_queue reference arrays and the interrupt
      group instances (gfargrp), all cacheline aligned.
      
      This has several benefits. Firstly comes the performance benefit
      by having the members required by the driver's hot path re-grouped
      in the structure's first cache lines, whereas the unimportant
      members were pushed towards the end of the struct.
      Another benefit comes from eliminating a 24 byte memory hole that
      was rendering gfar_priv's 2nd cacheline useless. The default gcc
      layout of gfar_private leaves an implicit 24 byte hole after the
      errata (enum) member. This patch fixes it.
      
      The uchar bitfields were pushed towards the end of the struct
      as these are not run-time performance critical (used for init
      time operations). Because there is no other 2 byte member
      around to couple the uchar bitfields memeber with, we will
      have an addititnal 2 byte hole after the bitfields. This is
      unsignificant however, and it doesn't influence gfar_priv's
      size, because the whole structure is padded to be a 32B multiple.
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b597d20d
    • Claudiu Manoil's avatar
      gianfar: Add device ref (dev) in gfar_private · 369ec162
      Claudiu Manoil authored
      Use device pointer (dev) to simplify the code and to
      avoid double indirections, especially on the hot path.
      
      Basically, instead of accessing priv to get the ofdev
      reference and then accessing the ofdev structure to
      dereference the needed dev pointer, we will get the
      dev pointer directly from priv.
      
      The dev pointer is required on the hot path, see gfar_new_rxbdp
      or gfar_clean_rx_ring (or xmit), and this patch makes
      it available directly from priv's 1st cacheline.
      
      This change is reflected at asm level too, taking (the hot)
      gfar_new_rxbdp():
      initial version -
          18c0:	7c 7e 1b 78 	mr      r30,r3
      
          18d0:	81 69 04 3c 	lwz     r11,1084(r9)
      
          18d8:	34 6b 00 10 	addic.  r3,r11,16
          18dc:	41 82 00 08 	beq-    18e4
      
      patched version -
          18d0:	80 69 04 38 	lwz     r3,1080(r9)
      
          18d8:	2f 83 00 00 	cmpwi   cr7,r3,0
          18dc:	41 9e 00 08 	beq-    cr7,18e4
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      369ec162
    • Claudiu Manoil's avatar
      gianfar: Remove unused device_node ref in gfar_private · 41a20609
      Claudiu Manoil authored
      Remove unused device node pointer.
      Remove duplicated SET_NETDEV_DEV().
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@freescale.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      41a20609
    • David S. Miller's avatar
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next · e0376d00
      David S. Miller authored
      Steffen Klassert says:
      
      ====================
      1) Remove a duplicated call to skb_orphan() in pf_key, from Cong Wang.
      
      2) Prepare xfrm and pf_key for algorithms without pf_key support,
         from Jussi Kivilinna.
      
      3) Fix an unbalanced lock in xfrm_output_one(), from Li RongQing.
      
      4) Add an IPsec state resolution packet queue to handle
         packets that are send before the states are resolved.
      
      5) xfrm4_policy_fini() is unused since 2.6.11, time to remove it.
         From Michal Kubecek.
      
      6) The xfrm gc threshold was configurable just in the initial
         namespace, make it configurable in all namespaces. From
         Michal Kubecek.
      
      7) We currently can not insert policies with mark and mask
         such that some flows would be matched from both policies.
         Allow this if the priorities of these policies are different,
         the one with the higher priority is used in this case.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e0376d00
    • Cong Wang's avatar
      bridge: make ifla_br_policy and br_af_ops static · 15004cab
      Cong Wang authored
      They are only used within this file.
      
      Cc: Vlad Yasevich <vyasevic@redhat.com>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarCong Wang <amwang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15004cab
    • Nathan Hintz's avatar
      bgmac: add read of interrupt mask after disabling interrupts · 4160815f
      Nathan Hintz authored
      The specs prescribe an immediate read of the interrupt mask after
      disabling interrupts.  This patch updates the driver to match the
      specs.
      Signed-off-by: default avatarNathan Hintz <nlhintz@hotmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4160815f
    • Cong Wang's avatar
      bridge: use __u16 in if_bridge.h · 9f89ec82
      Cong Wang authored
      We should use "__u16" instead of "u16" in the user-space visable
      header.
      
      Cc: Vlad Yasevich <vyasevic@redhat.com>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarCong Wang <amwang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9f89ec82
    • David S. Miller's avatar
      Merge branch 'bridge_vlan' · 93197b13
      David S. Miller authored
      Vlad Yasevich says:
      
      ====================
      VLAN filtering/VLAN aware bridge
      
      Changes since v10
      * Updated implemenation of ndo_fdb_del in emulex and qlogic drivers.
      
      Changes since v9:
      * series re-ordering so make functionality more distinct.  Basic vlan
        filtering is patches 1-4.  Support for PVID/untagged vlans is patches
        5 and 6.  VLAN support for FDB/MDB is patches 7-11.  Patch 12 is
        still additional egress policy.
      * Slight simplification to code that extracts the VID from skb.  Since we
        now depend on the vlan module, at the time of input skb_tci is guaranteed
        to be set if the packet had 8021q header.  We can simply refere to it.
      * Changed the opaque 'parent' pointer from prior patches to a union so we
        can be much more explicit in our assignments.
      * Lots of additional testing with STP turned on.  No issues were observed.
      
      Changes since v8:
      * Unified vlans_to_* calls into a single interface
      * Fixed the rest of the issues report by Michal Miroslaw
      * Fixed a bug where fdb entries were not created for all added vlans.
      
      Changes since v7:
      * Rebases on the latest net-next and removed the vlan wrapper patch from
      the series.
      * Fixed a crash in br_fdb_add/br_fdb_delete.
      
      Changes since v6:
      * VLANs are now stored in a VLAN bitmap per port.  This allows for O(1)
      lookup at ingress and egress.  We simply check to see if the bit associated
      with the vlan id is set in the map.  The drawback to this approach is that
      it wastes some space when there is only a small number of VLANs.
      * In addition to the build time configuration option, VLAN filtering also has
      a configuration paramter in sysfs.  By default the filtering is turned off
      and all traffic is permitted.  When the filtring is turned on, we do strict
      matching to the filter configured.  Thus, if there is no configuration, all
      packets are rejected.  This was done to make the behavior more streight
      forward.  Without this (and if egress policy patch is rejected), the
      decision for how to forward untagged traffic that was not filtered at ingress
      is almost impossible to make.  It would not be right to deliver to every
      port that has PVID set as, each port may have a different PVID.
      * Separate egress policy bitmap patch has been isolated and is provided last
      in the series.  This has been a more contentious piece of functionality and I
      wanted to isolate it so that it could easily be dropped and not block the whole
      series.
      
      Changes since v5:
       - Pulled VLAN filtering into its own file and made it a configuration options.
       - Made new vlan filtering option dependent on VLAN_8021Q.
       - Got rid of HW filter inlines and moved then vlan_core.c.
         (All of the above suggested by Stephen Hemminger)
      
      Changes since v4:
       - Pull per-port vlan data into its own structures and give it to the bridge
         device thus making bridge device behave like a regular port for vlan
         configuration.
       - Add a per-vlan 'untagged' bitmap that determins egress policy.  If a port
         is part of this bitmap, traffic egresses untagged.
       - PVID is now used for ingress policy only.  Incomming frames without VLAN tag
         are assigned to the PVID vlan.  Egress is determined via bitmap memberships.
       - Allow for incremental config of a vlan.  Now, PVID and untagged memberships
         may be set on existing vlans.  They however can NOT be cleared separately.
       - VLAN deletion is now done via RTM_DELLINK command for PF_BRIDGE family.
         This cleans up the netlink interface.
      
      Changes since v3:
       - Re-integrated compiler problems that got left out last time.  Appologies.
       - checkpatches.pl errors fixed
      
      Changes since v2:
       - Added inline functiosn to manimulate vlan hw filters and re-use in 8021q
         and bridge code.
       - Use rtnl_dereference (Michael Tsirkin)
       - Remove synchronize_net() call (Eric Dumazet)
       - Fix NULL ptr deref bug I introduced in br_ifinfo_notify.
      
      Changes since v1:
       - Fixed some forwarding bugs.
       - Add vlan to local fdb entries.  New local entries are created per vlan
         to facilite correct forwarding to bridge interface.
       - Allow configuration of vlans directly on the bridge master device
         in addition to ports.
      
      Changes since rfc v2:
       - Per-port vlan bitmap is gone and is replaced with a vlan list.
       - Added bridge vlan list, which is referenced by each port.  Entries in
         the birdge vlan list have port bitmap that shows which port are parts
         of which vlan.
       - Netlink API changes.
       - Dropped sysfs support for now.  If people think this is really usefull,
         can add it back.
       - Support for native/untagged vlans.
      
      Changes since rfc v1:
       - Comments addressed regarding formatting and RCU usage
       - iocts have been removed and changed over the netlink interface.
       - Added support of user added ndb entries.
       - changed sysfs interface to export a bitmap.  Also added a write interface.
         I am not sure how much I like it, but it made my testing easier/faster.  I
         might change the write interface to take text instead of binary.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93197b13
    • Vlad Yasevich's avatar
      bridge: Separate egress policy bitmap · 35e03f3a
      Vlad Yasevich authored
      Add an ability to configure a separate "untagged" egress
      policy to the VLAN information of the bridge.  This superseeds PVID
      policy and makes PVID ingress-only.  The policy is configured with a
      new flag and is represented as a port bitmap per vlan.  Egress frames
      with a VLAN id in "untagged" policy bitmap would egress
      the port without VLAN header.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      35e03f3a
    • Vlad Yasevich's avatar
      bridge: Add vlan support for local fdb entries · bc9a25d2
      Vlad Yasevich authored
      When VLAN is added to the port, a local fdb entry for that port
      (the entry with the mac address of the port) is added for that
      VLAN.  This way we can correctly determine if the traffic
      is for the bridge itself.  If the address of the port changes,
      we try to change all the local fdb entries we have for that port.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bc9a25d2
    • Vlad Yasevich's avatar
      bridge: Add vlan support to static neighbors · 1690be63
      Vlad Yasevich authored
      When a user adds bridge neighbors, allow him to specify VLAN id.
      If the VLAN id is not specified, the neighbor will be added
      for VLANs currently in the ports filter list.  If no VLANs are
      configured on the port, we use vlan 0 and only add 1 entry.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Acked-by: default avatarJitendra Kalsaria <jitendra.kalsaria@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1690be63
    • Vlad Yasevich's avatar
      bridge: Add vlan id to multicast groups · b0e9a30d
      Vlad Yasevich authored
      Add vlan_id to multicasts groups so that we know which vlan
      each group belongs to and can correctly forward to appropriate vlan.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b0e9a30d
    • Vlad Yasevich's avatar
      bridge: Add vlan to unicast fdb entries · 2ba071ec
      Vlad Yasevich authored
      This patch adds vlan to unicast fdb entries that are created for
      learned addresses (not the manually configured ones).  It adds
      vlan id into the hash mix and uses vlan as an addditional parameter
      for an entry match.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2ba071ec
    • Vlad Yasevich's avatar
      bridge: Add the ability to configure pvid · 552406c4
      Vlad Yasevich authored
      A user may designate a certain vlan as PVID.  This means that
      any ingress frame that does not contain a vlan tag is assigned to
      this vlan and any forwarding decisions are made with this vlan in mind.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      552406c4
    • Vlad Yasevich's avatar
      bridge: Implement vlan ingress/egress policy with PVID. · 78851988
      Vlad Yasevich authored
      At ingress, any untagged traffic is assigned to the PVID.
      Any tagged traffic is filtered according to membership bitmap.
      
      At egress, if the vlan matches the PVID, the frame is sent
      untagged.  Otherwise the frame is sent tagged.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78851988
    • Vlad Yasevich's avatar
      bridge: Dump vlan information from a bridge port · 6cbdceeb
      Vlad Yasevich authored
      Using the RTM_GETLINK dump the vlan filter list of a given
      bridge port.  The information depends on setting the filter
      flag similar to how nic VF info is dumped.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6cbdceeb
    • Vlad Yasevich's avatar
      bridge: Add netlink interface to configure vlans on bridge ports · 407af329
      Vlad Yasevich authored
      Add a netlink interface to add and remove vlan configuration on bridge port.
      The interface uses the RTM_SETLINK message and encodes the vlan
      configuration inside the IFLA_AF_SPEC.  It is possble to include multiple
      vlans to either add or remove in a single message.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      407af329
    • Vlad Yasevich's avatar
      bridge: Verify that a vlan is allowed to egress on given port · 85f46c6b
      Vlad Yasevich authored
      When bridge forwards a frame, make sure that a frame is allowed
      to egress on that port.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85f46c6b
    • Vlad Yasevich's avatar
      bridge: Validate that vlan is permitted on ingress · a37b85c9
      Vlad Yasevich authored
      When a frame arrives on a port or transmitted by the bridge,
      if we have VLANs configured, validate that a given VLAN is allowed
      to enter the bridge.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a37b85c9
    • Vlad Yasevich's avatar
      bridge: Add vlan filtering infrastructure · 243a2e63
      Vlad Yasevich authored
      Adds an optional infrustructure component to bridge that would allow
      native vlan filtering in the bridge.  Each bridge port (as well
      as the bridge device) now get a VLAN bitmap.  Each bit in the bitmap
      is associated with a vlan id.  This way if the bit corresponding to
      the vid is set in the bitmap that the packet with vid is allowed to
      enter and exit the port.
      
      Write access the bitmap is protected by RTNL and read access
      protected by RCU.
      
      Vlan functionality is disabled by default.
      Signed-off-by: default avatarVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      243a2e63
  3. 13 Feb, 2013 9 commits