Skip to contentSkip to conversation

wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port

PATCH In review Marek Vasut 3 participants 12 messages Nov 4, 2022 – Nov 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port

When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.

An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.

The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.

Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.

Fixes 0eb42586cf87 ("rsi: data packet descriptor enhancements")

---
NOTE: I am really unsure about the method of finding out the exact
place of ethernet header in the encapsulated packet and then extracting the ethertype from it. Is there maybe some sort of helper function for that purpose ?
---
V2: - Turn the duplicated code into common function
V3: - Simplify the TX EAPOL detection (Johannes)
V4: - Drop the double !!() from test
- Update commit message
V5: - Inline the rsi_is_tx_eapol() again, undoes V2 change completely
---
Cc: Amitkumar Karwar <[email protected]>
Cc: Angus Ainslie <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Martin Fuzzey <[email protected]>
Cc: Martin Kepplinger <[email protected]>
Cc: Prameela Rani Garnepudi <[email protected]>
Cc: Sebastian Krzyszkowiak <[email protected]>
Cc: Siva Rebbagondla <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/net/wireless/rsi/rsi_91x_core.c | 4 +++-
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_core.c +3 -1
index 0f3a80f66b61c..ead4d4e043280 100644
@@ -466,7 +466,9 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
 							      tid, 0);
 			}
 		}
-		if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+
+		if (IEEE80211_SKB_CB(skb)->control.flags &
+		    IEEE80211_TX_CTRL_PORT_CTRL_PROTO) {
 			q_num = MGMT_SOFT_Q;
 			skb->priority = q_num;
 		}
drivers/net/wireless/rsi/rsi_91x_hal.c +5 -1
index c61f83a7333b6..c7460fbba0142 100644
@@ -162,12 +162,16 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 	u8 header_size;
 	u8 vap_id = 0;
 	u8 dword_align_bytes;
+	bool tx_eapol;
 	u16 seq_num;
 
 	info = IEEE80211_SKB_CB(skb);
 	vif = info->control.vif;
 	tx_params = (struct skb_info *)info->driver_data;
 
+	tx_eapol = IEEE80211_SKB_CB(skb)->control.flags &
+		   IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+
 	header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
 	if (header_size > skb_headroom(skb)) {
 		rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
@@ -231,7 +235,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 		}
 	}
 
-	if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+	if (tx_eapol) {
 		rsi_dbg(INFO_ZONE, "*** Tx EAPOL ***\n");
 
 		data_desc->frame_info = cpu_to_le16(RATE_INFO_ENABLE);
Signature · 1 line
2.35.1
#1 lore raw
Quoted 27 lines · Marek Vasut

When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.

An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.

The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.

Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.

Fixes 0eb42586cf87 ("rsi: data packet descriptor enhancements")
Quoted 11 lines

---
NOTE: I am really unsure about the method of finding out the exact
place of ethernet header in the encapsulated packet and then extracting the ethertype from it. Is there maybe some sort of helper function for that purpose ?
---
V2: - Turn the duplicated code into common function
V3: - Simplify the TX EAPOL detection (Johannes)
V4: - Drop the double !!() from test
- Update commit message
V5: - Inline the rsi_is_tx_eapol() again, undoes V2 change completely

BTW did you test this on a real device?

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 41 lines · Kalle Valo
Quoted 27 lines · Marek Vasut

When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.

An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.

The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.

Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.

Fixes 0eb42586cf87 ("rsi: data packet descriptor enhancements")
Quoted 11 lines

---
NOTE: I am really unsure about the method of finding out the exact
place of ethernet header in the encapsulated packet and then extracting the ethertype from it. Is there maybe some sort of helper function for that purpose ?
---
V2: - Turn the duplicated code into common function
V3: - Simplify the TX EAPOL detection (Johannes)
V4: - Drop the double !!() from test
- Update commit message
V5: - Inline the rsi_is_tx_eapol() again, undoes V2 change completely

Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

What prompts this question ?

#3 lore raw
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#4 lore raw
Quoted 6 lines · Kalle Valo
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Quoted 7 lines

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Ah, this is a real problem right here.

wpa-supplicant 2.9 from OE dunfell 3.1 works.
wpa-supplicant 2.10 from OE kirkstone 4.0 fails.

That's how I ran into this initially. My subsequent tests were with debian wpa-supplicant 2.9 and 2.10 packages, since that was easier, they (2.10 does, 2.9 does not) trigger the problem all the same.

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it. Until I send such a patch, you can expect real fixes coming from my end at least.

#5 lore raw
Quoted 8 lines · Marek Vasut

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

Yes I've had similar problems with RSI.

It seems things have gone downhill a lot since RSI was taken over by Silabs and the people who wrote the driver initially left. The last mainline patches from anyone at Redpine / Silabs seem to date back to 2019.

But https://github.com/SiliconLabs/RS911X-nLink-OSD/blob/master/ReleaseNotes_OSD.pdf
it still says in the latest (March 2022) version
"The contents of this driver will be submitted to kernel community continuously" which does not seem to be the case.

Quoted 3 lines

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it. Until I send such a patch, you can expect real fixes coming from my end at least.

We still use it too but haven't run into the issue this patch addresses as we are still on wpa supplicant 2.9
If we run into any more problems I'll try to fix and upstream but, due to all the above, I have already recommended internally that we move to other hardware for future devices.

Martin

#6 lore raw
In reply to Marek Vasut
Quoted 33 lines · Marek Vasut
Quoted 6 lines · Kalle Valo
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Quoted 7 lines

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Ah, this is a real problem right here.

wpa-supplicant 2.9 from OE dunfell 3.1 works.
wpa-supplicant 2.10 from OE kirkstone 4.0 fails.

That's how I ran into this initially. My subsequent tests were with debian wpa-supplicant 2.9 and 2.10 packages, since that was easier, they (2.10 does, 2.9 does not) trigger the problem all the same.

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

Quoted 2 lines

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it.

That's a pity indeed. Should we at least mark the driver as orphaned in MAINTAINERS?

Or even better if you Marek would be willing to step up as the maintainer? :)

