mac80211: backport upstream patches for driver disconnect
authorFelix Fietkau <nbd@nbd.name>
Sun, 14 Mar 2021 23:05:42 +0000 (00:05 +0100)
committerFelix Fietkau <nbd@nbd.name>
Mon, 15 Mar 2021 13:05:43 +0000 (14:05 +0100)
Needed for an mt76 update

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch [new file with mode: 0644]
package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch [new file with mode: 0644]
package/kernel/mac80211/patches/subsys/311-net-fq_impl-drop-get_default_func-move-default-flow-.patch
package/kernel/mac80211/patches/subsys/315-mac80211-add-rx-decapsulation-offload-support.patch
package/kernel/mac80211/patches/subsys/500-mac80211_configure_antenna_gain.patch
package/network/utils/iw/patches/001-nl80211_h_sync.patch

diff --git a/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch b/package/kernel/mac80211/patches/subsys/300-cfg80211-support-immediate-reconnect-request-hint.patch
new file mode 100644 (file)
index 0000000..d3f4aa7
--- /dev/null
@@ -0,0 +1,301 @@
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Sun, 6 Dec 2020 14:54:42 +0200
+Subject: [PATCH] cfg80211: support immediate reconnect request hint
+
+There are cases where it's necessary to disconnect, but an
+immediate reconnection is desired. Support a hint to userspace
+that this is the case, by including a new attribute in the
+deauth or disassoc event.
+
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Link: https://lore.kernel.org/r/iwlwifi.20201206145305.58d33941fb9d.I0e7168c205c7949529c8e3b86f3c9b12c01a7017@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -6410,13 +6410,15 @@ void cfg80211_abandon_assoc(struct net_d
+  * @dev: network device
+  * @buf: 802.11 frame (header + body)
+  * @len: length of the frame data
++ * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
+  *
+  * This function is called whenever deauthentication has been processed in
+  * station mode. This includes both received deauthentication frames and
+  * locally generated ones. This function may sleep. The caller must hold the
+  * corresponding wdev's mutex.
+  */
+-void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
++void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
++                         bool reconnect);
+ /**
+  * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
+--- a/include/uapi/linux/nl80211.h
++++ b/include/uapi/linux/nl80211.h
+@@ -2527,6 +2527,10 @@ enum nl80211_commands {
+  *    override mask. Used with NL80211_ATTR_S1G_CAPABILITY in
+  *    NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT.
+  *
++ * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and
++ *    disassoc events to indicate that an immediate reconnect to the AP
++ *    is desired.
++ *
+  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
+  * @NL80211_ATTR_MAX: highest attribute number currently defined
+  * @__NL80211_ATTR_AFTER_LAST: internal use
+@@ -3016,6 +3020,8 @@ enum nl80211_attrs {
+       NL80211_ATTR_S1G_CAPABILITY,
+       NL80211_ATTR_S1G_CAPABILITY_MASK,
++      NL80211_ATTR_RECONNECT_REQUESTED,
++
+       /* add attributes here, update the policy in nl80211.c */
+       __NL80211_ATTR_AFTER_LAST,
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
+@@ -2729,7 +2729,7 @@ static void ieee80211_report_disconnect(
+       };
+       if (tx)
+-              cfg80211_tx_mlme_mgmt(sdata->dev, buf, len);
++              cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, false);
+       else
+               cfg80211_rx_mlme_mgmt(sdata->dev, buf, len);
+@@ -4716,7 +4716,8 @@ void ieee80211_mgd_quiesce(struct ieee80
+               if (ifmgd->auth_data)
+                       ieee80211_destroy_auth_data(sdata, false);
+               cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
+-                                    IEEE80211_DEAUTH_FRAME_LEN);
++                                    IEEE80211_DEAUTH_FRAME_LEN,
++                                    false);
+       }
+       /* This is a bit of a hack - we should find a better and more generic
+--- a/net/wireless/mlme.c
++++ b/net/wireless/mlme.c
+@@ -4,7 +4,7 @@
+  *
+  * Copyright (c) 2009, Jouni Malinen <j@w1.fi>
+  * Copyright (c) 2015         Intel Deutschland GmbH
+- * Copyright (C) 2019 Intel Corporation
++ * Copyright (C) 2019-2020 Intel Corporation
+  */
+ #include <linux/kernel.h>
+@@ -81,7 +81,8 @@ static void cfg80211_process_auth(struct
+ }
+ static void cfg80211_process_deauth(struct wireless_dev *wdev,
+-                                  const u8 *buf, size_t len)
++                                  const u8 *buf, size_t len,
++                                  bool reconnect)
+ {
+       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+       struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
+@@ -89,7 +90,7 @@ static void cfg80211_process_deauth(stru
+       u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
+       bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr);
+-      nl80211_send_deauth(rdev, wdev->netdev, buf, len, GFP_KERNEL);
++      nl80211_send_deauth(rdev, wdev->netdev, buf, len, reconnect, GFP_KERNEL);
+       if (!wdev->current_bss ||
+           !ether_addr_equal(wdev->current_bss->pub.bssid, bssid))
+@@ -100,7 +101,8 @@ static void cfg80211_process_deauth(stru
+ }
+ static void cfg80211_process_disassoc(struct wireless_dev *wdev,
+-                                    const u8 *buf, size_t len)
++                                    const u8 *buf, size_t len,
++                                    bool reconnect)
+ {
+       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
+       struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;
+@@ -108,7 +110,8 @@ static void cfg80211_process_disassoc(st
+       u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
+       bool from_ap = !ether_addr_equal(mgmt->sa, wdev->netdev->dev_addr);
+-      nl80211_send_disassoc(rdev, wdev->netdev, buf, len, GFP_KERNEL);
++      nl80211_send_disassoc(rdev, wdev->netdev, buf, len, reconnect,
++                            GFP_KERNEL);
+       if (WARN_ON(!wdev->current_bss ||
+                   !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
+@@ -133,9 +136,9 @@ void cfg80211_rx_mlme_mgmt(struct net_de
+       if (ieee80211_is_auth(mgmt->frame_control))
+               cfg80211_process_auth(wdev, buf, len);
+       else if (ieee80211_is_deauth(mgmt->frame_control))
+-              cfg80211_process_deauth(wdev, buf, len);
++              cfg80211_process_deauth(wdev, buf, len, false);
+       else if (ieee80211_is_disassoc(mgmt->frame_control))
+-              cfg80211_process_disassoc(wdev, buf, len);
++              cfg80211_process_disassoc(wdev, buf, len, false);
+ }
+ EXPORT_SYMBOL(cfg80211_rx_mlme_mgmt);
+@@ -180,22 +183,23 @@ void cfg80211_abandon_assoc(struct net_d
+ }
+ EXPORT_SYMBOL(cfg80211_abandon_assoc);
+-void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len)
++void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
++                         bool reconnect)
+ {
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+       struct ieee80211_mgmt *mgmt = (void *)buf;
+       ASSERT_WDEV_LOCK(wdev);
+-      trace_cfg80211_tx_mlme_mgmt(dev, buf, len);
++      trace_cfg80211_tx_mlme_mgmt(dev, buf, len, reconnect);
+       if (WARN_ON(len < 2))
+               return;
+       if (ieee80211_is_deauth(mgmt->frame_control))
+-              cfg80211_process_deauth(wdev, buf, len);
++              cfg80211_process_deauth(wdev, buf, len, reconnect);
+       else
+-              cfg80211_process_disassoc(wdev, buf, len);
++              cfg80211_process_disassoc(wdev, buf, len, reconnect);
+ }
+ EXPORT_SYMBOL(cfg80211_tx_mlme_mgmt);
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -732,6 +732,7 @@ static const struct nla_policy nl80211_p
+               NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
+       [NL80211_ATTR_S1G_CAPABILITY_MASK] =
+               NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
++      [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT },
+ };
+ /* policy for the key attributes */
+@@ -15899,7 +15900,7 @@ static void nl80211_send_mlme_event(stru
+                                   const u8 *buf, size_t len,
+                                   enum nl80211_commands cmd, gfp_t gfp,
+                                   int uapsd_queues, const u8 *req_ies,
+-                                  size_t req_ies_len)
++                                  size_t req_ies_len, bool reconnect)
+ {
+       struct sk_buff *msg;
+       void *hdr;
+@@ -15921,6 +15922,9 @@ static void nl80211_send_mlme_event(stru
+            nla_put(msg, NL80211_ATTR_REQ_IE, req_ies_len, req_ies)))
+               goto nla_put_failure;
++      if (reconnect && nla_put_flag(msg, NL80211_ATTR_RECONNECT_REQUESTED))
++              goto nla_put_failure;
++
+       if (uapsd_queues >= 0) {
+               struct nlattr *nla_wmm =
+                       nla_nest_start_noflag(msg, NL80211_ATTR_STA_WME);
+@@ -15949,7 +15953,8 @@ void nl80211_send_rx_auth(struct cfg8021
+                         size_t len, gfp_t gfp)
+ {
+       nl80211_send_mlme_event(rdev, netdev, buf, len,
+-                              NL80211_CMD_AUTHENTICATE, gfp, -1, NULL, 0);
++                              NL80211_CMD_AUTHENTICATE, gfp, -1, NULL, 0,
++                              false);
+ }
+ void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev,
+@@ -15959,23 +15964,25 @@ void nl80211_send_rx_assoc(struct cfg802
+ {
+       nl80211_send_mlme_event(rdev, netdev, buf, len,
+                               NL80211_CMD_ASSOCIATE, gfp, uapsd_queues,
+-                              req_ies, req_ies_len);
++                              req_ies, req_ies_len, false);
+ }
+ void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
+                        struct net_device *netdev, const u8 *buf,
+-                       size_t len, gfp_t gfp)
++                       size_t len, bool reconnect, gfp_t gfp)
+ {
+       nl80211_send_mlme_event(rdev, netdev, buf, len,
+-                              NL80211_CMD_DEAUTHENTICATE, gfp, -1, NULL, 0);
++                              NL80211_CMD_DEAUTHENTICATE, gfp, -1, NULL, 0,
++                              reconnect);
+ }
+ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
+                          struct net_device *netdev, const u8 *buf,
+-                         size_t len, gfp_t gfp)
++                         size_t len, bool reconnect, gfp_t gfp)
+ {
+       nl80211_send_mlme_event(rdev, netdev, buf, len,
+-                              NL80211_CMD_DISASSOCIATE, gfp, -1, NULL, 0);
++                              NL80211_CMD_DISASSOCIATE, gfp, -1, NULL, 0,
++                              reconnect);
+ }
+ void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev, const u8 *buf,
+@@ -16006,7 +16013,7 @@ void cfg80211_rx_unprot_mlme_mgmt(struct
+       trace_cfg80211_rx_unprot_mlme_mgmt(dev, buf, len);
+       nl80211_send_mlme_event(rdev, dev, buf, len, cmd, GFP_ATOMIC, -1,
+-                              NULL, 0);
++                              NULL, 0, false);
+ }
+ EXPORT_SYMBOL(cfg80211_rx_unprot_mlme_mgmt);
+--- a/net/wireless/nl80211.h
++++ b/net/wireless/nl80211.h
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
+ /*
+  * Portions of this file
+- * Copyright (C) 2018 Intel Corporation
++ * Copyright (C) 2018, 2020 Intel Corporation
+  */
+ #ifndef __NET_WIRELESS_NL80211_H
+ #define __NET_WIRELESS_NL80211_H
+@@ -69,10 +69,12 @@ void nl80211_send_rx_assoc(struct cfg802
+                          const u8 *req_ies, size_t req_ies_len);
+ void nl80211_send_deauth(struct cfg80211_registered_device *rdev,
+                        struct net_device *netdev,
+-                       const u8 *buf, size_t len, gfp_t gfp);
++                       const u8 *buf, size_t len,
++                       bool reconnect, gfp_t gfp);
+ void nl80211_send_disassoc(struct cfg80211_registered_device *rdev,
+                          struct net_device *netdev,
+-                         const u8 *buf, size_t len, gfp_t gfp);
++                         const u8 *buf, size_t len,
++                         bool reconnect, gfp_t gfp);
+ void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev,
+                              struct net_device *netdev,
+                              const u8 *addr, gfp_t gfp);
+--- a/net/wireless/trace.h
++++ b/net/wireless/trace.h
+@@ -2684,19 +2684,23 @@ DEFINE_EVENT(netdev_frame_event, cfg8021
+ );
+ TRACE_EVENT(cfg80211_tx_mlme_mgmt,
+-      TP_PROTO(struct net_device *netdev, const u8 *buf, int len),
+-      TP_ARGS(netdev, buf, len),
++      TP_PROTO(struct net_device *netdev, const u8 *buf, int len,
++               bool reconnect),
++      TP_ARGS(netdev, buf, len, reconnect),
+       TP_STRUCT__entry(
+               NETDEV_ENTRY
+               __dynamic_array(u8, frame, len)
++              __field(int, reconnect)
+       ),
+       TP_fast_assign(
+               NETDEV_ASSIGN;
+               memcpy(__get_dynamic_array(frame), buf, len);
++              __entry->reconnect = reconnect;
+       ),
+-      TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x",
++      TP_printk(NETDEV_PR_FMT ", ftype:0x%.2x reconnect:%d",
+                 NETDEV_PR_ARG,
+-                le16_to_cpup((__le16 *)__get_dynamic_array(frame)))
++                le16_to_cpup((__le16 *)__get_dynamic_array(frame)),
++                __entry->reconnect)
+ );
+ DECLARE_EVENT_CLASS(netdev_mac_evt,
diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-support-driver-based-disconnect-with-reconn.patch
new file mode 100644 (file)
index 0000000..8f948c1
--- /dev/null
@@ -0,0 +1,271 @@
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Sun, 6 Dec 2020 14:54:43 +0200
+Subject: [PATCH] mac80211: support driver-based disconnect with reconnect hint
+
+Support the driver indicating that a disconnection needs
+to be performed, and pass through the reconnect hint in
+this case.
+
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
+Link: https://lore.kernel.org/r/iwlwifi.20201206145305.5c8dab7a22a0.I58459fdf6968b16c90cab9c574f0f04ca22b0c79@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -5885,6 +5885,17 @@ void ieee80211_beacon_loss(struct ieee80
+ void ieee80211_connection_loss(struct ieee80211_vif *vif);
+ /**
++ * ieee80211_disconnect - request disconnection
++ *
++ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
++ * @reconnect: immediate reconnect is desired
++ *
++ * Request disconnection from the current network and, if enabled, send a
++ * hint to the higher layers that immediate reconnect is desired.
++ */
++void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect);
++
++/**
+  * ieee80211_resume_disconnect - disconnect from AP after resume
+  *
+  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -461,7 +461,9 @@ struct ieee80211_if_managed {
+       unsigned long probe_timeout;
+       int probe_send_count;
+       bool nullfunc_failed;
+-      bool connection_loss;
++      u8 connection_loss:1,
++         driver_disconnect:1,
++         reconnect:1;
+       struct cfg80211_bss *associated;
+       struct ieee80211_mgd_auth_data *auth_data;
+--- a/net/mac80211/mlme.c
++++ b/net/mac80211/mlme.c
+@@ -2720,7 +2720,7 @@ EXPORT_SYMBOL(ieee80211_ap_probereq_get)
+ static void ieee80211_report_disconnect(struct ieee80211_sub_if_data *sdata,
+                                       const u8 *buf, size_t len, bool tx,
+-                                      u16 reason)
++                                      u16 reason, bool reconnect)
+ {
+       struct ieee80211_event event = {
+               .type = MLME_EVENT,
+@@ -2729,7 +2729,7 @@ static void ieee80211_report_disconnect(
+       };
+       if (tx)
+-              cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, false);
++              cfg80211_tx_mlme_mgmt(sdata->dev, buf, len, reconnect);
+       else
+               cfg80211_rx_mlme_mgmt(sdata->dev, buf, len);
+@@ -2751,13 +2751,18 @@ static void __ieee80211_disconnect(struc
+       tx = !sdata->csa_block_tx;
+-      /* AP is probably out of range (or not reachable for another reason) so
+-       * remove the bss struct for that AP.
+-       */
+-      cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated);
++      if (!ifmgd->driver_disconnect) {
++              /*
++               * AP is probably out of range (or not reachable for another
++               * reason) so remove the bss struct for that AP.
++               */
++              cfg80211_unlink_bss(local->hw.wiphy, ifmgd->associated);
++      }
+       ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
+-                             WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
++                             ifmgd->driver_disconnect ?
++                                      WLAN_REASON_DEAUTH_LEAVING :
++                                      WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
+                              tx, frame_buf);
+       mutex_lock(&local->mtx);
+       sdata->vif.csa_active = false;
+@@ -2770,7 +2775,9 @@ static void __ieee80211_disconnect(struc
+       mutex_unlock(&local->mtx);
+       ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx,
+-                                  WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
++                                  WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
++                                  ifmgd->reconnect);
++      ifmgd->reconnect = false;
+       sdata_unlock(sdata);
+ }
+@@ -2789,6 +2796,13 @@ static void ieee80211_beacon_connection_
+               sdata_info(sdata, "Connection to AP %pM lost\n",
+                          ifmgd->bssid);
+               __ieee80211_disconnect(sdata);
++              ifmgd->connection_loss = false;
++      } else if (ifmgd->driver_disconnect) {
++              sdata_info(sdata,
++                         "Driver requested disconnection from AP %pM\n",
++                         ifmgd->bssid);
++              __ieee80211_disconnect(sdata);
++              ifmgd->driver_disconnect = false;
+       } else {
+               ieee80211_mgd_probe_ap(sdata, true);
+       }
+@@ -2827,6 +2841,21 @@ void ieee80211_connection_loss(struct ie
+ }
+ EXPORT_SYMBOL(ieee80211_connection_loss);
++void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect)
++{
++      struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
++      struct ieee80211_hw *hw = &sdata->local->hw;
++
++      trace_api_disconnect(sdata, reconnect);
++
++      if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION))
++              return;
++
++      sdata->u.mgd.driver_disconnect = true;
++      sdata->u.mgd.reconnect = reconnect;
++      ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work);
++}
++EXPORT_SYMBOL(ieee80211_disconnect);
+ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
+                                       bool assoc)
+@@ -3130,7 +3159,7 @@ static void ieee80211_rx_mgmt_deauth(str
+               ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
+               ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false,
+-                                          reason_code);
++                                          reason_code, false);
+               return;
+       }
+@@ -3179,7 +3208,8 @@ static void ieee80211_rx_mgmt_disassoc(s
+       ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
+-      ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code);
++      ieee80211_report_disconnect(sdata, (u8 *)mgmt, len, false, reason_code,
++                                  false);
+ }
+ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
+@@ -4199,7 +4229,8 @@ static void ieee80211_rx_mgmt_beacon(str
+                                      true, deauth_buf);
+               ieee80211_report_disconnect(sdata, deauth_buf,
+                                           sizeof(deauth_buf), true,
+-                                          WLAN_REASON_DEAUTH_LEAVING);
++                                          WLAN_REASON_DEAUTH_LEAVING,
++                                          false);
+               return;
+       }
+@@ -4344,7 +4375,7 @@ static void ieee80211_sta_connection_los
+                              tx, frame_buf);
+       ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true,
+-                                  reason);
++                                  reason, false);
+ }
+ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
+@@ -5431,7 +5462,8 @@ int ieee80211_mgd_auth(struct ieee80211_
+               ieee80211_report_disconnect(sdata, frame_buf,
+                                           sizeof(frame_buf), true,
+-                                          WLAN_REASON_UNSPECIFIED);
++                                          WLAN_REASON_UNSPECIFIED,
++                                          false);
+       }
+       sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid);
+@@ -5503,7 +5535,8 @@ int ieee80211_mgd_assoc(struct ieee80211
+               ieee80211_report_disconnect(sdata, frame_buf,
+                                           sizeof(frame_buf), true,
+-                                          WLAN_REASON_UNSPECIFIED);
++                                          WLAN_REASON_UNSPECIFIED,
++                                          false);
+       }
+       if (ifmgd->auth_data && !ifmgd->auth_data->done) {
+@@ -5802,7 +5835,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+               ieee80211_destroy_auth_data(sdata, false);
+               ieee80211_report_disconnect(sdata, frame_buf,
+                                           sizeof(frame_buf), true,
+-                                          req->reason_code);
++                                          req->reason_code, false);
+               return 0;
+       }
+@@ -5822,7 +5855,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+               ieee80211_destroy_assoc_data(sdata, false, true);
+               ieee80211_report_disconnect(sdata, frame_buf,
+                                           sizeof(frame_buf), true,
+-                                          req->reason_code);
++                                          req->reason_code, false);
+               return 0;
+       }
+@@ -5837,7 +5870,7 @@ int ieee80211_mgd_deauth(struct ieee8021
+                                      req->reason_code, tx, frame_buf);
+               ieee80211_report_disconnect(sdata, frame_buf,
+                                           sizeof(frame_buf), true,
+-                                          req->reason_code);
++                                          req->reason_code, false);
+               return 0;
+       }
+@@ -5870,7 +5903,7 @@ int ieee80211_mgd_disassoc(struct ieee80
+                              frame_buf);
+       ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true,
+-                                  req->reason_code);
++                                  req->reason_code, false);
+       return 0;
+ }
+--- a/net/mac80211/trace.h
++++ b/net/mac80211/trace.h
+@@ -2,7 +2,7 @@
+ /*
+ * Portions of this file
+ * Copyright(c) 2016-2017 Intel Deutschland GmbH
+-* Copyright (C) 2018 - 2019 Intel Corporation
++* Copyright (C) 2018 - 2020 Intel Corporation
+ */
+ #if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
+@@ -2086,6 +2086,27 @@ TRACE_EVENT(api_connection_loss,
+       )
+ );
++TRACE_EVENT(api_disconnect,
++      TP_PROTO(struct ieee80211_sub_if_data *sdata, bool reconnect),
++
++      TP_ARGS(sdata, reconnect),
++
++      TP_STRUCT__entry(
++              VIF_ENTRY
++              __field(int, reconnect)
++      ),
++
++      TP_fast_assign(
++              VIF_ASSIGN;
++              __entry->reconnect = reconnect;
++      ),
++
++      TP_printk(
++              VIF_PR_FMT " reconnect:%d",
++              VIF_PR_ARG, __entry->reconnect
++      )
++);
++
+ TRACE_EVENT(api_cqm_rssi_notify,
+       TP_PROTO(struct ieee80211_sub_if_data *sdata,
+                enum nl80211_cqm_rssi_threshold_event rssi_event,
index de1f1bb7f5021c7cae43993270e20d51f94ece39..f8748ef1233ff6f5019f9ab86542fd3561051a9d 100644 (file)
@@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int fq_init(struct fq *fq, int flows_cnt)
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -855,7 +855,6 @@ enum txq_info_flags {
+@@ -857,7 +857,6 @@ enum txq_info_flags {
   */
  struct txq_info {
        struct fq_tin tin;
index 02486372e968a2b716a54286a1f62c676ed8bb5f..09407f3b1d8c6f8f51c32d958ab36d68577c75d2 100644 (file)
@@ -536,7 +536,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  };
 --- a/net/mac80211/trace.h
 +++ b/net/mac80211/trace.h
-@@ -2740,7 +2740,7 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_u
+@@ -2761,7 +2761,7 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_u
        TP_ARGS(local, sdata)
  );
  
@@ -545,7 +545,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        TP_PROTO(struct ieee80211_local *local,
                 struct ieee80211_sub_if_data *sdata,
                 struct ieee80211_sta *sta, bool enabled),
-@@ -2767,6 +2767,22 @@ TRACE_EVENT(drv_sta_set_4addr,
+@@ -2788,6 +2788,22 @@ TRACE_EVENT(drv_sta_set_4addr,
        )
  );
  
index 7cd0417363c31c35d8cf52339c8c263bd1d03943..3d1bb3d6c820c45ecbb5d3af211f29abaff80e6c 100644 (file)
@@ -36,9 +36,9 @@
        u8 ps_dtim_period;
 --- a/include/uapi/linux/nl80211.h
 +++ b/include/uapi/linux/nl80211.h
-@@ -2527,6 +2527,9 @@ enum nl80211_commands {
-  *    override mask. Used with NL80211_ATTR_S1G_CAPABILITY in
-  *    NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT.
+@@ -2531,6 +2531,9 @@ enum nl80211_commands {
+  *    disassoc events to indicate that an immediate reconnect to the AP
+  *    is desired.
   *
 + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
 + *    transmit power to stay within regulatory limits. u32, dBi.
@@ -46,9 +46,9 @@
   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
   * @NL80211_ATTR_MAX: highest attribute number currently defined
   * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -3016,6 +3019,8 @@ enum nl80211_attrs {
-       NL80211_ATTR_S1G_CAPABILITY,
-       NL80211_ATTR_S1G_CAPABILITY_MASK,
+@@ -3022,6 +3025,8 @@ enum nl80211_attrs {
+       NL80211_ATTR_RECONNECT_REQUESTED,
  
 +      NL80211_ATTR_WIPHY_ANTENNA_GAIN,
 +
@@ -87,7 +87,7 @@
        CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -1401,6 +1401,7 @@ struct ieee80211_local {
+@@ -1403,6 +1403,7 @@ struct ieee80211_local {
        int dynamic_ps_forced_timeout;
  
        int user_power_level; /* in dBm, for all interfaces */
        local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
 --- a/net/wireless/nl80211.c
 +++ b/net/wireless/nl80211.c
-@@ -732,6 +732,7 @@ static const struct nla_policy nl80211_p
-               NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
+@@ -733,6 +733,7 @@ static const struct nla_policy nl80211_p
        [NL80211_ATTR_S1G_CAPABILITY_MASK] =
                NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
+       [NL80211_ATTR_RECONNECT_REQUESTED] = { .type = NLA_REJECT },
 +      [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
  };
  
  /* policy for the key attributes */
-@@ -3240,6 +3241,20 @@ static int nl80211_set_wiphy(struct sk_b
+@@ -3241,6 +3242,20 @@ static int nl80211_set_wiphy(struct sk_b
                if (result)
                        return result;
        }
index c944e02ba65bf4392e14eac7c4891702ae15baca..5aa3cd5146f1772c40cff16851c71ddb2970e3e1 100644 (file)
@@ -1,19 +1,25 @@
 --- a/nl80211.h
 +++ b/nl80211.h
-@@ -2527,6 +2527,9 @@ enum nl80211_commands {
+@@ -2527,6 +2527,13 @@ enum nl80211_commands {
   *    override mask. Used with NL80211_ATTR_S1G_CAPABILITY in
   *    NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT.
   *
++ * @NL80211_ATTR_RECONNECT_REQUESTED: flag attribute, used with deauth and
++ *    disassoc events to indicate that an immediate reconnect to the AP
++ *    is desired.
++ *
 + * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
 + *    transmit power to stay within regulatory limits. u32, dBi.
 + *
   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
   * @NL80211_ATTR_MAX: highest attribute number currently defined
   * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -3016,6 +3019,8 @@ enum nl80211_attrs {
+@@ -3016,6 +3023,10 @@ enum nl80211_attrs {
        NL80211_ATTR_S1G_CAPABILITY,
        NL80211_ATTR_S1G_CAPABILITY_MASK,
  
++      NL80211_ATTR_RECONNECT_REQUESTED,
++
 +      NL80211_ATTR_WIPHY_ANTENNA_GAIN,
 +
        /* add attributes here, update the policy in nl80211.c */