1. 11 10月, 2007 6 次提交
    • D
      [NETNS]: Fix bad macro definition. · a050c33f
      Daniel Lezcano 提交于
      The macro definition is bad. When calling next_net_device with
      parameter name "dev", the resulting code is:
      	  struct net_device *dev = dev and that leads to an unexpected
      behavior. Especially when llc_core is compiled in, the kernel panics
      at boot time.
      The patchset change macro definition with static inline functions as
      they were defined before.
      Signed-off-by: NBenjamin Thery <benjamin.thery@bull.net>
      Signed-off-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a050c33f
    • E
      [NET]: Implement network device movement between namespaces · ce286d32
      Eric W. Biederman 提交于
      This patch introduces NETIF_F_NETNS_LOCAL a flag to indicate
      a network device is local to a single network namespace and
      should never be moved.  Useful for pseudo devices that we
      need an instance in each network namespace (like the loopback
      device) and for any device we find that cannot handle multiple
      network namespaces so we may trap them in the initial network
      namespace.
      
      This patch introduces the function dev_change_net_namespace
      a function used to move a network device from one network
      namespace to another.  To the network device nothing
      special appears to happen, to the components of the network
      stack it appears as if the network device was unregistered
      in the network namespace it is in, and a new device
      was registered in the network namespace the device
      was moved to.
      
      This patch sets up a namespace device destructor that
      upon the exit of a network namespace moves all of the
      movable network devices  to the initial network namespace
      so they are not lost.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce286d32
    • E
      [NET]: Make the device list and device lookups per namespace. · 881d966b
      Eric W. Biederman 提交于
      This patch makes most of the generic device layer network
      namespace safe.  This patch makes dev_base_head a
      network namespace variable, and then it picks up
      a few associated variables.  The functions:
      dev_getbyhwaddr
      dev_getfirsthwbytype
      dev_get_by_flags
      dev_get_by_name
      __dev_get_by_name
      dev_get_by_index
      __dev_get_by_index
      dev_ioctl
      dev_ethtool
      dev_load
      wireless_process_ioctl
      
      were modified to take a network namespace argument, and
      deal with it.
      
      vlan_ioctl_set and brioctl_set were modified so their
      hooks will receive a network namespace argument.
      
      So basically anthing in the core of the network stack that was
      affected to by the change of dev_base was modified to handle
      multiple network namespaces.  The rest of the network stack was
      simply modified to explicitly use &init_net the initial network
      namespace.  This can be fixed when those components of the network
      stack are modified to handle multiple network namespaces.
      
      For now the ifindex generator is left global.
      
      Fundametally ifindex numbers are per namespace, or else
      we will have corner case problems with migration when
      we get that far.
      
      At the same time there are assumptions in the network stack
      that the ifindex of a network device won't change.  Making
      the ifindex number global seems a good compromise until
      the network stack can cope with ifindex changes when
      you change namespaces, and the like.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      881d966b
    • E
      [NET]: Add a network namespace tag to struct net_device · 4a1c5371
      Eric W. Biederman 提交于
      Please note that network devices do not increase the count
      count on the network namespace.  The are inside the network
      namespace and so the network namespace tag is in the nature
      of a back pointer and so getting and putting the network namespace
      is unnecessary.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a1c5371
    • J
      [ETHTOOL]: Add ETHTOOL_[GS]FLAGS sub-ioctls · 3ae7c0b2
      Jeff Garzik 提交于
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ae7c0b2
    • S
      [NET]: Make NAPI polling independent of struct net_device objects. · bea3348e
      Stephen Hemminger 提交于
      Several devices have multiple independant RX queues per net
      device, and some have a single interrupt doorbell for several
      queues.
      
      In either case, it's easier to support layouts like that if the
      structure representing the poll is independant from the net
      device itself.
      
      The signature of the ->poll() call back goes from:
      
      	int foo_poll(struct net_device *dev, int *budget)
      
      to
      
      	int foo_poll(struct napi_struct *napi, int budget)
      
      The caller is returned the number of RX packets processed (or
      the number of "NAPI credits" consumed if you want to get
      abstract).  The callee no longer messes around bumping
      dev->quota, *budget, etc. because that is all handled in the
      caller upon return.
      
      The napi_struct is to be embedded in the device driver private data
      structures.
      
      Furthermore, it is the driver's responsibility to disable all NAPI
      instances in it's ->stop() device close handler.  Since the
      napi_struct is privatized into the driver's private data structures,
      only the driver knows how to get at all of the napi_struct instances
      it may have per-device.
      
      With lots of help and suggestions from Rusty Russell, Roland Dreier,
      Michael Chan, Jeff Garzik, and Jamal Hadi Salim.
      
      Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
      Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.
      
      [ Ported to current tree and all drivers converted.  Integrated
        Stephen's follow-on kerneldoc additions, and restored poll_list
        handling to the old style to fix mutual exclusion issues.  -DaveM ]
      Signed-off-by: NStephen Hemminger <shemminger@linux-foundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bea3348e
  2. 14 8月, 2007 1 次提交
  3. 21 7月, 2007 1 次提交
  4. 18 7月, 2007 1 次提交
    • D
      [NET]: move dev_mc_discard from dev_mcast.c to dev.c · 456ad75c
      Denis Cheng 提交于
      Because this function is only called by unregister_netdevice,
      this moving could make this non-global function static,
      and also remove its declaration in netdevice.h;
      
      Any further, function __dev_addr_discard is also just called by
      dev_mc_discard and dev_unicast_discard, keeping this two functions
      both in one c file could make __dev_addr_discard also static
      and remove its declaration in netdevice.h;
      
      Futhermore, the sequential call to dev_unicast_discard and then
      dev_mc_discard in unregister_netdevice have a similar mechanism that:
      (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
      they should merged into one to eliminate duplicates in acquiring and
      releasing the dev->_xmit_lock, this would be done in my following patch.
      Signed-off-by: NDenis Cheng <crquan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      456ad75c
  5. 17 7月, 2007 1 次提交
  6. 15 7月, 2007 3 次提交
    • P
      [NET]: Add macvlan driver · b863ceb7
      Patrick McHardy 提交于
      Add macvlan driver, which allows to create virtual ethernet devices
      based on MAC address.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b863ceb7
    • P
      [NET]: dev_mcast: add multicast list synchronization helpers · a0a400d7
      Patrick McHardy 提交于
      The method drivers currently use to synchronize multicast lists is not
      very pretty:
      
      - walk the multicast list
      - search each entry on a copy of the previous list
      - if new add to lower device
      - walk the copy of the previous list
      - search each entry on the current list
      - if removed delete from lower device
      - copy entire list
      
      This patch adds a new field to struct dev_addr_list to store the
      synchronization state and adds two helper functions for synchronization
      and cleanup.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0a400d7
    • P
      [NET]: Add net_device change_rx_mode callback · 24023451
      Patrick McHardy 提交于
      Currently the set_multicast_list (and set_rx_mode) callbacks are
      responsible for configuring the device according to the IFF_PROMISC,
      IFF_MULTICAST and IFF_ALLMULTI flags and the mc_list (and uc_list in
      case of set_rx_mode).
      
      These callbacks can be invoked from BH context without the rtnl_mutex
      by dev_mc_add/dev_mc_delete, which makes reading the device flags and
      promiscous/allmulti count racy. For real hardware drivers that just
      commit all changes to the hardware this is not a real problem since
      the stack guarantees to call them for every change, so at least the
      final call will not race and commit the correct configuration to the
      hardware.
      
      For software devices that want to synchronize promiscous and multicast
      state to an underlying device however this can cause corruption of the
      underlying device's flags or promisc/allmulti counts.
      
      When the software device is concurrently put in promiscous or allmulti
      mode while set_multicast_list is invoked from bottem half context, the
      device might synchronize the change to the underlying device without
      holding the rtnl_mutex, which races with concurrent changes to the
      underlying device.
      
      Add a dev->change_rx_flags hook that is invoked when any of the flags
      that affect rx filtering change (under the rtnl_mutex), which allows
      drivers to perform synchronization immediately and only synchronize
      the address lists in set_multicast_list/set_rx_mode.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      24023451
  7. 12 7月, 2007 1 次提交
  8. 11 7月, 2007 8 次提交
  9. 31 5月, 2007 1 次提交
  10. 11 5月, 2007 1 次提交
    • H
      [NET] link_watch: Move link watch list into net_device · 572a103d
      Herbert Xu 提交于
      These days the link watch mechanism is an integral part of the
      network subsystem as it manages the carrier status.  So it now
      makes sense to allocate some memory for it in net_device rather
      than allocating it on demand.
      
      In fact, this is necessary because we can't tolerate a memory
      allocation failure since that means we'd have to potentially
      throw a link up event away.
      
      It also simplifies the code greatly.
      
      In doing so I discovered a subtle race condition in the use
      of singleevent.  This race condition still exists (and is
      somewhat magnified) without singleevent but it's now plugged
      thanks to an smp_mb__before_clear_bit.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      572a103d
  11. 04 5月, 2007 1 次提交
  12. 03 5月, 2007 1 次提交
  13. 29 4月, 2007 2 次提交
  14. 27 4月, 2007 1 次提交
  15. 26 4月, 2007 2 次提交
    • J
      [WIRELESS] cfg80211: New wireless config infrastructure. · 704232c2
      Johannes Berg 提交于
      This patch creates the core cfg80211 code along with some sysfs bits.
      This is a stripped down version to allow mac80211 to function, but
      doesn't include any configuration yet except for creating and removing
      virtual interfaces.
      
      This patch includes the nl80211 header file but it only contains the
      interface types which the cfg80211 interface for creating virtual
      interfaces relies on.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      704232c2
    • R
      [NET]: Inline net_device_stats · c45d286e
      Rusty Russell 提交于
      Network drivers which keep stats allocate their own stats structure
      then write a get_stats() function to return them.  It would be nice if
      this were done by default.
      
      1) Add a new "stats" field to "struct net_device".
      2) Add a new feature field to say "this driver uses the internal one"
      3) Have a default "get_stats" which returns NULL if that feature not set.
      4) Change callers to check result of get_stats call for NULL, not if
         ->get_stats is set.
      
      This should not break backwards compatibility with older drivers, yet
      allow modern drivers to shed some boilerplate code.
      
      Lightly tested: works for a modified lguest network driver.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c45d286e
  16. 09 2月, 2007 1 次提交
  17. 08 2月, 2007 1 次提交
  18. 01 1月, 2007 1 次提交
  19. 09 12月, 2006 2 次提交
  20. 04 12月, 2006 1 次提交
  21. 03 12月, 2006 3 次提交
    • A
      [NET]: Pack struct hh_cache · d5c42c0e
      Arnaldo Carvalho de Melo 提交于
      [acme@newtoy net-2.6.20]$ pahole net/ipv4/tcp.o hh_cache
      /* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/netdevice.h:190 */
      struct hh_cache {
              struct hh_cache *          hh_next;              /*     0     4 */
              atomic_t                   hh_refcnt;            /*     4     4 */
              __be16                     hh_type;              /*     8     2 */
      
              /* XXX 2 bytes hole, try to pack */
      
              int                        hh_len;               /*    12     4 */
              int                        (*hh_output)();       /*    16     4 */
              rwlock_t                   hh_lock;              /*    20    36 */
              long unsigned int          hh_data[24];          /*    56    96 */
      }; /* size: 152, sum members: 150, holes: 1, sum holes: 2 */
      
      [acme@newtoy net-2.6.20]$ find net -name "*.[ch]" | xargs grep 'hh_len.\+=' | sort -u
      net/atm/br2684.c:               hh->hh_len = PADLEN + ETH_HLEN;
      net/ethernet/eth.c:     hh->hh_len = ETH_HLEN;
      net/ipv4/ipconfig.c:    int hh_len = LL_RESERVED_SPACE(dev);
      net/ipv4/ip_output.c:   hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
      net/ipv4/ip_output.c:   int hh_len = LL_RESERVED_SPACE(dev);
      net/ipv4/netfilter.c:   hh_len = (*pskb)->dst->dev->hard_header_len;
      net/ipv4/raw.c: hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
      net/ipv6/ip6_output.c:  hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
      net/ipv6/netfilter/ip6t_REJECT.c:       hh_len = (dst->dev->hard_header_len + 15)&~15;
      net/ipv6/raw.c: hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
      [acme@newtoy net-2.6.20]$
      
      [acme@newtoy net-2.6.20]$ find include -name "*.h" | xargs grep 'define ETH_HLEN'
      include/linux/if_ether.h:#define ETH_HLEN       14              /* Total octets in header.       */
      
              (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
      
      [acme@newtoy net-2.6.20]$ pahole net/ipv4/tcp.o net_device | grep hard_header_len
              short unsigned int         hard_header_len;      /*   106     2 */
      [acme@newtoy net-2.6.20]$
      
      So I think we're safe in turning hh_len an u16, end result:
      
      [acme@newtoy net-2.6.20]$ codiff -sV /tmp/tcp.o.before net/ipv4/tcp.o
      /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp.c:
        struct hh_cache |   -4
          hh_len;
           from: int                   /*    12(0)     4(0) */
           to:   u16                   /*    10(0)     2(0) */
       1 struct changed
      [acme@newtoy net-2.6.20]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      d5c42c0e
    • G
      [TCP/DCCP]: Introduce net_xmit_eval · b9df3cb8
      Gerrit Renker 提交于
      Throughout the TCP/DCCP (and tunnelling) code, it often happens that the
      return code of a transmit function needs to be tested against NET_XMIT_CN
      which is a value that does not indicate a strict error condition.
      
      This patch uses a macro for these recurring situations which is consistent
      with the already existing macro net_xmit_errno, saving on duplicated code.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@mandriva.com>
      b9df3cb8
    • A
      [NET]: The scheduled removal of the frame diverter. · 90833aa4
      Adrian Bunk 提交于
      This patch contains the scheduled removal of the frame diverter.
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      90833aa4