All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: lan966x: Fixes for sleep in atomic context
@ 2022-01-25  9:30 Horatiu Vultur
  2022-01-25  9:30 ` [PATCH net 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
  2022-01-25  9:30 ` [PATCH net 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table Horatiu Vultur
  0 siblings, 2 replies; 3+ messages in thread
From: Horatiu Vultur @ 2022-01-25  9:30 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.

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] 3+ messages in thread

* [PATCH net 1/2] net: lan966x: Fix sleep in atomic context when injecting frames
  2022-01-25  9:30 [PATCH net 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
@ 2022-01-25  9:30 ` Horatiu Vultur
  2022-01-25  9:30 ` [PATCH net 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table Horatiu Vultur
  1 sibling, 0 replies; 3+ messages in thread
From: Horatiu Vultur @ 2022-01-25  9:30 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 0835be02f62b..42461af80ecb 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] 3+ messages in thread

* [PATCH net 2/2] net: lan966x: Fix sleep in atomic context when updating MAC table
  2022-01-25  9:30 [PATCH net 0/2] net: lan966x: Fixes for sleep in atomic context Horatiu Vultur
  2022-01-25  9:30 ` [PATCH net 1/2] net: lan966x: Fix sleep in atomic context when injecting frames Horatiu Vultur
@ 2022-01-25  9:30 ` Horatiu Vultur
  1 sibling, 0 replies; 3+ messages in thread
From: Horatiu Vultur @ 2022-01-25  9:30 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: f8f233c510bda0 ("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] 3+ messages in thread

end of thread, other threads:[~2022-01-25  9:35 UTC | newest]

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

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.