Search Linux Wireless

[PATCH] New functionality for aborting ongoing CAC.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add NL80211_CMD_ABORT_CAC to the nl80211 interface.

Signed-off-by: Enrique Giraldo <enrique.giraldo@xxxxxxxxxx>
---
 include/net/cfg80211.h       |  2 ++
 include/uapi/linux/nl80211.h |  4 ++++
 net/mac80211/cfg.c           |  6 ++++++
 net/wireless/nl80211.c       | 23 +++++++++++++++++++++++
 net/wireless/rdev-ops.h      |  8 ++++++++
 net/wireless/trace.h         |  5 +++++
 6 files changed, 48 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8ebabc9873d1..60b60fbdce32 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2896,6 +2896,7 @@ struct cfg80211_external_auth_params {
  *	the scan/scan_done bracket too.
  * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
  *	indicate the status of the scan through cfg80211_scan_done().
+ * @abort_cac: Tell the driver to abort an ongoing cac.
  *
  * @auth: Request to authenticate with the specified peer
  *	(invoked with the wireless_dev mutex held)
@@ -3227,6 +3228,7 @@ struct cfg80211_ops {
 	int	(*scan)(struct wiphy *wiphy,
 			struct cfg80211_scan_request *request);
 	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
+	void	(*abort_cac)(struct wiphy *wiphy, struct wireless_dev *wdev);
 
 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
 			struct cfg80211_auth_request *req);
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 7acc16f34942..4ddcb93f370b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -932,6 +932,9 @@
  *	not running. The driver indicates the status of the scan through
  *	cfg80211_scan_done().
  *
+ * @NL80211_CMD_ABORT_CAC: Stop an ongoing CAC. Returns -ENOENT if a CAC
+ *	process is not running.
+ *
  * @NL80211_CMD_START_NAN: Start NAN operation, identified by its
  *	%NL80211_ATTR_WDEV interface. This interface must have been
  *	previously created with %NL80211_CMD_NEW_INTERFACE. After it
@@ -1220,6 +1223,7 @@ enum nl80211_commands {
 	NL80211_CMD_WIPHY_REG_CHANGE,
 
 	NL80211_CMD_ABORT_SCAN,
+	NL80211_CMD_ABORT_CAC,
 
 	NL80211_CMD_START_NAN,
 	NL80211_CMD_STOP_NAN,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d25da0e66da1..2036c91a6e51 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2248,6 +2248,11 @@ static void ieee80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev)
 	ieee80211_scan_cancel(wiphy_priv(wiphy));
 }
 
+static void ieee80211_abort_cac(struct wiphy *wiphy, struct wireless_dev *wdev)
+{
+	ieee80211_dfs_cac_cancel(wiphy_priv(wiphy));
+}
+
 static int
 ieee80211_sched_scan_start(struct wiphy *wiphy,
 			   struct net_device *dev,
@@ -3850,6 +3855,7 @@ const struct cfg80211_ops mac80211_config_ops = {
 	.resume = ieee80211_resume,
 	.scan = ieee80211_scan,
 	.abort_scan = ieee80211_abort_scan,
+	.abort_cac = ieee80211_abort_cac,
 	.sched_scan_start = ieee80211_sched_scan_start,
 	.sched_scan_stop = ieee80211_sched_scan_stop,
 	.auth = ieee80211_auth,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4b8ec659e797..ee80904e098a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7306,6 +7306,21 @@ static int nl80211_abort_scan(struct sk_buff *skb, struct genl_info *info)
 	return 0;
 }
 
+static int nl80211_abort_cac(struct sk_buff *skb, struct genl_info *info)
+{
+	struct cfg80211_registered_device *rdev = info->user_ptr[0];
+	struct wireless_dev *wdev = info->user_ptr[1];
+
+	if (!rdev->ops->abort_cac)
+		return -EOPNOTSUPP;
+
+	if (!wdev->cac_started)
+		return -ENOENT;
+
+	rdev_abort_cac(rdev, wdev);
+	return 0;
+}
+
 static int
 nl80211_parse_sched_scan_plans(struct wiphy *wiphy, int n_plans,
 			       struct cfg80211_sched_scan_request *request,
@@ -13344,6 +13359,14 @@ static const struct genl_ops nl80211_ops[] = {
 		.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
 				  NL80211_FLAG_NEED_RTNL,
 	},
+	{
+		.cmd = NL80211_CMD_ABORT_CAC,
+		.doit = nl80211_abort_cac,
+		.policy = nl80211_policy,
+		.flags = GENL_UNS_ADMIN_PERM,
+		.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
+				  NL80211_FLAG_NEED_RTNL,
+	},
 	{
 		.cmd = NL80211_CMD_GET_SCAN,
 		.policy = nl80211_policy,
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 364f5d67f05b..edbb11251c03 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -435,6 +435,14 @@ static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
 	trace_rdev_return_void(&rdev->wiphy);
 }
 
+static inline void rdev_abort_cac(struct cfg80211_registered_device *rdev,
+				  struct wireless_dev *wdev)
+{
+	trace_rdev_abort_cac(&rdev->wiphy, wdev);
+	rdev->ops->abort_cac(&rdev->wiphy, wdev);
+	trace_rdev_return_void(&rdev->wiphy);
+}
+
 static inline int rdev_auth(struct cfg80211_registered_device *rdev,
 			    struct net_device *dev,
 			    struct cfg80211_auth_request *req)
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 7c73510b161f..a585522c678a 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3227,6 +3227,11 @@ DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
 	TP_ARGS(wiphy, wdev)
 );
 
+DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_cac,
+	     TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
+	TP_ARGS(wiphy, wdev)
+);
+
 TRACE_EVENT(rdev_set_multicast_to_unicast,
 	TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
 		 const bool enabled),
-- 
2.18.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux