diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-11-09 11:50:11 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-11-19 12:44:43 -0500 |
commit | 7528ec57760b942c9b74d2c6931a4a5b88f0eeff (patch) | |
tree | ee4d7d9db3393669cf0c3daf01d092d15e945981 /net/mac80211 | |
parent | 4c9451ed94087abf0e45835f133e0fa44b809f96 (diff) |
mac80211: add function to create data frame template including key
For some TDLS channel switch implementations data frames need to be
sent by the firmware based on a template. This template should be
created by mac80211, and thus needs to properly be built from an
802.3 frame into an 802.11 frame. In addition, the device will need
the key information so the select_key handler needs to be run.
However, the driver/device will be responsible for all of the crypto
encapsulation, as the sequence numbers etc. cannot be built by the
host anyway in this case since it's a template to be used multiple
times.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
-rw-r--r-- | net/mac80211/tx.c | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 00cda1ea15f9..53eb41fad033 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1634,6 +1634,9 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1634 | u32 info_flags); | 1634 | u32 info_flags); |
1635 | void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, | 1635 | void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, |
1636 | struct sk_buff_head *skbs); | 1636 | struct sk_buff_head *skbs); |
1637 | struct sk_buff * | ||
1638 | ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, | ||
1639 | struct sk_buff *skb, u32 info_flags); | ||
1637 | 1640 | ||
1638 | /* HT */ | 1641 | /* HT */ |
1639 | void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, | 1642 | void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 55d69fda4c6a..2dd89670e1cd 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2277,6 +2277,37 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2277 | return NETDEV_TX_OK; | 2277 | return NETDEV_TX_OK; |
2278 | } | 2278 | } |
2279 | 2279 | ||
2280 | struct sk_buff * | ||
2281 | ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, | ||
2282 | struct sk_buff *skb, u32 info_flags) | ||
2283 | { | ||
2284 | struct ieee80211_hdr *hdr; | ||
2285 | struct ieee80211_tx_data tx = { | ||
2286 | .local = sdata->local, | ||
2287 | .sdata = sdata, | ||
2288 | }; | ||
2289 | |||
2290 | rcu_read_lock(); | ||
2291 | |||
2292 | skb = ieee80211_build_hdr(sdata, skb, info_flags); | ||
2293 | if (IS_ERR(skb)) | ||
2294 | goto out; | ||
2295 | |||
2296 | hdr = (void *)skb->data; | ||
2297 | tx.sta = sta_info_get(sdata, hdr->addr1); | ||
2298 | tx.skb = skb; | ||
2299 | |||
2300 | if (ieee80211_tx_h_select_key(&tx) != TX_CONTINUE) { | ||
2301 | rcu_read_unlock(); | ||
2302 | kfree_skb(skb); | ||
2303 | return ERR_PTR(-EINVAL); | ||
2304 | } | ||
2305 | |||
2306 | out: | ||
2307 | rcu_read_unlock(); | ||
2308 | return skb; | ||
2309 | } | ||
2310 | |||
2280 | /* | 2311 | /* |
2281 | * ieee80211_clear_tx_pending may not be called in a context where | 2312 | * ieee80211_clear_tx_pending may not be called in a context where |
2282 | * it is possible that it packets could come in again. | 2313 | * it is possible that it packets could come in again. |