1. 22 Nov, 2019 12 commits
    • David S. Miller's avatar
      Merge tag 'mac80211-next-for-net-next-2019-11-22' of... · 4bbb02f1
      David S. Miller authored
      Merge tag 'mac80211-next-for-net-next-2019-11-22' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next
      
      Johannes Berg says:
      
      ====================
      The interesting new thing here is AQL, the Airtime Queue Limit
      patchset from Kan Yan (Google) and Toke Høiland-Jørgensen (Redhat).
      The effect is intended to eventually be similar to BQL, but byte
      queue limits are not useful in wifi where the actual throughput can
      vary by around 4 orders of magnitude. There are more details in the
      patches themselves.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4bbb02f1
    • Tuong Lien's avatar
      tipc: support in-order name publication events · 41b416f1
      Tuong Lien authored
      It is observed that TIPC service binding order will not be kept in the
      publication event report to user if the service is subscribed after the
      bindings.
      
      For example, services are bound by application in the following order:
      
      Server: bound port A to {18888,66,66} scope 2
      Server: bound port A to {18888,33,33} scope 2
      
      Now, if a client subscribes to the service range (e.g. {18888, 0-100}),
      it will get the 'TIPC_PUBLISHED' events in that binding order only when
      the subscription is started before the bindings.
      Otherwise, if started after the bindings, the events will arrive in the
      opposite order:
      
      Client: received event for published {18888,33,33}
      Client: received event for published {18888,66,66}
      
      For the latter case, it is clear that the bindings have existed in the
      name table already, so when reported, the events' order will follow the
      order of the rbtree binding nodes (- a node with lesser 'lower'/'upper'
      range value will be first).
      
      This is correct as we provide the tracking on a specific service status
      (available or not), not the relationship between multiple services.
      However, some users expect to see the same order of arriving events
      irrespective of when the subscription is issued. This turns out to be
      easy to fix. We now add functionality to ensure that publication events
      always are issued in the same temporal order as the corresponding
      bindings were performed.
      
      v2: replace the unnecessary macro - 'publication_after()' with inline
      function.
      v3: reuse 'time_after32()' instead of reinventing the same exact code.
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      41b416f1
    • Hoang Le's avatar
      tipc: update replicast capability for broadcast send link · ba5f6a86
      Hoang Le authored
      When setting up a cluster with non-replicast/replicast capability
      supported. This capability will be disabled for broadcast send link
      in order to be backwards compatible.
      
      However, when these non-support nodes left and be removed out the cluster.
      We don't update this capability on broadcast send link. Then, some of
      features that based on this capability will also disabling as unexpected.
      
      In this commit, we make sure the broadcast send link capabilities will
      be re-calculated as soon as a node removed/rejoined a cluster.
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarHoang Le <hoang.h.le@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ba5f6a86
    • Toke Høiland-Jørgensen's avatar
      mac80211: Use Airtime-based Queue Limits (AQL) on packet dequeue · 7a89233a
      Toke Høiland-Jørgensen authored
      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: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/r/20191119060610.76681-5-kyan@google.comSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      7a89233a
    • 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 28 commits