08 Nov, 2019

1 commit

  • 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
     

15 Sep, 2019

1 commit


11 Sep, 2019

1 commit

  • 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
     

21 Aug, 2019

1 commit

  • Report timestamp for when sta becomes associated.

    Signed-off-by: Ben Greear
    Link: https://lore.kernel.org/r/20190809180001.26393-2-greearb@candelatech.com
    [fix ktime_get_boot_ns() to ktime_get_boottime_ns(), assoc_at type to u64]
    Signed-off-by: Johannes Berg

    Ben Greear
     

26 Jul, 2019

1 commit

  • The remove_sta_debugfs callback in struct rate_control_ops is no longer
    used by any driver, as there is no need for it (the debugfs directory is
    already removed recursivly by the mac80211 core.) Because no one needs
    it, just remove it to keep anyone else from accidentally using it in the
    future.

    Cc: Johannes Berg
    Cc: "David S. Miller"
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman
    Link: https://lore.kernel.org/r/20190612142658.12792-5-gregkh@linuxfoundation.org
    Signed-off-by: Johannes Berg

    Greg Kroah-Hartman
     

22 Jun, 2019

1 commit


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
     

14 Jun, 2019

1 commit

  • Even if we have a station, we currently call rate_control_send_low()
    with the NULL station unless further rate control (driver, minstrel)
    has been initialized.

    Change this so we can use more information about the station to use
    a better rate. For example, when we associate with an AP, we will
    now use the lowest rate it advertised as supported (that we can)
    rather than the lowest mandatory rate. This aligns our behaviour
    with most other 802.11 implementations.

    To make this possible, we need to also ensure that we have non-zero
    rates at all times, so in case we really have *nothing* pre-fill
    the supp_rates bitmap with the very lowest mandatory bitmap (11b
    and 11a on 2.4 and 5 GHz respectively).

    Additionally, hostapd appears to be giving us an empty supported
    rates bitmap (it can and should do better, since the STA must have
    supported for at least the basic rates in the BSS), so ignore any
    such bitmaps that would actually zero out the supp_rates, and in
    that case just keep the pre-filled mandatory rates.

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

    Johannes Berg
     

26 Apr, 2019

1 commit

  • Add support for Extended Key ID as defined in IEEE 802.11-2016.

    - Implement the nl80211 API for Extended Key ID
    - Extend mac80211 API to allow drivers to support Extended Key ID
    - Enable Extended Key ID by default for drivers only supporting SW
    crypto (e.g. mac80211_hwsim)
    - Allow unicast Tx usage to be supressed (IEEE80211_KEY_FLAG_NO_AUTO_TX)
    - Select the decryption key based on the MPDU keyid
    - Enforce existing assumptions in the code that rekeys don't change the
    cipher

    Signed-off-by: Alexander Wetzel
    [remove module parameter]
    Signed-off-by: Johannes Berg

    Alexander Wetzel
     

08 Apr, 2019

1 commit


19 Jan, 2019

