1. 08 5月, 2010 2 次提交
    • J
      mac80211: improve HT channel handling · 0aaffa9b
      Johannes Berg 提交于
      Currently, when one interface switches HT mode,
      all others will follow along. This is clearly
      undesirable, since the new one might switch to
      no-HT while another one is operating in HT.
      
      Address this issue by keeping track of the HT
      mode per interface, and allowing only changes
      that are compatible, i.e. switching into HT40+
      is not possible when another interface is in
      HT40-, in that case the second one needs to
      fall back to HT20.
      
      Also, to allow drivers to know what's going on,
      store the per-interface HT mode (channel type)
      in the virtual interface's bss_conf.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      0aaffa9b
    • J
      cfg80211/mac80211: better channel handling · f444de05
      Johannes Berg 提交于
      Currently (all tested with hwsim) you can do stupid
      things like setting up an AP on a certain channel,
      then adding another virtual interface and making
      that associate on another channel -- this will make
      the beaconing to move channel but obviously without
      the necessary IEs data update.
      
      In order to improve this situation, first make the
      configuration APIs (cfg80211 and nl80211) aware of
      multi-channel operation -- we'll eventually need
      that in the future anyway. There's one userland API
      change and one API addition. The API change is that
      now SET_WIPHY must be called with virtual interface
      index rather than only wiphy index in order to take
      effect for that interface -- luckily all current
      users (hostapd) do that. For monitor interfaces, the
      old setting is preserved, but monitors are always
      slaved to other devices anyway so no guarantees.
      
      The second userland API change is the introduction
      of a per virtual interface SET_CHANNEL command, that
      hostapd should use going forward to make it easier
      to understand what's going on (it can automatically
      detect a kernel with this command).
      
      Other than mac80211, no existing cfg80211 drivers
      are affected by this change because they only allow
      a single virtual interface.
      
      mac80211, however, now needs to be aware that the
      channel settings are per interface now, and needs
      to disallow (for now) real multi-channel operation,
      which is another important part of this patch.
      
      One of the immediate benefits is that you can now
      start hostapd to operate on a hardware that already
      has a connection on another virtual interface, as
      long as you specify the same channel.
      
      Note that two things are left unhandled (this is an
      improvement -- not a complete fix):
      
       * different HT/no-HT modes
      
         currently you could start an HT AP and then
         connect to a non-HT network on the same channel
         which would configure the hardware for no HT;
         that can be fixed fairly easily
      
       * CSA
      
         An AP we're connected to on a virtual interface
         might indicate switching channels, and in that
         case we would follow it, regardless of how many
         other interfaces are operating; this requires
         more effort to fix but is pretty rare after all
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      f444de05
  2. 28 4月, 2010 3 次提交
  3. 20 4月, 2010 1 次提交
  4. 01 4月, 2010 2 次提交
  5. 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
  6. 25 3月, 2010 1 次提交
  7. 16 2月, 2010 1 次提交
    • J
      cfg80211/mac80211: allow registering for and sending action frames · 026331c4
      Jouni Malinen 提交于
      This implements a new command to register for action frames
      that userspace wants to handle instead of the in-kernel
      rejection. It is then responsible for rejecting ones that
      it decided not to handle. There is no unregistration, but
      the socket can be closed for that.
      
      Frames that are not registered for will not be forwarded
      to userspace and will be rejected by the kernel, the
      cfg80211 API helps implementing that.
      
      Additionally, this patch adds a new command that allows
      doing action frame transmission from userspace. It can be
      used either to exchange action frames on the current
      operational channel (e.g., with the AP with which we are
      currently associated) or to exchange off-channel Public
      Action frames with the remain-on-channel command.
      Signed-off-by: NJouni Malinen <jouni.malinen@atheros.com>
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      026331c4
  8. 09 2月, 2010 2 次提交
    • J
      mac80211: fix bss_conf.dtim_period · 19885c4f
      Johannes Berg 提交于
      In AP mode, the only mode where the parameter
      is supposed to be valid, we never assign it!
      Fix that to allow drivers to avoid parsing
      the TIM IE for the value.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      19885c4f
    • J
      mac80211: allow station add/remove to sleep · 34e89507
      Johannes Berg 提交于
      Many drivers would like to sleep during station
      addition and removal, and currently have a high
      complexity there from not being able to.
      
      This introduces two new callbacks sta_add() and
      sta_remove() that drivers can implement instead
      of using sta_notify() and that can sleep, and
      the new sta_add() callback is also allowed to
      fail.
      
      The reason we didn't do this previously is that
      the IBSS code wants to insert stations from the
      RX path, which is a tasklet, so cannot sleep.
      This patch will keep the station allocation in
      that path, but moves adding the station to the
      driver out of line. Since the addition can now
      fail, we can have IBSS peer structs the driver
      rejected -- in that case we still talk to the
      station but never tell the driver about it in
      the control.sta pointer. If there will ever be
      a driver that has a low limit on the number of
      stations and that cannot talk to any stations
      that are not known to it, we need to do come up
      with a new strategy of handling larger IBSSs,
      maybe quicker expiry or rejecting peers.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      34e89507
  9. 16 1月, 2010 2 次提交
  10. 13 1月, 2010 4 次提交
    • K
      mac80211: add U-APSD client support · ab13315a
      Kalle Valo 提交于
      Add Unscheduled Automatic Power-Save Delivery (U-APSD) client support. The
      idea is that the data frames from the client trigger AP to send the buffered
      frames with ACs which have U-APSD enabled. This decreases latency and makes it
      possible to save even more power.
      
      Driver needs to use IEEE80211_HW_UAPSD to enable the feature. The current
      implementation assumes that firmware takes care of the wakeup and
      hardware needing IEEE80211_HW_PS_NULLFUNC_STACK is not yet supported.
      
      Tested with wl1251 on a Nokia N900 and Cisco Aironet 1231G AP and running
      various test traffic with ping.
      Signed-off-by: NKalle Valo <kalle.valo@nokia.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      ab13315a
    • F
      mac80211: allow station updates on ap interfaces for vlan stations · 0e5ded5a
      Felix Fietkau 提交于
      Since the per-vif station changes, sta_info_get on the ap sdata no
      longer returns entries for stations on ap vlans. This causes issues
      with hostapd, which currently always passes the ap interface name to
      nl80211 calls. This patch provides bug compatibility with the earlier
      versions until hostapd is fixed.
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      0e5ded5a
    • J
      cfg80211/mac80211: Use more generic bitrate mask for rate control · 37eb0b16
      Jouni Malinen 提交于
      Extend struct cfg80211_bitrate_mask to actually use a bitfield mask
      instead of just a single fixed or maximum rate index. This change
      itself does not modify the behavior (except for debugfs files), but it
      prepares cfg80211 and mac80211 for a new nl80211 command for setting
      which rates can be used in TX rate control.
      
      Since frames are now going through the rate control algorithm
      unconditionally, the internal IEEE80211_TX_INTFL_RCALGO flag can now
      be removed. The RC implementations can use the rate_idx_mask value to
      optimize their behavior if only a single rate is enabled.
      
      The old max_rate_idx in struct ieee80211_tx_rate_control is maintained
      (but commented as deprecated) for backwards compatibility with existing
      RC implementations. Once these implementations have been updated to
      use the more generic rate_idx_mask, the max_rate_idx value can be
      removed.
      Signed-off-by: NJouni Malinen <jouni.malinen@atheros.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      37eb0b16
    • L
      mac80211: Add new callback set_coverage_class · 310bc676
      Lukáš Turek 提交于
      Mac80211 callback to driver set_coverage_class() sets slot time and ACK
      timeout for given IEEE 802.11 coverage class. The callback is optional,
      but it's essential for long distance links.
      Signed-off-by: NLukas Turek <8an@praha12.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      310bc676
  11. 29 12月, 2009 3 次提交
  12. 23 12月, 2009 2 次提交
  13. 22 12月, 2009 2 次提交
    • J
      mac80211: reduce reliance on netdev · 47846c9b
      Johannes Berg 提交于
      For bluetooth 3, we will most likely not have
      a netdev for a virtual interface (sdata), so
      prepare for that by reducing the reliance on
      having a netdev. This patch moves the name
      and address fields into the sdata struct and
      uses them from there all over. Some work is
      needed to keep them sync'ed, but that's not
      a lot of work and in slow paths anyway.
      
      In doing so, this also reduces the number of
      pointer dereferences in many places, because
      of things like sdata->dev->dev_addr becoming
      sdata->vif.addr.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      47846c9b
    • J
      mac80211: make station management completely depend on vif · abe60632
      Johannes Berg 提交于
      The station management currently uses the virtual
      interface, but you cannot add the same station to
      multiple virtual interfaces if you're communicating
      with it in multiple ways.
      
      This restriction should be lifted so that in the
      future we can, for instance, support bluetooth 3
      with an access point that mac80211 is already
      associated to.
      
      We can do that by requiring all sta_info_get users
      to provide the virtual interface and making the RX
      code aware that an address may match more than one
      station struct. Thanks to the previous patches this
      one isn't all that large and except for the RX and
      TX status paths changes has low complexity.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      abe60632
  14. 10 12月, 2009 1 次提交
  15. 24 11月, 2009 1 次提交
  16. 20 11月, 2009 1 次提交
    • J
      cfg80211: introduce capability for 4addr mode · 9bc383de
      Johannes Berg 提交于
      It's very likely that not many devices will support
      four-address mode in station or AP mode so introduce
      capability bits for both modes, set them in mac80211
      and check them when userspace tries to use the mode.
      Also, keep track of 4addr in cfg80211 (wireless_dev)
      and not in mac80211 any more. mac80211 can also be
      improved for the VLAN case by not looking at the
      4addr flag but maintaining the station pointer for
      it correctly. However, keep track of use_4addr for
      station mode in mac80211 to avoid all the derefs.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      9bc383de
  17. 19 11月, 2009 1 次提交
  18. 14 11月, 2009 2 次提交
  19. 12 11月, 2009 1 次提交
    • F
      mac80211: implement support for 4-address frames for AP and client mode · f14543ee
      Felix Fietkau 提交于
      In some situations it might be useful to run a network with an
      Access Point and multiple clients, but with each client bridged
      to a network behind it. For this to work, both the client and the
      AP need to transmit 4-address frames, containing both source and
      destination MAC addresses.
      With this patch, you can configure a client to communicate using
      only 4-address frames for data traffic.
      On the AP side you can enable 4-address frames for individual
      clients by isolating them in separate AP VLANs which are configured
      in 4-address mode.
      Such an AP VLAN will be limited to one client only, and this client
      will be used as the destination for all traffic on its interface,
      regardless of the destination MAC address in the packet headers.
      The advantage of this mode compared to regular WDS mode is that it's
      easier to configure and does not require a static list of peer MAC
      addresses on any side.
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      f14543ee
  20. 03 11月, 2009 1 次提交
    • J
      mac80211: check interface is down before type change · c1f9a764
      Johannes Berg 提交于
      For some strange reason the netif_running() check
      ended up after the actual type change instead of
      before, potentially causing all kinds of problems
      if the interface is up while changing the type;
      one of the problems manifests itself as a warning:
      
      WARNING: at net/mac80211/iface.c:651 ieee80211_teardown_sdata+0xda/0x1a0 [mac80211]()
      Hardware name: Aspire one
      Pid: 2596, comm: wpa_supplicant Tainted: G        W  2.6.31-10-generic #32-Ubuntu
      Call Trace:
       [] warn_slowpath_common+0x6d/0xa0
       [] warn_slowpath_null+0x15/0x20
       [] ieee80211_teardown_sdata+0xda/0x1a0 [mac80211]
       [] ieee80211_if_change_type+0x4a/0xc0 [mac80211]
       [] ieee80211_change_iface+0x61/0xa0 [mac80211]
       [] cfg80211_wext_siwmode+0xc7/0x120 [cfg80211]
       [] ioctl_standard_call+0x58/0xf0
      
      (http://www.kerneloops.org/searchweek.php?search=ieee80211_teardown_sdata)
      
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: stable@kernel.org
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      c1f9a764
  21. 31 10月, 2009 1 次提交
  22. 14 8月, 2009 1 次提交
    • J
      nl80211: add generation number to all dumps · f5ea9120
      Johannes Berg 提交于
      In order for userspace to be able to figure out whether
      it obtained a consistent snapshot of data or not when
      using netlink dumps, we need to have a generation number
      in each dump message that indicates whether the list has
      changed or not -- its value is arbitrary.
      
      This patch adds such a number to all dumps, this needs
      some mac80211 involvement to keep track of a generation
      number to start with when adding/removing mesh paths or
      stations.
      
      The wiphy and netdev lists can be fully handled within
      cfg80211, of course, but generation numbers need to be
      stored there as well.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      f5ea9120
  23. 28 7月, 2009 1 次提交
    • J
      cfg80211: make aware of net namespaces · 463d0183
      Johannes Berg 提交于
      In order to make cfg80211/nl80211 aware of network namespaces,
      we have to do the following things:
      
       * del_virtual_intf method takes an interface index rather
         than a netdev pointer - simply change this
      
       * nl80211 uses init_net a lot, it changes to use the sender's
         network namespace
      
       * scan requests use the interface index, hold a netdev pointer
         and reference instead
      
       * we want a wiphy and its associated virtual interfaces to be
         in one netns together, so
          - we need to be able to change ns for a given interface, so
            export dev_change_net_namespace()
          - for each virtual interface set the NETIF_F_NETNS_LOCAL
            flag, and clear that flag only when the wiphy changes ns,
            to disallow breaking this invariant
      
       * when a network namespace goes away, we need to reparent the
         wiphy to init_net
      
       * cfg80211 users that support creating virtual interfaces must
         create them in the wiphy's namespace, currently this affects
         only mac80211
      
      The end result is that you can now switch an entire wiphy into
      a different network namespace with the new command
      	iw phy#<idx> set netns <pid>
      and all virtual interfaces will follow (or the operation fails).
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      463d0183
  24. 25 7月, 2009 1 次提交
  25. 11 7月, 2009 2 次提交
    • J
      cfg80211: fix locking · 667503dd
      Johannes Berg 提交于
      Over time, a lot of locking issues have crept into
      the smarts of cfg80211, so e.g. scan completion can
      race against a new scan, IBSS join can race against
      leaving an IBSS, etc.
      
      Introduce a new per-interface lock that protects
      most of the per-interface data that we need to keep
      track of, and sprinkle assertions about that lock
      everywhere. Some things now need to be offloaded to
      work structs so that we don't require being able to
      sleep in functions the drivers call. The exception
      to that are the MLME callbacks (rx_auth etc.) that
      currently only mac80211 calls because it was easier
      to do that there instead of in cfg80211, and future
      drivers implementing those calls will, if they ever
      exist, probably need to use a similar scheme like
      mac80211 anyway...
      
      In order to be able to handle _deauth and _disassoc
      properly, introduce a cookie passed to it that will
      determine locking requirements.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      667503dd
    • J
      mac80211: rework MLME for multiple authentications · 77fdaa12
      Johannes Berg 提交于
      Sit tight. This shakes up the world as you know
      it. Let go of your spaghetti tongs, they will no
      longer be required, the horrible statemachine in
      net/mac80211/mlme.c is no more...
      
      With the cfg80211 SME mac80211 now has much less
      to keep track of, but, on the other hand, for FT
      it needs to be able to keep track of at least one
      authentication being in progress while associated.
      So convert from a single state machine to having
      small ones for all the different things we need to
      do. For real FT it will still need work wrt. PS,
      but this should be a good step.
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      77fdaa12