aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/mac80211.h14
-rw-r--r--net/mac80211/tx.c29
2 files changed, 43 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ecba8a10acf4..7ceed99a05bc 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4571,4 +4571,18 @@ void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
4571 struct cfg80211_wowlan_wakeup *wakeup, 4571 struct cfg80211_wowlan_wakeup *wakeup,
4572 gfp_t gfp); 4572 gfp_t gfp);
4573 4573
4574/**
4575 * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
4576 * @hw: pointer as obtained from ieee80211_alloc_hw()
4577 * @vif: virtual interface
4578 * @skb: frame to be sent from within the driver
4579 * @band: the band to transmit on
4580 * @sta: optional pointer to get the station to send the frame to
4581 *
4582 * Note: must be called under RCU lock
4583 */
4584bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
4585 struct ieee80211_vif *vif, struct sk_buff *skb,
4586 int band, struct ieee80211_sta **sta);
4587
4574#endif /* MAC80211_H */ 4588#endif /* MAC80211_H */
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)
1366 return 0; 1366 return 0;
1367} 1367}
1368 1368
1369bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
1370 struct ieee80211_vif *vif, struct sk_buff *skb,
1371 int band, struct ieee80211_sta **sta)
1372{
1373 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1374 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1375 struct ieee80211_tx_data tx;
1376
1377 if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP)
1378 return false;
1379
1380 info->band = band;
1381 info->control.vif = vif;
1382 info->hw_queue = vif->hw_queue[skb_get_queue_mapping(skb)];
1383
1384 if (invoke_tx_handlers(&tx))
1385 return false;
1386
1387 if (sta) {
1388 if (tx.sta)
1389 *sta = &tx.sta->sta;
1390 else
1391 *sta = NULL;
1392 }
1393
1394 return true;
1395}
1396EXPORT_SYMBOL(ieee80211_tx_prepare_skb);
1397
1369/* 1398/*
1370 * Returns false if the frame couldn't be transmitted but was queued instead. 1399 * Returns false if the frame couldn't be transmitted but was queued instead.
1371 */ 1400 */