1. 03 5月, 2008 2 次提交
    • D
      netns: Fix device renaming for sysfs · aaf8cdc3
      Daniel Lezcano 提交于
      When a netdev is moved across namespaces with the
      'dev_change_net_namespace' function, the 'device_rename' function is
      used to fixup kobject and refresh the sysfs tree. The device_rename
      function will call kobject_rename and this one will check if there is
      an object with the same name and this is the case because we are
      renaming the object with the same name.
      
      The use of 'device_rename' seems for me wrong because we usually don't
      rename it but just move it across namespaces. As we just want to do a
      mini "netdev_[un]register", IMO the functions
      'netdev_[un]register_kobject' should be used instead, like an usual
      network device [un]registering.
      
      This patch replace device_rename by netdev_unregister_kobject,
      followed by netdev_register_kobject.
      
      The netdev_register_kobject will call device_initialize and will raise
      a warning indicating the device was already initialized. In order to
      fix that, I split the device initialization into a separate function
      and use it together with 'netdev_register_kobject' into
      register_netdevice. So we can safely call 'netdev_register_kobject' in
      'dev_change_net_namespace'.
      
      This fix will allow to properly use the sysfs per namespace which is
      coming from -mm tree.
      Signed-off-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Acked-by: NBenjamin Thery <benjamin.thery@bull.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aaf8cdc3
    • M
      net: remove NR_CPUS arrays in net/core/dev.c · 0c0b0aca
      Mike Travis 提交于
      Remove the fixed size channels[NR_CPUS] array in net/core/dev.c and
      dynamically allocate array based on nr_cpu_ids.
      Signed-off-by: NMike Travis <travis@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c0b0aca
  2. 29 4月, 2008 1 次提交
  3. 19 4月, 2008 1 次提交
    • A
      [NET]: Fix and allocate less memory for ->priv'less netdevices · d1643d24
      Alexey Dobriyan 提交于
      This patch effectively reverts commit d0498d9a
      aka "[NET]: Do not allocate unneeded memory for dev->priv alignment."
      It was found to be buggy because of final unconditional += NETDEV_ALIGN_CONST
      removal.
      
      For example, for sizeof(struct net_device) being 2048 bytes, "alloc_size"
      was also 2048 bytes, but allocator with debugging options turned on started
      giving out !32-byte aligned memory resulting in redzones overwrites.
      
      Patch does small optimization in ->priv'less case: bumping size to next
      32-byte boundary was always done to ensure ->priv will also be aligned.
      But, no ->priv, no need to do that.
      Signed-off-by: NAlexey Dobriyan <adobriyan@sw.ru>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1643d24
  4. 16 4月, 2008 2 次提交
  5. 26 3月, 2008 3 次提交
  6. 25 3月, 2008 1 次提交
  7. 21 3月, 2008 1 次提交
    • P
      [NET]: Add per-connection option to set max TSO frame size · 82cc1a7a
      Peter P Waskiewicz Jr 提交于
      Update: My mailer ate one of Jarek's feedback mails...  Fixed the
      parameter in netif_set_gso_max_size() to be u32, not u16.  Fixed the
      whitespace issue due to a patch import botch.  Changed the types from
      u32 to unsigned int to be more consistent with other variables in the
      area.  Also brought the patch up to the latest net-2.6.26 tree.
      
      Update: Made gso_max_size container 32 bits, not 16.  Moved the
      location of gso_max_size within netdev to be less hotpath.  Made more
      consistent names between the sock and netdev layers, and added a
      define for the max GSO size.
      
      Update: Respun for net-2.6.26 tree.
      
      Update: changed max_gso_frame_size and sk_gso_max_size from signed to
      unsigned - thanks Stephen!
      
      This patch adds the ability for device drivers to control the size of
      the TSO frames being sent to them, per TCP connection.  By setting the
      netdevice's gso_max_size value, the socket layer will set the GSO
      frame size based on that value.  This will propogate into the TCP
      layer, and send TSO's of that size to the hardware.
      
      This can be desirable to help tune the bursty nature of TSO on a
      per-adapter basis, where one may have 1 GbE and 10 GbE devices
      coexisting in a system, one running multiqueue and the other not, etc.
      
      This can also be desirable for devices that cannot support full 64 KB
      TSO's, but still want to benefit from some level of segmentation
      offloading.
      Signed-off-by: NPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      82cc1a7a
  8. 20 2月, 2008 1 次提交
  9. 14 2月, 2008 2 次提交
  10. 13 2月, 2008 1 次提交
    • M
      [NET]: Fix race in dev_close(). (Bug 9750) · d8b2a4d2
      Matti Linnanvuori 提交于
      There is a race in Linux kernel file net/core/dev.c, function dev_close.
      The function calls function dev_deactivate, which calls function
      dev_watchdog_down that deletes the watchdog timer. However, after that, a
      driver can call netif_carrier_ok, which calls function
      __netdev_watchdog_up that can add the watchdog timer again. Function
      unregister_netdevice calls function dev_shutdown that traps the bug
      !timer_pending(&dev->watchdog_timer). Moving dev_deactivate after
      netif_running() has been cleared prevents function netif_carrier_on
      from calling __netdev_watchdog_up and adding the watchdog timer again.
      Signed-off-by: NMatti Linnanvuori <mattilinnanvuori@yahoo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d8b2a4d2
  11. 02 2月, 2008 3 次提交
  12. 01 2月, 2008 1 次提交
    • C
      [VLAN]: set_rx_mode support for unicast address list · e83a2ea8
      Chris Leech 提交于
      Reuse the existing logic for multicast list synchronization for the
      unicast address list. The core of dev_mc_sync/unsync are split out as
      __dev_addr_sync/unsync and moved from dev_mcast.c to dev.c.  These are
      then used to implement dev_unicast_sync/unsync as well.
      
      I'm working on cleaning up Intel's FCoE stack, which generates new MAC
      addresses from the fibre channel device id assigned by the fabric as
      per the current draft specification in T11.  When using such a
      protocol in a VLAN environment it would be nice to not always be
      forced into promiscuous mode, assuming the underlying Ethernet driver
      supports multiple unicast addresses as well.
      Signed-off-by: NChris Leech <christopher.leech@intel.com>
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      e83a2ea8
  13. 29 1月, 2008 7 次提交
  14. 09 1月, 2008 1 次提交
  15. 21 12月, 2007 1 次提交
  16. 11 12月, 2007 1 次提交
  17. 15 11月, 2007 1 次提交
    • P
      [NET]: Remove notifier block from chain when register_netdevice_notifier fails · c67625a1
      Pavel Emelyanov 提交于
      Commit fcc5a03a:
      
      	[NET]: Allow netdev REGISTER/CHANGENAME events to fail
      
      makes the register_netdevice_notifier() handle the error from the
      NETDEV_REGISTER event, sent to the registering block.
      
      The bad news is that in this case the notifier block is 
      not removed from the list, but the error is returned to the 
      caller. In case the caller is in module init function and 
      handles this error this can abort the module loading. The
      notifier block will be then removed from the kernel, but 
      will be left in the list. Oops :(
      
      I think that the notifier block should be removed from the
      chain in case of error, regardless whether this error is 
      handled by the caller or not. In the worst case (the error 
      is _not_ handled) module will not receive the events any 
      longer.
      Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c67625a1
  18. 13 11月, 2007 1 次提交
  19. 11 11月, 2007 1 次提交
  20. 01 11月, 2007 1 次提交
  21. 31 10月, 2007 1 次提交
    • D
      [NET]: Fix free_netdev on register_netdev failure. · 93ee31f1
      Daniel Lezcano 提交于
      Point 1:
      The unregistering of a network device schedule a netdev_run_todo.
      This function calls dev->destructor when it is set and the
      destructor calls free_netdev.
      
      Point 2:
      In the case of an initialization of a network device the usual code
      is:
       * alloc_netdev
       * register_netdev
          -> if this one fails, call free_netdev and exit with error.
      
      Point 3:
      In the register_netdevice function at the later state, when the device
      is at the registered state, a call to the netdevice_notifiers is made.
      If one of the notification falls into an error, a rollback to the
      registered state is done using unregister_netdevice.
      
      Conclusion:
      When a network device fails to register during initialization because
      one network subsystem returned an error during a notification call
      chain, the network device is freed twice because of fact 1 and fact 2.
      The second free_netdev will be done with an invalid pointer.
      
      Proposed solution:
      The following patch move all the code of unregister_netdevice *except*
      the call to net_set_todo, to a new function "rollback_registered".
      
      The following functions are changed in this way:
       * register_netdevice: calls rollback_registered when a notification fails
       * unregister_netdevice: calls rollback_register + net_set_todo, the call
                               order to net_set_todo is changed because it is the
                               latest now. Since it justs add an element to a list
                               that should not break anything.
      Signed-off-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93ee31f1
  22. 30 10月, 2007 1 次提交
    • D
      [NET]: Fix race between poll_napi() and net_rx_action() · 0a7606c1
      David S. Miller 提交于
      netpoll_poll_lock() synchronizes the ->poll() invocation
      code paths, but once we have the lock we have to make
      sure that NAPI_STATE_SCHED is still set.  Otherwise we
      get:
      
      	cpu 0			cpu 1
      
      	net_rx_action()		poll_napi()
      	netpoll_poll_lock()	... spin on ->poll_lock
      	->poll()
      	  netif_rx_complete
      	netpoll_poll_unlock()	acquire ->poll_lock()
      				->poll()
      				 netif_rx_complete()
      				 CRASH
      
      Based upon a bug report from Tina Yang.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0a7606c1
  23. 27 10月, 2007 1 次提交
    • E
      [NET]: Marking struct pernet_operations __net_initdata was inappropriate · 2b008b0a
      Eric W. Biederman 提交于
      It is not safe to to place struct pernet_operations in a special section.
      We need struct pernet_operations to last until we call unregister_pernet_subsys.
      Which doesn't happen until module unload.
      
      So marking struct pernet_operations is a disaster for modules in two ways.
      - We discard it before we call the exit method it points to.
      - Because I keep struct pernet_operations on a linked list discarding
        it for compiled in code removes elements in the middle of a linked
        list and does horrible things for linked insert.
      
      So this looks safe assuming __exit_refok is not discarded
      for modules.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2b008b0a
  24. 26 10月, 2007 1 次提交
  25. 24 10月, 2007 2 次提交
  26. 22 10月, 2007 1 次提交