1. 11 2月, 2019 1 次提交
    • I
      mac80211: Fix Tx aggregation session tear down with ITXQs · 6157ca0d
      Ilan Peer 提交于
      When mac80211 requests the low level driver to stop an ongoing
      Tx aggregation, the low level driver is expected to call
      ieee80211_stop_tx_ba_cb_irqsafe() to indicate that it is ready
      to stop the session. The callback in turn schedules a worker
      to complete the session tear down, which in turn also handles
      the relevant state for the intermediate Tx queue.
      
      However, as this flow in asynchronous, the intermediate queue
      should be stopped and not continue servicing frames, as in
      such a case frames that are dequeued would be marked as part
      of an aggregation, although the aggregation is already been
      stopped.
      
      Fix this by stopping the intermediate Tx queue, before
      calling the low level driver to stop the Tx aggregation.
      Signed-off-by: NIlan Peer <ilan.peer@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      6157ca0d
  2. 19 6月, 2018 2 次提交
  3. 08 5月, 2018 1 次提交
  4. 19 12月, 2017 1 次提交
  5. 11 12月, 2017 3 次提交
    • T
      mac80211: Add TXQ scheduling API · e937b8da
      Toke Høiland-Jørgensen 提交于
      This adds an API to mac80211 to handle scheduling of TXQs and changes the
      interface between driver and mac80211 for TXQ handling as follows:
      
      - The wake_tx_queue callback interface no longer includes the TXQ. Instead,
        the driver is expected to retrieve that from ieee80211_next_txq()
      
      - Two new mac80211 functions are added: ieee80211_next_txq() and
        ieee80211_schedule_txq(). The former returns the next TXQ that should be
        scheduled, and is how the driver gets a queue to pull packets from. The
        latter is called internally by mac80211 to start scheduling a queue, and
        the driver is supposed to call it to re-schedule the TXQ after it is
        finished pulling packets from it (unless the queue emptied).
      
      The ath9k and ath10k drivers are changed to use the new API.
      Signed-off-by: NToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e937b8da
    • S
      mac80211: call synchronize_net once in the restart flow · 2316380f
      Sara Sharon 提交于
      Currently the restart flow enables RX back, and then proceeds
      to tear down RX and TX aggregations.
      The TX aggregation tear down calls synchronize_net(), which
      waits for packet receiving to be done.
      This is done for every session, while RX processing is already
      active, and in some reproductions it takes up to 3 seconds.
      Add a call once in the restart_work, before we have traffic
      active again, and remove the subsequent calls when tearing
      down the aggregation.
      This requires to move down the code that turns off the
      reconfig flag in order to be able to test it in
      _ieee80211_stop_tx_ba_session().
      Signed-off-by: NSara Sharon <sara.sharon@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      2316380f
    • J
      mac80211: avoid looking up tid_tx/tid_rx from timers · d559e303
      Johannes Berg 提交于
      There's no need to re-lookup the data structures now that
      we actually get them immediately with from_timer(), just
      avoid that. The struct has to be valid anyway, otherwise
      the timer object itself would no longer be valid, and we
      can't have a different version of the struct since only a
      single session per TID is permitted.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      d559e303
  6. 21 11月, 2017 1 次提交
    • J
      mac80211: properly free requested-but-not-started TX agg sessions · 33ddd81e
      Johannes Berg 提交于
      When deleting a station or otherwise tearing down all aggregation
      sessions, make sure to delete requested but not yet started ones,
      to avoid the following scenario:
      
       * session is requested, added to tid_start_tx[]
       * ieee80211_ba_session_work() runs, gets past BLOCK_BA check
       * ieee80211_sta_tear_down_BA_sessions() runs, locks &sta->ampdu_mlme.mtx,
         e.g. while deleting the station - deleting all active sessions
       * ieee80211_ba_session_work() continues since tear down flushes it, and
         calls ieee80211_tx_ba_session_handle_start() for the new session, arms
         the timer for it
       * station deletion continues to __cleanup_single_sta() and frees the
         session struct, while the timer is armed
      Reported-by: NFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      33ddd81e
  7. 20 11月, 2017 1 次提交
    • K
      mac80211: aggregation: Convert timers to use timer_setup() · 7cca2acd
      Kees Cook 提交于
      In preparation for unconditionally passing the struct timer_list pointer to
      all timer callbacks, switch to using the new timer_setup() and from_timer()
      to pass the timer pointer explicitly.
      
      This removes the tid mapping array and expands the tid structures to
      add a pointer back to the station, along with the tid index itself.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-wireless@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Signed-off-by: NKees Cook <keescook@chromium.org>
      [switch tid variables to u8, the valid range is 0-15 at most,
       initialize tid_tx->sta/tid properly]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      7cca2acd
  8. 05 9月, 2017 2 次提交
  9. 16 6月, 2017 1 次提交
    • J
      networking: convert many more places to skb_put_zero() · b080db58
      Johannes Berg 提交于
      There were many places that my previous spatch didn't find,
      as pointed out by yuan linyu in various patches.
      
      The following spatch found many more and also removes the
      now unnecessary casts:
      
          @@
          identifier p, p2;
          expression len;
          expression skb;
          type t, t2;
          @@
          (
          -p = skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          |
          -p = (t)skb_put(skb, len);
          +p = skb_put_zero(skb, len);
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, len);
          |
          -memset(p, 0, len);
          )
      
          @@
          type t, t2;
          identifier p, p2;
          expression skb;
          @@
          t *p;
          ...
          (
          -p = skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          |
          -p = (t *)skb_put(skb, sizeof(t));
          +p = skb_put_zero(skb, sizeof(t));
          )
          ... when != p
          (
          p2 = (t2)p;
          -memset(p2, 0, sizeof(*p));
          |
          -memset(p, 0, sizeof(*p));
          )
      
          @@
          expression skb, len;
          @@
          -memset(skb_put(skb, len), 0, len);
          +skb_put_zero(skb, len);
      
      Apply it to the tree (with one manual fixup to keep the
      comment in vxlan.c, which spatch removed.)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b080db58
  10. 30 5月, 2017 1 次提交
    • J
      mac80211: fix TX aggregation start/stop callback race · 7a7c0a64
      Johannes Berg 提交于
      When starting or stopping an aggregation session, one of the steps
      is that the driver calls back to mac80211 that the start/stop can
      proceed. This is handled by queueing up a fake SKB and processing
      it from the normal iface/sdata work. Since this isn't flushed when
      disassociating, the following race is possible:
      
       * associate
       * start aggregation session
       * driver callback
       * disassociate
       * associate again to the same AP
       * callback processing runs, leading to a WARN_ON() that
         the TID hadn't requested aggregation
      
      If the second association isn't to the same AP, there would only
      be a message printed ("Could not find station: <addr>"), but the
      same race could happen.
      
      Fix this by not going the whole detour with a fake SKB etc. but
      simply looking up the aggregation session in the driver callback,
      marking it with a START_CB/STOP_CB bit and then scheduling the
      regular aggregation work that will now process these bits as well.
      This also simplifies the code and gets rid of the whole problem
      with allocation failures of said skb, which could have left the
      session in limbo.
      Reported-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      7a7c0a64
  11. 06 3月, 2017 1 次提交
  12. 15 9月, 2016 1 次提交
    • J
      mac80211: reject TSPEC TIDs (TSIDs) for aggregation · 85d5313e
      Johannes Berg 提交于
      Since mac80211 doesn't currently support TSIDs 8-15 which can
      only be used after QoS TSPEC negotiation (and not even after
      WMM negotiation), reject attempts to set up aggregation
      sessions for them, which might confuse drivers. In mac80211
      we do correctly handle that, but the TSIDs should never get
      used anyway, and drivers might not be able to handle it.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      85d5313e
  13. 09 6月, 2016 1 次提交
    • M
      mac80211: implement fair queueing per txq · fa962b92
      Michal Kazior 提交于
      mac80211's software queues were designed to work
      very closely with device tx queues. They are
      required to make use of 802.11 packet aggregation
      easily and efficiently.
      
      Due to the way 802.11 aggregation is designed it
      only makes sense to keep fair queuing as close to
      hardware as possible to reduce induced latency and
      inertia and provide the best flow responsiveness.
      
      This change doesn't translate directly to
      immediate and significant gains. End result
      depends on driver's induced latency. Best results
      can be achieved if driver keeps its own tx
      queue/fifo fill level to a minimum.
      Signed-off-by: NMichal Kazior <michal.kazior@tieto.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      fa962b92
  14. 06 4月, 2016 1 次提交
    • F
      mac80211: add A-MSDU tx support · 6e0456b5
      Felix Fietkau 提交于
      Requires software tx queueing and fast-xmit support. For good
      performance, drivers need frag_list support as well. This avoids the
      need for copying data of aggregated frames. Running without it is only
      supported for debugging purposes.
      
      To avoid performance and packet size issues, the rate control module or
      driver needs to limit the maximum A-MSDU size by setting
      max_rc_amsdu_len in struct ieee80211_sta.
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      [fix locking issue]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      6e0456b5
  15. 14 1月, 2016 1 次提交
  16. 20 11月, 2015 1 次提交
  17. 22 9月, 2015 1 次提交
  18. 10 6月, 2015 1 次提交
    • J
      mac80211: convert HW flags to unsigned long bitmap · 30686bf7
      Johannes Berg 提交于
      As we're running out of hardware capability flags pretty quickly,
      convert them to use the regular test_bit() style unsigned long
      bitmaps.
      
      This introduces a number of helper functions/macros to set and to
      test the bits, along with new debugfs code.
      
      The occurrences of an explicit __clear_bit() are intentional, the
      drivers were never supposed to change their supported bits on the
      fly. We should investigate changing this to be a per-frame flag.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      30686bf7
  19. 02 4月, 2015 1 次提交
    • F
      mac80211: add an intermediate software queue implementation · ba8c3d6f
      Felix Fietkau 提交于
      This allows drivers to request per-vif and per-sta-tid queues from which
      they can pull frames. This makes it easier to keep the hardware queues
      short, and to improve fairness between clients and vifs.
      
      The task of scheduling packet transmission is left up to the driver -
      queueing is controlled by mac80211. Drivers can only dequeue packets by
      calling ieee80211_tx_dequeue. This makes it possible to add active queue
      management later without changing drivers using this code.
      
      This can also be used as a starting point to implement A-MSDU
      aggregation in a way that does not add artificially induced latency.
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      [resolved minor context conflict, minor changes, endian annotations]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      ba8c3d6f
  20. 30 3月, 2015 2 次提交
    • J
      mac80211: reject aggregation sessions with non-HT peers · 8f9c77fc
      Johannes Berg 提交于
      If a peer or some local agent (rate control, ...) decides to start
      an aggregation session but doesn't support HT (which also implies
      QoS), reject it.
      
      This is mostly a corner case as such peers normally won't try to
      use block-ack sessions and rate control wouldn't start them, but
      technically QoS stations could request it according to the spec.
      
      However, since drivers don't really support such non-HT sessions
      it's better to reject them.
      
      Also, while at it, move the tracing for TX sessions earlier so it
      captures the error cases as well.
      Reviewed-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      8f9c77fc
    • J
      mac80211: agg-tx: avoid sending DelBA with sta->lock held · 2c158887
      Johannes Berg 提交于
      The rate control locking caused a potential deadlock here due to the
      locks being acquired in different orders, so that change cannot yet
      be applied. However, there's no fundamental reason for this code to
      hold the sta->lock while transmitting frames.
      
      Clearly it's better not to hold the lock for longer periods of time,
      which can happen here since we call all the way down to the driver.
      Change the code a bit to not hold it while doing that.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      2c158887
  21. 20 11月, 2014 1 次提交
  22. 22 10月, 2014 1 次提交
    • J
      mac80211: add WMM admission control support · 02219b3a
      Johannes Berg 提交于
      Use the currently existing APIs between mac80211 and the low
      level driver to implement WMM admission control.
      
      The low level driver needs to report the media time used by
      each transmitted packet in ieee80211_tx_status. Based on that
      information, mac80211 will modify the QoS parameters of the
      admission controlled Access Category when the limit is
      reached. Once the original QoS parameters can be restored,
      mac80211 will do so.
      
      One issue with this approach is that management frames will
      also erroneously be downgraded, but the upside is that the
      implementation is simple. In the future, it can be extended
      to driver- or device-based implementations that are better.
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      02219b3a
  23. 23 6月, 2014 1 次提交
  24. 05 2月, 2014 1 次提交
    • K
      mac80211: send {ADD,DEL}BA on AC_VO like other mgmt frames, as per spec · c6e13327
      Karl Beldan 提交于
      ATM, {ADD,DEL}BA and BAR frames are sent on the AC matching the TID of
      the BA parameters. In the discussion [1] about this patch, Johannes
      recalled that it fixed some races with the DELBA and indeed this
      behavior was introduced in [2].
      While [2] is right for the BARs, the part queueing the {ADD,DEL}BAs on
      their BA params TID AC violates the spec and is more a workaround for
      some drivers. Helmut expressed some concerns wrt such drivers, in
      particular DELBAs in rt2x00.
      
      ATM, DELBAs are sent after a driver has called (hence "purposely")
      ieee80211_start_tx_ba_cb_irqsafe and Johannes and Emmanuel gave some
      details wrt intentions behind the split of the IEEE80211_AMPDU_TX_STOP_*
      given to the driver ampdu_action supposed to call this function, which
      could prove handy to people trying to do the right thing in faulty
      drivers (if their fw/hw don't get in their way).
      
      [1] http://mid.gmane.org/1390391564-18481-1-git-send-email-karl.beldan@gmail.com
      [2] Commit: cf6bb79a ("mac80211: Use appropriate TID for sending BAR, ADDBA and DELBA frames")
      Signed-off-by: NKarl Beldan <karl.beldan@rivierawaves.com>
      Cc: Helmut Schaa <helmut.schaa@googlemail.com>
      Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c6e13327
  25. 24 1月, 2013 1 次提交
    • J
      mac80211: fix aggregation state with current drivers · 8147dc7f
      Johannes Berg 提交于
      For drivers that don't actually flush their queues when
      aggregation stop with the IEEE80211_AMPDU_TX_STOP_FLUSH
      or IEEE80211_AMPDU_TX_STOP_FLUSH_CONT reasons is done,
      like iwlwifi or iwlegacy, mac80211 can then transmit on
      a TID that the driver still considers busy. This happens
      in the following way:
      
       - IEEE80211_AMPDU_TX_STOP_FLUSH requested
       - driver marks TID as emptying
       - mac80211 removes tid_tx data, this can copy packets
         to the TX pending queues and also let new packets
         through to the driver
       - driver gets unexpected TX as it wasn't completely
         converted to the new API
      
      In iwlwifi, this lead to the following warning:
      
      WARNING: at drivers/net/wireless/iwlwifi/dvm/tx.c:442 iwlagn_tx_skb+0xc47/0xce0
      Tx while agg.state = 4
      Modules linked in: [...]
      Pid: 0, comm: kworker/0:0 Tainted: G        W   3.1.0 #1
      Call Trace:
       [<c1046e42>] warn_slowpath_common+0x72/0xa0
       [<c1046f13>] warn_slowpath_fmt+0x33/0x40
       [<fddffa17>] iwlagn_tx_skb+0xc47/0xce0 [iwldvm]
       [<fddfcaa3>] iwlagn_mac_tx+0x23/0x40 [iwldvm]
       [<fd8c98b6>] __ieee80211_tx+0xf6/0x3c0 [mac80211]
       [<fd8cbe00>] ieee80211_tx+0xd0/0x100 [mac80211]
       [<fd8cc176>] ieee80211_xmit+0x96/0xe0 [mac80211]
       [<fd8cc578>] ieee80211_subif_start_xmit+0x348/0xc80 [mac80211]
       [<c1445207>] dev_hard_start_xmit+0x337/0x6d0
       [<c145eee9>] sch_direct_xmit+0xa9/0x210
       [<c14462c0>] dev_queue_xmit+0x1b0/0x8e0
      
      Fortunately, solving this problem is easy as the station
      is being destroyed, so such transmit packets can only
      happen due to races. Instead of trying to close the race
      just let the race not reach the drivers by making two
      changes:
       1) remove the explicit aggregation session teardown in
          the managed mode code, the same thing will be done
          when the station is removed, in __sta_info_destroy.
       2) When aggregation stop with AGG_STOP_DESTROY_STA is
          requested, leave the tid_tx data around as stopped.
          It will be cleared and freed in cleanup_single_sta
          later, but until then any racy packets will be put
          onto the tid_tx pending queue instead of transmitted
          which is fine since the station is being removed.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      8147dc7f
  26. 19 1月, 2013 1 次提交
  27. 03 1月, 2013 4 次提交
    • J
      mac80211: split TX aggregation stop action · 18b559d5
      Johannes Berg 提交于
      When TX aggregation is stopped, there are a few
      different cases:
       - connection with the peer was dropped
       - session stop was requested locally
       - session stop was requested by the peer
       - connection was dropped while a session is stopping
      
      The behaviour in these cases should be different, if
      the connection is dropped then the driver should drop
      all frames, otherwise the frames may continue to be
      transmitted, aggregated in the case of a locally
      requested session stop or unaggregated in the case of
      the peer requesting session stop.
      
      Split these different cases so that the driver can
      act accordingly; however, treat local and remote stop
      the same way and ask the driver to not send frames as
      aggregated packets any more.
      
      In the case of connection drop, the stop callback the
      driver is otherwise supposed to call is no longer
      required.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      18b559d5
    • J
      mac80211: move ieee80211_remove_tid_tx function · 30bf5f1f
      Johannes Berg 提交于
      To call it from ___ieee80211_stop_tx_ba_session,
      move the function and dependencies up.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      30bf5f1f
    • J
      mac80211: split out aggregation TX removal · faec12ee
      Johannes Berg 提交于
      Create the function ieee80211_remove_tid_tx to call
      it from ___ieee80211_stop_tx_ba_session later.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      faec12ee
    • J
      mac80211: split aggregation stop by reason · c82c4a80
      Johannes Berg 提交于
      The initiator/tx doesn't really identify why an
      aggregation session is stopped, give a reason
      for stopping that more clearly identifies what's
      going on. This will help tell the driver clearly
      what is expected of it.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c82c4a80
  28. 07 12月, 2012 1 次提交
  29. 19 11月, 2012 1 次提交
  30. 21 9月, 2012 1 次提交
  31. 08 7月, 2012 1 次提交
  32. 24 6月, 2012 1 次提交
    • J
      mac80211: clean up debugging · bdcbd8e0
      Johannes Berg 提交于
      There are a few things that make the logging and
      debugging in mac80211 less useful than it should
      be right now:
       * a lot of messages should be pr_info, not pr_debug
       * wholesale use of pr_debug makes it require *both*
         Kconfig and dynamic configuration
       * there are still a lot of ifdefs
       * the style is very inconsistent, sometimes the
         sdata->name is printed in front
      
      Clean up everything, introducing new macros and
      separating out the station MLME debugging into
      a new Kconfig symbol.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      bdcbd8e0