Skip to contentSkip to conversation

octeontx2-af: Limit link bringup time at firmware

PATCH Applied Geetha sowjanya 2 participants 2 messages Jul 12, 2022 – Jul 14, 2022

Subsystems (3)
lore
Share & tools
lore

Geetha sowjanya

author maintainer
#0 lore raw

PATCH 1/1 octeontx2-af: Limit link bringup time at firmware

From: Hariprasad Kelam <[email protected]>

Set the maximum time firmware should poll for a link. If not set firmware could block CPU for a long time resulting in mailbox failures. If link doesn't come up within 1second, firmware will anyway notify the status as and when LINK comes up

---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c    | 14 +++++++++++---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.h    |  2 +-
 .../net/ethernet/marvell/octeontx2/af/cgx_fw_if.h  |  2 ++
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  2 +-
 4 files changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +11 -3
index 931a1a7ebf76..618b9d167fa6 100644
@@ -1440,11 +1440,19 @@ static int cgx_fwi_link_change(struct cgx *cgx, int lmac_id, bool enable)
 	u64 req = 0;
 	u64 resp;
 
-	if (enable)
+	if (enable) {
 		req = FIELD_SET(CMDREG_ID, CGX_CMD_LINK_BRING_UP, req);
-	else
-		req = FIELD_SET(CMDREG_ID, CGX_CMD_LINK_BRING_DOWN, req);
+		/* On CN10K firmware offloads link bring up/down operations to ECP
+		 * On Octeontx2 link operations are handled by firmware itself
+		 * which can cause mbox errors so configure maximum time firmware
+		 * poll for Link as 1000 ms
+		 */
+		if (!is_dev_rpm(cgx))
+			req = FIELD_SET(LINKCFG_TIMEOUT, 1000, req);
 
+	} else {
+		req = FIELD_SET(CMDREG_ID, CGX_CMD_LINK_BRING_DOWN, req);
+	}
 	return cgx_fwi_cmd_generic(req, &resp, cgx, lmac_id);
 }
 
drivers/net/ethernet/marvell/octeontx2/af/cgx.h +1 -1
index bd2f33a26eee..0b06788b8d80 100644
@@ -92,7 +92,7 @@
 
 #define CGX_COMMAND_REG			CGXX_SCRATCH1_REG
 #define CGX_EVENT_REG			CGXX_SCRATCH0_REG
-#define CGX_CMD_TIMEOUT			2200 /* msecs */
+#define CGX_CMD_TIMEOUT			5000 /* msecs */
 #define DEFAULT_PAUSE_TIME		0x7FF
 
 #define CGX_LMAC_FWI			0
drivers/net/ethernet/marvell/octeontx2/af/cgx_fw_if.h +2 -0
index f72ec0e2506f..d4a27c882a5b 100644
@@ -261,4 +261,6 @@ struct cgx_lnk_sts {
 #define CMDMODECHANGE_PORT		GENMASK_ULL(21, 14)
 #define CMDMODECHANGE_FLAGS		GENMASK_ULL(63, 22)
 
+/* LINK_BRING_UP command timeout */
+#define LINKCFG_TIMEOUT		GENMASK_ULL(21, 8)
 #endif /* __CGX_FW_INTF_H__ */
drivers/net/ethernet/marvell/octeontx2/af/mbox.h +1 -1
index 430aa8a05c23..529f2c5513ef 100644
@@ -33,7 +33,7 @@
 
 #define INTR_MASK(pfvfs) ((pfvfs < 64) ? (BIT_ULL(pfvfs) - 1) : (~0ull))
 
-#define MBOX_RSP_TIMEOUT	3000 /* Time(ms) to wait for mbox response */
+#define MBOX_RSP_TIMEOUT	6000 /* Time(ms) to wait for mbox response */
 
 #define MBOX_MSG_ALIGN		16  /* Align mbox msg start to 16bytes */
 
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 12 Jul 2022 21:48:15 +0530 you wrote:

From: Hariprasad Kelam <[email protected]>

Set the maximum time firmware should poll for a link. If not set firmware could block CPU for a long time resulting in mailbox failures. If link doesn't come up within 1second, firmware will anyway notify the status as and when LINK comes up

[...]

Here is the summary with links:
- [net-next] octeontx2-af: Limit link bringup time at firmware

    https://git.kernel.org/netdev/net-next/c/9b633670087e

You are awesome, thank you!

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