29 Jul, 2019

1 commit

  • HE allows peers to negotiate the aggregation fragmentation level to be used
    during transmission. The level can be 1-3. The Ext element is added behind
    the ADDBA request inside the action frame. The responder will then reply
    with the same level or a lower one if the requested one is not supported.
    This patch only handles the negotiation part as the ADDBA frames get passed
    to the ATH11k firmware, which does the rest of the magic for us aswell as
    generating the requests.

    Signed-off-by: Shashidhar Lakkavalli
    Signed-off-by: John Crispin
    Link: https://lore.kernel.org/r/20190729104512.27615-1-john@phrozen.org
    Signed-off-by: Johannes Berg

    John Crispin
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

10 Apr, 2019

1 commit


19 Jan, 2019

1 commit

  • Allow user to override STBC configuration for Rx and Tx spatial streams.
    In practice RX/TX STBC settings can be modified using appropriate
    options in wpa_supplicant configuration file:
    tx_stbc=-1..1
    rx_stbc=-1..3

    This functionality has been added to wpa_supplicant in commit cdeea70f59d0.

    In FullMAC case these STBC options are passed to drivers by cfg80211
    connect callback in fields of cfg80211_connect_params structure.
    However for mac80211 drivers, e.g. for mac80211_hwsim,
    overrides for STBC settings are ignored.

    The reason why RX/TX STBC capabilities are not modified for mac80211
    drivers is as follows. All drivers need to specify supported HT/VHT
    overrides explicitly: see ht_capa_mod_mask and vht_capa_mod_mask fields
    of wiphy structure. Only supported overrides will be passed to drivers by
    cfg80211_connect and cfg80211_mlme_assoc operations: see bitwise 'AND'
    performed by cfg80211_oper_and_ht_capa and cfg80211_oper_and_vht_capa.

    This commit adds RX/TX STBC HT capabilities to mac80211_ht_capa_mod_mask,
    allowing their modifications, as well as applies requested STBC
    modifications in function ieee80211_apply_htcap_overrides.

    Signed-off-by: Sergey Matyukevich
    Signed-off-by: Johannes Berg

    Sergey Matyukevich
     

19 Jun, 2018

1 commit


18 May, 2018

1 commit

  • The mac80211 tear down code is not waiting for the driver call back.
    This can bring down the the TX path (TID) till the user manually
    reconnects. (Observed with iwldvm and enabled TX aggregation.)

    The race can be prevented when the ampdu_mlme worker handles the tear
    down.

    The race:
    * ieee80211_sta_tear_down_BA_sessions calls
    ___ieee80211_stop_tx_ba_session for all TIDs,

    * then cancels the ampdu_mlme worker

    * and cleanups the TIDs the driver already has called back for.

    * ieee80211_stop_tx_ba_cb will never be called for a TID if the callback
    came after the the check in ieee80211_sta_tear_down_BA_sessions.

    Signed-off-by: Alexander Wetzel
    [johannes: "enabled" -> "blocked" and invert logic, simplify init]
    Signed-off-by: Johannes Berg

    Alexander Wetzel
     

29 Mar, 2018

1 commit


05 Jan, 2018

1 commit


11 Dec, 2017

2 commits

  • In preparation to enabling -Wimplicit-fallthrough, mark switch cases
    where we are expecting to fall through.

    Notice that in some cases I replaced "fall through on else" and
    "otherwise fall through" comments with just a "fall through" comment,
    which is what GCC is expecting to find.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Johannes Berg

    Gustavo A. R. Silva
     
  • Due to overlap between
    commit 1281103770e9 ("mac80211: Simplify locking in ieee80211_sta_tear_down_BA_sessions()")
    and the way that Luca modified
    commit 72e2c3438ba3 ("mac80211: tear down RX aggregations first")
    when sending it upstream from Intel's internal tree, we get
    the following warning:

    WARNING: CPU: 0 PID: 5472 at net/mac80211/agg-tx.c:315 ___ieee80211_stop_tx_ba_session+0x158/0x1f0

    since there's no appropriate locking around the call to
    ___ieee80211_stop_tx_ba_session; Sara's original just had
    a call to the locked __ieee80211_stop_tx_ba_session (one
    less underscore) but it looks like Luca modified both of
    the calls when fixing it up for upstream, leading to the
    problem at hand.

    Move the locking appropriately to fix this problem.

    Reported-by: Kalle Valo
    Reported-by: Pavel Machek
    Tested-by: Pavel Machek
    Signed-off-by: Johannes Berg

    Johannes Berg
     

