1. 14 1月, 2016 1 次提交
    • J
      mac80211: recalculate SW ROC only when needed · e9db4557
      Johannes Berg 提交于
      The current (new) code recalculates the new work timeout
      for software remain-on-channel whenever any item started.
      In two of the callers of ieee80211_handle_roc_started(),
      this is completely pointless since they're for hardware
      and will skip the recalculation entirely; it's necessary
      only in the case of having just added a new item to the
      list, as in the last remaining case the recalculation had
      just been done.
      
      This last case, however, is also problematic - if one of
      the items on the list actually expires during the recalc
      the list iteration outside becomes corrupted and crashes.
      
      Fix this by moving the recalculation to the only place
      where it's required.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e9db4557
  2. 07 12月, 2015 1 次提交
    • I
      mac80211: handle HW ROC expired properly · 1b894521
      Ilan Peer 提交于
      In case of HW ROC, when the driver reports that the ROC expired,
      it is not sufficient to purge the ROCs based on the remaining
      time, as it possible that the device finished the ROC session
      before the actual requested duration.
      
      To handle such cases, in case of ROC expired notification from
      the driver, complete all the ROCs which are marked with hw_begun,
      regardless of the remaining duration.
      Signed-off-by: NIlan Peer <ilan.peer@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      1b894521
  3. 04 12月, 2015 5 次提交
    • J
      mac80211: reject zero cookie in mgmt-tx/roc cancel · 7d37fcd4
      Johannes Berg 提交于
      When cancelling, you can cancel "any" (first in list) mgmt-tx
      or remain-on-channel operation by using the value 0 for the
      cookie along with the *opposite* operation, i.e.
       * cancel the first mgmt-tx by cancelling roc with 0 cookie
       * cancel the first roc by cancelling mgmt-tx with 0 cookie
      
      This isn't really that bad since userspace should only pass
      cookies that we gave it, but could lead to hard-to-debug
      issues so better prevent it and reject zero values since we
      never hand those out.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      7d37fcd4
    • J
      mac80211: rewrite remain-on-channel logic · aaa016cc
      Johannes Berg 提交于
      Jouni found a bug in the remain-on-channel logic: when a short item
      is queued, a long item is combined with it extending the original
      one, and then the long item is deleted, the timeout doesn't go back
      to the short one, and the short item ends up taking a long time. In
      this case, this showed as blocking scan when running two test cases
      back to back - the scan from the second was delayed even though all
      the remain-on-channel items should long have been gone.
      
      Fixing this with the current data structures turns out to be a bit
      complicated, we just remove the long item from the dependents list
      right now and don't recalculate the timeouts.
      
      There's a somewhat similar bug where we delete the short item and
      all the dependents go with it; to fix this we'd have to move them
      from the dependents to the real list.
      
      Instead of trying to do that, rewrite the code to not have all this
      complexity in the data structures: use a single list and allow more
      than one entry in it being marked as started. This makes the code a
      bit more complex, the worker needs to understand that it might need
      to just remove one of the started items, while keeping the device
      off-channel, but that's not more complicated than the nested data
      structures.
      
      This then fixes both issues described, and makes it easier to also
      limit the overall off-channel time when combining.
      
      TODO: as before, with hardware remain-on-channel, deleting an item
      after combining results in cancelling them all - we can keep track
      of the time elapsed and only cancel after that to fix this.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      aaa016cc
    • J
      mac80211: simplify ack_skb handling · 5ee00dbd
      Johannes Berg 提交于
      Since the cookie is assigned inside ieee80211_make_ack_skb()
      now, we no longer need to return the ack_skb as the cookie
      and can simplify the function's return and the callers. Also
      rename it to ieee80211_attach_ack_skb() to more accurately
      reflect its purpose.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      5ee00dbd
    • J
      mac80211: move off-channel/mgmt-tx code to offchannel.c · a2fcfccb
      Johannes Berg 提交于
      This is quite a bit of code that logically depends here since
      it has to deal with all the remain-on-channel logic.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      a2fcfccb
    • J
      mac80211: fix mgmt-tx abort cookie and leak · e673a659
      Johannes Berg 提交于
      If a mgmt-tx operation is aborted before it runs, the wrong
      cookie is reported back to userspace, and the ack_skb gets
      leaked since the frame is freed directly instead of freeing
      it using ieee80211_free_txskb(). Fix that.
      
      Fixes: 3b79af97 ("mac80211: stop using pointers as userspace cookies")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e673a659
  4. 29 9月, 2015 1 次提交
  5. 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
  6. 14 1月, 2015 1 次提交
  7. 23 6月, 2014 1 次提交
  8. 14 5月, 2014 1 次提交
    • J
      mac80211: fix on-channel remain-on-channel · b4b177a5
      Johannes Berg 提交于
      Jouni reported that if a remain-on-channel was active on the
      same channel as the current operating channel, then the ROC
      would start, but any frames transmitted using mgmt-tx on the
      same channel would get delayed until after the ROC.
      
      The reason for this is that the ROC starts, but doesn't have
      any handling for "remain on the same channel", so it stops
      the interface queues. The later mgmt-tx then puts the frame
      on the interface queues (since it's on the current operating
      channel) and thus they get delayed until after the ROC.
      
      To fix this, add some logic to handle remaining on the same
      channel specially and not stop the queues etc. in this case.
      This not only fixes the bug but also improves behaviour in
      this case as data frames etc. can continue to flow.
      
      Cc: stable@vger.kernel.org
      Reported-by: NJouni Malinen <j@w1.fi>
      Tested-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      b4b177a5
  9. 09 4月, 2014 1 次提交
    • J
      mac80211: fix software remain-on-channel implementation · 115b943a
      Johannes Berg 提交于
      Jouni reported that when doing off-channel transmissions mixed
      with on-channel transmissions, the on-channel ones ended up on
      the off-channel in some cases.
      
      The reason for that is that during the refactoring of the off-
      channel code, I lost the part that stopped all activity and as
      a consequence the on-channel frames (including data frames)
      were no longer queued but would be transmitted on the temporary
      channel.
      
      Fix this by simply restoring the lost activity stop call.
      
      Cc: stable@vger.kernel.org
      Fixes: 2eb278e0 ("mac80211: unify SW/offload remain-on-channel")
      Reported-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      115b943a
  10. 30 9月, 2013 1 次提交
    • J
      mac80211: Run deferred scan if last roc_list item is not started · 22c4ceed
      Jouni Malinen 提交于
      mac80211 scan processing could get stuck if roc work for pending, but
      not started when a scan request was deferred due to such roc item.
      Normally the deferred scan would be started from
      ieee80211_start_next_roc(), but ieee80211_sw_roc_work() calls that only
      if the finished ROC was started. Fix this by calling
      ieee80211_run_deferred_scan() in the case the last ROC was not actually
      started.
      
      This issue was hit relatively easily in P2P find operations where Listen
      state (remain-on-channel) and Search state (scan) are repeated in a
      loop.
      Signed-off-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      22c4ceed
  11. 08 4月, 2013 1 次提交
  12. 25 3月, 2013 1 次提交
  13. 19 3月, 2013 2 次提交
  14. 06 3月, 2013 1 次提交
  15. 12 2月, 2013 2 次提交
    • S
      mac80211: Add flushes before going off-channel · 9c35d7d2
      Seth Forshee 提交于
      We've got a couple of races when enabling powersave with an AP for
      off-channel operation. The first is fairly simple. If we go off-channel
      before the nullfunc frame to enable PS is transmitted then it may not be
      received by the AP. Add a flush after enabling off-channel PS to prevent
      this from happening.
      
      The second race is a bit more subtle. If the driver supports QoS and has
      frames queued when the nullfunc frame is queued, those frames may get
      transmitted after the nullfunc frame. If PM is not set then the AP is
      being told that we've exited PS before we go off-channel and may try to
      deliver frames. To prevent this, add a flush after stopping the queues
      but before passing the nullfunc frame to the driver.
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9c35d7d2
    • S
      mac80211: Fix tx queue handling during scans · 6c17b77b
      Seth Forshee 提交于
      Scans currently work by stopping the netdev tx queues but leaving the
      mac80211 queues active. This stops the flow of incoming packets while
      still allowing mac80211 to transmit nullfunc and probe request frames to
      facilitate scanning. However, the driver may try to wake the mac80211
      queues while in this state, which will also wake the netdev queues.
      
      To prevent this, add a new queue stop reason,
      IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, to be used when stopping the tx
      queues for off-channel operation. This prevents the netdev queues from
      waking when a driver wakes the mac80211 queues.
      
      This also stops all frames from being transmitted, even those meant to
      be sent off-channel. Add a new tx control flag,
      IEEE80211_TX_CTL_OFFCHAN_TX_OK, which allows frames to be transmitted
      when the queues are stopped only for the off-channel stop reason. Update
      all locations transmitting off-channel frames to use this flag.
      Signed-off-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      6c17b77b
  16. 16 1月, 2013 1 次提交
    • S
      mac80211: synchronize scan off/on-channel and PS states · aacde9ee
      Stanislaw Gruszka 提交于
      Since:
      
      commit b23b025f
      Author: Ben Greear <greearb@candelatech.com>
      Date:   Fri Feb 4 11:54:17 2011 -0800
      
          mac80211: Optimize scans on current operating channel.
      
      we do not disable PS while going back to operational channel (on
      ieee80211_scan_state_suspend) and deffer that until scan finish.
      But since we are allowed to send frames, we can send a frame to AP
      without PM bit set, so disable PS on AP side. Then when we switch
      to off-channel (in ieee80211_scan_state_resume) we do not enable PS.
      Hence we are off-channel with PS disabled, frames are not buffered
      by AP.
      
      To fix remove offchannel_ps_disable argument and always enable PS when
      going off-channel and disable it when going on-channel, like it was
      before.
      
      Cc: stable@vger.kernel.org # 2.6.39+
      Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
      Tested-by: NSeth Forshee <seth.forshee@canonical.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      aacde9ee
  17. 03 1月, 2013 1 次提交
  18. 27 11月, 2012 1 次提交
  19. 26 11月, 2012 1 次提交
    • J
      cfg80211: remove remain-on-channel channel type · 42d97a59
      Johannes Berg 提交于
      As mwifiex (and mac80211 in the software case) are the
      only drivers actually implementing remain-on-channel
      with channel type, userspace can't be relying on it.
      This is the case, as it's used only for P2P operations
      right now.
      
      Rather than adding a flag to tell userspace whether or
      not it can actually rely on it, simplify all the code
      by removing the ability to use different channel types.
      Leave only the validation of the attribute, so that if
      we extend it again later (with the needed capability
      flag), it can't break userspace sending invalid data.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      42d97a59
  20. 19 11月, 2012 1 次提交
  21. 30 10月, 2012 1 次提交
  22. 17 10月, 2012 2 次提交
    • J
      mac80211: use channel contexts · 55de908a
      Johannes Berg 提交于
      Instead of operating on a single channel only,
      use the new channel context infrastructure in
      all mac80211 code.
      
      This enables drivers that want to use the new
      channel context infrastructure to use multiple
      channels, while nothing should change for all
      the other drivers that don't support it.
      
      Right now this disables both TX power settings
      and spatial multiplexing powersave. Both need
      to be re-enabled on a channel context basis.
      
      Additionally, when channel contexts are used
      drop the connection when channel switch is
      received rather than trying to handle it. This
      will have to be improved later.
      
      [With fixes from Eliad and Emmanuel incorporated]
      Signed-off-by: NEliad Peller <eliad@wizery.com>
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      55de908a
    • J
      mac80211: track whether to use channel contexts · fe57d9f5
      Johannes Berg 提交于
      Depending on the driver, channel contexts may be used or
      not. If they are used, the driver must have support for
      hardware scan and remain-on-channel; otherwise the driver
      must not advertise support for multiple channels.
      
      Also prohibit WDS type interfaces when channel contexts
      are to be used as there's no clear definition of which
      channel they use.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      fe57d9f5
  23. 06 9月, 2012 1 次提交
  24. 20 8月, 2012 1 次提交
  25. 13 7月, 2012 1 次提交
  26. 09 7月, 2012 1 次提交
    • J
      cfg80211: use wdev in mgmt-tx/ROC APIs · 71bbc994
      Johannes Berg 提交于
      The management frame and remain-on-channel APIs will be
      needed in the P2P device abstraction, so move them over
      to the new wdev-based APIs. Userspace can still use both
      the interface index and wdev identifier for them so it's
      backward compatible, but for the P2P Device wdev it will
      be able to use the wdev identifier only.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      71bbc994
  27. 24 6月, 2012 1 次提交
  28. 21 6月, 2012 1 次提交
  29. 20 6月, 2012 1 次提交
  30. 11 6月, 2012 1 次提交
  31. 07 6月, 2012 2 次提交
    • J
      mac80211: unify SW/offload remain-on-channel · 2eb278e0
      Johannes Berg 提交于
      Redesign all the off-channel code, getting rid of
      the generic off-channel work concept, replacing
      it with a simple remain-on-channel list.
      
      This fixes a number of small issues with the ROC
      implementation:
       * offloaded remain-on-channel couldn't be queued,
         now we can queue it as well, if needed
       * in iwlwifi (the only user) offloaded ROC is
         mutually exclusive with scanning, use the new
         queue to handle that case -- I expect that it
         will later depend on a HW flag
      
      The bigger issue though is that there's a bad bug
      in the current implementation: if we get a mgmt
      TX request while HW roc is active, and this new
      request has a wait time, we actually schedule a
      software ROC instead since we can't guarantee the
      existing offloaded ROC will still be that long.
      To fix this, the queuing mechanism was needed.
      
      The queuing mechanism for offloaded ROC isn't yet
      optimal, ideally we should add API to have the HW
      extend the ROC if needed. We could add that later
      but for now use a software implementation.
      
      Overall, this unifies the behaviour between the
      offloaded and software-implemented case as much
      as possible.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      2eb278e0
    • J
      mac80211: do remain-on-channel while idle · 196ac1c1
      Johannes Berg 提交于
      The IDLE handling in HW off-channel is broken right
      now since we turn off IDLE only when the off-channel
      period already started. Therefore, all drivers that
      use it today (only iwlwifi!) must support off-channel
      while idle, so playing with idle isn't needed at all.
      
      Off-channel in general, since it's no longer used for
      authentication/association, shouldn't affect PS, so
      also remove that logic.
      
      Also document a small caveat for reporting TX status
      from off-channel frames in HW remain-on-channel.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      196ac1c1
  32. 05 6月, 2012 1 次提交