2 commits

  • This adds airtime accounting and scheduling to the mac80211 TXQ
    scheduler. A new callback, ieee80211_sta_register_airtime(), is added
    that drivers can call to report airtime usage for stations.

    When airtime information is present, mac80211 will schedule TXQs
    (through ieee80211_next_txq()) in a way that enforces airtime fairness
    between active stations. This scheduling works the same way as the ath9k
    in-driver airtime fairness scheduling. If no airtime usage is reported
    by the driver, the scheduler will default to round-robin scheduling.

    For drivers that don't control TXQ scheduling in software, a new API
    function, ieee80211_txq_may_transmit(), is added which the driver can use
    to check if the TXQ is eligible for transmission, or should be throttled to
    enforce fairness. Calls to this function must also be enclosed in
    ieee80211_txq_schedule_{start,end}() calls to ensure proper locking.

    The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
    aligned aginst driver's own round-robin scheduler list. i.e it rotates
    the TXQ list till it makes the requested node becomes the first entry
    in TXQ list. Thus both the TXQ list and driver's list are in sync.

    Co-developed-by: Rajkumar Manoharan
    Signed-off-by: Louie Lu
    [added debugfs write op to reset airtime counter]
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Rajkumar Manoharan
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     
  • This adds an API to mac80211 to handle scheduling of TXQs. The interface
    between driver and mac80211 for TXQ handling is changed by adding two new
    functions: ieee80211_next_txq(), which will return the next TXQ to schedule
    in the current round-robin rotation, and ieee80211_return_txq(), which the
    driver uses to indicate that it has finished scheduling a TXQ (which will
    then be put back in the scheduling rotation if it isn't empty).

    The driver must call ieee80211_txq_schedule_start() at the start of each
    scheduling session, and ieee80211_txq_schedule_end() at the end. The API
    then guarantees that the same TXQ is not returned twice in the same
    session (so a driver can loop on ieee80211_next_txq() without worrying
    about breaking the loop.

    Usage of the new API is optional, so drivers can be ported one at a time.
    In this patch, the actual scheduling performed by mac80211 is simple
    round-robin, but a subsequent commit adds airtime fairness awareness to the
    scheduler.

    Signed-off-by: Toke Høiland-Jørgensen
    [minor kernel-doc fix, propagate sparse locking checks out]
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     

09 Nov, 2018

2 commits


05 Sep, 2018

1 commit


29 Aug, 2018

1 commit

  • Modify the API to include all ACK frames in average ACK
    signal strength reporting, not just ACKs for data frames.
    Make exposing the data conditional on implementing the
    extended feature flag.

    This is how it was really implemented in mac80211, update
    the code there to use the new defines and clean up some of
    the setting code.

    Keep nl80211.h source compatibility by keeping the old names.

    Signed-off-by: Balaji Pothunoori
    [rewrite commit log, change compatibility to be old=new
    instead of the other way around, update kernel-doc,
    roll in mac80211 changes, make mac80211 depend on valid
    bit instead of HW flag]
    Signed-off-by: Johannes Berg

    Balaji Pothunoori
     

29 Jun, 2018

1 commit

  • The BIT macro uses unsigned long which some architectures handle as 32 bit
    and therefore might cause macro's shift to overflow when used on a value
    equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

    Since 'filled' member in station_info changed to u64, BIT_ULL macro
    should be used with all NL80211_STA_INFO_* attribute types instead of BIT
    to prevent future possible bugs when one will use BIT macro for higher
    attributes by mistake.

    This commit cleans up all usages of BIT macro with the above field
    in mac80211 by changing it to BIT_ULL instead.

    Signed-off-by: Omer Efrat
    Signed-off-by: Johannes Berg

    Omer Efrat
     

19 Jun, 2018

1 commit

  • Add support for HE in mac80211 conforming with P802.11ax_D1.4.

    Johannes: Fix another bug with the buf_size comparison in agg-rx.c.

    Signed-off-by: Liad Kaufman
    Signed-off-by: Johannes Berg
    Signed-off-by: Ilan Peer
    Signed-off-by: Ido Yariv
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Luca Coelho
     

15 Jun, 2018

1 commit


18 May, 2018

2 commits

  • This fixes memory leaks in the case where we just have the
    station info on the stack for internal usage without sending
    it to cfg80211.

    Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
    Signed-off-by: Johannes Berg

    Johannes Berg
     
  • With the addition of TXQ stats in the per-tid statistics the struct
    station_info grew significantly. This resulted in stack size warnings
    due to the structure itself being above the limit for the warnings.

    Add an allocation function that those who want to provide per-tid
    stats should use to allocate the tid array, i.e.
    struct station_info::pertid.

    Cc: Toke Høiland-Jørgensen
    Fixes: 52539ca89f36 ("cfg80211: Expose TXQ stats and parameters to userspace")
    Signed-off-by: Arend van Spriel
    [johannes: fix missing BIT() and logic by removing]
    Signed-off-by: Johannes Berg

    Arend van Spriel
     

08 May, 2018

3 commits


24 Feb, 2018

1 commit


19 Feb, 2018

3 commits


20 Nov, 2017

2 commits

  • 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
    Cc: "David S. Miller"
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Kees Cook
    [switch tid variables to u8, the valid range is 0-15 at most,
    initialize tid_tx->sta/tid properly]
    Signed-off-by: Johannes Berg

    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.

    Cc: Johannes Berg
    Cc: "David S. Miller"
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Signed-off-by: Kees Cook
    Signed-off-by: Johannes Berg

    Kees Cook
     

16 Nov, 2017

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Maintain the TCP retransmit queue using an rbtree, with 1GB
    windows at 100Gb this really has become necessary. From Eric
    Dumazet.

    2) Multi-program support for cgroup+bpf, from Alexei Starovoitov.

    3) Perform broadcast flooding in hardware in mv88e6xxx, from Andrew
    Lunn.

    4) Add meter action support to openvswitch, from Andy Zhou.

    5) Add a data meta pointer for BPF accessible packets, from Daniel
    Borkmann.

    6) Namespace-ify almost all TCP sysctl knobs, from Eric Dumazet.

    7) Turn on Broadcom Tags in b53 driver, from Florian Fainelli.

    8) More work to move the RTNL mutex down, from Florian Westphal.

    9) Add 'bpftool' utility, to help with bpf program introspection.
    From Jakub Kicinski.

    10) Add new 'cpumap' type for XDP_REDIRECT action, from Jesper
    Dangaard Brouer.

    11) Support 'blocks' of transformations in the packet scheduler which
    can span multiple network devices, from Jiri Pirko.

    12) TC flower offload support in cxgb4, from Kumar Sanghvi.

    13) Priority based stream scheduler for SCTP, from Marcelo Ricardo
    Leitner.

    14) Thunderbolt networking driver, from Amir Levy and Mika Westerberg.

    15) Add RED qdisc offloadability, and use it in mlxsw driver. From
    Nogah Frankel.

    16) eBPF based device controller for cgroup v2, from Roman Gushchin.

    17) Add some fundamental tracepoints for TCP, from Song Liu.

    18) Remove garbage collection from ipv6 route layer, this is a
    significant accomplishment. From Wei Wang.

    19) Add multicast route offload support to mlxsw, from Yotam Gigi"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2177 commits)
    tcp: highest_sack fix
    geneve: fix fill_info when link down
    bpf: fix lockdep splat
    net: cdc_ncm: GetNtbFormat endian fix
    openvswitch: meter: fix NULL pointer dereference in ovs_meter_cmd_reply_start
    netem: remove unnecessary 64 bit modulus
    netem: use 64 bit divide by rate
    tcp: Namespace-ify sysctl_tcp_default_congestion_control
    net: Protect iterations over net::fib_notifier_ops in fib_seq_sum()
    ipv6: set all.accept_dad to 0 by default
    uapi: fix linux/tls.h userspace compilation error
    usbnet: ipheth: prevent TX queue timeouts when device not ready
    vhost_net: conditionally enable tx polling
    uapi: fix linux/rxrpc.h userspace compilation errors
    net: stmmac: fix LPI transitioning for dwmac4
    atm: horizon: Fix irq release error
    net-sysfs: trigger netlink notification on ifalias change via sysfs
    openvswitch: Using kfree_rcu() to simplify the code
    openvswitch: Make local function ovs_nsh_key_attr_size() static
    openvswitch: Fix return value check in ovs_meter_cmd_features()
    ...

    Linus Torvalds
     