27 Nov, 2017

1 commit

  • When doing HW restart we tear down aggregations.
    Since at this point we are not TX'ing any aggregation, while
    the peer is still sending RX aggregation over the air, it will
    make sense to tear down the RX aggregations first.

    Signed-off-by: Sara Sharon
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Sara Sharon
     

21 Sep, 2017

1 commit


06 Sep, 2017

2 commits

  • When an RX BA session is started by the driver, and it has to tell
    mac80211 about it, the corresponding bit in tid_rx_manage_offl gets
    set and the BA session work is scheduled. Upon testing this bit, it
    will call __ieee80211_start_rx_ba_session(), thus deadlocking as it
    already holds the ampdu_mlme.mtx, which that acquires again.

    Fix this by adding ___ieee80211_start_rx_ba_session(), a version of
    the function that requires the mutex already held.

    Cc: stable@vger.kernel.org
    Fixes: 699cb58c8a52 ("mac80211: manage RX BA session offload without SKB queue")
    Reported-by: Matteo Croce
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Commit 7a7c0a6438b8 ("mac80211: fix TX aggregation start/stop callback race")
    added a cancellation of the ampdu work after the loop that stopped the
    Tx and Rx BA sessions. However, in some cases, e.g., during HW reconfig,
    the low level driver might call mac80211 APIs to complete the stopping
    of the BA sessions, which would queue the ampdu work to handle the actual
    completion. This work needs to be performed as otherwise mac80211 data
    structures would not be properly synced.

    Fix this by checking if BA session STOP_CB bit is set after the BA session
    cancellation and properly clean the session.

    Signed-off-by: Ilan Peer
    [Johannes: the work isn't flushed because that could do other things we
    don't want, and the locking situation isn't clear]
    Signed-off-by: Johannes Berg

    Ilan peer
     

16 Jun, 2017

2 commits

  • It seems like a historic accident that these return unsigned char *,
    and in many places that means casts are required, more often than not.

    Make these functions (skb_put, __skb_put and pskb_put) return void *
    and remove all the casts across the tree, adding a (u8 *) cast only
    where the unsigned char pointer was used directly, all done with the
    following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_put, __skb_put };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_put, __skb_put };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    which actually doesn't cover pskb_put since there are only three
    users overall.

    A handful of stragglers were converted manually, notably a macro in
    drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
    instances in net/bluetooth/hci_sock.c. In the former file, I also
    had to fix one whitespace problem spatch introduced.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    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: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

08 Jun, 2017

1 commit

  • Instead of using the SKB queue with the fake pkt_type for the
    offloaded RX BA session management, also handle this with the
    normal aggregation state machine worker. This also makes the
    use of this more reliable since it gets rid of the allocation
    of the fake skb.

    Combined with the previous patch, this finally allows us to
    get rid of the pkt_type hack entirely, so do that as well.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

30 May, 2017

1 commit

  • 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: "), 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: Jouni Malinen
    Signed-off-by: Johannes Berg

    Johannes Berg
     

24 Feb, 2016

1 commit

  • In VHT, the specification allows to limit the number of
    MSDUs in an A-MSDU in the Extended Capabilities IE. There
    is also a limitation on the byte size in the VHT IE.
    In HT, the only limitation is on the byte size.
    Parse the capabilities from the peer and make them
    available to the driver.

    In HT, there is another limitation when a BA agreement
    is active: the byte size can't be greater than 4095.
    This is not enforced here.

    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg

    Emmanuel Grumbach
     

