Search Linux Wireless

[RFC 03/15] nl80211: alloc and free the periodic_req data

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

 



This patch adds code to allocate and deallocate the periodic request data
structure.  This structure will be passed down when making the actual scan
call and it is also used to check whether a periodic scan is still running or
not.

Signed-off-by: Luciano Coelho <luciano.coelho@xxxxxxxxx>
---
 net/wireless/nl80211.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a2293ea..0884464 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3001,6 +3001,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
 static int nl80211_start_periodic(struct sk_buff *skb,
 				  struct genl_info *info)
 {
+	struct cfg80211_periodic_request *request;
 	struct cfg80211_registered_device *rdev;
 	struct net_device *dev;
 	int err;
@@ -3018,6 +3019,22 @@ static int nl80211_start_periodic(struct sk_buff *skb,
 		goto out;
 	}
 
+	if (rdev->periodic_req) {
+		err = -EINPROGRESS;
+		goto out;
+	}
+
+	request = kzalloc(sizeof(*request), GFP_KERNEL);
+	if (!request) {
+		err = -ENOMEM;
+		goto out;
+	}
+
+	request->dev = dev;
+	request->wiphy = &rdev->wiphy;
+
+	rdev->periodic_req = request;
+
 	/* add actual calls here */
 
 	if (!err) {
@@ -3055,7 +3072,9 @@ static int nl80211_stop_periodic(struct sk_buff *skb,
 		goto out;
 	}
 
-	/* add actual calls here */
+	if (rdev->periodic_req) {
+		/* add actual calls here */
+	}
 
 	if (!err) {
 		nl80211_send_periodic(rdev, dev,
@@ -3063,6 +3082,13 @@ static int nl80211_stop_periodic(struct sk_buff *skb,
 		dev_hold(dev);
 	}
 
+	/*
+	 * FIXME: Can this stay here? How will the auto-complete and other
+	 * cleanup cases work?
+	 */
+	kfree(rdev->periodic_req);
+	rdev->periodic_req = NULL;
+
 out:
 	cfg80211_unlock_rdev(rdev);
 	dev_put(dev);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux