Skip to contentSkip to conversation

net: lan966x: Fixes for sleep in atomic context

PATCH Applied Horatiu Vultur 2 participants 4 messages Jan 25, 2022 – Jan 26, 2022

Subsystems (3)
lore
Share & tools
lore

Horatiu Vultur

author maintainer
#0 lore raw

v2 cover net: lan966x: Fixes for sleep in atomic context

This patch series contains 2 fixes for lan966x that is sleeping in atomic context. The first patch fixes the injection of the frames while the second one fixes the updating of the MAC table.

v1->v2:
- correct the fix tag in the second patch, it was using the wrong sha.

Horatiu Vultur (2):
net: lan966x: Fix sleep in atomic context when injecting frames
net: lan966x: Fix sleep in atomic context when updating MAC table

 drivers/net/ethernet/microchip/lan966x/lan966x_mac.c  | 11 ++++++-----
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c |  6 +++---
 2 files changed, 9 insertions(+), 8 deletions(-)
Signature · 1 line
2.33.0
author maintainer
#1 lore raw

PATCH v2 1/2 net: lan966x: Fix sleep in atomic context when injecting frames

On lan966x, when injecting a frame it was polling the register QS_INJ_STATUS to see if it can continue with the injection of the frame. The problem was that it was using readx_poll_timeout which could sleep in atomic context.
This patch fixes this issue by using readx_poll_timeout_atomic.

Fixes d28d6d2e37d10d ("net: lan966x: add port module support")
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_main.c +3 -3
index 4e31239316e8..e62758bcb998 100644
@@ -183,9 +183,9 @@ static int lan966x_port_inj_ready(struct lan966x *lan966x, u8 grp)
 {
 	u32 val;
 
-	return readx_poll_timeout(lan966x_port_inj_status, lan966x, val,
-				  QS_INJ_STATUS_FIFO_RDY_GET(val) & BIT(grp),
-				  READL_SLEEP_US, READL_TIMEOUT_US);
+	return readx_poll_timeout_atomic(lan966x_port_inj_status, lan966x, val,
+					 QS_INJ_STATUS_FIFO_RDY_GET(val) & BIT(grp),
+					 READL_SLEEP_US, READL_TIMEOUT_US);
 }
 
 static int lan966x_port_ifh_xmit(struct sk_buff *skb,
Signature · 1 line
2.33.0
author maintainer
#2 lore raw

PATCH v2 2/2 net: lan966x: Fix sleep in atomic context when updating MAC table

In reply to Horatiu Vultur

The function lan966x_mac_wait_for_completion is used to poll the status of the MAC table using the function readx_poll_timeout. The problem with this function is that is called also from atomic context. Therefore update the function to use readx_poll_timeout_atomic.

Fixes e18aba8941b40b ("net: lan966x: add mactable support")
---
 drivers/net/ethernet/microchip/lan966x/lan966x_mac.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/microchip/lan966x/lan966x_mac.c +6 -5
index ca5f1177963d..ce5970bdcc6a 100644
@@ -40,11 +40,12 @@ static int lan966x_mac_wait_for_completion(struct lan966x *lan966x)
 {
 	u32 val;
 
-	return readx_poll_timeout(lan966x_mac_get_status,
-		lan966x, val,
-		(ANA_MACACCESS_MAC_TABLE_CMD_GET(val)) ==
-		MACACCESS_CMD_IDLE,
-		TABLE_UPDATE_SLEEP_US, TABLE_UPDATE_TIMEOUT_US);
+	return readx_poll_timeout_atomic(lan966x_mac_get_status,
+					 lan966x, val,
+					 (ANA_MACACCESS_MAC_TABLE_CMD_GET(val)) ==
+					 MACACCESS_CMD_IDLE,
+					 TABLE_UPDATE_SLEEP_US,
+					 TABLE_UPDATE_TIMEOUT_US);
 }
 
 static void lan966x_mac_select(struct lan966x *lan966x,
Signature · 1 line
2.33.0
#3 lore raw
In reply to Horatiu Vultur
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 25 Jan 2022 12:48:14 +0100 you wrote:

This patch series contains 2 fixes for lan966x that is sleeping in atomic context. The first patch fixes the injection of the frames while the second one fixes the updating of the MAC table.

v1->v2:
- correct the fix tag in the second patch, it was using the wrong sha.

[...]

Here is the summary with links:
- [net,v2,1/2] net: lan966x: Fix sleep in atomic context when injecting frames

    https://git.kernel.org/netdev/net/c/b6ab149654ef
  - [net,v2,2/2] net: lan966x: Fix sleep in atomic context when updating MAC table
    https://git.kernel.org/netdev/net/c/77bdaf39f3c8

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html