25 Oct, 2017

1 commit

  • …READ_ONCE()/WRITE_ONCE()

    Please do not apply this to mainline directly, instead please re-run the
    coccinelle script shown below and apply its output.

    For several reasons, it is desirable to use {READ,WRITE}_ONCE() in
    preference to ACCESS_ONCE(), and new code is expected to use one of the
    former. So far, there's been no reason to change most existing uses of
    ACCESS_ONCE(), as these aren't harmful, and changing them results in
    churn.

    However, for some features, the read/write distinction is critical to
    correct operation. To distinguish these cases, separate read/write
    accessors must be used. This patch migrates (most) remaining
    ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following
    coccinelle script:

    ----
    // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and
    // WRITE_ONCE()

    // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch

    virtual patch

    @ depends on patch @
    expression E1, E2;
    @@

    - ACCESS_ONCE(E1) = E2
    + WRITE_ONCE(E1, E2)

    @ depends on patch @
    expression E;
    @@

    - ACCESS_ONCE(E)
    + READ_ONCE(E)
    ----

    Signed-off-by: Mark Rutland <mark.rutland@arm.com>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: davem@davemloft.net
    Cc: linux-arch@vger.kernel.org
    Cc: mpe@ellerman.id.au
    Cc: shuah@kernel.org
    Cc: snitzer@redhat.com
    Cc: thor.thayer@linux.intel.com
    Cc: tj@kernel.org
    Cc: viro@zeniv.linux.org.uk
    Cc: will.deacon@arm.com
    Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Mark Rutland
     

06 Oct, 2017

1 commit

  • 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 requires adding a pointer back
    to the sta_info since container_of() can't resolve the sta_info.

    Cc: Johannes Berg
    Cc: "David S. Miller"
    Cc: linux-wireless@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: Thomas Gleixner
    Signed-off-by: Kees Cook
    Signed-off-by: Johannes Berg

    Kees Cook
     

21 Sep, 2017

