All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, QH <qiumin.hu@gmail.com>,
	Andrei Otcheretianski <andrei.otcheretianski@intel.com>,
	Etan Cohen <etancohen@google.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 10/12] mac80211: Add API to report nan function match
Date: Mon, 29 Feb 2016 15:25:11 +0200	[thread overview]
Message-ID: <1456752313-5792-11-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <1456752313-5792-1-git-send-email-emmanuel.grumbach@intel.com>

From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

Provide an API to report nan function match. Mac80211 will lookup the
corresponding cookie and report the match to cfg80211.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 include/net/mac80211.h | 14 ++++++++++++++
 net/mac80211/cfg.c     | 28 ++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d2ebefab..0fbe6b1 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5675,4 +5675,18 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
 				   enum nl80211_nan_func_term_reason reason,
 				   gfp_t gfp);
 
+/**
+ * ieee80211_nan_func_match - notify about NAN function match event.
+ *
+ * This function is used to notify mac80211 about nan function match. The
+ * cookie inside the match struct will be assigned by mac80211.
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @match: match event information
+ * @gfp: allocation flags
+ */
+void ieee80211_nan_func_match(struct ieee80211_vif *vif,
+			      struct cfg80211_nan_match_params *match,
+			      gfp_t gfp);
+
 #endif /* MAC80211_H */
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6686922..53f1122 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3563,6 +3563,34 @@ void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL(ieee80211_nan_func_terminated);
 
+void ieee80211_nan_func_match(struct ieee80211_vif *vif,
+			      struct cfg80211_nan_match_params *match,
+			      gfp_t gfp)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+	struct ieee80211_nan_func *func;
+	struct wireless_dev *wdev;
+
+	if (WARN_ON(vif->type != NL80211_IFTYPE_NAN))
+		return;
+
+	spin_lock_bh(&sdata->u.nan.func_lock);
+
+	func = ieee80211_find_nan_func(sdata, match->inst_id);
+	if (WARN_ON(!func)) {
+		spin_unlock_bh(&sdata->u.nan.func_lock);
+		return;
+	}
+	match->cookie = func->func.cookie;
+
+	spin_unlock_bh(&sdata->u.nan.func_lock);
+
+	wdev = ieee80211_vif_to_wdev(vif);
+	if (!WARN_ON_ONCE(!wdev))
+		cfg80211_nan_match(wdev, match, gfp);
+}
+EXPORT_SYMBOL(ieee80211_nan_func_match);
+
 const struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
-- 
2.5.0


  parent reply	other threads:[~2016-02-29 13:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-29 13:25 [PATCH 00/12] Add support for Neighbor Awareness Networking Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 01/12] cfg80211: add start / stop NAN commands Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 02/12] mac80211: add boilerplate code for start / stop NAN Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 03/12] cfg80211: add add_nan_func / rm_nan_func Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 04/12] cfg80211: allow the user space to change current NAN configuration Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 05/12] cfg80211: provide a function to report a match for NAN Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 06/12] cfg80211: Provide an API to report NAN function termination Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 07/12] cfg80211: add utility functions to clone and free nan_func Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 08/12] mac80211: implement nan_change_conf Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 09/12] mac80211: Implement add_nan_func and rm_nan_func Emmanuel Grumbach
2016-02-29 13:25 ` Emmanuel Grumbach [this message]
2016-02-29 13:25 ` [PATCH 11/12] iwlwifi: mvm: Add support for NAN interface type Emmanuel Grumbach
2016-02-29 13:25 ` [PATCH 12/12] cfg80211: allow to tie the NAN instance to the owner Emmanuel Grumbach

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=1456752313-5792-11-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=andrei.otcheretianski@intel.com \
    --cc=etancohen@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=qiumin.hu@gmail.com \
    /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.