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

Commit a9566a76 authored by Vidyullatha Kanchanapally's avatar Vidyullatha Kanchanapally Committed by Gerrit - the friendly Code Review server
Browse files

cfg80211: Add support for aborting an ongoing scan



Implement new functionality for aborting an ongoing scan.

Add NL80211_CMD_ABORT_SCAN to the nl80211 interface. After
aborting the scan, driver shall provide the scan status by
calling cfg80211_scan_done().

Reviewed-by: default avatarJouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: default avatarVidyullatha Kanchanapally <vkanchan@qti.qualcomm.com>
Signed-off-by: default avatarSunil Dutt <usdutt@qti.qualcomm.com>
[change command to take wdev instead of netdev so that it
 can be used on p2p-device scans]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Git-commit: 91d3ab46730379e89e1e908c6f62fbcadb3d8f08
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Change-Id: I071841cfea5b0da72f70032d0d99b05678d3d747
CRs-fixed: 930859
[vidyullatha@codeaurora.org: backport to 3.18 - This commit includes
the changes from following commits in include/uapi/linux/nl80211.h to
enum nl80211_commands to compile for msm-3.18.
66be7d2bcd826344894be09dc385f9f805136b84:
cfg80211: add ops to query mesh proxy path table,
6e0bd6c35b021dc73a81ebd1ef79761233c48b50:
cfg80211: 802.11p OCB mode handling,
f8d7552e945d38bd8d2e9c23aebf98042ce12302:
cfg80211: add channel switch started notification,
1057d35ede5dbf7ed7842357564fb42c9b54ba50:
cfg80211: introduce TDLS channel switch commands,
b0d7aa59592b4270531de5ce65dcf18338a2d98c:
cfg80211: allow wiphy specific regdomain management.]
Signed-off-by: default avatarVidyullatha Kanchanapally <vidyullatha@codeaurora.org>
parent 866b7283
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -2193,6 +2193,8 @@ struct cfg80211_qos_map {
 *	the driver, and will be valid until passed to cfg80211_scan_done().
 *	the driver, and will be valid until passed to cfg80211_scan_done().
 *	For scan results, call cfg80211_inform_bss(); you can call this outside
 *	For scan results, call cfg80211_inform_bss(); you can call this outside
 *	the scan/scan_done bracket too.
 *	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().
 *
 *
 * @auth: Request to authenticate with the specified peer
 * @auth: Request to authenticate with the specified peer
 *	(invoked with the wireless_dev mutex held)
 *	(invoked with the wireless_dev mutex held)
@@ -2441,6 +2443,7 @@ struct cfg80211_ops {


	int	(*scan)(struct wiphy *wiphy,
	int	(*scan)(struct wiphy *wiphy,
			struct cfg80211_scan_request *request);
			struct cfg80211_scan_request *request);
	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);


	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
			struct cfg80211_auth_request *req);
			struct cfg80211_auth_request *req);
+52 −0
Original line number Original line Diff line number Diff line
@@ -645,6 +645,15 @@
 *	%NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
 *	%NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
 *	attributes determining channel width.
 *	attributes determining channel width.
 *
 *
 * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
 *      has been started on an interface, regardless of the initiator
 *      (ie. whether it was requested from a remote device or
 *      initiated on our own).  It indicates that
 *      %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
 *      after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's.  The userspace may
 *      decide to react to this indication by requesting other
 *      interfaces to change channel as well.
 *
 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
 * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
 *	its %NL80211_ATTR_WDEV identifier. It must have been created with
 *	its %NL80211_ATTR_WDEV identifier. It must have been created with
 *	%NL80211_CMD_NEW_INTERFACE previously. After it has been started, the
 *	%NL80211_CMD_NEW_INTERFACE previously. After it has been started, the
