All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context
@ 2022-01-25 11:48 Horatiu Vultur
  2022-01-25 11:48 ` [PATCH net v2 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-01-25 11:48 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: UNGLinuxDriver, davem, kuba, f.fainelli, vivien.didelot,
	vladimir.oltean, andrew, Horatiu Vultur

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(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net v2 1/2] net: lan966x: Fix sleep in atomic context when injecting frames
  2022-01-25 11:48 [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
@ 2022-01-25 11:48 ` Horatiu Vultur
  2022-01-25 11:48 ` [PATCH net v2 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table Horatiu Vultur
  2022-01-26 15:50 ` [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-01-25 11:48 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: UNGLinuxDriver, davem, kuba, f.fainelli, vivien.didelot,
	vladimir.oltean, andrew, Horatiu Vultur

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")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 4e31239316e8..e62758bcb998 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -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,
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net v2 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table
  2022-01-25 11:48 [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
  2022-01-25 11:48 ` [PATCH net v2 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
@ 2022-01-25 11:48 ` Horatiu Vultur
  2022-01-26 15:50 ` [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Horatiu Vultur @ 2022-01-25 11:48 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: UNGLinuxDriver, davem, kuba, f.fainelli, vivien.didelot,
	vladimir.oltean, andrew, 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")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_mac.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c b/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
index ca5f1177963d..ce5970bdcc6a 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_mac.c
@@ -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,
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context
  2022-01-25 11:48 [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
  2022-01-25 11:48 ` [PATCH net v2 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
  2022-01-25 11:48 ` [PATCH net v2 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table Horatiu Vultur
@ 2022-01-26 15:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-26 15:50 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: netdev, linux-kernel, UNGLinuxDriver, davem, kuba, f.fainelli,
	vivien.didelot, vladimir.oltean, andrew

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-26 15:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 11:48 [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
2022-01-25 11:48 ` [PATCH net v2 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
2022-01-25 11:48 ` [PATCH net v2 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table Horatiu Vultur
2022-01-26 15:50 ` [PATCH net v2 0/2] net: lan966x: Fixes for sleep in atomic context patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.