Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df935065 authored by Purushottam Kushwaha's avatar Purushottam Kushwaha Committed by Vidyullatha Kanchanapally
Browse files

cfg80211: Specify the reason for connect timeout



This enhances the connect timeout API to also carry the reason for the
timeout. These reason codes for the connect time out are represented by
enum nl80211_timeout_reason and are passed to user space through a new
attribute NL80211_ATTR_TIMEOUT_REASON (u32).

Signed-off-by: default avatarPurushottam Kushwaha <pkushwah@qti.qualcomm.com>
Signed-off-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
[keep gfp_t argument last]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>

Git-commit: 3093ebbeabcdddc9a982950052f2151df43c7aa2
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git


CRs-Fixed: 2004380
Change-Id: If25dbf99d08d6ee658782fb08bd0ac670e95584a
Signed-off-by: default avatarPurushottam Kushwaha <pkushwah@codeaurora.org>
[vidyullatha@codeaurora.org: revert commit
 31565065 to fix build issue]
Signed-off-by: default avatarVidyullatha Kanchanapally <vidyullatha@codeaurora.org>
parent 7f9676c1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -592,7 +592,8 @@ static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
			cfg80211_connect_bss(ndev, evt->bssid, wil->bss,
					     assoc_req_ie, assoc_req_ielen,
					     assoc_resp_ie, assoc_resp_ielen,
					     WLAN_STATUS_SUCCESS, GFP_KERNEL);
					     WLAN_STATUS_SUCCESS, GFP_KERNEL,
					     NL80211_TIMEOUT_UNSPECIFIED);
		}
		wil->bss = NULL;
	} else if ((wdev->iftype == NL80211_IFTYPE_AP) ||
+14 −4
Original line number Diff line number Diff line
@@ -5075,6 +5075,12 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
 *      %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
 *      the real status code for failures.
 * @gfp: allocation flags
 * @timeout_reason: reason for connection timeout. This is used when the
 *	connection fails due to a timeout instead of an explicit rejection from
 *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
 *	not known. This value is used only if @status < 0 to indicate that the
 *	failure is due to a timeout and not due to explicit rejection by the AP.
 *	This value is ignored in other cases (@status >= 0).
 *
 * It should be called by the underlying driver whenever connect() has
 * succeeded. This is similar to cfg80211_connect_result(), but with the
@@ -5084,7 +5090,8 @@ static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
void cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
			  struct cfg80211_bss *bss, const u8 *req_ie,
			  size_t req_ie_len, const u8 *resp_ie,
			  size_t resp_ie_len, int status, gfp_t gfp);
			  size_t resp_ie_len, int status, gfp_t gfp,
			  enum nl80211_timeout_reason timeout_reason);

/**
 * cfg80211_connect_result - notify cfg80211 of connection result
@@ -5110,7 +5117,8 @@ cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
			u16 status, gfp_t gfp)
{
	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
			     resp_ie_len, status, gfp);
			     resp_ie_len, status, gfp,
			     NL80211_TIMEOUT_UNSPECIFIED);
}

/**
@@ -5121,6 +5129,7 @@ cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
 * @req_ie: association request IEs (maybe be %NULL)
 * @req_ie_len: association request IEs length
 * @gfp: allocation flags
 * @timeout_reason: reason for connection timeout.
 *
 * It should be called by the underlying driver whenever connect() has failed
 * in a sequence where no explicit authentication/association rejection was
@@ -5130,10 +5139,11 @@ cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
 */
static inline void
cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp)
			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
			 enum nl80211_timeout_reason timeout_reason)
{
	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
			     gfp);
			     gfp, timeout_reason);
}

/**
+21 −0
Original line number Diff line number Diff line
@@ -1994,6 +1994,10 @@ enum nl80211_commands {
 *	better BSSs. The attribute value is a packed structure
 *	value as specified by &struct nl80211_bss_select_rssi_adjust.
 *
 * @NL80211_ATTR_TIMEOUT_REASON: The reason for which an operation timed out.
 *	u32 attribute with an &enum nl80211_timeout_reason value. This is used,
 *	e.g., with %NL80211_CMD_CONNECT event.
 *
 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
 * @NL80211_ATTR_MAX: highest attribute number currently defined
 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2403,6 +2407,8 @@ enum nl80211_attrs {
	NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI,
	NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST,

	NL80211_ATTR_TIMEOUT_REASON,

	/* add attributes here, update the policy in nl80211.c */

	__NL80211_ATTR_AFTER_LAST,
@@ -4786,6 +4792,21 @@ enum nl80211_connect_failed_reason {
	NL80211_CONN_FAIL_BLOCKED_CLIENT,
};

/**
 * enum nl80211_timeout_reason - timeout reasons
 *
 * @NL80211_TIMEOUT_UNSPECIFIED: Timeout reason unspecified.
 * @NL80211_TIMEOUT_SCAN: Scan (AP discovery) timed out.
 * @NL80211_TIMEOUT_AUTH: Authentication timed out.
 * @NL80211_TIMEOUT_ASSOC: Association timed out.
 */
enum nl80211_timeout_reason {
	NL80211_TIMEOUT_UNSPECIFIED,
	NL80211_TIMEOUT_SCAN,
	NL80211_TIMEOUT_AUTH,
	NL80211_TIMEOUT_ASSOC,
};

/**
 * enum nl80211_scan_flags -  scan request control flags
 *
+3 −1
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ struct cfg80211_event {
			size_t resp_ie_len;
			struct cfg80211_bss *bss;
			int status; /* -1 = failed; 0..65535 = status code */
			enum nl80211_timeout_reason timeout_reason;
		} cr;
		struct {
			const u8 *req_ie;
@@ -388,7 +389,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
			       const u8 *req_ie, size_t req_ie_len,
			       const u8 *resp_ie, size_t resp_ie_len,
			       int status, bool wextev,
			       struct cfg80211_bss *bss);
			       struct cfg80211_bss *bss,
			       enum nl80211_timeout_reason timeout_reason);
void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
			     size_t ie_len, u16 reason, bool from_ap);
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
+2 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,
	/* update current_bss etc., consumes the bss reference */
	__cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs,
				  status_code,
				  status_code == WLAN_STATUS_SUCCESS, bss);
				  status_code == WLAN_STATUS_SUCCESS, bss,
				  NL80211_TIMEOUT_UNSPECIFIED);
}
EXPORT_SYMBOL(cfg80211_rx_assoc_resp);

Loading