diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-14 18:01:00 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-10-28 15:05:27 +0100 |
commit | 06be6b149f7e406bcf16098567f5a6c9f042bced (patch) | |
tree | 997b993af20474b9e3fd78ffb62a6fbd1c6bfbd4 /net/mac80211/tx.c | |
parent | 034c6d6e675f84ef5e67445150522b2517d963c9 (diff) | |
download | blackbird-op-linux-06be6b149f7e406bcf16098567f5a6c9f042bced.tar.gz blackbird-op-linux-06be6b149f7e406bcf16098567f5a6c9f042bced.zip |
mac80211: add ieee80211_tx_prepare_skb() helper function
This can be used by a driver to prepare skbs for transmission, which were
obtained via functions such as ieee80211_probereq_get or
ieee80211_nullfunc_get.
This is useful for drivers that want to send those frames directly, but
need rate control information to be prepared first.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 4fcbf634b548..acd9b61fbc07 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -1366,6 +1366,35 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) return 0; } +bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct sk_buff *skb, + int band, struct ieee80211_sta **sta) +{ + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_tx_data tx; + + if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP) + return false; + + info->band = band; + info->control.vif = vif; + info->hw_queue = vif->hw_queue[skb_get_queue_mapping(skb)]; + + if (invoke_tx_handlers(&tx)) + return false; + + if (sta) { + if (tx.sta) + *sta = &tx.sta->sta; + else + *sta = NULL; + } + + return true; +} +EXPORT_SYMBOL(ieee80211_tx_prepare_skb); + /* * Returns false if the frame couldn't be transmitted but was queued instead. */ |