Quoted 2 lines

Until I send such a patch, you can expect real fixes coming from my end at least.

Great, thank you.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#7 lore raw
Quoted 35 lines · Kalle Valo
Quoted 33 lines · Marek Vasut
Quoted 6 lines · Kalle Valo
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Quoted 7 lines

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Ah, this is a real problem right here.

wpa-supplicant 2.9 from OE dunfell 3.1 works.
wpa-supplicant 2.10 from OE kirkstone 4.0 fails.

That's how I ran into this initially. My subsequent tests were with debian wpa-supplicant 2.9 and 2.10 packages, since that was easier, they (2.10 does, 2.9 does not) trigger the problem all the same.

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

Quoted 8 lines
Quoted 2 lines

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it.

That's a pity indeed. Should we at least mark the driver as orphaned in MAINTAINERS?

Or even better if you Marek would be willing to step up as the maintainer? :)

I think best mark it orphaned, to make it clear what the state of the driver really is.

If RSI was willing to provide documentation, or at least releases which are not 30k+/20k- single-all-in-one-commit dumps of code, or at least any help, I would consider it. But not like this.

#8 lore raw
Quoted 45 lines · Marek Vasut
Quoted 35 lines · Kalle Valo
Quoted 33 lines · Marek Vasut
Quoted 6 lines · Kalle Valo
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Quoted 7 lines

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Ah, this is a real problem right here.

wpa-supplicant 2.9 from OE dunfell 3.1 works.
wpa-supplicant 2.10 from OE kirkstone 4.0 fails.

That's how I ran into this initially. My subsequent tests were with debian wpa-supplicant 2.9 and 2.10 packages, since that was easier, they (2.10 does, 2.9 does not) trigger the problem all the same.

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

Quoted 8 lines
Quoted 2 lines

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it.

That's a pity indeed. Should we at least mark the driver as orphaned in MAINTAINERS?

Or even better if you Marek would be willing to step up as the maintainer? :)

Quoted 6 lines

I think best mark it orphaned, to make it clear what the state of the driver really is.

If RSI was willing to provide documentation, or at least releases which are not 30k+/20k- single-all-in-one-commit dumps of code, or at least any help, I would consider it. But not like this.

Yeah, very understandable. So let's mark the driver orphaned then, can someone send a patch?

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#9 lore raw
Quoted 50 lines · Kalle Valo
Quoted 48 lines · Marek Vasut
Quoted 35 lines · Kalle Valo
Quoted 33 lines · Marek Vasut
Quoted 6 lines · Kalle Valo
Quoted 3 lines · Marek Vasut
Quoted 1 line

BTW did you test this on a real device?

Yes, SDIO RS9116 on next-20221104 and 5.10.153 .

Quoted 7 lines

Very good, thanks.

Quoted 1 line

What prompts this question ?

I get too much "fixes" which have been nowhere near real hardware and can break the driver instead of fixing anything, especially syzbot patches have been notorious. So I have become cautious.

Ah, this is a real problem right here.

wpa-supplicant 2.9 from OE dunfell 3.1 works.
wpa-supplicant 2.10 from OE kirkstone 4.0 fails.

That's how I ran into this initially. My subsequent tests were with debian wpa-supplicant 2.9 and 2.10 packages, since that was easier, they (2.10 does, 2.9 does not) trigger the problem all the same.

I'm afraid this RSI driver is so poorly maintained and has so many bugs, that, there is little that can make it worse. The dealing I had with RSI has been ... long ... and very depressing. I tried to get documentation or anything which would help us fix the problems we have with this RSI driver ourselves, but RSI refused it all and suggested we instead use their downstream driver (I won't go into the quality of that). It seems RSI has little interest in maintaining the upstream driver, pity.

Quoted 8 lines
Quoted 2 lines

I've been tempted to flag this driver as BROKEN for a while, to prevent others from suffering with it.

That's a pity indeed. Should we at least mark the driver as orphaned in MAINTAINERS?

Or even better if you Marek would be willing to step up as the maintainer? :)

I think best mark it orphaned, to make it clear what the state of the driver really is.

Quoted 6 lines
Quoted 3 lines

If RSI was willing to provide documentation, or at least releases which are not 30k+/20k- single-all-in-one-commit dumps of code, or at least any help, I would consider it. But not like this.

Yeah, very understandable. So let's mark the driver orphaned then, can someone send a patch?

Done

#10 lore raw
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Kalle Valo
Quoted 11 lines · Marek Vasut
Quoted 5 lines · Kalle Valo

That's a pity indeed. Should we at least mark the driver as orphaned in MAINTAINERS?

Or even better if you Marek would be willing to step up as the maintainer? :)

I think best mark it orphaned, to make it clear what the state of the driver really is.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

If RSI was willing to provide documentation, or at least releases which are not 30k+/20k- single-all-in-one-commit dumps of code, or at least any help, I would consider it. But not like this.

Yeah, very understandable. So let's mark the driver orphaned then, can someone send a patch?

Done

Great, thank you very much.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#11 lore raw
In reply to Marek Vasut
Quoted 20 lines · Marek Vasut

When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.

An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.

The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.

Quoted 7 lines

Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.

Fixes 0eb42586cf87 ("rsi: data packet descriptor enhancements")

Patch applied to wireless-next.git, thanks.

b8f6efccbb9d wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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