30 Mar, 2015

1 commit


21 Jul, 2014

2 commits


22 Apr, 2014

1 commit


09 Apr, 2014

1 commit


21 Feb, 2014

1 commit


14 Feb, 2014

1 commit


06 Feb, 2014

1 commit

  • sdata->u.ap.request_smps_work can’t be flushed synchronously
    under wdev_lock(wdev) since ieee80211_request_smps_ap_work
    itself locks the same lock.
    While at it, reset the driver_smps_mode when the ap is
    stopped to its default: OFF.

    This solves:

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    3.12.0-ipeer+ #2 Tainted: G O
    -------------------------------------------------------
    rmmod/2867 is trying to acquire lock:
    ((&sdata->u.ap.request_smps_work)){+.+...}, at: [] flush_work+0x0/0x90

    but task is already holding lock:
    (&wdev->mtx){+.+.+.}, at: [] cfg80211_stop_ap+0x26/0x230 [cfg80211]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&wdev->mtx){+.+.+.}:
    [] lock_acquire+0x79/0xe0
    [] mutex_lock_nested+0x4a/0x360
    [] ieee80211_request_smps_ap_work+0x2b/0x50 [mac80211]
    [] process_one_work+0x198/0x450
    [] worker_thread+0xf9/0x320
    [] kthread+0x9f/0xb0
    [] ret_from_kernel_thread+0x1b/0x28

    -> #0 ((&sdata->u.ap.request_smps_work)){+.+...}:
    [] __lock_acquire+0x183f/0x1910
    [] lock_acquire+0x79/0xe0
    [] flush_work+0x47/0x90
    [] __cancel_work_timer+0x67/0xe0
    [] cancel_work_sync+0xf/0x20
    [] ieee80211_stop_ap+0x8c/0x340 [mac80211]
    [] cfg80211_stop_ap+0x8c/0x230 [cfg80211]
    [] cfg80211_leave+0x79/0x100 [cfg80211]
    [] cfg80211_netdev_notifier_call+0xf2/0x4f0 [cfg80211]
    [] notifier_call_chain+0x59/0x130
    [] __raw_notifier_call_chain+0x1e/0x30
    [] raw_notifier_call_chain+0x1f/0x30
    [] call_netdevice_notifiers_info+0x33/0x70
    [] call_netdevice_notifiers+0x13/0x20
    [] __dev_close_many+0x34/0xb0
    [] dev_close_many+0x6e/0xc0
    [] rollback_registered_many+0xa7/0x1f0
    [] unregister_netdevice_many+0x14/0x60
    [] ieee80211_remove_interfaces+0xe9/0x170 [mac80211]
    [] ieee80211_unregister_hw+0x56/0x110 [mac80211]
    [] iwl_op_mode_mvm_stop+0x26/0xe0 [iwlmvm]
    [] _iwl_op_mode_stop+0x3a/0x70 [iwlwifi]
    [] iwl_opmode_deregister+0x6f/0x90 [iwlwifi]
    [] __exit_compat+0xd/0x19 [iwlmvm]
    [] SyS_delete_module+0x179/0x2b0
    [] sysenter_do_call+0x12/0x32

    Fixes: 687da132234f ("mac80211: implement SMPS for AP")
    Cc: [3.13]
    Reported-by: Ilan Peer
    Signed-off-by: Emmanuel Grumbach
    Signed-off-by: Johannes Berg

    Emmanuel Grumbach
     

05 Feb, 2014

1 commit

  • 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: cf6bb79ad828 ("mac80211: Use appropriate TID for sending BAR, ADDBA and DELBA frames")

    Signed-off-by: Karl Beldan
    Cc: Helmut Schaa
    Cc: Emmanuel Grumbach
    Signed-off-by: Johannes Berg

    Karl Beldan
     

07 Jan, 2014

1 commit


28 Oct, 2013

