All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: johannes@sipsolutions.net
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 02/16] cfg80211: Add support for notifying association comeback
Date: Mon, 29 Nov 2021 15:32:34 +0200	[thread overview]
Message-ID: <iwlwifi.20211129152938.2467809e8cb3.I45574185b582666bc78eef0c29a4c36b478e5382@changeid> (raw)
In-Reply-To: <20211129133248.83829-1-luca@coelho.fi>

From: Ilan Peer <ilan.peer@intel.com>

Thought the underline driver MLME can handle association temporal
rejection with comeback, it is still useful to notify this to
user space, as user space might want to handle the temporal
rejection differently. For example, in case the comeback time
is too long, user space can deauthenticate immediately and try
to associate with a different AP.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 include/net/cfg80211.h       | 12 ++++++++++++
 include/uapi/linux/nl80211.h |  7 +++++++
 net/wireless/nl80211.c       | 38 ++++++++++++++++++++++++++++++++++++
 net/wireless/trace.h         | 17 ++++++++++++++++
 4 files changed, 74 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 362da9f6bf39..b9b269504591 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -8269,6 +8269,18 @@ bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
 			     bool is_4addr, u8 check_swif);
 
 
+/**
+ * cfg80211_assoc_comeback - notification of association that was
+ * temporarly rejected with a comeback
+ * @netdev: network device
+ * @bss: the bss entry with which association is in progress.
+ * @timeout: timeout interval value TUs.
+ *
+ * this function may sleep. the caller must hold the corresponding wdev's mutex.
+ */
+void cfg80211_assoc_comeback(struct net_device *netdev,
+			     struct cfg80211_bss *bss, u32 timeout);
+
 /* Logging, debugging and troubleshooting/diagnostic helpers. */
 
 /* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 3e734826792f..5ab616dc363e 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1232,6 +1232,11 @@
  *	&NL80211_ATTR_FILS_NONCES - for FILS Nonces
  *		(STA Nonce 16 bytes followed by AP Nonce 16 bytes)
  *
+ * @NL80211_CMD_ASSOC_COMEBACK: notification about an association
+ *      temporal rejection with comeback. The event includes %NL80211_ATTR_MAC
+ *      to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
+ *      specify the timeout value.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1474,6 +1479,8 @@ enum nl80211_commands {
 
 	NL80211_CMD_SET_FILS_AAD,
 
+	NL80211_CMD_ASSOC_COMEBACK,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 83a1ba96e172..249109848497 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -17040,6 +17040,44 @@ static void nl80211_send_remain_on_chan_event(
 	nlmsg_free(msg);
 }
 
+void cfg80211_assoc_comeback(struct net_device *netdev,
+			     struct cfg80211_bss *bss, u32 timeout)
+{
+	struct wireless_dev *wdev = netdev->ieee80211_ptr;
+	struct wiphy *wiphy = wdev->wiphy;
+	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+	struct sk_buff *msg;
+	void *hdr;
+
+	trace_cfg80211_assoc_comeback(wdev, bss->bssid, timeout);
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (!msg)
+		return;
+
+	hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ASSOC_COMEBACK);
+	if (!hdr) {
+		nlmsg_free(msg);
+		return;
+	}
+
+	if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+	    nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
+	    nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bss->bssid) ||
+	    nla_put_u32(msg, NL80211_ATTR_TIMEOUT, timeout))
+		goto nla_put_failure;
+
+	genlmsg_end(msg, hdr);
+
+	genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
+				NL80211_MCGRP_MLME, GFP_KERNEL);
+	return;
+
+ nla_put_failure:
+	nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_assoc_comeback);
+
 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
 			       struct ieee80211_channel *chan,
 			       unsigned int duration, gfp_t gfp)
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 0b27eaa14a18..e0a80349c5b3 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3693,6 +3693,23 @@ TRACE_EVENT(rdev_set_radar_offchan,
 		  WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
 );
 
+TRACE_EVENT(cfg80211_assoc_comeback,
+	TP_PROTO(struct wireless_dev *wdev, const u8 *bssid, u32 timeout),
+	TP_ARGS(wdev, bssid, timeout),
+	TP_STRUCT__entry(
+		WDEV_ENTRY
+		MAC_ENTRY(bssid)
+		__field(u32, timeout)
+	),
+	TP_fast_assign(
+		WDEV_ASSIGN;
+		MAC_ASSIGN(bssid, bssid);
+		__entry->timeout = timeout;
+	),
+	TP_printk(WDEV_PR_FMT ", " MAC_PR_FMT ", timeout: %u TUs",
+		  WDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->timeout)
+);
+
 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH
-- 
2.33.1


  parent reply	other threads:[~2021-11-29 13:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 13:32 [PATCH 00/16] cfg80211/mac80211 patches from our internal tree 2021-11-29 Luca Coelho
2021-11-29 13:32 ` [PATCH 01/16] mac80211: add more HT/VHT/HE state logging Luca Coelho
2021-11-30  9:05   ` kernel test robot
2021-11-30  9:26   ` kernel test robot
2021-11-30  9:26     ` kernel test robot
2021-11-30 11:15   ` Luca Coelho
2021-11-30 11:16   ` [PATCH v2] " Luca Coelho
2021-11-30 15:50     ` Ben Greear
2021-11-29 13:32 ` Luca Coelho [this message]
2021-11-29 13:32 ` [PATCH 03/16] mac80211: Notify cfg80211 about association comeback Luca Coelho
2021-11-29 13:32 ` [PATCH 04/16] cfg80211: Use the HE operation IE to determine a 6GHz BSS channel Luca Coelho
2021-11-30  8:14   ` kernel test robot
2021-11-30 11:18   ` kernel test robot
2021-11-30 11:18     ` kernel test robot
2021-11-30 11:49   ` kernel test robot
2021-12-02 12:28   ` Luca Coelho
2021-12-02 12:36   ` [PATCH v2] " Luca Coelho
2021-11-29 13:32 ` [PATCH 05/16] [BUGFIX] cfg80211: check fixed size before ieee80211_he_oper_size() Luca Coelho
2021-11-29 13:32 ` [PATCH 06/16] mac80211: introduce channel switch disconnect function Luca Coelho
2021-11-29 13:32 ` [PATCH 07/16] mac80211: mark TX-during-stop for TX in in_reconfig Luca Coelho
2021-11-29 13:32 ` [PATCH 08/16] mac80211: do drv_reconfig_complete() before restarting all Luca Coelho
2021-11-29 13:32 ` [PATCH 09/16] cfg80211: Fix order of enum nl80211_band_iftype_attr documentation Luca Coelho
2021-11-29 13:32 ` [PATCH 10/16] mac80211: update channel context before station state Luca Coelho
2021-11-29 13:32 ` [PATCH 11/16] cfg80211: simplify cfg80211_chandef_valid() Luca Coelho
2021-11-29 13:32 ` [PATCH 12/16] mac80211: Remove a couple of obsolete TODO Luca Coelho
2021-11-29 13:32 ` [PATCH 13/16] mac80211: Fix the size used for building probe request Luca Coelho
2021-11-29 13:32 ` [PATCH 14/16] mac80211: fix lookup when adding AddBA extension element Luca Coelho
2021-11-29 13:32 ` [PATCH 15/16] mac80211: agg-tx: don't schedule_and_wake_txq() under sta->lock Luca Coelho
2021-11-29 13:54   ` Toke Høiland-Jørgensen
2021-11-30 11:12     ` Luca Coelho
2021-11-30 11:32       ` Toke Høiland-Jørgensen
2021-11-30 11:52         ` Johannes Berg
2021-11-30 11:56           ` Toke Høiland-Jørgensen
2021-11-30 11:57           ` Luca Coelho
2021-11-30 12:08             ` Johannes Berg
2021-12-02 13:26   ` [PATCH v2] " Luca Coelho
2021-11-29 13:32 ` [PATCH 16/16] cfg80211: Acquire wiphy mutex on regulatory work Luca Coelho
2021-12-01 13:47   ` Kalle Valo
2021-12-02 13:27     ` Luca Coelho
2021-12-02 13:28   ` [PATCH v2] " Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=iwlwifi.20211129152938.2467809e8cb3.I45574185b582666bc78eef0c29a4c36b478e5382@changeid \
    --to=luca@coelho.fi \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.