1. 15 4月, 2010 1 次提交
  2. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  3. 19 3月, 2010 1 次提交
  4. 27 2月, 2010 2 次提交
    • P
      dev: support deferring device flag change notifications · bd380811
      Patrick McHardy 提交于
      Split dev_change_flags() into two functions: __dev_change_flags() to
      perform the actual changes and __dev_notify_flags() to invoke netdevice
      notifiers. This will be used by rtnl_link to defer netlink notifications
      until the device has been fully configured.
      
      This changes ordering of some operations, in particular:
      
      - netlink notifications are sent after all changes have been performed.
        As a side effect this surpresses one unnecessary netlink message when
        the IFF_UP and other flags are changed simultaneously.
      
      - The NETDEV_UP/NETDEV_DOWN and NETDEV_CHANGE notifiers are invoked
        after all changes have been performed. Their relative is unchanged.
      
      - net_dmaengine_put() is invoked before the NETDEV_DOWN notifier instead
        of afterwards. This should not make any difference since both RX and TX
        are already shut down at this point.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd380811
    • P
      rtnetlink: handle rtnl_link netlink notifications manually · a2835763
      Patrick McHardy 提交于
      In order to support specifying device flags during device creation,
      we must be able to roll back device registration in case setting the
      flags fails without sending any notifications related to the device
      to userspace.
      
      This patch changes rollback_registered_many() and register_netdevice()
      to manually send netlink notifications for devices not handled by
      rtnl_link and allows to defer notifications for devices handled by
      rtnl_link until setup is complete.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a2835763
  5. 26 2月, 2010 1 次提交
  6. 25 2月, 2010 1 次提交
    • P
      net: Add checking to rcu_dereference() primitives · a898def2
      Paul E. McKenney 提交于
      Update rcu_dereference() primitives to use new lockdep-based
      checking. The rcu_dereference() in __in6_dev_get() may be
      protected either by rcu_read_lock() or RTNL, per Eric Dumazet.
      The rcu_dereference() in __sk_free() is protected by the fact
      that it is never reached if an update could change it.  Check
      for this by using rcu_dereference_check() to verify that the
      struct sock's ->sk_wmem_alloc counter is zero.
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: laijs@cn.fujitsu.com
      Cc: dipankar@in.ibm.com
      Cc: mathieu.desnoyers@polymtl.ca
      Cc: josh@joshtriplett.org
      Cc: dvhltc@us.ibm.com
      Cc: niv@us.ibm.com
      Cc: peterz@infradead.org
      Cc: rostedt@goodmis.org
      Cc: Valdis.Kletnieks@vt.edu
      Cc: dhowells@redhat.com
      LKML-Reference: <1266887105-1528-5-git-send-email-paulmck@linux.vnet.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a898def2
  7. 24 2月, 2010 1 次提交
    • A
      net: bug fix for vlan + gro issue · c4d49794
      Ajit Khaparde 提交于
      Traffic (tcp) doesnot start on a vlan interface when gro is enabled.
      Even the tcp handshake was not taking place.
      This is because, the eth_type_trans call before the netif_receive_skb
      in napi_gro_finish() resets the skb->dev to napi->dev from the previously
      set vlan netdev interface. This causes the ip_route_input to drop the
      incoming packet considering it as a packet coming from a martian source.
      
      I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
      With this fix, the traffic starts and the test runs fine on both vlan
      and non-vlan interfaces.
      
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: Patrick McHardy <kaber@trash.net>
      Signed-off-by: NAjit Khaparde <ajitk@serverengines.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c4d49794
  8. 18 2月, 2010 1 次提交
    • A
      net: bug fix for vlan + gro issue · e76b69cc
      Ajit Khaparde 提交于
      Traffic (tcp) doesnot start on a vlan interface when gro is enabled.
      Even the tcp handshake was not taking place.
      This is because, the eth_type_trans call before the netif_receive_skb
      in napi_gro_finish() resets the skb->dev to napi->dev from the previously
      set vlan netdev interface. This causes the ip_route_input to drop the
      incoming packet considering it as a packet coming from a martian source.
      
      I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
      With this fix, the traffic starts and the test runs fine on both vlan
      and non-vlan interfaces.
      
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: Patrick McHardy <kaber@trash.net>
      Signed-off-by: NAjit Khaparde <ajitk@serverengines.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e76b69cc
  9. 13 2月, 2010 1 次提交
  10. 11 2月, 2010 1 次提交
  11. 04 2月, 2010 1 次提交
  12. 26 1月, 2010 1 次提交
  13. 21 1月, 2010 1 次提交
  14. 20 1月, 2010 1 次提交
  15. 07 1月, 2010 2 次提交
    • J
      net: Make it easier to parse /proc/net/dev contents. · 2d13bafe
      Jesper Dangaard Brouer 提交于
      The contents of /proc/net/dev is annoying to parse, because
      it changes whether there is a space after the "ethX:" or not.
      It depends upon the size of the "Receive bytes" counter,
      if the number is below 7 digits, then there is whitespaces
      else if the number is 8 digits or above there is no space
      between the ":" and the number.
      
      This patch changes the output to assure there is always a space
      between the ":" and the number.  Given that all existing userspace
      application already need to handle the whitespaces, I see
      no breakage of existing tools.
      Signed-off-by: NJesper Dangaard Brouer <hawk@comx.dk>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2d13bafe
    • A
      fix bonding: allow arp_ip_targets on separate vlans to use arp validation · ca8d9ea3
      Andy Gospodarek 提交于
      On Wed, Jan 06, 2010 at 10:10:03PM +0100, Eric Dumazet wrote:
      > Le 06/01/2010 19:38, Eric Dumazet a écrit :
      > >
      > > (net-next-2.6 doesnt work well on my bond/vlan setup, I suspect I need a bisection)
      >
      > David, I had to revert 1f3c8804
      > (bonding: allow arp_ip_targets on separate vlans to use arp validation)
      >
      > Or else, my vlan devices dont work (unfortunatly I dont have much time
      > these days to debug the thing)
      >
      > My config :
      >
      >               +---------+
      > vlan.103 -----+ bond0   +--- eth1 (bnx2)
      >               |         +
      > vlan.825 -----+         +--- eth2 (tg3)
      >               +---------+
      >
      > $ cat /proc/net/bonding/bond0
      > Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
      >
      > Bonding Mode: fault-tolerance (active-backup)
      > Primary Slave: None
      > Currently Active Slave: eth2
      > MII Status: up
      > MII Polling Interval (ms): 100
      > Up Delay (ms): 0
      > Down Delay (ms): 0
      >
      > Slave Interface: eth1  (bnx2)
      > MII Status: down
      > Link Failure Count: 1
      > Permanent HW addr: 00:1e:0b:ec:d3:d2
      >
      > Slave Interface: eth2   (tg3)
      > MII Status: up
      > Link Failure Count: 0
      > Permanent HW addr: 00:1e:0b:92:78:50
      >
      
      This patch fixes up a problem with found with commit
      1f3c8804.  The original change
      overloaded null_or_orig, but doing that prevented any packet handlers
      that were not tied to a specific device (i.e. ptype->dev == NULL) from
      ever receiving any frames.
      
      The null_or_orig variable cannot be overloaded, and must be kept as NULL
      to prevent the frame from being ignored by packet handlers designed to
      accept frames on any interface.
      Signed-off-by: NAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ca8d9ea3
  16. 04 1月, 2010 1 次提交
    • A
      bonding: allow arp_ip_targets on separate vlans to use arp validation · 1f3c8804
      Andy Gospodarek 提交于
      This allows a bond device to specify an arp_ip_target as a host that is
      not on the same vlan as the base bond device and still use arp
      validation.  A configuration like this, now works:
      
      BONDING_OPTS="mode=active-backup arp_interval=1000 arp_ip_target=10.0.100.1 arp_validate=3"
      
      1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
          inet 127.0.0.1/8 scope host lo
          inet6 ::1/128 scope host
             valid_lft forever preferred_lft forever
      2: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
          link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
      3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 qlen 1000
          link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
      8: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue
          link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
          inet6 fe80::213:21ff:febe:33e9/64 scope link
             valid_lft forever preferred_lft forever
      9: bond0.100@bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue
          link/ether 00:13:21:be:33:e9 brd ff:ff:ff:ff:ff:ff
          inet 10.0.100.2/24 brd 10.0.100.255 scope global bond0.100
          inet6 fe80::213:21ff:febe:33e9/64 scope link
             valid_lft forever preferred_lft forever
      
      Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
      
      Bonding Mode: fault-tolerance (active-backup)
      Primary Slave: None
      Currently Active Slave: eth1
      MII Status: up
      MII Polling Interval (ms): 0
      Up Delay (ms): 0
      Down Delay (ms): 0
      ARP Polling Interval (ms): 1000
      ARP IP target/s (n.n.n.n form): 10.0.100.1
      
      Slave Interface: eth1
      MII Status: up
      Link Failure Count: 1
      Permanent HW addr: 00:40:05:30:ff:30
      
      Slave Interface: eth0
      MII Status: up
      Link Failure Count: 0
      Permanent HW addr: 00:13:21:be:33:e9
      Signed-off-by: NAndy Gospodarek <andy@greyhouse.net>
      Signed-off-by: NJay Vosburgh <fubar@us.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1f3c8804
  17. 24 12月, 2009 1 次提交
  18. 14 12月, 2009 1 次提交
    • E
      net: Fix userspace RTM_NEWLINK notifications. · d90a909e
      Eric W. Biederman 提交于
      I received some bug reports about userspace programs having problems
      because after RTM_NEWLINK was received they could not immediate access
      files under /proc/sys/net/ because they had not been registered yet.
      
      The original problem was trivially fixed by moving the userspace
      notification from rtnetlink_event() to the end of
      register_netdevice().
      
      When testing that change I discovered I was still getting RTM_NEWLINK
      events before I could access proc and I was also getting RTM_NEWLINK
      events after I was seeing RTM_DELLINK.  Things practically guaranteed
      to confuse userspace.
      
      After a little more investigation these extra notifications proved to
      be from the new notifiers NETDEV_POST_INIT and NETDEV_UNREGISTER_BATCH
      hitting the default case in rtnetlink_event, and triggering
      unnecessary RTM_NEWLINK messages.
      
      rtnetlink_event now explicitly handles NETDEV_UNREGISTER_BATCH and
      NETDEV_POST_INIT to avoid sending the incorrect userspace
      notifications.
      Signed-off-by: NEric W. Biederman <ebiederm@aristanetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d90a909e
  19. 12 12月, 2009 1 次提交
    • K
      net: Handle NETREG_UNINITIALIZED devices correctly · e93737b0
      Krishna Kumar 提交于
      Fix two problems:
      
      1. If unregister_netdevice_many() is called with both registered
         and unregistered devices, rollback_registered_many() bails out
         when it reaches the first unregistered device. The processing
         of the prior registered devices is unfinished, and the
         remaining devices are skipped, and possible registered netdev's
         are leaked/unregistered.
      
      2. System hangs or panics depending on how the devices are passed,
         since when netdev_run_todo() runs, some devices were not fully
         processed.
      
      Tested by passing intermingled unregistered and registered vlan
      devices to unregister_netdevice_many() as follows:
      	1. dev, fake_dev1, fake_dev2: hangs in run_todo
      	   ("unregister_netdevice: waiting for eth1.100 to become
      	    free. Usage count = 1")
      	2. fake_dev1, dev, fake_dev2: failure during de-registration
      	   and next registration, followed by a vlan driver Oops
      	   during subsequent registration.
      
      Confirmed that the patch fixes both cases.
      Signed-off-by: NKrishna Kumar <krkumar2@in.ibm.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e93737b0
  20. 04 12月, 2009 2 次提交
  21. 02 12月, 2009 2 次提交
  22. 30 11月, 2009 1 次提交
  23. 27 11月, 2009 1 次提交
  24. 26 11月, 2009 1 次提交
  25. 23 11月, 2009 1 次提交
  26. 21 11月, 2009 1 次提交
  27. 18 11月, 2009 4 次提交
    • O
      d9031024
    • E
      linkwatch: linkwatch_forget_dev() to speedup device dismantle · e014debe
      Eric Dumazet 提交于
      Herbert Xu a écrit :
      > On Tue, Nov 17, 2009 at 04:26:04AM -0800, David Miller wrote:
      >> Really, the link watch stuff is just due for a redesign.  I don't
      >> think a simple hack is going to cut it this time, sorry Eric :-)
      >
      > I have no objections against any redesigns, but since the only
      > caller of linkwatch_forget_dev runs in process context with the
      > RTNL, it could also legally emit those events.
      
      Thanks guys, here an updated version then, before linkwatch surgery ?
      
      In this version, I force the event to be sent synchronously.
      
      [PATCH net-next-2.6] linkwatch: linkwatch_forget_dev() to speedup device dismantle
      
      time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105
      
      real	0m0.266s
      user	0m0.000s
      sys	0m0.001s
      
      real	0m0.770s
      user	0m0.000s
      sys	0m0.000s
      
      real	0m1.022s
      user	0m0.000s
      sys	0m0.000s
      
      One problem of current schem in vlan dismantle phase is the
      holding of device done by following chain :
      
      vlan_dev_stop() ->
      	netif_carrier_off(dev) ->
      		linkwatch_fire_event(dev) ->
      			dev_hold() ...
      
      And __linkwatch_run_queue() runs up to one second later...
      
      A generic fix to this problem is to add a linkwatch_forget_dev() method
      to unlink the device from the list of watched devices.
      
      dev->link_watch_next becomes dev->link_watch_list (and use a bit more memory),
      to be able to unlink device in O(1).
      
      After patch :
      time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105
      
      real    0m0.024s
      user    0m0.000s
      sys     0m0.000s
      
      real    0m0.032s
      user    0m0.000s
      sys     0m0.001s
      
      real    0m0.033s
      user    0m0.000s
      sys     0m0.000s
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e014debe
    • O
      net: introduce NETDEV_UNREGISTER_PERNET · 395264d5
      Octavian Purdila 提交于
      This new event is called once for each unique net namespace in batched
      unregister operations (with the argument set to a random device from
      that namespace) and once per device in non-batched unregister
      operations.
      
      It allows us to factorize some device unregister work such as clearing the
      routing cache.
      Signed-off-by: NOctavian Purdila <opurdila@ixiacom.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      395264d5
    • E
      net: add dev_txq_stats_fold() helper · d83345ad
      Eric Dumazet 提交于
      Some drivers ndo_get_stats() method need to perform txqueue stats folding.
      
      Move folding from dev_get_stats() to a new dev_txq_stats_fold() function
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d83345ad
  28. 16 11月, 2009 3 次提交
  29. 14 11月, 2009 1 次提交
    • P
      net: allow to propagate errors through ->ndo_hard_start_xmit() · 572a9d7b
      Patrick McHardy 提交于
      Currently the ->ndo_hard_start_xmit() callbacks are only permitted to return
      one of the NETDEV_TX codes. This prevents any kind of error propagation for
      virtual devices, like queue congestion of the underlying device in case of
      layered devices, or unreachability in case of tunnels.
      
      This patches changes the NET_XMIT codes to avoid clashes with the NETDEV_TX
      codes and changes the two callers of dev_hard_start_xmit() to expect either
      errno codes, NET_XMIT codes or NETDEV_TX codes as return value.
      
      In case of qdisc_restart(), all non NETDEV_TX codes are mapped to NETDEV_TX_OK
      since no error propagation is possible when using qdiscs. In case of
      dev_queue_xmit(), the error is propagated upwards.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      572a9d7b
  30. 12 11月, 2009 1 次提交
  31. 04 11月, 2009 1 次提交