Skip to contentSkip to conversation

ath10k: fix bug in masking of TID value

PATCH In review Erik Stromdahl 2 participants 5 messages Jun 15, 2018 – Jun 28, 2018 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath10k: fix bug in masking of TID value

Although the TID mask is 0xf, the modulus operation does still not produce identical results as the bitwise and operator.

If the TID is 15, the modulus operation will "convert" it to 0, whereas the bitwise and will keep it as 15.

---
 drivers/net/wireless/ath/ath10k/htt_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +1 -1
index 89157c5b5e5f..be5b52aaffa6 100644
@@ -1056,7 +1056,7 @@ static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth)
 	if (!is_eth && ieee80211_is_mgmt(hdr->frame_control))
 		return HTT_DATA_TX_EXT_TID_MGMT;
 	else if (cb->flags & ATH10K_SKB_F_QOS)
-		return skb->priority % IEEE80211_QOS_CTL_TID_MASK;
+		return skb->priority & IEEE80211_QOS_CTL_TID_MASK;
 	else
 		return HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST;
 }
Signature · 1 line
2.17.0
#1 lore raw
Quoted 16 lines · Erik Stromdahl

Although the TID mask is 0xf, the modulus operation does still not produce identical results as the bitwise and operator.

If the TID is 15, the modulus operation will "convert" it to 0, whereas the bitwise and will keep it as 15.

---
 drivers/net/wireless/ath/ath10k/htt_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +0 -0
index 89157c5b5e5f..be5b52aaffa6 100644

drivers/net/wireless/ath/ath10k/htt_tx.c static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth) · line 1059

Quoted 5 lines
drivers/net/wireless/ath/ath10k/htt_tx.c +1 -1
@@ -1056,7 +1056,7 @@ static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth)
 	if (!is_eth && ieee80211_is_mgmt(hdr->frame_control))
 		return HTT_DATA_TX_EXT_TID_MGMT;
 	else if (cb->flags & ATH10K_SKB_F_QOS)
-		return skb->priority % IEEE80211_QOS_CTL_TID_MASK;
+		return skb->priority & IEEE80211_QOS_CTL_TID_MASK;

I guess you just found this during code review? If yes, I'll add that to the commit log.

Signature · 1 line
Kalle Valo
#2 lore raw

Hi Kalle,

Quoted 13 lines · Kalle Valo
Quoted 11 lines · Erik Stromdahl

Although the TID mask is 0xf, the modulus operation does still not produce identical results as the bitwise and operator.

If the TID is 15, the modulus operation will "convert" it to 0, whereas the bitwise and will keep it as 15.

---
  drivers/net/wireless/ath/ath10k/htt_tx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/net/wireless/ath/ath10k/htt_tx.c static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth) · line 1059

Quoted 10 lines
drivers/net/wireless/ath/ath10k/htt_tx.c +1 -1
index 89157c5b5e5f..be5b52aaffa6 100644
@@ -1056,7 +1056,7 @@ static u8 ath10k_htt_tx_get_tid(struct sk_buff *skb, bool is_eth)
  	if (!is_eth && ieee80211_is_mgmt(hdr->frame_control))
  		return HTT_DATA_TX_EXT_TID_MGMT;
  	else if (cb->flags & ATH10K_SKB_F_QOS)
-		return skb->priority % IEEE80211_QOS_CTL_TID_MASK;
+		return skb->priority & IEEE80211_QOS_CTL_TID_MASK;

I guess you just found this during code review? If yes, I'll add that to the commit log.

Correct, I kind of stumbled upon it while working with TX bundling for SDIO.

--
Erik

#3 lore raw
In reply to Erik Stromdahl
Quoted 9 lines · Erik Stromdahl

Although the TID mask is 0xf, the modulus operation does still not produce identical results as the bitwise and operator. If the TID is 15, the modulus operation will "convert" it to 0, whereas the bitwise and will keep it as 15.

This was found during code review.

Patch applied to ath-next branch of ath.git, thanks.

d1a566bec588 ath10k: fix bug in masking of TID value

Signature · 3 lines
https://patchwork.kernel.org/patch/10466271/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw
In reply to Erik Stromdahl
Quoted 9 lines · Erik Stromdahl

Although the TID mask is 0xf, the modulus operation does still not produce identical results as the bitwise and operator. If the TID is 15, the modulus operation will "convert" it to 0, whereas the bitwise and will keep it as 15.

This was found during code review.

Patch applied to ath-next branch of ath.git, thanks.

d1a566bec588 ath10k: fix bug in masking of TID value

Signature · 9 lines
https://patchwork.kernel.org/patch/10466271/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k