1. 08 Feb, 2010 2 commits
    • Johannes Berg's avatar
      mac80211: allow station add/remove to sleep · 34e89507
      Johannes Berg authored
      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: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      34e89507
    • Johannes Berg's avatar
      wireless: update radiotap parser · 33e5a2f7
      Johannes Berg authored
      Upstream radiotap has adopted the namespace
      proposal David Young made and I then took care
      of, for which I had adapted the radiotap parser
      as a library outside the kernel. This brings
      the in-kernel parser up to speed.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      33e5a2f7
  2. 01 Feb, 2010 2 commits
  3. 25 Jan, 2010 1 commit
    • Johannes Berg's avatar
      mac80211: fix sw crypto · 382b1655
      Johannes Berg authored
      What a stupid mistake. In
      
          commit 813d7669
          Author: Johannes Berg <johannes@sipsolutions.net>
          Date:   Sun Jan 17 01:47:58 2010 +0100
      
              mac80211: move control.hw_key assignment
      
      I inserted code testing the wrong flags field,
      which means that the test is almost always true
      (it's really testing for the peer's WMM support)
      and thus the later parts of the stack assume hw
      crypto will be done even if that's not true.
      
      Obviously, that broke software crypto. Maxim
      said so specifically, and Jochen probably uses
      some cipher that iwl3945 doesn't support in
      hardware, which might also explain that Maxim
      reports that even hw crypto is broken.
      
      Fix this to test the right flags field.
      Reported-by: default avatarMaxim Levitsky <maximlevitsky@gmail.com>
      Reported-by: default avatarJochen Friedrich <jochen@scram.de>
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      382b1655
  4. 23 Jan, 2010 1 commit
  5. 22 Jan, 2010 1 commit
  6. 19 Jan, 2010 4 commits
  7. 12 Jan, 2010 7 commits
    • Kalle Valo's avatar
      mac80211: check uapsd state for dynamic power save · 0c74211d
      Kalle Valo authored
      To make U-APSD client mode effective, we must not wake up from dynamic power
      save when transmitting frames. So if dynamic power save is enabled, it needs
      check the queue the transmitted packet is in and decide if we need to wake
      up or not.
      
      In a perfect world, where all packets would have correct QoS tags, U-APSD
      enabled queues should not trigger wakeup from power save. But in the real
      world, where very few packets have correct QoS tags, this won't work. For
      example, if only voip class has U-APSD enabled and we send a packet in voip
      class, but the packets we receive are in best effort class, we would receive
      the packets with the legacy power save method. And that would increase
      latencies too much from a voip application point of view.
      
      The workaround is to enable U-APSD for all qeueus and still use dynamic ps
      wakeup for all other queues except voip. That way we can still save power
      with a voip application and not sacrifice latency. Normal traffic (in
      background, best effort or video class) would still trigger wakeup from
      dynamic power save.
      Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      0c74211d
    • Kalle Valo's avatar
      mac80211: create tx handler for dynamic ps · 5c1b98a5
      Kalle Valo authored
      Currently dynamic ps check is in ieee80211_xmit(), but it's cleaner
      to have a separate tx handler for this. Also this is a prerequisite for
      U-APSD client mode which needs to know the queue frame is in.
      
      Also need_dynamic_ps() function is embedded to the tx handler.
      
      No functional changes expect that the code is run in a later phase than
      originally.
      Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      5c1b98a5
    • Felix Fietkau's avatar
      mac80211: do not transmit frames on unconfigured 4-addr vlan interfaces · 3f0e0b22
      Felix Fietkau authored
      If frames are transmitted on 4-addr ap vlan interfaces with no station,
      they end up being transmitted unencrypted, even if the ap interface
      uses WPA. This patch add some sanity checking to make sure that this
      does not happen.
      Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      3f0e0b22
    • Kalle Valo's avatar
      mac80211: create Probe Request template · 05e54ea6
      Kalle Valo authored
      Certain type of hardware, for example wl1251 and wl1271, need a template
      for the Probe Request. Create a function ieee80211_probereq_get() which
      creates the template and drivers send it to hardware.
      Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      05e54ea6
    • Kalle Valo's avatar
      mac80211: add functions to create PS Poll and Nullfunc templates · 7044cc56
      Kalle Valo authored
      Some hardware, for example wl1251 and wl1271, handle the transmission
      of power save related frames in hardware, but the driver is responsible
      for creating the templates. It's better to create the templates in mac80211,
      that way all drivers can benefit from this.
      
      Add two new functions, ieee80211_pspoll_get() and ieee80211_nullfunc_get()
      which drivers need to call to get the frame. Drivers are also responsible
      for updating the templates after each association.
      
      Also new struct ieee80211_hdr_3addr is added to ieee80211.h to make it
      easy to calculate length of the Nullfunc frame.
      Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      7044cc56
    • Jouni Malinen's avatar
      cfg80211/mac80211: Use more generic bitrate mask for rate control · 37eb0b16
      Jouni Malinen authored
      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: default avatarJouni Malinen <jouni.malinen@atheros.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      37eb0b16
    • Jouni Malinen's avatar
      mac80211: Select lowest rate based on basic rate set in AP mode · e00cfce0
      Jouni Malinen authored
      If the basic rate set is configured to not include the lowest rate
      (e.g., basic rate set = 6, 12, 24 Mbps in IEEE 802.11g mode), the AP
      should not send out broadcast frames at 1 Mbps. This type of
      configuration can be used to optimize channel usage in cases where
      there is no need for backwards compatibility with IEEE 802.11b-only
      devices.
      
      In AP mode, mac80211 was unconditionally using the lowest rate for
      Beacon frames and similarly, with all rate control algorithms that use
      rate_control_send_low(), the lowest rate ended up being used for all
      broadcast frames (and all unicast frames that are sent before
      association). Change this to take into account the basic rate
      configuration in AP mode, i.e., use the lowest rate in the basic rate
      set instead of the lowest supported rate when selecting the rate.
      Signed-off-by: default avatarJouni Malinen <jouni.malinen@atheros.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      e00cfce0
  8. 05 Jan, 2010 1 commit
    • Johannes Berg's avatar
      mac80211: fix skb buffering issue · cf0277e7
      Johannes Berg authored
      Since I removed the master netdev, we've been
      keeping internal queues only, and even before
      that we never told the networking stack above
      the virtual interfaces about congestion. This
      means that packets are queued in mac80211 and
      the upper layers never know, possibly leading
      to memory exhaustion and other problems.
      
      This patch makes all interfaces multiqueue and
      uses ndo_select_queue to put the packets into
      queues per AC. Additionally, when the driver
      stops a queue, we now stop all corresponding
      queues for the virtual interfaces as well.
      
      The injection case will use VO by default for
      non-data frames, and BE for data frames, but
      downgrade any data frames according to ACM. It
      needs to be fleshed out in the future to allow
      chosing the queue/AC in radiotap.
      Reported-by: default avatarLennert Buytenhek <buytenh@marvell.com>
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Cc: stable@kernel.org [2.6.32]
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      cf0277e7
  9. 28 Dec, 2009 2 commits
  10. 21 Dec, 2009 2 commits
    • Johannes Berg's avatar
      mac80211: reduce reliance on netdev · 47846c9b
      Johannes Berg authored
      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: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      47846c9b
    • Johannes Berg's avatar
      mac80211: make station management completely depend on vif · abe60632
      Johannes Berg authored
      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: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      abe60632
  11. 29 Nov, 2009 1 commit
  12. 19 Nov, 2009 2 commits
    • Johannes Berg's avatar
      mac80211: request TX status where needed · 7351c6bd
      Johannes Berg authored
      Right now all frames mac80211 hands to the driver
      have the IEEE80211_TX_CTL_REQ_TX_STATUS flag set to
      request TX status. This isn't really necessary, only
      the injected frames need TX status (the latter for
      hostapd) so move setting this flag.
      
      The rate control algorithms also need TX status, but
      they don't require it.
      
      Also, rt2x00 uses that bit for its own purposes and
      seems to require it being set for all frames, but
      that can be fixed in rt2x00.
      
      This doesn't really change anything for any drivers
      but in the future drivers using hw-rate control may
      opt to not report TX status for frames that don't
      have the IEEE80211_TX_CTL_REQ_TX_STATUS flag set.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Acked-by: Ivo van Doorn <IvDoorn@gmail.com> [rt2x00 bits]
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      7351c6bd
    • Johannes Berg's avatar
      cfg80211: introduce capability for 4addr mode · 9bc383de
      Johannes Berg authored
      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: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      9bc383de
  13. 18 Nov, 2009 4 commits
  14. 13 Nov, 2009 1 commit
  15. 11 Nov, 2009 1 commit
    • Felix Fietkau's avatar
      mac80211: implement support for 4-address frames for AP and client mode · f14543ee
      Felix Fietkau authored
      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: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      f14543ee
  16. 06 Nov, 2009 1 commit
    • Johannes Berg's avatar
      mac80211: async station powersave handling · af818581
      Johannes Berg authored
      Some devices require that all frames to a station
      are flushed when that station goes into powersave
      mode before being able to send frames to that
      station again when it wakes up or polls -- all in
      order to avoid reordering and too many or too few
      frames being sent to the station when it polls.
      
      Normally, this is the case unless the station
      goes to sleep and wakes up very quickly again.
      But in that case, frames for it may be pending
      on the hardware queues, and thus races could
      happen in the case of multiple hardware queues
      used for QoS/WMM. Normally this isn't a problem,
      but with the iwlwifi mechanism we need to make
      sure the race doesn't happen.
      
      This makes mac80211 able to cope with the race
      with driver help by a new WLAN_STA_PS_DRIVER
      per-station flag that can be controlled by the
      driver and tells mac80211 whether it can transmit
      frames or not. This flag must be set according to
      very specific rules outlined in the documentation
      for the function that controls it.
      
      When we buffer new frames for the station, we
      normally set the TIM bit right away, but while
      the driver has blocked transmission to that sta
      we need to avoid that as well since we cannot
      respond to the station if it wakes up due to the
      TIM bit. Once the driver unblocks, we can set
      the TIM bit.
      
      Similarly, when the station just wakes up, we
      need to wait until all other frames are flushed
      before we can transmit frames to that station,
      so the same applies here, we need to wait for
      the driver to give the OK.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      af818581
  17. 02 Nov, 2009 1 commit
  18. 30 Oct, 2009 4 commits
  19. 27 Oct, 2009 1 commit
  20. 07 Oct, 2009 1 commit
    • Johannes Berg's avatar
      mac80211: fix vlan and optimise RX · fbc44bf7
      Johannes Berg authored
      When receiving data frames, we can send them only to
      the interface they belong to based on transmitting
      station (this doesn't work for probe requests). Also,
      don't try to handle other frames for AP_VLAN at all
      since those interface should only receive data.
      
      Additionally, the transmit side must check that the
      station we're sending a frame to is actually on the
      interface we're transmitting on, and not transmit
      packets to functions that live on other interfaces,
      so validate that as well.
      
      Another bug fix is needed in sta_info.c where in the
      VLAN case when adding/removing stations we overwrite
      the sdata variable we still need.
      Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Cc: stable@kernel.org
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      fbc44bf7