1. 22 Nov, 2019 8 commits
    • Kan Yan's avatar
      mac80211: Implement Airtime-based Queue Limit (AQL) · 3ace10f5
      Kan Yan authored
      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: default avatarKan Yan <kyan@google.com>
      [ Toke: Keep API to set pending airtime internal, fix nits in commit msg ]
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20191119060610.76681-4-kyan@google.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      3ace10f5
    • Toke Høiland-Jørgensen's avatar
      mac80211: Import airtime calculation code from mt76 · db3e1c40
      Toke Høiland-Jørgensen authored
      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: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      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: default avatarJohannes Berg <johannes.berg@intel.com>
      db3e1c40
    • Taehee Yoo's avatar
      virt_wifi: fix use-after-free in virt_wifi_newlink() · bc71d8b5
      Taehee Yoo authored
      When virt_wifi interface is created, virt_wifi_newlink() is called and
      it calls register_netdevice().
      if register_netdevice() fails, it internally would call
      ->priv_destructor(), which is virt_wifi_net_device_destructor() and
      it frees netdev. but virt_wifi_newlink() still use netdev.
      So, use-after-free would occur in virt_wifi_newlink().
      
      Test commands:
          ip link add dummy0 type dummy
          modprobe bonding
          ip link add bonding_masters link dummy0 type virt_wifi
      
      Splat looks like:
      [  202.220554] BUG: KASAN: use-after-free in virt_wifi_newlink+0x88b/0x9a0 [virt_wifi]
      [  202.221659] Read of size 8 at addr ffff888061629cb8 by task ip/852
      
      [  202.222896] CPU: 1 PID: 852 Comm: ip Not tainted 5.4.0-rc5 #3
      [  202.223765] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
      [  202.225073] Call Trace:
      [  202.225532]  dump_stack+0x7c/0xbb
      [  202.226869]  print_address_description.constprop.5+0x1be/0x360
      [  202.229362]  __kasan_report+0x12a/0x16f
      [  202.230714]  kasan_report+0xe/0x20
      [  202.232595]  virt_wifi_newlink+0x88b/0x9a0 [virt_wifi]
      [  202.233370]  __rtnl_newlink+0xb9f/0x11b0
      [  202.244909]  rtnl_newlink+0x65/0x90
      [ ... ]
      
      Cc: stable@vger.kernel.org
      Fixes: c7cdba31 ("mac80211-next: rtnetlink wifi simulation device")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Link: https://lore.kernel.org/r/20191121122645.9355-1-ap420073@gmail.com
      [trim stack dump a bit]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      bc71d8b5
    • Thomas Pedersen's avatar
      mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED · 08a5bdde
      Thomas Pedersen authored
      Commit 7b6ddeaf ("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: 7b6ddeaf ("mac80211: use QoS NDP for AP probing")
      Signed-off-by: default avatarThomas Pedersen <thomas@adapt-ip.com>
      Link: https://lore.kernel.org/r/20191119053538.25979-4-thomas@adapt-ip.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      08a5bdde
    • Thomas Pedersen's avatar
      mac80211: expose HW conf flags through debugfs · c90142a5
      Thomas Pedersen authored
      This is useful during testing to eg. check the currently
      configured HW power save state.
      Signed-off-by: default avatarThomas Pedersen <thomas@adapt-ip.com>
      Link: https://lore.kernel.org/r/20191119053538.25979-3-thomas@adapt-ip.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      c90142a5
    • Toke Høiland-Jørgensen's avatar
      mac80211: Add new sta_info getter by sta/vif addrs · 5072f73c
      Toke Høiland-Jørgensen authored
      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: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20191112130835.382062-1-toke@redhat.com
      [remove internal rcu_read_lock(), document instead]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      5072f73c
    • Johannes Berg's avatar
      mac80211: add a comment about monitor-to-dev injection · b226a826
      Johannes Berg authored
      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: default avatarJohannes Berg <johannes.berg@intel.com>
      b226a826
    • Mao Wenan's avatar
      enetc: make enetc_setup_tc_mqprio static · 13baf667
      Mao Wenan authored
      While using ARCH=mips CROSS_COMPILE=mips-linux-gnu- command to compile,
      make C=2 drivers/net/ethernet/freescale/enetc/enetc.o
      
      one warning can be found:
      drivers/net/ethernet/freescale/enetc/enetc.c:1439:5:
      warning: symbol 'enetc_setup_tc_mqprio' was not declared.
      Should it be static?
      
      This patch make symbol enetc_setup_tc_mqprio static.
      Fixes: 34c6adf1 ("enetc: Configure the Time-Aware Scheduler via tc-taprio offload")
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      13baf667
  2. 21 Nov, 2019 32 commits