Skip to content

Commit

Permalink
mac80211: let the driver reserve extra tailroom in beacons
Browse files Browse the repository at this point in the history
Can be used to add extra IEs (such as P2P NoA) without having to
reallocate the buffer.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Felix Fietkau authored and Johannes Berg committed Dec 16, 2013
1 parent 7907c7d commit 70dabeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,9 @@ enum ieee80211_hw_flags {
* @extra_tx_headroom: headroom to reserve in each transmit skb
* for use by the driver (e.g. for transmit headers.)
*
* @extra_beacon_tailroom: tailroom to reserve in each beacon tx skb.
* Can be used by drivers to add extra IEs.
*
* @channel_change_time: time (in microseconds) it takes to change channels.
*
* @max_signal: Maximum value for signal (rssi) in RX information, used
Expand Down Expand Up @@ -1695,6 +1698,7 @@ struct ieee80211_hw {
void *priv;
u32 flags;
unsigned int extra_tx_headroom;
unsigned int extra_beacon_tailroom;
int channel_change_time;
int vif_data_size;
int sta_data_size;
Expand Down
9 changes: 6 additions & 3 deletions net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2549,7 +2549,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
*/
skb = dev_alloc_skb(local->tx_headroom +
beacon->head_len +
beacon->tail_len + 256);
beacon->tail_len + 256 +
local->hw.extra_beacon_tailroom);
if (!skb)
goto out;

Expand Down Expand Up @@ -2581,7 +2582,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
ieee80211_update_csa(sdata, presp);


skb = dev_alloc_skb(local->tx_headroom + presp->head_len);
skb = dev_alloc_skb(local->tx_headroom + presp->head_len +
local->hw.extra_beacon_tailroom);
if (!skb)
goto out;
skb_reserve(skb, local->tx_headroom);
Expand All @@ -2608,7 +2610,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
skb = dev_alloc_skb(local->tx_headroom +
bcn->head_len +
256 + /* TIM IE */
bcn->tail_len);
bcn->tail_len +
local->hw.extra_beacon_tailroom);
if (!skb)
goto out;
skb_reserve(skb, local->tx_headroom);
Expand Down

0 comments on commit 70dabeb

Please sign in to comment.