1 commit

  • When the driver requests to move to STATIC or DYNAMIC SMPS,
    we send an action frame to each associated station and
    reconfigure the channel context / driver.
    Of course, non-MIMO stations are ignored.

    The beacon isn't updated. The association response will
    include the original capabilities. Stations that associate
    while in non-OFF SMPS mode will get an action frame right
    after association to inform them about our current state.
    Note that we wait until the end of the EAPOL. Sending an
    action frame before the EAPOL is finished can be an issue
    for a few clients. Clients aren't likely to send EAPOL
    frames in MIMO anyway.

    When the SMPS configuration gets more permissive (e.g.
    STATIC -> OFF), we don't wake up stations that are asleep
    We remember that they don't know about the change and send
    the action frame when they wake up.

    When the SMPS configuration gets more restrictive (e.g.
    OFF -> STATIC), we set the TIM bit for every sleeping STA.
    uAPSD stations might send MIMO until they poll the action
    frame, but this is for a short period of time.

    Signed-off-by: Emmanuel Grumbach
    [fix vht streams loop, initialisation]
    Signed-off-by: Johannes Berg

    Emmanuel Grumbach
     

16 Jul, 2013

1 commit


13 Jun, 2013

1 commit


25 May, 2013

1 commit

  • Using separate locks in cfg80211 and mac80211 has always
    caused issues, for example having to unlock in places in
    mac80211 to call cfg80211, which even needed a framework
    to make cfg80211 calls after some functions returned etc.

    Additionally, I suspect some issues people have reported
    with the cfg80211 state getting confused could be due to
    such issues, when cfg80211 is asking mac80211 to change
    state but mac80211 is in the process of telling cfg80211
    that the state changed (in another way.)

    Signed-off-by: Johannes Berg

    Johannes Berg
     

06 Mar, 2013

2 commits

  • HT capabilites are asymmetric -- e.g. beamforming is both an
    RX and TX capability. If, for example, we support RX but not
    TX, the RX capability of the AP station is masked out (if it
    supports it). This works correctly if it's really the driver
    capability.

    If, on the other hand, the reason for not supporting TX BF
    is that it was removed by HT capability overrides then the
    wrong thing happens: the AP's TX capability will be removed
    rather than its RX capability, because the override function
    works on own capabilities, not remote ones, and doesn't take
    the asymmetry into account.

    To fix this make a copy of our own capabilities, apply the
    overrides to them (where needed) and then use that to set up
    the peer's capabilities.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • The HT overrides are intended only for the connection
    to the AP, not for any other purpose. Therefore, don't
    apply them to TDLS peers that are also stations added
    to a managed station interface.

    Signed-off-by: Johannes Berg

    Johannes Berg
     

15 Feb, 2013

4 commits

  • Instead of modifying the HT SMPS capability field
    for stations, track the SMPS mode explicitly in a
    new field in the station struct and use it in the
    drivers that care about it. This simplifies the
    code using it.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Make all the parsed IE pointers const, and propagate
    the change to all the users etc.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • Handle the operating mode notification action frame.
    When the supported streams or the bandwidth change
    let the driver and rate control algorithm know.

    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • For VHT, many more bandwidth changes are possible. As a first
    step, stop toggling the IEEE80211_HT_CAP_SUP_WIDTH_20_40 flag
    in the HT capabilities and instead introduce a bandwidth field
    indicating the currently usable bandwidth to transmit to the
    station. Of course, make all drivers use it.

    To achieve this, make ieee80211_ht_cap_ie_to_sta_ht_cap() get
    the station as an argument, rather than the new capabilities,
    so it can set up the new bandwidth field.

    If the station is a VHT station and VHT bandwidth is in use,
    also set the bandwidth accordingly.

    Doing this allows us to get rid of the supports_40mhz flag as
    the HT capabilities now reflect the true capability instead of
    the current setting.

    While at it, also fix ieee80211_ht_cap_ie_to_sta_ht_cap() to not
    ignore HT cap overrides when MCS TX isn't supported (not that it
    really happens...)

    Signed-off-by: Johannes Berg

    Johannes Berg
     

12 Feb, 2013

1 commit