@@ -742,6 +751,35 @@
 *	before removing a station entry entirely, or before disassociating
 *	before removing a station entry entirely, or before disassociating
 *	or similar, cleanup will happen in the driver/device in this case.
 *	or similar, cleanup will happen in the driver/device in this case.
 *
 *
 * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
 *	destination %NL80211_ATTR_MAC on the interface identified by
 *	%NL80211_ATTR_IFINDEX.
 *
 * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
 *	bandwidth of a channel must be given.
 * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
 *	network is determined by the network interface.
 *
 * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
 *	identified by the %NL80211_ATTR_MAC parameter. A target channel is
 *	provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
 *	channel width/type. The target operating class is given via
 *	%NL80211_ATTR_OPER_CLASS.
 *	The driver is responsible for continually initiating channel-switching
 *	operations and returning to the base channel for communication with the
 *	AP.
 * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
 *	peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
 *	when this command completes.
 *
 * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
 *	as an event to indicate changes for devices with wiphy-specific regdom
 *	management.
 *
 * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
 *	not running. The driver indicates the status of the scan through
 *	cfg80211_scan_done().
 *
 * @NL80211_CMD_MAX: highest used command number
 * @NL80211_CMD_MAX: highest used command number
 * @__NL80211_CMD_AFTER_LAST: internal use
 * @__NL80211_CMD_AFTER_LAST: internal use
 */
 */
@@ -916,6 +954,20 @@ enum nl80211_commands {
	NL80211_CMD_ADD_TX_TS,
	NL80211_CMD_ADD_TX_TS,
	NL80211_CMD_DEL_TX_TS,
	NL80211_CMD_DEL_TX_TS,


	NL80211_CMD_GET_MPP,

	NL80211_CMD_JOIN_OCB,
	NL80211_CMD_LEAVE_OCB,

	NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,

	NL80211_CMD_TDLS_CHANNEL_SWITCH,
	NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,

	NL80211_CMD_WIPHY_REG_CHANGE,

	NL80211_CMD_ABORT_SCAN,

	/* add new commands above here */
	/* add new commands above here */


	/* used to define NL80211_CMD_MAX below */
	/* used to define NL80211_CMD_MAX below */
+26 −0
Original line number Original line Diff line number Diff line
@@ -5593,6 +5593,24 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
	return err;
	return err;
}
}


static int nl80211_abort_scan(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_scan)
		return -EOPNOTSUPP;

	if (rdev->scan_msg)
		return 0;

	if (!rdev->scan_req)
		return -ENOENT;

	rdev_abort_scan(rdev, wdev);
	return 0;
}

static int nl80211_start_sched_scan(struct sk_buff *skb,
static int nl80211_start_sched_scan(struct sk_buff *skb,
				    struct genl_info *info)
				    struct genl_info *info)
{
{
@@ -9903,6 +9921,14 @@ static const struct genl_ops nl80211_ops[] = {
		.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
		.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
				  NL80211_FLAG_NEED_RTNL,
				  NL80211_FLAG_NEED_RTNL,
	},
	},
	{
		.cmd = NL80211_CMD_ABORT_SCAN,
		.doit = nl80211_abort_scan,
		.policy = nl80211_policy,
		.flags = GENL_ADMIN_PERM,
		.internal_flags = NL80211_FLAG_NEED_WDEV_UP |
				  NL80211_FLAG_NEED_RTNL,
	},
	{
	{
		.cmd = NL80211_CMD_GET_SCAN,
		.cmd = NL80211_CMD_GET_SCAN,
		.policy = nl80211_policy,
		.policy = nl80211_policy,
+8 −0
Original line number Original line Diff line number Diff line
@@ -379,6 +379,14 @@ static inline int rdev_scan(struct cfg80211_registered_device *rdev,
	return ret;
	return ret;
}
}


static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
				   struct wireless_dev *wdev)
{
	trace_rdev_abort_scan(&rdev->wiphy, wdev);
	rdev->ops->abort_scan(&rdev->wiphy, wdev);
	trace_rdev_return_void(&rdev->wiphy);
}

static inline int rdev_auth(struct cfg80211_registered_device *rdev,
static inline int rdev_auth(struct cfg80211_registered_device *rdev,
			    struct net_device *dev,
			    struct net_device *dev,
			    struct cfg80211_auth_request *req)
			    struct cfg80211_auth_request *req)
+4 −0
Original line number Original line Diff line number Diff line
@@ -2681,6 +2681,10 @@ TRACE_EVENT(cfg80211_stop_iface,
		  WIPHY_PR_ARG, WDEV_PR_ARG)
		  WIPHY_PR_ARG, WDEV_PR_ARG)
);
);


DEFINE_EVENT(wiphy_wdev_evt, rdev_abort_scan,
	TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
	TP_ARGS(wiphy, wdev)
);
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */


#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_PATH