13 Dec, 2019

3 commits

  • Instead of just having an airtime flag in debugfs, turn AQL into a proper
    NL80211_EXT_FEATURE, so drivers can turn it on when they are ready, and so
    we also expose the presence of the feature to userspace.

    This also has the effect of flipping the default, so drivers have to opt in
    to using AQL instead of getting it by default with TXQs. To keep
    functionality the same as pre-patch, we set this feature for ath10k (which
    is where it is needed the most).

    While we're at it, split out the debugfs interface so AQL gets its own
    per-station debugfs file instead of using the 'airtime' file.

    [Johannes:]
    This effectively disables AQL for iwlwifi, where it fixes a number of
    issues:
    * TSO in iwlwifi is causing underflows and associated warnings in AQL
    * HE (802.11ax) rates aren't reported properly so at HE rates, AQL could
    never have a valid estimate (it'd use 6 Mbps instead of up to 2400!)

    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191212111437.224294-1-toke@redhat.com
    Fixes: 3ace10f5b5ad ("mac80211: Implement Airtime-based Queue Limit (AQL)")
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • This code was copied from mt76 and inherited an off by one bug from
    there. The > should be >= so that we don't read one element beyond
    the end of the array.

    Fixes: db3e1c40cf2f ("mac80211: Import airtime calculation code from mt76")
    Reported-by: Toke Høiland-Jørgensen
    Signed-off-by: Dan Carpenter
    Acked-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191126120910.ftr4t7me3by32aiz@kili.mountain
    Signed-off-by: Johannes Berg

    Dan Carpenter
     
  • Fix overwriting of the qos_ctrl.tid field for encrypted frames injected on
    a monitor interface. While qos_ctrl.tid is not encrypted, it's used as an
    input into the encryption algorithm so it's protected, and thus cannot be
    modified after encryption. For injected frames, the encryption may already
    have been done in userspace, so we cannot change any fields.

    Before passing the frame to the driver, the qos_ctrl.tid field is updated
    from skb->priority. Prior to dbd50a851c50 skb->priority was updated in
    ieee80211_select_queue_80211(), but this function is no longer always
    called.

    Update skb->priority in ieee80211_monitor_start_xmit() so that the value
    is stored, and when later code 'modifies' the TID it really sets it to
    the same value as before, preserving the encryption.

    Fixes: dbd50a851c50 ("mac80211: only allocate one queue when using iTXQs")
    Signed-off-by: Fredrik Olofsson
    Link: https://lore.kernel.org/r/20191119133451.14711-1-fredrik.olofsson@anyfinetworks.com
    [rewrite commit message based on our discussion]
    Signed-off-by: Johannes Berg

    Fredrik Olofsson
     

28 Nov, 2019

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the "big" set of driver core patches for 5.5-rc1

    There's a few minor cleanups and fixes in here, but the majority of
    the patches in here fall into two buckets:

    - debugfs api cleanups and fixes

    - driver core device link support for boot dependancy issues

    The debugfs api cleanups are working to slowly refactor the debugfs
    apis so that it is even harder to use incorrectly. That work has been
    happening for the past few kernel releases and will continue over
    time, it's a long-term project/goal

    The driver core device link support missed 5.4 by just a bit, so it's
    been sitting and baking for many months now. It's from Saravana Kannan
    to help resolve the problems that DT-based systems have at boot time
    with dependancy graphs and kernel modules. Turns out that no one has
    actually tried to build a generic arm64 kernel with loads of modules
    and have it "just work" for a variety of platforms (like a distro
    kernel). The big problem turned out to be a lack of dependency
    information between different areas of DT entries, and the work here
    resolves that problem and now allows devices to boot properly, and
    quicker than a monolith kernel.

    All of these patches have been in linux-next for a long time with no
    reported issues"

    * tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (68 commits)
    tracing: Remove unnecessary DEBUG_FS dependency
    of: property: Add device link support for interrupt-parent, dmas and -gpio(s)
    debugfs: Fix !DEBUG_FS debugfs_create_automount
    of: property: Add device link support for "iommu-map"
    of: property: Fix the semantics of of_is_ancestor_of()
    i2c: of: Populate fwnode in of_i2c_get_board_info()
    drivers: base: Fix Kconfig indentation
    firmware_loader: Fix labels with comma for builtin firmware
    driver core: Allow device link operations inside sync_state()
    driver core: platform: Declare ret variable only once
    cpu-topology: declare parse_acpi_topology in
    crypto: hisilicon: no need to check return value of debugfs_create functions
    driver core: platform: use the correct callback type for bus_find_device
    firmware_class: make firmware caching configurable
    driver core: Clarify documentation for fwnode_operations.add_links()
    mailbox: tegra: Fix superfluous IRQ error message
    net: caif: Fix debugfs on 64-bit platforms
    mac80211: Use debugfs_create_xul() helper
    media: c8sectpfe: no need to check return value of debugfs_create functions
    of: property: Add device link support for iommus, mboxes and io-channels
    ...

    Linus Torvalds
     

22 Nov, 2019

7 commits

  • The previous commit added the ability to throttle stations when they queue
    too much airtime in the hardware. This commit enables the functionality by
    calculating the expected airtime usage of each packet that is dequeued from
    the TXQs in mac80211, and accounting that as pending airtime.

    The estimated airtime for each skb is stored in the tx_info, so we can
    subtract the same amount from the running total when the skb is freed or
    recycled. The throttling mechanism relies on this accounting to be
    accurate (i.e., that we are not freeing skbs without subtracting any
    airtime they were accounted for), so we put the subtraction into
    ieee80211_report_used_skb(). As an optimisation, we also subtract the
    airtime on regular TX completion, zeroing out the value stored in the
    packet afterwards, to avoid having to do an expensive lookup of the station
    from the packet data on every packet.

    This patch does *not* include any mechanism to wake a throttled TXQ again,
    on the assumption that this will happen anyway as a side effect of whatever
    freed the skb (most commonly a TX completion).

    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191119060610.76681-5-kyan@google.com
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • In order for the Fq_CoDel algorithm integrated in mac80211 layer to operate
    effectively to control excessive queueing latency, the CoDel algorithm
    requires an accurate measure of how long packets stays in the queue, AKA
    sojourn time. The sojourn time measured at the mac80211 layer doesn't
    include queueing latency in the lower layer (firmware/hardware) and CoDel
    expects lower layer to have a short queue. However, most 802.11ac chipsets
    offload tasks such TX aggregation to firmware or hardware, thus have a deep
    lower layer queue.

    Without a mechanism to control the lower layer queue size, packets only
    stay in mac80211 layer transiently before being sent to firmware queue.
    As a result, the sojourn time measured by CoDel in the mac80211 layer is
    almost always lower than the CoDel latency target, hence CoDel does little
    to control the latency, even when the lower layer queue causes excessive
    latency.

    The Byte Queue Limits (BQL) mechanism is commonly used to address the
    similar issue with wired network interface. However, this method cannot be
    applied directly to the wireless network interface. "Bytes" is not a
    suitable measure of queue depth in the wireless network, as the data rate
    can vary dramatically from station to station in the same network, from a
    few Mbps to over Gbps.

    This patch implements an Airtime-based Queue Limit (AQL) to make CoDel work
    effectively with wireless drivers that utilized firmware/hardware
    offloading. AQL allows each txq to release just enough packets to the lower
    layer to form 1-2 large aggregations to keep hardware fully utilized and
    retains the rest of the frames in mac80211 layer to be controlled by the
    CoDel algorithm.

    Signed-off-by: Kan Yan
    [ Toke: Keep API to set pending airtime internal, fix nits in commit msg ]
    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191119060610.76681-4-kyan@google.com
    Signed-off-by: Johannes Berg

    Kan Yan
     
  • Felix recently added code to calculate airtime of packets to the mt76
    driver. Import this into mac80211 so we can use it for airtime queue limit
    calculations.

    The airtime.c file is copied verbatim from the mt76 driver, and adjusted to
    be usable in mac80211. This involves:

    - Switching to mac80211 data structures.
    - Adding support for 160 MHz channels and HE mode.
    - Moving the symbol and duration calculations around a bit to avoid
    rounding with the higher rates and longer symbol times used for HE rates.

    The per-rate TX rate calculation is also split out to its own function so
    it can be used directly for the AQL calculations later.

    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191119060610.76681-3-kyan@google.com
    [fix HE_GROUP_IDX() to use 3 * bw, since there are 3 _gi values]
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • Commit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing")
    let STAs send QoS Null frames as PS triggers if the AP was
    a QoS STA. However, the mac80211 PS stack relies on an
    interface flag IEEE80211_STA_NULLFUNC_ACKED for
    determining trigger frame ACK, which was not being set for
    acked non-QoS Null frames. The effect is an inability to
    trigger hardware sleep via IEEE80211_CONF_PS since the QoS
    Null frame was seemingly never acked.

    This bug only applies to drivers which set both
    IEEE80211_HW_REPORTS_TX_ACK_STATUS and
    IEEE80211_HW_PS_NULLFUNC_STACK.

    Detect the acked QoS Null frame to restore STA power save.

    Fixes: 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing")
    Signed-off-by: Thomas Pedersen
    Link: https://lore.kernel.org/r/20191119053538.25979-4-thomas@adapt-ip.com
    Signed-off-by: Johannes Berg

    Thomas Pedersen
     
  • This is useful during testing to eg. check the currently
    configured HW power save state.

    Signed-off-by: Thomas Pedersen
    Link: https://lore.kernel.org/r/20191119053538.25979-3-thomas@adapt-ip.com
    Signed-off-by: Johannes Berg

    Thomas Pedersen
     
  • In ieee80211_tx_status() we don't have an sdata struct when looking up the
    destination sta. Instead, we just do a lookup by the vif addr that is the
    source of the packet being completed. Factor this out into a new sta_info
    getter helper, since we need to use it for accounting AQL as well.

    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191112130835.382062-1-toke@redhat.com
    [remove internal rcu_read_lock(), document instead]
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • Add a note with a use-case for the monitor-to-dev injection
    mechanism in mac80211, reported by Ben Greear.

    Change-Id: I6456997ef9bc40b24ede860b6ef2fed5af49cf44
    Signed-off-by: Johannes Berg

    Johannes Berg
     

10 Nov, 2019

1 commit


09 Nov, 2019

1 commit


08 Nov, 2019

5 commits

  • To implement airtime queue limiting, we need to keep a running account of
    the estimated airtime of all skbs queued into the device. Do to this
    correctly, we need to store the airtime estimate into the skb so we can
    decrease the outstanding balance when the skb is freed. This means that the
    time estimate must be stored somewhere that will survive for the lifetime
    of the skb.

    To get this, decrease the size of the ack_frame_id field to 6 bits, and
    lower the size of the ID space accordingly. This leaves 10 bits for use for
    tx_time_est, which is enough to store a maximum of 4096 us, if we shift the
    values so they become units of 4us.

    Signed-off-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/157182474063.150713.16132669599100802716.stgit@toke.dk
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • We've already parsed the same data in the caller, so we can
    pass it. The only thing is that we might fill in more details
    in ieee80211_assoc_success(), but that doesn't bother the
    caller, so it's fine to do even when we share the parsed data.

    This reduces the stack space usage of the call stack here,
    Arnd reported it had grown above the 1024 byte warning limit.

    Reported-by: Arnd Bergmann
    Signed-off-by: Johannes Berg
    Link: https://lore.kernel.org/r/20191028125240.cb7661671bd2.I757c8752bf4f2f35e54f5e0a2c0a9cd9216c3d8b@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • This patch moves the code handling SKBTX_WIFI_STATUS inside the TX path
    into an extra function. This allows us to reuse it inside the 802.11 encap
    offloading datapath.

    Signed-off-by: John Crispin
    Link: https://lore.kernel.org/r/20191029091304.7330-2-john@phrozen.org
    Signed-off-by: Johannes Berg

    John Crispin
     
  • In the first 5 minutes after boot (time of INITIAL_JIFFIES),
    ieee80211_sta_last_active() returns zero if last_ack is zero. This
    leads to "inactive time" showing jiffies_to_msecs(jiffies).

    # iw wlan0 station get fc:ec:da:64:a6:dd
    Station fc:ec:da:64:a6:dd (on wlan0)
    inactive time: 4294894049 ms
    .
    .
    connected time: 70 seconds

    Fix by returning last_rx if last_ack == 0.

    Signed-off-by: Ahmed Zaki
    Link: https://lore.kernel.org/r/20191031121243.27694-1-anzaki@gmail.com
    Signed-off-by: Johannes Berg

    Ahmed Zaki
     
  • If ieee80211_txq_setup_flows() fails, we don't clean up LED
    state properly, leading to crashes later on, fix that.

    Fixes: dc8b274f0952 ("mac80211: Move up init of TXQs")
    Signed-off-by: Johannes Berg
    Acked-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/20191105154110.1ccf7112ba5d.I0ba865792446d051867b33153be65ce6b063d98c@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     

21 Oct, 2019

1 commit


14 Oct, 2019

1 commit


11 Oct, 2019

3 commits

  • Reduces per-rate data structure size

    Signed-off-by: Felix Fietkau
    Link: https://lore.kernel.org/r/20191008171139.96476-3-nbd@nbd.name
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • Rate success probability usually fluctuates a lot under normal conditions.
    With a simple EWMA, noise and fluctuation can be reduced by increasing the
    window length, but that comes at the cost of introducing lag on sudden
    changes.

    This change replaces the EWMA implementation with a moving average that's
    designed to significantly reduce lag while keeping a bigger window size
    by being better at filtering out noise.

    It is only slightly more expensive than the simple EWMA and still avoids
    divisions in its calculation.

    The algorithm is adapted from an implementation intended for a completely
    different field (stock market trading), where the tradeoff of lag vs
    noise filtering is equally important. It is based on the "smoothing filter"
    from http://www.stockspotter.com/files/PredictiveIndicators.pdf.

    I have adapted it to fixed-point math with some constants so that it uses
    only addition, bit shifts and multiplication

    To better make use of the filtering and bigger window size, the update
    interval time is cut in half.

    For testing, the algorithm can be reverted to the older one via debugfs

    Signed-off-by: Felix Fietkau
    Link: https://lore.kernel.org/r/20191008171139.96476-2-nbd@nbd.name
    Signed-off-by: Johannes Berg

    Felix Fietkau
     
  • Use a slightly different threshold for downgrading spatial streams to
    make it easier to calculate without divisions.
    Slightly reduces CPU overhead.

    Signed-off-by: Felix Fietkau
    Link: https://lore.kernel.org/r/20191008171139.96476-1-nbd@nbd.name
    Signed-off-by: Johannes Berg

    Felix Fietkau
     

08 Oct, 2019

2 commits

  • In non-ETSI regulatory domains scan is blocked when operating channel
    is a DFS channel. For ETSI, however, once DFS channel is marked as
    available after the CAC, this channel will remain available (for some
    time) even after leaving this channel.

    Therefore a scan can be done without any impact on the availability
    of the DFS channel as no new CAC is required after the scan.

    Enable scan in mac80211 in these cases.

    Signed-off-by: Aaron Komisar
    Link: https://lore.kernel.org/r/1570024728-17284-1-git-send-email-aaron.komisar@tandemg.com
    Signed-off-by: Johannes Berg

    Aaron Komisar
     
  • We can process deauth frames and all, but we drop them very
    early in the RX path today - this could never have worked.

    Fixes: 2cc59e784b54 ("mac80211: reply to AUTH with DEAUTH if sta allocation fails in IBSS")
    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20191004123706.15768-2-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Johannes Berg
     

04 Oct, 2019

4 commits

  • Although this shouldn't occur in practice, it's a good idea to bounds
    check the length field of the SSID element prior to using it for things
    like allocations or memcpy operations.

    Cc:
    Cc: Kees Cook
    Reported-by: Nicolas Waisman
    Signed-off-by: Will Deacon
    Link: https://lore.kernel.org/r/20191004095132.15777-1-will@kernel.org
    Signed-off-by: Johannes Berg

    Will Deacon
     
  • There really is no need to make drivers call the
    ieee80211_start_tx_ba_cb_irqsafe() function and then
    schedule the worker if all we want is to set a bit.

    Add a new return value (that was previously considered
    invalid) to indicate that the driver is immediately
    ready for the session, and make drivers use it. The
    only drivers that remain different are the Intel ones
    as they need to negotiate more with the firmware.

    Link: https://lore.kernel.org/r/1570007543-I152912660131cbab2e5d80b4218238c20f8a06e5@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • This simplifies the code somewhat, and if necessary would let
    us access the sta itself in that code.

    Link: https://lore.kernel.org/r/1569965193-Id656db92703dded4bb2e3ec5dc329529f58e58f0@changeid
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • when ieee80211_ibss_csa_beacon() fails, we return it's value.
    When it succeeds, we basically copy it's value and also .. return it.

    Just return it immediately, simplifying the code.

    Signed-off-by: Koen Vandeputte
    Link: https://lore.kernel.org/r/20190911141431.12498-1-koen.vandeputte@ncentric.com
    Signed-off-by: Johannes Berg

    Koen Vandeputte
     

01 Oct, 2019

2 commits

  • Drivers typically expect this, as it's the case for almost all cases
    where this is called (i.e. from the TX path). Also, the code in mac80211
    itself (if the driver calls ieee80211_tx_dequeue()) expects this as it
    uses this_cpu_ptr() without additional protection.

    This should fix various reports of the problem:
    https://bugzilla.kernel.org/show_bug.cgi?id=204127
    https://lore.kernel.org/linux-wireless/CAN5HydrWb3o_FE6A1XDnP1E+xS66d5kiEuhHfiGKkLNQokx13Q@mail.gmail.com/
    https://lore.kernel.org/lkml/nycvar.YFH.7.76.1909111238470.473@cbobk.fhfr.pm/

    Cc: stable@vger.kernel.org
    Reported-and-tested-by: Jiri Kosina
    Reported-by: Aaron Hill
    Reported-by: Lukas Redlinger
    Reported-by: Oleksii Shevchuk
    Fixes: 21a5d4c3a45c ("mac80211: add stop/start logic for software TXQs")
    Link: https://lore.kernel.org/r/1569928763-I3e8838c5ecad878e59d4a94eb069a90f6641461a@changeid
    Reviewed-by: Toke Høiland-Jørgensen
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • If the interface type is P2P_DEVICE or NAN, read the file of
    '/sys/kernel/debug/ieee80211/phyx/netdev:wlanx/aqm' will get a
    NULL pointer dereference. As for those interface type, the
    pointer sdata->vif.txq is NULL.

    Unable to handle kernel NULL pointer dereference at virtual address 00000011
    CPU: 1 PID: 30936 Comm: cat Not tainted 4.14.104 #1
    task: ffffffc0337e4880 task.stack: ffffff800cd20000
    PC is at ieee80211_if_fmt_aqm+0x34/0xa0 [mac80211]
    LR is at ieee80211_if_fmt_aqm+0x34/0xa0 [mac80211]
    [...]
    Process cat (pid: 30936, stack limit = 0xffffff800cd20000)
    [...]
    [] ieee80211_if_fmt_aqm+0x34/0xa0 [mac80211]
    [] ieee80211_if_read+0x60/0xbc [mac80211]
    [] ieee80211_if_read_aqm+0x28/0x30 [mac80211]
    [] full_proxy_read+0x2c/0x48
    [] __vfs_read+0x2c/0xd4
    [] vfs_read+0x8c/0x108
    [] SyS_read+0x40/0x7c

    Signed-off-by: Miaoqing Pan
    Acked-by: Toke Høiland-Jørgensen
    Link: https://lore.kernel.org/r/1569549796-8223-1-git-send-email-miaoqing@codeaurora.org
    [trim useless data from commit message]
    Signed-off-by: Johannes Berg

    Miaoqing Pan
     

15 Sep, 2019

1 commit


11 Sep, 2019

8 commits

  • The Layer 2 Update frame is used to update bridges when a station roams
    to another AP even if that STA does not transmit any frames after the
    reassociation. This behavior was described in IEEE Std 802.11F-2003 as
    something that would happen based on MLME-ASSOCIATE.indication, i.e.,
    before completing 4-way handshake. However, this IEEE trial-use
    recommended practice document was published before RSN (IEEE Std
    802.11i-2004) and as such, did not consider RSN use cases. Furthermore,
    IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been
    maintained amd should not be used anymore.

    Sending out the Layer 2 Update frame immediately after association is
    fine for open networks (and also when using SAE, FT protocol, or FILS
    authentication when the station is actually authenticated by the time
    association completes). However, it is not appropriate for cases where
    RSN is used with PSK or EAP authentication since the station is actually
    fully authenticated only once the 4-way handshake completes after
    authentication and attackers might be able to use the unauthenticated
    triggering of Layer 2 Update frame transmission to disrupt bridge
    behavior.

    Fix this by postponing transmission of the Layer 2 Update frame from
    station entry addition to the point when the station entry is marked
    authorized. Similarly, send out the VLAN binding update only if the STA
    entry has already been authorized.

    Signed-off-by: Jouni Malinen
    Reviewed-by: Johannes Berg
    Signed-off-by: David S. Miller

    Jouni Malinen
     
  • …inux/kernel/git/jberg/mac80211-next

    Johannes Berg says:

    ====================
    We have a number of changes, but things are settling down:
    * a fix in the new 6 GHz channel support
    * a fix for recent minstrel (rate control) updates
    for an infinite loop
    * handle interface type changes better wrt. management frame
    registrations (for management frames sent to userspace)
    * add in-BSS RX time to survey information
    * handle HW rfkill properly if !CONFIG_RFKILL
    * send deauth on IBSS station expiry, to avoid state mismatches
    * handle deferred crypto tailroom updates in mac80211 better
    when device restart happens
    * fix a spectre-v1 - really a continuation of a previous patch
    * advertise NL80211_CMD_UPDATE_FT_IES as supported if so
    * add some missing parsing in VHT extended NSS support
    * support HE in mac80211_hwsim
    * let mac80211 drivers determine the max MTU themselves
    along with the usual cleanups etc.
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     
  • Make it possibly for drivers to adjust the default max_mtu
    by storing it in the hardware struct and using that value
    for all interfaces.

    Signed-off-by: Wen Gong
    Link: https://lore.kernel.org/r/1567738137-31748-1-git-send-email-wgong@codeaurora.org
    Signed-off-by: Johannes Berg

    Wen Gong
     
  • When we expire an inactive station, try to send it a deauth. This
    helps if it's actually still around, and just has issues with
    beacon distribution (or we do), and it will not also remove us.
    Then, if we have shared state, this may not be reset properly,
    causing problems; for example, we saw a case where aggregation
    sessions weren't removed properly (due to the TX start being
    offloaded to firmware and it relying on deauth for stop), causing
    a lot of traffic to get lost due to the SN reset after remove/add
    of the peer.

    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-9-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • We already assume that key is not NULL and dereference it in a few
    other places before we check whether it is NULL, so the check is
    unnecessary. Remove it.

    Fixes: 96fc6efb9ad9 ("mac80211: IEEE 802.11 Extended Key ID support")
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-8-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Luca Coelho
     
  • In case we got a fw restart while roaming from encrypted AP to
    non-encrypted one, we might end up with hitting a warning on the pending
    counter crypto_tx_tailroom_pending_dec having a non-zero value.

    The following comment taken from net/mac80211/key.c explains the rational
    for the delayed tailroom needed:

    /*
    * The reason for the delayed tailroom needed decrementing is to
    * make roaming faster: during roaming, all keys are first deleted
    * and then new keys are installed. The first new key causes the
    * crypto_tx_tailroom_needed_cnt to go from 0 to 1, which invokes
    * the cost of synchronize_net() (which can be slow). Avoid this
    * by deferring the crypto_tx_tailroom_needed_cnt decrementing on
    * key removal for a while, so if we roam the value is larger than
    * zero and no 0->1 transition happens.
    *
    * The cost is that if the AP switching was from an AP with keys
    * to one without, we still allocate tailroom while it would no
    * longer be needed. However, in the typical (fast) roaming case
    * within an ESS this usually won't happen.
    */

    The next flow lead to the warning eventually reported as a bug:
    1. Disconnect from encrypted AP
    2. Set crypto_tx_tailroom_pending_dec = 1 for the key
    3. Schedule work
    4. Reconnect to non-encrypted AP
    5. Add a new key, setting the tailroom counter = 1
    6. Got FW restart while pending counter is set ---> hit the warning

    While on it, the ieee80211_reset_crypto_tx_tailroom() func was merged into
    its single caller ieee80211_reenable_keys (previously called
    ieee80211_enable_keys). Also, we reset the crypto_tx_tailroom_pending_dec
    and remove the counters warning as we just reset both.

    Signed-off-by: Lior Cohen
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-7-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Lior Cohen
     
  • When we reach this point, the key cannot be NULL. Remove the condition
    that suggests otherwise.

    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-6-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • "HE/HT/VHT" is a bit confusing since really the order of
    development (and possible support) is different - change
    this to "HT/VHT/HE".

    Signed-off-by: Johannes Berg
    Signed-off-by: Luca Coelho
    Link: https://lore.kernel.org/r/20190830112451.21655-4-luca@coelho.fi
    Signed-off-by: Johannes Berg

    Johannes Berg