1. 10 12月, 2010 2 次提交
    • E
      net: optimize INET input path further · 68835aba
      Eric Dumazet 提交于
      Followup of commit b178bb3d (net: reorder struct sock fields)
      
      Optimize INET input path a bit further, by :
      
      1) moving sk_refcnt close to sk_lock.
      
      This reduces number of dirtied cache lines by one on 64bit arches (and
      64 bytes cache line size).
      
      2) moving inet_daddr & inet_rcv_saddr at the beginning of sk
      
      (same cache line than hash / family / bound_dev_if / nulls_node)
      
      This reduces number of accessed cache lines in lookups by one, and dont
      increase size of inet and timewait socks.
      inet and tw sockets now share same place-holder for these fields.
      
      Before patch :
      
      offsetof(struct sock, sk_refcnt) = 0x10
      offsetof(struct sock, sk_lock) = 0x40
      offsetof(struct sock, sk_receive_queue) = 0x60
      offsetof(struct inet_sock, inet_daddr) = 0x270
      offsetof(struct inet_sock, inet_rcv_saddr) = 0x274
      
      After patch :
      
      offsetof(struct sock, sk_refcnt) = 0x44
      offsetof(struct sock, sk_lock) = 0x48
      offsetof(struct sock, sk_receive_queue) = 0x68
      offsetof(struct inet_sock, inet_daddr) = 0x0
      offsetof(struct inet_sock, inet_rcv_saddr) = 0x4
      
      compute_score() (udp or tcp) now use a single cache line per ignored
      item, instead of two.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      68835aba
    • D
      net: Abstract away all dst_entry metrics accesses. · defb3519
      David S. Miller 提交于
      Use helper functions to hide all direct accesses, especially writes,
      to dst_entry metrics values.
      
      This will allow us to:
      
      1) More easily change how the metrics are stored.
      
      2) Implement COW for metrics.
      
      In particular this will help us put metrics into the inetpeer
      cache if that is what we end up doing.  We can make the _metrics
      member a pointer instead of an array, initially have it point
      at the read-only metrics in the FIB, and then on the first set
      grab an inetpeer entry and point the _metrics member there.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      defb3519
  2. 07 12月, 2010 1 次提交
    • E
      filter: fix sk_filter rcu handling · 46bcf14f
      Eric Dumazet 提交于
      Pavel Emelyanov tried to fix a race between sk_filter_(de|at)tach and
      sk_clone() in commit 47e958ea
      
      Problem is we can have several clones sharing a common sk_filter, and
      these clones might want to sk_filter_attach() their own filters at the
      same time, and can overwrite old_filter->rcu, corrupting RCU queues.
      
      We can not use filter->rcu without being sure no other thread could do
      the same thing.
      
      Switch code to a more conventional ref-counting technique : Do the
      atomic decrement immediately and queue one rcu call back when last
      reference is released.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      46bcf14f
  3. 03 12月, 2010 5 次提交
  4. 02 12月, 2010 3 次提交
  5. 01 12月, 2010 5 次提交
  6. 30 11月, 2010 2 次提交
    • E
      af_unix: limit recursion level · 25888e30
      Eric Dumazet 提交于
      Its easy to eat all kernel memory and trigger NMI watchdog, using an
      exploit program that queues unix sockets on top of others.
      
      lkml ref : http://lkml.org/lkml/2010/11/25/8
      
      This mechanism is used in applications, one choice we have is to have a
      recursion limit.
      
      Other limits might be needed as well (if we queue other types of files),
      since the passfd mechanism is currently limited by socket receive queue
      sizes only.
      
      Add a recursion_level to unix socket, allowing up to 4 levels.
      
      Each time we send an unix socket through sendfd mechanism, we copy its
      recursion level (plus one) to receiver. This recursion level is cleared
      when socket receive queue is emptied.
      Reported-by: NМарк Коренберг <socketpair@gmail.com>
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      25888e30
    • S
      sctp: kill unused macros in head file · 49b4a654
      Shan Wei 提交于
      1. SCTP_CMD_NUM_VERBS,SCTP_CMD_MAX
      These two macros have never been used for several years since v2.6.12-rc2.
      
      2.sctp_port_rover,sctp_port_alloc_lock
      The commit 063930 abandoned global variables of port_rover and port_alloc_lock,
      but still keep two macros to refer to them.
      So, remove them now.
      
      commit 06393009
      Author: Stephen Hemminger <shemminger@linux-foundation.org>
      Date:   Wed Oct 10 17:30:18 2007 -0700
      
          [SCTP]: port randomization
      Signed-off-by: NShan Wei <shanwei@cn.fujitsu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      49b4a654
  7. 29 11月, 2010 3 次提交
  8. 28 11月, 2010 1 次提交
    • T
      rtnl: make link af-specific updates atomic · cf7afbfe
      Thomas Graf 提交于
      As David pointed out correctly, updates to af-specific attributes
      are currently not atomic. If multiple changes are requested and
      one of them fails, previous updates may have been applied already
      leaving the link behind in a undefined state.
      
      This patch splits the function parse_link_af() into two functions
      validate_link_af() and set_link_at(). validate_link_af() is placed
      to validate_linkmsg() check for errors as early as possible before
      any changes to the link have been made. set_link_af() is called to
      commit the changes later.
      
      This method is not fail proof, while it is currently sufficient
      to make set_link_af() inerrable and thus 100% atomic, the
      validation function method will not be able to detect all error
      scenarios in the future, there will likely always be errors
      depending on states which are f.e. not protected by rtnl_mutex
      and thus may change between validation and setting.
      
      Also, instead of silently ignoring unknown address families and
      config blocks for address families which did not register a set
      function the errors EAFNOSUPPORT respectively EOPNOSUPPORT are
      returned to avoid comitting 4 out of 5 update requests without
      notifying the user.
      Signed-off-by: NThomas Graf <tgraf@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cf7afbfe
  9. 25 11月, 2010 6 次提交
  10. 23 11月, 2010 1 次提交
    • L
      cfg80211: Fix regulatory bug with multiple cards and delays · b2e253cf
      Luis R. Rodriguez 提交于
      When two cards are connected with the same regulatory domain
      if CRDA had a delayed response then cfg80211's own set regulatory
      domain would still be the world regulatory domain. There was a bug
      on cfg80211's logic such that it assumed that once you pegged a
      request as the last request it was already the currently set
      regulatory domain. This would mean we would race setting a stale
      regulatory domain to secondary cards which had the same regulatory
      domain since the alpha2 would match.
      
      We fix this by processing each regulatory request atomically,
      and only move on to the next one once we get it fully processed.
      In the case CRDA is not present we will simply world roam.
      
      This issue is only present when you have a slow system and the
      CRDA processing is delayed. Because of this it is not a known
      regression.
      
      Without this fix when a delay is present with CRDA the second card
      would end up with an intersected regulatory domain and not allow it
      to use the channels it really is designed for. When two cards with
      two different regulatory domains were inserted you'd end up
      rejecting the second card's regulatory domain request.
      This fails with mac80211_hswim's regtest=2 (two requests, same alpha2)
      and regtest=3 (two requests, different alpha2) module parameter
      options.
      
      This was reproduced and tested against mac80211_hwsim using this
      CRDA delayer:
      
             #!/bin/bash
             echo $COUNTRY >> /tmp/log
             sleep 2
             /sbin/crda.orig
      
      And these regulatory tests:
      
             modprobe mac80211_hwsim regtest=2
             modprobe mac80211_hwsim regtest=3
      Reported-by: NMark Mentovai <mark@moxienet.com>
      Signed-off-by: NLuis R. Rodriguez <lrodriguez@atheros.com>
      Tested-by: NMark Mentovai <mark@moxienet.com>
      Tested-by: NBruno Randolf <br1@einfach.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      b2e253cf
  11. 22 11月, 2010 1 次提交
  12. 19 11月, 2010 2 次提交
  13. 18 11月, 2010 3 次提交
  14. 17 11月, 2010 5 次提交
    • F
    • F
    • J
      mac80211: Add function to get probe request template for current AP · a619a4c0
      Juuso Oikarinen 提交于
      Chipsets with hardware based connection monitoring need to autonomically
      send directed probe-request frames to the AP (in the event of beacon loss,
      for example.)
      
      For the hardware to be able to do this, it requires a template for the frame
      to transmit to the AP, filled in with the BSSID and SSID of the AP, but also
      the supported rate IE's.
      
      This patch adds a function to mac80211, which allows the hardware driver to
      fetch this template after association, so it can be configured to the hardware.
      Signed-off-by: NJuuso Oikarinen <juuso.oikarinen@nokia.com>
      Acked-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      a619a4c0
    • B
      mac80211: Add antenna configuration · 15d96753
      Bruno Randolf 提交于
      Allow antenna configuration by calling driver's function for it.
      
      We disallow antenna configuration if the wiphy is already running, mainly to
      make life easier for 802.11n drivers which need to recalculate HT capabilites.
      Signed-off-by: NBruno Randolf <br1@einfach.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      15d96753
    • B
      cfg80211: Add nl80211 antenna configuration · afe0cbf8
      Bruno Randolf 提交于
      Allow setting of TX and RX antennas configuration via nl80211.
      
      The antenna configuration is defined as a bitmap of allowed antennas to use.
      This API can be used to mask out antennas which are not attached or should not
      be used for other reasons like regulatory concerns or special setups.
      
      Separate bitmaps are used for RX and TX to allow configuring different antennas
      for receiving and transmitting. Each bitmap is 32 bit long, each bit
      representing one antenna, starting with antenna 1 at the first bit. If an
      antenna bit is set, this means the driver is allowed to use this antenna for RX
      or TX respectively; if the bit is not set the hardware is not allowed to use
      this antenna.
      
      Using bitmaps has the benefit of allowing for a flexible configuration
      interface which can support many different configurations and which can be used
      for 802.11n as well as non-802.11n devices. Instead of relying on some hardware
      specific assumptions, drivers can use this information to know which antennas
      are actually attached to the system and derive their capabilities based on
      that.
      
      802.11n devices should enable or disable chains, based on which antennas are
      present (If all antennas belonging to a particular chain are disabled, the
      entire chain should be disabled). HT capabilities (like STBC, TX Beamforming,
      Antenna selection) should be calculated based on the available chains after
      applying the antenna masks. Should a 802.11n device have diversity antennas
      attached to one of their chains, diversity can be enabled or disabled based on
      the antenna information.
      
      Non-802.11n drivers can use the antenna masks to select RX and TX antennas and
      to enable or disable antenna diversity.
      
      While covering chainmasks for 802.11n and the standard "legacy" modes "fixed
      antenna 1", "fixed antenna 2" and "diversity" this API also allows more rare,
      but useful configurations as follows:
      
      1) Send on antenna 1, receive on antenna 2 (or vice versa). This can be used to
      have a low gain antenna for TX in order to keep within the regulatory
      constraints and a high gain antenna for RX in order to receive weaker signals
      ("speak softly, but listen harder"). This can be useful for building long-shot
      outdoor links. Another usage of this setup is having a low-noise pre-amplifier
      on antenna 1 and a power amplifier on the other antenna. This way transmit
      noise is mostly kept out of the low noise receive channel.
      (This would be bitmaps: tx 1 rx 2).
      
      2) Another similar setup is: Use RX diversity on both antennas, but always send
      on antenna 1. Again that would allow us to benefit from a higher gain RX
      antenna, while staying within the legal limits.
      (This would be: tx 0 rx 3).
      
      3) And finally there can be special experimental setups in research and
      development even with pre 802.11n hardware where more than 2 antennas are
      available. It's good to keep the API simple, yet flexible.
      Signed-off-by: NBruno Randolf <br1@einfach.org>
      
      --
      v7:	Made bitmasks 32 bit wide and rebased to latest wireless-testing.
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      afe0cbf8