1. 14 2月, 2013 27 次提交
    • C
      bridge: use __u16 in if_bridge.h · 9f89ec82
      Cong Wang 提交于
      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: NCong Wang <amwang@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9f89ec82
    • D
      Merge branch 'bridge_vlan' · 93197b13
      David S. Miller 提交于
      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: NDavid S. Miller <davem@davemloft.net>
      93197b13
    • V
      bridge: Separate egress policy bitmap · 35e03f3a
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      35e03f3a
    • V
      bridge: Add vlan support for local fdb entries · bc9a25d2
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bc9a25d2
    • V
      bridge: Add vlan support to static neighbors · 1690be63
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Acked-by: NJitendra Kalsaria <jitendra.kalsaria@qlogic.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1690be63
    • V
      bridge: Add vlan id to multicast groups · b0e9a30d
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0e9a30d
    • V
      bridge: Add vlan to unicast fdb entries · 2ba071ec
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ba071ec
    • V
      bridge: Add the ability to configure pvid · 552406c4
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      552406c4
    • V
      bridge: Implement vlan ingress/egress policy with PVID. · 78851988
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      78851988
    • V
      bridge: Dump vlan information from a bridge port · 6cbdceeb
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6cbdceeb
    • V
      bridge: Add netlink interface to configure vlans on bridge ports · 407af329
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      407af329
    • V
      bridge: Verify that a vlan is allowed to egress on given port · 85f46c6b
      Vlad Yasevich 提交于
      When bridge forwards a frame, make sure that a frame is allowed
      to egress on that port.
      Signed-off-by: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      85f46c6b
    • V
      bridge: Validate that vlan is permitted on ingress · a37b85c9
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a37b85c9
    • V
      bridge: Add vlan filtering infrastructure · 243a2e63
      Vlad Yasevich 提交于
      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: NVlad Yasevich <vyasevic@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      243a2e63
    • D
      net: sctp: add build check for sctp_sf_eat_sack_6_2/jsctp_sf_eat_sack · 22222997
      Daniel Borkmann 提交于
      In order to avoid any future surprises of kernel panics due to jprobes
      function mismatches (as e.g. fixed in 4cb9d6ea: sctp: jsctp_sf_eat_sack:
      fix jprobes function signature mismatch), we should check both function
      types during build and scream loudly if they do not match. __same_type
      resolves to __builtin_types_compatible_p, which is 1 in case both types
      are the same and 0 otherwise, qualifiers are ignored. Tested by myself.
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      22222997
    • D
      net: sctp: minor: make jsctp_sf_eat_sack static · 1e558174
      Daniel Borkmann 提交于
      The function jsctp_sf_eat_sack can be made static, no need to extend
      its visibility.
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1e558174
    • R
      bgmac: return error on failed PHY write · 217a55a3
      Rafał Miłecki 提交于
      Some callers may want to know if PHY write succeed. Also make PHY
      functions static, they are not exported anywhere.
      Signed-off-by: NRafał Miłecki <zajec5@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      217a55a3
    • S
      be2net: remove BUG_ON() in be_mcc_compl_is_new() · 9e9ff4b7
      Sathya Perla 提交于
      The current code expects that the last word (with valid bit)
      of an MCC compl is DMAed in one shot. This may not be the case.
      Remove this assertion.
      Signed-off-by: NSathya Perla <sathya.perla@emulex.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9e9ff4b7
    • C
      net: ethernet: ti: remove redundant NULL check. · 79876e03
      Cyril Roelandt 提交于
      cpdma_chan_destroy() on a NULL pointer is a no-op, so the NULL check in
      cpdma_ctlr_destroy() can safely be removed.
      Signed-off-by: NCyril Roelandt <tipecaml@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79876e03
    • P
      net: Fix possible wrong checksum generation. · c9af6db4
      Pravin B Shelar 提交于
      Patch cef401de (net: fix possible wrong checksum
      generation) fixed wrong checksum calculation but it broke TSO by
      defining new GSO type but not a netdev feature for that type.
      net_gso_ok() would not allow hardware checksum/segmentation
      offload of such packets without the feature.
      
      Following patch fixes TSO and wrong checksum. This patch uses
      same logic that Eric Dumazet used. Patch introduces new flag
      SKBTX_SHARED_FRAG if at least one frag can be modified by
      the user. but SKBTX_SHARED_FRAG flag is kept in skb shared
      info tx_flags rather than gso_type.
      
      tx_flags is better compared to gso_type since we can have skb with
      shared frag without gso packet. It does not link SHARED_FRAG to
      GSO, So there is no need to define netdev feature for this.
      Signed-off-by: NPravin B Shelar <pshelar@nicira.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c9af6db4
    • D
      Merge branch 'tcp_tsoffset' · b8fa4100
      David S. Miller 提交于
      Andrey Vagin says:
      
      ====================
      If a TCP socket will get live-migrated from one box to another the
      timestamps (which are typically ON) will get screwed up -- the new
      kernel will generate TS values that has nothing to do with what they
      were on dump. The solution is to yet again fix the kernel and put a
      "timestamp offset" on a socket.
      
      A socket offset is added in places where externally visible tcp
      timestamp option is parsed/initialized.
      
      Connections in the SYN_RECV state are not supported, global
      tcp_time_stamp is used for them, because repair mode doesn't support
      this state. In a future it can be implemented by the similar way as for
      TIME_WAIT sockets.
      
      For time-wait sockets offset is inhereted by a proper tcp_sock.
      
      A per-socket offset can be set only for sockets in repair mode.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b8fa4100
    • A
      tcp: send packets with a socket timestamp · ee684b6f
      Andrey Vagin 提交于
      A socket timestamp is a sum of the global tcp_time_stamp and
      a per-socket offset.
      
      A socket offset is added in places where externally visible
      tcp timestamp option is parsed/initialized.
      
      Connections in the SYN_RECV state are not supported, global
      tcp_time_stamp is used for them, because repair mode doesn't support
      this state. In a future it can be implemented by the similar way
      as for TIME_WAIT sockets.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Cc: James Morris <jmorris@namei.org>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Cc: Patrick McHardy <kaber@trash.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Signed-off-by: NAndrey Vagin <avagin@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ee684b6f
    • A
      tcp: set and get per-socket timestamp · 93be6ce0
      Andrey Vagin 提交于
      A timestamp can be set, only if a socket is in the repair mode.
      
      This patch adds a new socket option TCP_TIMESTAMP, which allows to
      get and set current tcp times stamp.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Cc: James Morris <jmorris@namei.org>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Cc: Patrick McHardy <kaber@trash.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Signed-off-by: NAndrey Vagin <avagin@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93be6ce0
    • A
      tcp: adding a per-socket timestamp offset · ceaa1fef
      Andrey Vagin 提交于
      This functionality is used for restoring tcp sockets. A tcp timestamp
      depends on how long a system has been running, so it's differ for each
      host. The solution is to set a per-socket offset.
      
      A per-socket offset for a TIME_WAIT socket is inherited from a proper
      tcp socket.
      
      tcp_request_sock doesn't have a timestamp offset, because the repair
      mode for them are not implemented.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Cc: James Morris <jmorris@namei.org>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Cc: Patrick McHardy <kaber@trash.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Signed-off-by: NAndrey Vagin <avagin@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ceaa1fef
    • D
      Merge branch 'gfar-ethtool-atomic' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux · d0023f82
      David S. Miller 提交于
      Paul Gortmaker says:
      
      ====================
      Eric noticed that the handling of local u64 ethtool counters for
      this driver commonly found on Freescale ppc-32 boards was racy.
      
      However, before converting them over to atomic64_t, I noticed
      that an internal struct was being used to determine the offsets
      for exporting this data into the ethtool buffer, and in doing
      so, it assumed that the counters would always be u64.  Rather
      than keep this implicit assumption, a simple code cleanup gets
      rid of the struct completely, and leaves less conversion sites.
      
      The alternative solution would have been to take advantage of
      the fact that the counters are all relating to error conditions,
      and hence make them internally u32.  In doing so, we'd be assuming
      that U32_MAX of any particular error condition is highly unlikely.
      This might have made sense if any increments were in a hot path.
      
      Tested with "ethtool -S eth0" on sbc8548 board.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0023f82
    • N
      netpoll: fix smatch warnings in netpoll core code · 959d5fde
      Neil Horman 提交于
      Dan Carpenter contacted me with some notes regarding some smatch warnings in the
      netpoll code, some of which I introduced with my recent netpoll locking fixes,
      some which were there prior.   Specifically they were:
      
      net-next/net/core/netpoll.c:243 netpoll_poll_dev() warn: inconsistent
        returns mutex:&ni->dev_lock: locked (213,217) unlocked (210,243)
      net-next/net/core/netpoll.c:706 netpoll_neigh_reply() warn: potential
        pointer math issue ('skb_transport_header(send_skb)' is a 128 bit pointer)
      
      This patch corrects the locking imbalance (the first error), and adds some
      parenthesis to correct the second error.  Tested by myself. Applies to net-next
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      CC: Dan Carpenter <dan.carpenter@oracle.com>
      CC: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      959d5fde
    • J
      net: skbuff: fix compile error in skb_panic() · 99d5851e
      James Hogan 提交于
      I get the following build error on next-20130213 due to the following
      commit:
      
      commit f05de73b ("skbuff: create
      skb_panic() function and its wrappers").
      
      It adds an argument called panic to a function that uses the BUG() macro
      which tries to call panic, but the argument masks the panic() function
      declaration, resulting in the following error (gcc 4.2.4):
      
      net/core/skbuff.c In function 'skb_panic':
      net/core/skbuff.c +126 : error: called object 'panic' is not a function
      
      This is fixed by renaming the argument to msg.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Jean Sacren <sakiwit@gmail.com>
      Cc: Jiri Pirko <jiri@resnulli.us>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      99d5851e
  2. 13 2月, 2013 13 次提交