Skip to contentSkip to conversation

rt2x00: do not increment sequence number while re-transmitting

PATCH In review Stanislaw Gruszka 3 participants 3 messages Mar 27, 2019 – Apr 12, 2019 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00: do not increment sequence number while re-transmitting

From: Vijayakumar Durai <[email protected]>

Currently rt2x00 devices retransmit the management frames with incremented sequence number if hardware is assigning the sequence.

This is HW bug fixed already for non-QOS data frames, but it should be fixed for management frames except beacon.

Without fix retransmitted frames have wrong SN:

AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1648, FN=0, Flags=........C Frame is not being retransmitted 1648 1 AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1649, FN=0, Flags=....R...C Frame is being retransmitted 1649 1 AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1650, FN=0, Flags=....R...C Frame is being retransmitted 1650 1

With the fix SN stays correctly the same:

88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=........C 88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=....R...C 88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=....R...C

[sgruszka: simplify code, change comments and changelog]
---
 drivers/net/wireless/ralink/rt2x00/rt2x00.h      |  1 -
 drivers/net/wireless/ralink/rt2x00/rt2x00mac.c   | 10 ----------
 drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 15 +++++++++------
 3 files changed, 9 insertions(+), 17 deletions(-)
drivers/net/wireless/ralink/rt2x00/rt2x00.h +0 -1
index 4b1744e9fb78..50b92ca92bd7 100644
@@ -673,7 +673,6 @@ enum rt2x00_state_flags {
 	CONFIG_CHANNEL_HT40,
 	CONFIG_POWERSAVING,
 	CONFIG_HT_DISABLED,
-	CONFIG_QOS_DISABLED,
 	CONFIG_MONITORING,
 
 	/*
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c +0 -10
index 2825560e2424..e8462f25d252 100644
@@ -642,19 +642,9 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
 			rt2x00dev->intf_associated--;
 
 		rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated);
-
-		clear_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags);
 	}
 
 	/*
-	 * Check for access point which do not support 802.11e . We have to
-	 * generate data frames sequence number in S/W for such AP, because
-	 * of H/W bug.
-	 */
-	if (changes & BSS_CHANGED_QOS && !bss_conf->qos)
-		set_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags);
-
-	/*
 	 * When the erp information has changed, we should perform
 	 * additional configuration steps. For all other changes we are done.
 	 */
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c +9 -6
index 92ddc19e7bf7..4834b4eb0206 100644
@@ -201,15 +201,18 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
 	if (!rt2x00_has_cap_flag(rt2x00dev, REQUIRE_SW_SEQNO)) {
 		/*
 		 * rt2800 has a H/W (or F/W) bug, device incorrectly increase
-		 * seqno on retransmited data (non-QOS) frames. To workaround
-		 * the problem let's generate seqno in software if QOS is
-		 * disabled.
+		 * seqno on retransmitted data (non-QOS) and management frames.
+		 * To workaround the problem let's generate seqno in software.
+		 * Except for beacons which are transmitted periodically by H/W
+		 * hence hardware has to assign seqno for them.
 		 */
-		if (test_bit(CONFIG_QOS_DISABLED, &rt2x00dev->flags))
-			__clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
-		else
+	    	if (ieee80211_is_beacon(hdr->frame_control)) {
+			__set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
 			/* H/W will generate sequence number */
 			return;
+		}
+
+		__clear_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
 	}
 
 	/*
Signature · 1 line
2.7.5
maintainer
#1 lore raw

Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.0.5, v4.19.32, v4.14.109, v4.9.166, v4.4.177, v3.18.137.

v5.0.5: Build OK!
v4.19.32: Build OK!
v4.14.109: Build OK!
v4.9.166: Build OK!
v4.4.177: Failed to apply! Possible dependencies:

    262c741e0825 ("rt2x00: fix monitor mode regression")

v3.18.137: Failed to apply! Possible dependencies:

    2359b5c2d950 ("staging: vt6655: replace memcpy() by ether_addr_copy() using coccinelle and pack variables")
    262c741e0825 ("rt2x00: fix monitor mode regression")
    33b1c8c13fb8 ("staging: vt6655: mac80211 conversion: add new rx functions")
    67013f2c0e58 ("staging: vt6655: mac80211 conversion add main mac80211 functions")
    81a4e959f201 ("staging: vt6655: device.h: Comments fixes")
    89cf9be6e6e1 ("staging: vt6655: mac80211 conversion: s_uFillDataHead add power saving poll")
    99b4a7e0a2a4 ("staging: vt6655: dpc.h: Replace C99 // comment by /bin /boot /dev /etc /home /initrd.img /initrd.img.old /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /snap /srv /sys /tmp /usr /var /vmlinuz /vmlinuz.old */")
    df1404650ccb ("mac80211: remove support for IFF_PROMISC")
    fee7506a121a ("staging: vt6655: mac80211 conversion: add new key functions")

How should we proceed with this patch?

--
Thanks,
Sasha

#2 lore raw
In reply to Stanislaw Gruszka
Quoted 16 lines · Stanislaw Gruszka

From: Vijayakumar Durai <[email protected]>

Currently rt2x00 devices retransmit the management frames with incremented sequence number if hardware is assigning the sequence.

This is HW bug fixed already for non-QOS data frames, but it should be fixed for management frames except beacon.

Without fix retransmitted frames have wrong SN:

AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1648, FN=0, Flags=........C Frame is not being retransmitted 1648 1 AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1649, FN=0, Flags=....R...C Frame is being retransmitted 1649 1 AlphaNet_e8:fb:36 Vivotek_52:31:51 Authentication, SN=1650, FN=0, Flags=....R...C Frame is being retransmitted 1650 1

With the fix SN stays correctly the same:

Quoted 8 lines

88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=........C 88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=....R...C 88:6a:e3:e8:f9:a2 8c:f5:a3:88:76:87 Authentication, SN=1450, FN=0, Flags=....R...C

[sgruszka: simplify code, change comments and changelog]

Patch applied to wireless-drivers.git, thanks.

746ba11f1706 rt2x00: do not increment sequence number while re-transmitting

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

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