diff mbox series

[RFC,4/5] mac80211: assure that certain drivers adhere to DONT_REORDER flag

Message ID 20200724055104.105675-4-Mathy.Vanhoef@kuleuven.be (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show
Series Add radiotap flag to prevent frame reordering | expand

Commit Message

Mathy Vanhoef July 24, 2020, 5:51 a.m. UTC
Some drivers use skb->priority to determine on which queue to send
a frame. An example is mt76x2u (this was tested on an AWUS036ACM).
This means these drivers do not adhere to the DONT_REORDER flag.
To fix this, we do not set skb->priority based on the QoS TID of
injected frames when the DONT_REORDER flag is set.

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@kuleuven.be>
---
 net/mac80211/tx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 96069683f..33697c5dc 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2266,8 +2266,12 @@  netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
 						    payload[7]);
 	}
 
-	/* Initialize skb->priority for QoS frames */
-	if (ieee80211_is_data_qos(hdr->frame_control)) {
+	/* Initialize skb->priority for QoS frames. If the DONT_REORDER flag
+	 * is, stick to the default value to assure frames injected with this
+	 * flag are not reordered relative to each other.
+	 */
+	if (ieee80211_is_data_qos(hdr->frame_control) &&
+	    !(info->control.flags & IEEE80211_TX_CTRL_DONT_REORDER)) {
 		u8 *p = ieee80211_get_qos_ctl(hdr);
 		skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
 	}