1 commit

  • Sometimes a station is added already in ASSOC state. For example,
    in AP mode, when a client station didn't get assoc resp and sends
    an assoc req again. If a station is inserted when its state is ASSOC
    or higher, the min chandef and allow_p2p_go_ps should be recalculated
    again after the insertion.

    Before this patch the recalculation happened only in sta_info_move_state
    which occurs before the insertion of the sta and thus even though
    it calls ieee80211_recalc_min_chandef/_p2p_go_ps_allowed functions,
    since sdata->local->sta_list is still empty at this point, it doesn't do
    anything.

    Signed-off-by: Gregory Greenman
    Signed-off-by: Luca Coelho
    Signed-off-by: Johannes Berg

    Gregory Greenman
     

16 Jun, 2017

1 commit

  • 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
     

08 Jun, 2017

1 commit


02 Jun, 2017

1 commit

  • In the commit enabling per-CPU station statistics, I inadvertedly
    copy-pasted some code to update rx_packets and forgot to change it
    to update rx_dropped_misc. Fix that.

    This addresses https://bugzilla.kernel.org/show_bug.cgi?id=195953.

    Fixes: c9c5962b56c1 ("mac80211: enable collecting station statistics per-CPU")
    Reported-by: Petru-Florin Mihancea
    Signed-off-by: Johannes Berg

    Johannes Berg
     

17 May, 2017

1 commit

  • CoDel can be too aggressive if a station sends at a very low rate,
    leading reduced throughput. This gets worse the more stations are
    present, as each station gets more bursty the longer the round-robin
    scheduling between stations takes.

    This adds dynamic adjustment of CoDel parameters per station. It uses
    the rate selection information to estimate throughput and sets more
    lenient CoDel parameters if the estimated throughput is below a
    threshold (modified by the number of active stations).

    A new callback is added that drivers can use to notify mac80211 about
    changes in expected throughput, so the same adjustment can be made for
    cards that implement rate control in firmware. Drivers that don't use
    this will just get the default parameters.

    Signed-off-by: Toke Høiland-Jørgensen
    [remove currently unnecessary EXPORT_SYMBOL, fix kernel-doc, remove
    inline annotation]
    Signed-off-by: Johannes Berg

    Toke Høiland-Jørgensen
     

28 Apr, 2017

2 commits

  • Existing API 'ieee80211_get_sdata_band' returns default 2 GHz band even
    if the channel context configuration is NULL. This crashes for chipsets
    which support 5 Ghz alone when it tries to access members of 'sband'.
    Channel context configuration can be NULL in multivif case and when
    channel switch is in progress (or) when it fails. Fix this by replacing
    the API 'ieee80211_get_sdata_band' with 'ieee80211_get_sband' which
    returns a NULL pointer for sband when the channel configuration is NULL.

    An example scenario is as below:

    In multivif mode (AP + STA) with drivers like ath10k, when we do a
    channel switch in the AP vif (which has a number of clients connected)
    and a STA vif which is connected to some other AP, when the channel
    switch in AP vif fails, while the STA vifs tries to connect to the
    other AP, there is a window where the channel context is NULL/invalid
    and this results in a crash while the clients connected to the AP vif
    tries to reconnect and this race is very similar to the one investigated
    by Michal in https://patchwork.kernel.org/patch/3788161/ and this does
    happens with hardware that supports 5Ghz alone after long hours of
    testing with continuous channel switch on the AP vif

    ieee80211 phy0: channel context reservation cannot be finalized because
    some interfaces aren't switching
    wlan0: failed to finalize CSA, disconnecting
    wlan0-1: deauthenticating from 8c:fd:f0:01:54:9c by local choice
    (Reason: 3=DEAUTH_LEAVING)

    WARNING: CPU: 1 PID: 19032 at net/mac80211/ieee80211_i.h:1013 sta_info_alloc+0x374/0x3fc [mac80211]
    [] (sta_info_alloc [mac80211])
    [] (ieee80211_add_station [mac80211]))
    [] (nl80211_new_station [cfg80211])

    Unable to handle kernel NULL pointer dereference at virtual
    address 00000014
    pgd = d5f4c000
    Internal error: Oops: 17 [#1] PREEMPT SMP ARM
    PC is at sta_info_alloc+0x380/0x3fc [mac80211]
    LR is at sta_info_alloc+0x37c/0x3fc [mac80211]
    [] (sta_info_alloc [mac80211])
    [] (ieee80211_add_station [mac80211])
    [] (nl80211_new_station [cfg80211]))

    Cc: Michal Kazior
    Signed-off-by: Mohammed Shafi Shajakhan
    Signed-off-by: Johannes Berg

    Mohammed Shafi Shajakhan
     
  • Instead of hand-coding the bit manipulations, use the bitfield
    macros to generate the code for the encoded bitrate.

    Signed-off-by: Johannes Berg

    Johannes Berg