1. 25 11月, 2010 1 次提交
    • T
      xps: Transmit Packet Steering · 1d24eb48
      Tom Herbert 提交于
      This patch implements transmit packet steering (XPS) for multiqueue
      devices.  XPS selects a transmit queue during packet transmission based
      on configuration.  This is done by mapping the CPU transmitting the
      packet to a queue.  This is the transmit side analogue to RPS-- where
      RPS is selecting a CPU based on receive queue, XPS selects a queue
      based on the CPU (previously there was an XPS patch from Eric
      Dumazet, but that might more appropriately be called transmit completion
      steering).
      
      Each transmit queue can be associated with a number of CPUs which will
      use the queue to send packets.  This is configured as a CPU mask on a
      per queue basis in:
      
      /sys/class/net/eth<n>/queues/tx-<n>/xps_cpus
      
      The mappings are stored per device in an inverted data structure that
      maps CPUs to queues.  In the netdevice structure this is an array of
      num_possible_cpu structures where each structure holds and array of
      queue_indexes for queues which that CPU can use.
      
      The benefits of XPS are improved locality in the per queue data
      structures.  Also, transmit completions are more likely to be done
      nearer to the sending thread, so this should promote locality back
      to the socket on free (e.g. UDP).  The benefits of XPS are dependent on
      cache hierarchy, application load, and other factors.  XPS would
      nominally be configured so that a queue would only be shared by CPUs
      which are sharing a cache, the degenerative configuration woud be that
      each CPU has it's own queue.
      
      Below are some benchmark results which show the potential benfit of
      this patch.  The netperf test has 500 instances of netperf TCP_RR test
      with 1 byte req. and resp.
      
      bnx2x on 16 core AMD
         XPS (16 queues, 1 TX queue per CPU)  1234K at 100% CPU
         No XPS (16 queues)                   996K at 100% CPU
      Signed-off-by: NTom Herbert <therbert@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1d24eb48
  2. 19 11月, 2010 1 次提交
    • J
      net: zero kobject in rx_queue_release · 7d8e76bf
      John Fastabend 提交于
      netif_set_real_num_rx_queues() can decrement and increment
      the number of rx queues. For example ixgbe does this as
      features and offloads are toggled. Presumably this could
      also happen across down/up on most devices if the available
      resources changed (cpu offlined).
      
      The kobject needs to be zero'd in this case so that the
      state is not preserved across kobject_put()/kobject_init_and_add().
      
      This resolves the following error report.
      
      ixgbe 0000:03:00.0: eth2: NIC Link is Up 10 Gbps, Flow Control: RX/TX
      kobject (ffff880324b83210): tried to init an initialized object, something is seriously wrong.
      Pid: 1972, comm: lldpad Not tainted 2.6.37-rc18021qaz+ #169
      Call Trace:
       [<ffffffff8121c940>] kobject_init+0x3a/0x83
       [<ffffffff8121cf77>] kobject_init_and_add+0x23/0x57
       [<ffffffff8107b800>] ? mark_lock+0x21/0x267
       [<ffffffff813c6d11>] net_rx_queue_update_kobjects+0x63/0xc6
       [<ffffffff813b5e0e>] netif_set_real_num_rx_queues+0x5f/0x78
       [<ffffffffa0261d49>] ixgbe_set_num_queues+0x1c6/0x1ca [ixgbe]
       [<ffffffffa0262509>] ixgbe_init_interrupt_scheme+0x1e/0x79c [ixgbe]
       [<ffffffffa0274596>] ixgbe_dcbnl_set_state+0x167/0x189 [ixgbe]
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d8e76bf
  3. 18 11月, 2010 1 次提交
    • J
      net: zero kobject in rx_queue_release · 9ea19481
      John Fastabend 提交于
      netif_set_real_num_rx_queues() can decrement and increment
      the number of rx queues. For example ixgbe does this as
      features and offloads are toggled. Presumably this could
      also happen across down/up on most devices if the available
      resources changed (cpu offlined).
      
      The kobject needs to be zero'd in this case so that the
      state is not preserved across kobject_put()/kobject_init_and_add().
      
      This resolves the following error report.
      
      ixgbe 0000:03:00.0: eth2: NIC Link is Up 10 Gbps, Flow Control: RX/TX
      kobject (ffff880324b83210): tried to init an initialized object, something is seriously wrong.
      Pid: 1972, comm: lldpad Not tainted 2.6.37-rc18021qaz+ #169
      Call Trace:
       [<ffffffff8121c940>] kobject_init+0x3a/0x83
       [<ffffffff8121cf77>] kobject_init_and_add+0x23/0x57
       [<ffffffff8107b800>] ? mark_lock+0x21/0x267
       [<ffffffff813c6d11>] net_rx_queue_update_kobjects+0x63/0xc6
       [<ffffffff813b5e0e>] netif_set_real_num_rx_queues+0x5f/0x78
       [<ffffffffa0261d49>] ixgbe_set_num_queues+0x1c6/0x1ca [ixgbe]
       [<ffffffffa0262509>] ixgbe_init_interrupt_scheme+0x1e/0x79c [ixgbe]
       [<ffffffffa0274596>] ixgbe_dcbnl_set_state+0x167/0x189 [ixgbe]
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9ea19481
  4. 16 11月, 2010 1 次提交
  5. 26 10月, 2010 1 次提交
  6. 09 10月, 2010 1 次提交
  7. 28 9月, 2010 1 次提交
  8. 02 9月, 2010 1 次提交
  9. 17 8月, 2010 1 次提交
  10. 25 7月, 2010 1 次提交
    • S
      sysfs: add attribute to indicate hw address assignment type · c1f79426
      Stefan Assmann 提交于
      Add addr_assign_type to struct net_device and expose it via sysfs.
      This new attribute has the purpose of giving user-space the ability to
      distinguish between different assignment types of MAC addresses.
      
      For example user-space can treat NICs with randomly generated MAC
      addresses differently than NICs that have permanent (locally assigned)
      MAC addresses.
      For the former udev could write a persistent net rule by matching the
      device path instead of the MAC address.
      There's also the case of devices that 'steal' MAC addresses from slave
      devices. In which it is also be beneficial for user-space to be aware
      of the fact.
      
      This patch also introduces a helper function to assist adoption of
      drivers that generate MAC addresses randomly.
      Signed-off-by: NStefan Assmann <sassmann@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c1f79426
  11. 13 7月, 2010 1 次提交
  12. 08 7月, 2010 1 次提交
    • E
      net: fix 64 bit counters on 32 bit arches · 28172739
      Eric Dumazet 提交于
      There is a small possibility that a reader gets incorrect values on 32
      bit arches. SNMP applications could catch incorrect counters when a
      32bit high part is changed by another stats consumer/provider.
      
      One way to solve this is to add a rtnl_link_stats64 param to all
      ndo_get_stats64() methods, and also add such a parameter to
      dev_get_stats().
      
      Rule is that we are not allowed to use dev->stats64 as a temporary
      storage for 64bit stats, but a caller provided area (usually on stack)
      
      Old drivers (only providing get_stats() method) need no changes.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28172739
  13. 13 6月, 2010 1 次提交
    • B
      net: Enable 64-bit net device statistics on 32-bit architectures · be1f3c2c
      Ben Hutchings 提交于
      Use struct rtnl_link_stats64 as the statistics structure.
      
      On 32-bit architectures, insert 32 bits of padding after/before each
      field of struct net_device_stats to make its layout compatible with
      struct rtnl_link_stats64.  Add an anonymous union in net_device; move
      stats into the union and add struct rtnl_link_stats64 stats64.
      
      Add net_device_ops::ndo_get_stats64, implementations of which will
      return a pointer to struct rtnl_link_stats64.  Drivers that implement
      this operation must not update the structure asynchronously.
      
      Change dev_get_stats() to call ndo_get_stats64 if available, and to
      return a pointer to struct rtnl_link_stats64.  Change callers of
      dev_get_stats() accordingly.
      Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be1f3c2c
  14. 22 5月, 2010 3 次提交
    • E
      net: Expose all network devices in a namespaces in sysfs · a1b3f594
      Eric W. Biederman 提交于
      This reverts commit aaf8cdc3.
      
      Drivers like the ipw2100 call device_create_group when they
      are initialized and device_remove_group when they are shutdown.
      Moving them between namespaces deletes their sysfs groups early.
      
      In particular the following call chain results.
      netdev_unregister_kobject -> device_del -> kobject_del -> sysfs_remove_dir
      With sysfs_remove_dir recursively deleting all of it's subdirectories,
      and nothing adding them back.
      
      Ouch!
      
      Therefore we need to call something that ultimate calls sysfs_mv_dir
      as that sysfs function can move sysfs directories between namespaces
      without deleting their subdirectories or their contents.   Allowing
      us to avoid placing extra boiler plate into every driver that does
      something interesting with sysfs.
      
      Currently the function that provides that capability is device_rename.
      That is the code works without nasty side effects as originally written.
      
      So remove the misguided fix for moving devices between namespaces.  The
      bug in the kobject layer that inspired it has now been recognized and
      fixed.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a1b3f594
    • E
      net/sysfs: Fix the bitrot in network device kobject namespace support · d6523ddf
      Eric W. Biederman 提交于
      I had a couple of stupid bugs in:
      netns: Teach network device kobjects which namespace they are in.
      
      - I duplicated the Kconfig for the NET_NS
      - The build was broken when sysfs was not compiled in
      
      The sysfs breakage is because after I moved the operations
      for the sysfs to the kobject layer, to make things cleaner
      I forgot to move the ifdefs.  Opps.
      
      I'm not quite certain how I got introduced a second NET_NS Kconfig,
      but it was probably a 3 way merge somewhere along the way that
      did not notice that the NET_NS Kconfig option had mvoed and thout
      that was a bug.  It probably slipped in because it used to be the
      sysfs patches were the first patches in my network namespace patches.
      Some things just don't go like you would expect.
      
      Neither of these bugs actually affect anything in the common case
      but they should be fixed.
      
      Thanks to Serge for noticing they were present.
      Reported-by: NSerge E. Hallyn <serue@us.ibm.com>
      Signed-off-by: NEric W. Biederman <ebiederm@aristanetworks.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      
      d6523ddf
    • E
      netns: Teach network device kobjects which namespace they are in. · 608b4b95
      Eric W. Biederman 提交于
      The problem.  Network devices show up in sysfs and with the network
      namespace active multiple devices with the same name can show up in
      the same directory, ouch!
      
      To avoid that problem and allow existing applications in network namespaces
      to see the same interface that is currently presented in sysfs, this
      patch enables the tagging directory support in sysfs.
      
      By using the network namespace pointers as tags to separate out the
      the sysfs directory entries we ensure that we don't have conflicts
      in the directories and applications only see a limited set of
      the network devices.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      608b4b95
  15. 20 4月, 2010 1 次提交
  16. 17 4月, 2010 1 次提交
    • T
      rfs: Receive Flow Steering · fec5e652
      Tom Herbert 提交于
      This patch implements receive flow steering (RFS).  RFS steers
      received packets for layer 3 and 4 processing to the CPU where
      the application for the corresponding flow is running.  RFS is an
      extension of Receive Packet Steering (RPS).
      
      The basic idea of RFS is that when an application calls recvmsg
      (or sendmsg) the application's running CPU is stored in a hash
      table that is indexed by the connection's rxhash which is stored in
      the socket structure.  The rxhash is passed in skb's received on
      the connection from netif_receive_skb.  For each received packet,
      the associated rxhash is used to look up the CPU in the hash table,
      if a valid CPU is set then the packet is steered to that CPU using
      the RPS mechanisms.
      
      The convolution of the simple approach is that it would potentially
      allow OOO packets.  If threads are thrashing around CPUs or multiple
      threads are trying to read from the same sockets, a quickly changing
      CPU value in the hash table could cause rampant OOO packets--
      we consider this a non-starter.
      
      To avoid OOO packets, this solution implements two types of hash
      tables: rps_sock_flow_table and rps_dev_flow_table.
      
      rps_sock_table is a global hash table.  Each entry is just a CPU
      number and it is populated in recvmsg and sendmsg as described above.
      This table contains the "desired" CPUs for flows.
      
      rps_dev_flow_table is specific to each device queue.  Each entry
      contains a CPU and a tail queue counter.  The CPU is the "current"
      CPU for a matching flow.  The tail queue counter holds the value
      of a tail queue counter for the associated CPU's backlog queue at
      the time of last enqueue for a flow matching the entry.
      
      Each backlog queue has a queue head counter which is incremented
      on dequeue, and so a queue tail counter is computed as queue head
      count + queue length.  When a packet is enqueued on a backlog queue,
      the current value of the queue tail counter is saved in the hash
      entry of the rps_dev_flow_table.
      
      And now the trick: when selecting the CPU for RPS (get_rps_cpu)
      the rps_sock_flow table and the rps_dev_flow table for the RX queue
      are consulted.  When the desired CPU for the flow (found in the
      rps_sock_flow table) does not match the current CPU (found in the
      rps_dev_flow table), the current CPU is changed to the desired CPU
      if one of the following is true:
      
      - The current CPU is unset (equal to RPS_NO_CPU)
      - Current CPU is offline
      - The current CPU's queue head counter >= queue tail counter in the
      rps_dev_flow table.  This checks if the queue tail has advanced
      beyond the last packet that was enqueued using this table entry.
      This guarantees that all packets queued using this entry have been
      dequeued, thus preserving in order delivery.
      
      Making each queue have its own rps_dev_flow table has two advantages:
      1) the tail queue counters will be written on each receive, so
      keeping the table local to interrupting CPU s good for locality.  2)
      this allows lockless access to the table-- the CPU number and queue
      tail counter need to be accessed together under mutual exclusion
      from netif_receive_skb, we assume that this is only called from
      device napi_poll which is non-reentrant.
      
      This patch implements RFS for TCP and connected UDP sockets.
      It should be usable for other flow oriented protocols.
      
      There are two configuration parameters for RFS.  The
      "rps_flow_entries" kernel init parameter sets the number of
      entries in the rps_sock_flow_table, the per rxqueue sysfs entry
      "rps_flow_cnt" contains the number of entries in the rps_dev_flow
      table for the rxqueue.  Both are rounded to power of two.
      
      The obvious benefit of RFS (over just RPS) is that it achieves
      CPU locality between the receive processing for a flow and the
      applications processing; this can result in increased performance
      (higher pps, lower latency).
      
      The benefits of RFS are dependent on cache hierarchy, application
      load, and other factors.  On simple benchmarks, we don't necessarily
      see improvement and sometimes see degradation.  However, for more
      complex benchmarks and for applications where cache pressure is
      much higher this technique seems to perform very well.
      
      Below are some benchmark results which show the potential benfit of
      this patch.  The netperf test has 500 instances of netperf TCP_RR
      test with 1 byte req. and resp.  The RPC test is an request/response
      test similar in structure to netperf RR test ith 100 threads on
      each host, but does more work in userspace that netperf.
      
      e1000e on 8 core Intel
         No RFS or RPS		104K tps at 30% CPU
         No RFS (best RPS config):    290K tps at 63% CPU
         RFS				303K tps at 61% CPU
      
      RPC test	tps	CPU%	50/90/99% usec latency	Latency StdDev
        No RFS/RPS	103K	48%	757/900/3185		4472.35
        RPS only:	174K	73%	415/993/2468		491.66
        RFS		223K	73%	379/651/1382		315.61
      Signed-off-by: NTom Herbert <therbert@google.com>
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fec5e652
  17. 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
  18. 29 3月, 2010 1 次提交
  19. 23 3月, 2010 1 次提交
  20. 17 3月, 2010 1 次提交
    • T
      rps: Receive Packet Steering · 0a9627f2
      Tom Herbert 提交于
      This patch implements software receive side packet steering (RPS).  RPS
      distributes the load of received packet processing across multiple CPUs.
      
      Problem statement: Protocol processing done in the NAPI context for received
      packets is serialized per device queue and becomes a bottleneck under high
      packet load.  This substantially limits pps that can be achieved on a single
      queue NIC and provides no scaling with multiple cores.
      
      This solution queues packets early on in the receive path on the backlog queues
      of other CPUs.   This allows protocol processing (e.g. IP and TCP) to be
      performed on packets in parallel.   For each device (or each receive queue in
      a multi-queue device) a mask of CPUs is set to indicate the CPUs that can
      process packets. A CPU is selected on a per packet basis by hashing contents
      of the packet header (e.g. the TCP or UDP 4-tuple) and using the result to index
      into the CPU mask.  The IPI mechanism is used to raise networking receive
      softirqs between CPUs.  This effectively emulates in software what a multi-queue
      NIC can provide, but is generic requiring no device support.
      
      Many devices now provide a hash over the 4-tuple on a per packet basis
      (e.g. the Toeplitz hash).  This patch allow drivers to set the HW reported hash
      in an skb field, and that value in turn is used to index into the RPS maps.
      Using the HW generated hash can avoid cache misses on the packet when
      steering it to a remote CPU.
      
      The CPU mask is set on a per device and per queue basis in the sysfs variable
      /sys/class/net/<device>/queues/rx-<n>/rps_cpus.  This is a set of canonical
      bit maps for receive queues in the device (numbered by <n>).  If a device
      does not support multi-queue, a single variable is used for the device (rx-0).
      
      Generally, we have found this technique increases pps capabilities of a single
      queue device with good CPU utilization.  Optimal settings for the CPU mask
      seem to depend on architectures and cache hierarcy.  Below are some results
      running 500 instances of netperf TCP_RR test with 1 byte req. and resp.
      Results show cumulative transaction rate and system CPU utilization.
      
      e1000e on 8 core Intel
         Without RPS: 108K tps at 33% CPU
         With RPS:    311K tps at 64% CPU
      
      forcedeth on 16 core AMD
         Without RPS: 156K tps at 15% CPU
         With RPS:    404K tps at 49% CPU
      
      bnx2x on 16 core AMD
         Without RPS  567K tps at 61% CPU (4 HW RX queues)
         Without RPS  738K tps at 96% CPU (8 HW RX queues)
         With RPS:    854K tps at 76% CPU (4 HW RX queues)
      
      Caveats:
      - The benefits of this patch are dependent on architecture and cache hierarchy.
      Tuning the masks to get best performance is probably necessary.
      - This patch adds overhead in the path for processing a single packet.  In
      a lightly loaded server this overhead may eliminate the advantages of
      increased parallelism, and possibly cause some relative performance degradation.
      We have found that masks that are cache aware (share same caches with
      the interrupting CPU) mitigate much of this.
      - The RPS masks can be changed dynamically, however whenever the mask is changed
      this introduces the possibility of generating out of order packets.  It's
      probably best not change the masks too frequently.
      Signed-off-by: NTom Herbert <therbert@google.com>
      
       include/linux/netdevice.h |   32 ++++-
       include/linux/skbuff.h    |    3 +
       net/core/dev.c            |  335 +++++++++++++++++++++++++++++++++++++--------
       net/core/net-sysfs.c      |  225 ++++++++++++++++++++++++++++++-
       net/core/skbuff.c         |    2 +
       5 files changed, 538 insertions(+), 59 deletions(-)
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0a9627f2
  21. 20 2月, 2010 1 次提交
  22. 26 11月, 2009 1 次提交
  23. 31 10月, 2009 1 次提交
  24. 28 10月, 2009 1 次提交
  25. 08 10月, 2009 1 次提交
    • J
      wext: refactor · 3d23e349
      Johannes Berg 提交于
      Refactor wext to
       * split out iwpriv handling
       * split out iwspy handling
       * split out procfs support
       * allow cfg80211 to have wireless extensions compat code
         w/o CONFIG_WIRELESS_EXT
      
      After this, drivers need to
       - select WIRELESS_EXT	- for wext support
       - select WEXT_PRIV	- for iwpriv support
       - select WEXT_SPY	- for iwspy support
      
      except cfg80211 -- which gets new hooks in wext-core.c
      and can then get wext handlers without CONFIG_WIRELESS_EXT.
      
      Wireless extensions procfs support is auto-selected
      based on PROC_FS and anything that requires the wext core
      (i.e. WIRELESS_EXT or CFG80211_WEXT).
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      3d23e349
  26. 05 10月, 2009 2 次提交
    • J
      wext: let get_wireless_stats() sleep · a160ee69
      Johannes Berg 提交于
      A number of drivers (recently including cfg80211-based ones)
      assume that all wireless handlers, including statistics, can
      sleep and they often also implicitly assume that the rtnl is
      held around their invocation. This is almost always true now
      except when reading from sysfs:
      
        BUG: sleeping function called from invalid context at kernel/mutex.c:280
        in_atomic(): 1, irqs_disabled(): 0, pid: 10450, name: head
        2 locks held by head/10450:
         #0:  (&buffer->mutex){+.+.+.}, at: [<c10ceb99>] sysfs_read_file+0x24/0xf4
         #1:  (dev_base_lock){++.?..}, at: [<c12844ee>] wireless_show+0x1a/0x4c
        Pid: 10450, comm: head Not tainted 2.6.32-rc3 #1
        Call Trace:
         [<c102301c>] __might_sleep+0xf0/0xf7
         [<c1324355>] mutex_lock_nested+0x1a/0x33
         [<f8cea53b>] wdev_lock+0xd/0xf [cfg80211]
         [<f8cea58f>] cfg80211_wireless_stats+0x45/0x12d [cfg80211]
         [<c13118d6>] get_wireless_stats+0x16/0x1c
         [<c12844fe>] wireless_show+0x2a/0x4c
      
      Fix this by using the rtnl instead of dev_base_lock.
      Reported-by: NMiles Lane <miles.lane@gmail.com>
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a160ee69
    • A
      net: export device speed and duplex via sysfs · d519e17e
      Andy Gospodarek 提交于
      This patch exports the link-speed (in Mbps) and duplex of an interface
      via sysfs.  This eliminates the need to use ethtool just to check the
      link-speed.  Not requiring 'ethtool' and not relying on the SIOCETHTOOL
      ioctl should be helpful in an embedded environment where space is at a
      premium as well.
      
      NOTE: This patch also intentionally allows non-root users to check the link
      speed and duplex -- something not possible with ethtool.
      
      Here's some sample output:
      
      # cat /sys/class/net/eth0/speed
      100
      # cat /sys/class/net/eth0/duplex
      half
      # ethtool eth0
      Settings for eth0:
              Supported ports: [ TP ]
              Supported link modes:   10baseT/Half 10baseT/Full
                                      100baseT/Half 100baseT/Full
                                      1000baseT/Half 1000baseT/Full
              Supports auto-negotiation: Yes
              Advertised link modes:  Not reported
              Advertised auto-negotiation: No
              Speed: 100Mb/s
              Duplex: Half
              Port: Twisted Pair
              PHYAD: 1
              Transceiver: internal
              Auto-negotiation: off
              Supports Wake-on: g
              Wake-on: g
              Current message level: 0x000000ff (255)
              Link detected: yes
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d519e17e
  27. 29 9月, 2009 1 次提交
  28. 16 9月, 2009 1 次提交
  29. 06 8月, 2009 1 次提交
  30. 27 5月, 2009 1 次提交
  31. 19 5月, 2009 1 次提交
  32. 10 3月, 2009 1 次提交
  33. 03 3月, 2009 1 次提交
  34. 26 11月, 2008 1 次提交
  35. 20 11月, 2008 1 次提交
  36. 11 11月, 2008 1 次提交
  37. 28 10月, 2008 1 次提交