From: Wey-Yi Guy <wey-yi.w.guy@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
Johannes Berg <johannes.berg@intel.com>,
Wey-Yi Guy <wey-yi.w.guy@intel.com>
Subject: [PATCH 01/28] iwlagn: add P2P NoA to probe responses
Date: Wed, 9 Nov 2011 16:39:04 -0800 [thread overview]
Message-ID: <1320885571-19122-2-git-send-email-wey-yi.w.guy@intel.com> (raw)
In-Reply-To: <1320885571-19122-1-git-send-email-wey-yi.w.guy@intel.com>
From: Johannes Berg <johannes.berg@intel.com>
Whether to use NoA or not is entire controlled
by the uCode right now, and it also adds the
attribute to beacons. We do need to add it to
probe responses in the driver though.
Keep track of the NoA notification from the
uCode and add the data to probe responses when
such are transmitted. Use RCU to manage the
lifetime.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
drivers/net/wireless/iwlwifi/iwl-agn-rx.c | 46 +++++++++++++++++++++++++++++
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 13 ++++++++
drivers/net/wireless/iwlwifi/iwl-agn.c | 1 +
drivers/net/wireless/iwlwifi/iwl-dev.h | 8 +++++
4 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
index 5af9e62..f0d6d94 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c
@@ -1032,6 +1032,50 @@ static int iwlagn_rx_reply_rx(struct iwl_priv *priv,
return 0;
}
+static int iwlagn_rx_noa_notification(struct iwl_priv *priv,
+ struct iwl_rx_mem_buffer *rxb,
+ struct iwl_device_cmd *cmd)
+{
+ struct iwl_wipan_noa_data *new_data, *old_data;
+ struct iwl_rx_packet *pkt = rxb_addr(rxb);
+ struct iwl_wipan_noa_notification *noa_notif = (void *)pkt->u.raw;
+
+ /* no condition -- we're in softirq */
+ old_data = rcu_dereference_protected(priv->noa_data, true);
+
+ if (noa_notif->noa_active) {
+ u32 len = le16_to_cpu(noa_notif->noa_attribute.length);
+ u32 copylen = len;
+
+ /* EID, len, OUI, subtype */
+ len += 1 + 1 + 3 + 1;
+ /* P2P id, P2P length */
+ len += 1 + 2;
+ copylen += 1 + 2;
+
+ new_data = kmalloc(sizeof(*new_data) + len, GFP_ATOMIC);
+ if (new_data) {
+ new_data->length = len;
+ new_data->data[0] = WLAN_EID_VENDOR_SPECIFIC;
+ new_data->data[1] = len - 2; /* not counting EID, len */
+ new_data->data[2] = (WLAN_OUI_WFA >> 16) & 0xff;
+ new_data->data[3] = (WLAN_OUI_WFA >> 8) & 0xff;
+ new_data->data[4] = (WLAN_OUI_WFA >> 0) & 0xff;
+ new_data->data[5] = WLAN_OUI_TYPE_WFA_P2P;
+ memcpy(&new_data->data[6], &noa_notif->noa_attribute,
+ copylen);
+ }
+ } else
+ new_data = NULL;
+
+ rcu_assign_pointer(priv->noa_data, new_data);
+
+ if (old_data)
+ kfree_rcu(old_data, rcu_head);
+
+ return 0;
+}
+
/**
* iwl_setup_rx_handlers - Initialize Rx handler callbacks
*
@@ -1055,6 +1099,8 @@ void iwl_setup_rx_handlers(struct iwl_priv *priv)
handlers[BEACON_NOTIFICATION] = iwlagn_rx_beacon_notif;
handlers[REPLY_ADD_STA] = iwl_add_sta_callback;
+ handlers[REPLY_WIPAN_NOA_NOTIFICATION] = iwlagn_rx_noa_notification;
+
/*
* The same handler is used for both the REPLY to a discrete
* statistics request from the host as well as for the periodic
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 35a6b71..014b98a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -283,6 +283,19 @@ int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");
#endif
+ if (unlikely(ieee80211_is_probe_resp(fc))) {
+ struct iwl_wipan_noa_data *noa_data =
+ rcu_dereference(priv->noa_data);
+
+ if (noa_data &&
+ pskb_expand_head(skb, 0, noa_data->length,
+ GFP_ATOMIC) == 0) {
+ memcpy(skb_put(skb, noa_data->length),
+ noa_data->data, noa_data->length);
+ hdr = (struct ieee80211_hdr *)skb->data;
+ }
+ }
+
hdr_len = ieee80211_hdrlen(fc);
/* For management frames use broadcast id to do not break aggregation */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 9d463cf..b03eb99 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3069,6 +3069,7 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
kmem_cache_destroy(priv->tx_cmd_pool);
kfree(priv->scan_cmd);
kfree(priv->beacon_cmd);
+ kfree(priv->noa_data);
#ifdef CONFIG_IWLWIFI_DEBUGFS
kfree(priv->wowlan_sram);
#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 6c00a44..ef8620b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -824,6 +824,12 @@ struct iwl_testmode_trace {
};
#endif
+struct iwl_wipan_noa_data {
+ struct rcu_head rcu_head;
+ u32 length;
+ u8 data[];
+};
+
struct iwl_priv {
/*data shared among all the driver's layers */
@@ -883,6 +889,8 @@ struct iwl_priv {
/* init calibration results */
struct iwl_calib_result calib_results[IWL_CALIB_MAX];
+ struct iwl_wipan_noa_data __rcu *noa_data;
+
/* Scan related variables */
unsigned long scan_start;
unsigned long scan_start_tsf;
--
1.7.0.4
next prev parent reply other threads:[~2011-11-10 1:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 0:39 [PATCH 00/28] update for 3.3 Wey-Yi Guy
2011-11-10 0:39 ` Wey-Yi Guy [this message]
2011-11-10 8:05 ` [PATCH 01/28] iwlagn: add P2P NoA to probe responses Johannes Berg
2011-11-10 0:39 ` [PATCH 02/28] iwlwifi: Suppress noisy syslog messages when RF_KILL switch engaged Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 03/28] iwlwifi: two more SKUs for 6x05 series Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 04/28] iwlagn: check for SMPS mode Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 05/28] iwlagn: fix NULL ptr deref when reprogramming sta w/o LQ Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 06/28] iwlagn: use per-vif AC parameters Wey-Yi Guy
2011-11-10 8:05 ` Johannes Berg
2011-11-10 0:39 ` [PATCH 07/28] iwlwifi: remove un-supported SKUs Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 08/28] iwlagn: move ucode_write_complete from priv to trans structure Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 09/28] iwlagn: remove knowledge of ucode image location from upper layers Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 10/28] iwlagn: push knowledge of ucode image lower down Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 11/28] iwlagn: move ucode files out of the iwl_priv structure Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 12/28] iwlwifi: move all mac80211 related functions to one place Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 13/28] iwlagn: explicitly program P2P QoS parameters Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 14/28] iwlwifi: move more mac80211 callback function Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 15/28] iwlwifi: move hw_scan into _mac80211 file Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 16/28] iwlwifi: move station functions to mac80211 Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 17/28] iwlwifi: Move the core suspend function to iwl-agn-lib Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 18/28] iwlwifi: set "echo" host command length Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 19/28] iwlwifi: check status before send command Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 20/28] iwlwifi: fix unused label in iwl_send_cmd_sync Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 21/28] iwlagn: convert remain-on-channel duration to TU Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 22/28] iwlagn: don't always split remain-on-channel Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 23/28] iwlwifi: remove the use of the QOS debug flag Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 24/28] iwlwifi: add debug information on queue stop / wake Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 25/28] iwlwifi: fix an RCU sparse warning Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 26/28] iwlwifi: fix rate-scaling algorithm for BT combo devices Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 27/28] iwlagn: Remove dependence of iwl_priv from eeprom routines Wey-Yi Guy
2011-11-10 0:39 ` [PATCH 28/28] iwlagn: move nvm_device_type from iwl_priv to iwl_trans Wey-Yi Guy
2011-11-10 14:16 ` [PATCH 00/28] update for 3.3 Guy, Wey-Yi
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=1320885571-19122-2-git-send-email-wey-yi.w.guy@intel.com \
--to=wey-yi.w.guy@intel.com \
--cc=johannes.berg@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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 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).