Skip to content

Commit 7351c6b

Browse files
jmberglinvjw
authored andcommitted
mac80211: request TX status where needed
Right now all frames mac80211 hands to the driver have the IEEE80211_TX_CTL_REQ_TX_STATUS flag set to request TX status. This isn't really necessary, only the injected frames need TX status (the latter for hostapd) so move setting this flag. The rate control algorithms also need TX status, but they don't require it. Also, rt2x00 uses that bit for its own purposes and seems to require it being set for all frames, but that can be fixed in rt2x00. This doesn't really change anything for any drivers but in the future drivers using hw-rate control may opt to not report TX status for frames that don't have the IEEE80211_TX_CTL_REQ_TX_STATUS flag set. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> [rt2x00 bits] Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent ad4bb6f commit 7351c6b

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

drivers/net/wireless/rt2x00/rt2x00dev.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ void rt2x00lib_txdone(struct queue_entry *entry,
205205
enum data_queue_qid qid = skb_get_queue_mapping(entry->skb);
206206
unsigned int header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
207207
u8 rate_idx, rate_flags, retry_rates;
208+
u8 skbdesc_flags = skbdesc->flags;
208209
unsigned int i;
209210
bool success;
210211

@@ -287,12 +288,12 @@ void rt2x00lib_txdone(struct queue_entry *entry,
287288
}
288289

289290
/*
290-
* Only send the status report to mac80211 when TX status was
291-
* requested by it. If this was a extra frame coming through
292-
* a mac80211 library call (RTS/CTS) then we should not send the
293-
* status report back.
291+
* Only send the status report to mac80211 when it's a frame
292+
* that originated in mac80211. If this was a extra frame coming
293+
* through a mac80211 library call (RTS/CTS) then we should not
294+
* send the status report back.
294295
*/
295-
if (tx_info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS)
296+
if (!(skbdesc_flags & SKBDESC_NOT_MAC80211))
296297
ieee80211_tx_status_irqsafe(rt2x00dev->hw, entry->skb);
297298
else
298299
dev_kfree_skb_irq(entry->skb);

drivers/net/wireless/rt2x00/rt2x00lib.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@ void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length);
162162
* rt2x00queue_write_tx_frame - Write TX frame to hardware
163163
* @queue: Queue over which the frame should be send
164164
* @skb: The skb to send
165+
* @local: frame is not from mac80211
165166
*/
166-
int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb);
167+
int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
168+
bool local);
167169

168170
/**
169171
* rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware

drivers/net/wireless/rt2x00/rt2x00mac.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
6666
rts_info = IEEE80211_SKB_CB(skb);
6767
rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_RTS_CTS;
6868
rts_info->control.rates[0].flags &= ~IEEE80211_TX_RC_USE_CTS_PROTECT;
69-
rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
7069

7170
if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
7271
rts_info->flags |= IEEE80211_TX_CTL_NO_ACK;
@@ -91,7 +90,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
9190
frag_skb->data, data_length, tx_info,
9291
(struct ieee80211_rts *)(skb->data));
9392

94-
retval = rt2x00queue_write_tx_frame(queue, skb);
93+
retval = rt2x00queue_write_tx_frame(queue, skb, true);
9594
if (retval) {
9695
dev_kfree_skb_any(skb);
9796
WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
@@ -153,7 +152,7 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
153152
goto exit_fail;
154153
}
155154

156-
if (rt2x00queue_write_tx_frame(queue, skb))
155+
if (rt2x00queue_write_tx_frame(queue, skb, false))
157156
goto exit_fail;
158157

159158
if (rt2x00queue_threshold(queue))

drivers/net/wireless/rt2x00/rt2x00queue.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
454454
rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, queue->qid);
455455
}
456456

457-
int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
457+
int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
458+
bool local)
458459
{
459460
struct ieee80211_tx_info *tx_info;
460461
struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
@@ -495,6 +496,9 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
495496
skbdesc->tx_rate_idx = rate_idx;
496497
skbdesc->tx_rate_flags = rate_flags;
497498

499+
if (local)
500+
skbdesc->flags |= SKBDESC_NOT_MAC80211;
501+
498502
/*
499503
* When hardware encryption is supported, and this frame
500504
* is to be encrypted, we should strip the IV/EIV data from

drivers/net/wireless/rt2x00/rt2x00queue.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,15 @@ enum data_queue_qid {
9494
* mac80211 but was stripped for processing by the driver.
9595
* @SKBDESC_L2_PADDED: Payload has been padded for 4-byte alignment,
9696
* the padded bytes are located between header and payload.
97+
* @SKBDESC_NOT_MAC80211: Frame didn't originate from mac80211,
98+
* don't try to pass it back.
9799
*/
98100
enum skb_frame_desc_flags {
99101
SKBDESC_DMA_MAPPED_RX = 1 << 0,
100102
SKBDESC_DMA_MAPPED_TX = 1 << 1,
101103
SKBDESC_IV_STRIPPED = 1 << 2,
102-
SKBDESC_L2_PADDED = 1 << 3
104+
SKBDESC_L2_PADDED = 1 << 3,
105+
SKBDESC_NOT_MAC80211 = 1 << 4,
103106
};
104107

105108
/**

include/net/mac80211.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct ieee80211_bss_conf {
219219
*
220220
* These flags are used with the @flags member of &ieee80211_tx_info.
221221
*
222-
* @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
222+
* @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
223223
* @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
224224
* number to this frame, taking care of not overwriting the fragment
225225
* number and increasing the sequence number only when the

net/mac80211/tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,8 +1443,6 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
14431443
msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
14441444
}
14451445

1446-
info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1447-
14481446
rcu_read_lock();
14491447

14501448
if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
@@ -1575,6 +1573,8 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
15751573

15761574
memset(info, 0, sizeof(*info));
15771575

1576+
info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1577+
15781578
/* pass the radiotap header up to xmit */
15791579
ieee80211_xmit(IEEE80211_DEV_TO_SUB_IF(dev), skb);
15801580
return NETDEV_TX_OK;

0 commit comments

Comments
 (0)