From: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, mcgrof@do-not-panic.com,
sujith@msujith.org, johannes@sipsolutions.net,
rmanohar@qca.qualcomm.com
Subject: [PATCH 1/3] mac80211: implement ieee80211_get_vif_by_addr
Date: Sun, 24 Nov 2013 17:56:49 +0100 [thread overview]
Message-ID: <1385312211-3119-2-git-send-email-lorenzo.bianconi83@gmail.com> (raw)
In-Reply-To: <1385312211-3119-1-git-send-email-lorenzo.bianconi83@gmail.com>
ieee80211_get_vif_by_addr allows low level drivers to get a reference to
vif data structure which is not added to the driver as monitor interface.
ieee80211_get_vif_by_addr will be used in ath9k tx99 code
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
---
include/net/mac80211.h | 9 +++++++++
net/mac80211/util.c | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7ceed99..cdec60d 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4585,4 +4585,13 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct sk_buff *skb,
int band, struct ieee80211_sta **sta);
+/**
+ * ieee80211_get_vif_by_addr - get vif for given mac address
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @mac: mac address
+ *
+ */
+struct ieee80211_vif *ieee80211_get_vif_by_addr(struct ieee80211_hw *hw,
+ const u8 *mac);
+
#endif /* MAC80211_H */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 592a181..6a7a3df 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2472,3 +2472,29 @@ int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
ieee80211_tx_skb(sdata, skb);
return 0;
}
+
+/**
+ * ieee80211_get_vif_by_addr - get vif for given mac address
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @mac: mac address
+ *
+ */
+struct ieee80211_vif *ieee80211_get_vif_by_addr(struct ieee80211_hw *hw,
+ const u8 *mac)
+{
+ struct ieee80211_vif *vif = NULL;
+ struct ieee80211_local *local = hw_to_local(hw);
+ struct ieee80211_sub_if_data *sdata;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+ if (!compare_ether_addr(sdata->vif.addr, mac)) {
+ vif = &sdata->vif;
+ break;
+ }
+ }
+ rcu_read_unlock();
+
+ return vif;
+}
+EXPORT_SYMBOL(ieee80211_get_vif_by_addr);
--
1.8.3.2
next prev parent reply other threads:[~2013-11-24 16:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-24 16:56 [PATCH 0/3] ath9k: tx99 initialization fixes Lorenzo Bianconi
2013-11-24 16:56 ` Lorenzo Bianconi [this message]
2013-11-24 18:35 ` [PATCH 1/3] mac80211: implement ieee80211_get_vif_by_addr Johannes Berg
2013-11-24 18:37 ` Johannes Berg
2013-11-25 10:15 ` Lorenzo Bianconi
2013-11-24 16:56 ` [PATCH 2/3] ath9k: get tx99_vif pointer in ath9k_tx99_init Lorenzo Bianconi
2013-11-24 16:56 ` [PATCH 3/3] ath9k: fix retry chain initialization in tx99 code Lorenzo Bianconi
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=1385312211-3119-2-git-send-email-lorenzo.bianconi83@gmail.com \
--to=lorenzo.bianconi83@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mcgrof@do-not-panic.com \
--cc=rmanohar@qca.qualcomm.com \
--cc=sujith@msujith.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).