openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on
@ 2021-07-02 11:25 Ivan Mikhaylov
  2021-07-02 11:25 ` [PATCH 1/2] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ivan Mikhaylov @ 2021-07-02 11:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Samuel Mendoza-Jonas
  Cc: openbmc, linux-kernel, netdev, Ivan Mikhaylov

Add NCSI Intel OEM command to keep PHY link up and prevents any channel
resets during the host load. Also includes dummy response handler for Intel
manufacturer id.

Ivan Mikhaylov (2):
  net/ncsi: add NCSI Intel OEM command to keep PHY up
  net/ncsi: add dummy response handler for Intel boards

 net/ncsi/Kconfig       |  6 ++++++
 net/ncsi/internal.h    |  5 +++++
 net/ncsi/ncsi-manage.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 net/ncsi/ncsi-rsp.c    |  9 +++++++-
 4 files changed, 67 insertions(+), 1 deletion(-)

-- 
2.31.1


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

* [PATCH 1/2] net/ncsi: add NCSI Intel OEM command to keep PHY up
  2021-07-02 11:25 [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on Ivan Mikhaylov
@ 2021-07-02 11:25 ` Ivan Mikhaylov
  2021-07-02 11:25 ` [PATCH 2/2] net/ncsi: add dummy response handler for Intel boards Ivan Mikhaylov
  2021-07-02 20:47 ` [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ivan Mikhaylov @ 2021-07-02 11:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Samuel Mendoza-Jonas
  Cc: openbmc, linux-kernel, netdev, Ivan Mikhaylov

This allows to keep PHY link up and prevents any channel resets during
the host load. On BMC it prevents channel reconfiguration:

eth1: NCSI: No channel with link found, configuring channel 0

which brings problem with BMC accessibility.

It is KEEP_PHY_LINK_UP option(Veto bit) in i210 datasheet which
blocks PHY reset and power state changes.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
---
 net/ncsi/Kconfig       |  6 ++++++
 net/ncsi/internal.h    |  5 +++++
 net/ncsi/ncsi-manage.c | 48 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)

diff --git a/net/ncsi/Kconfig b/net/ncsi/Kconfig
index 93309081f5a4..ea1dd32b6b1f 100644
--- a/net/ncsi/Kconfig
+++ b/net/ncsi/Kconfig
@@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC
 	help
 	  This allows to get MAC address from NCSI firmware and set them back to
 		controller.
+config NCSI_OEM_CMD_KEEP_PHY
+	bool "Keep PHY Link up"
+	depends on NET_NCSI
+	help
+	  This allows to keep PHY link up and prevents any channel resets during
+	  the host load.
diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h
index 49031f804276..0a232f3eb343 100644
--- a/net/ncsi/internal.h
+++ b/net/ncsi/internal.h
@@ -78,6 +78,9 @@ enum {
 /* OEM Vendor Manufacture ID */
 #define NCSI_OEM_MFR_MLX_ID             0x8119
 #define NCSI_OEM_MFR_BCM_ID             0x113d
+#define NCSI_OEM_MFR_INL_ID             0x157
+/* Intel specific OEM command */
+#define NCSI_OEM_INL_CMD_KEEP_PHY       0x20   /* CMD ID for Keep PHY up */
 /* Broadcom specific OEM Command */
 #define NCSI_OEM_BCM_CMD_GMA            0x01   /* CMD ID for Get MAC */
 /* Mellanox specific OEM Command */
@@ -86,6 +89,7 @@ enum {
 #define NCSI_OEM_MLX_CMD_SMAF           0x01   /* CMD ID for Set MC Affinity */
 #define NCSI_OEM_MLX_CMD_SMAF_PARAM     0x07   /* Parameter for SMAF         */
 /* OEM Command payload lengths*/
+#define NCSI_OEM_INL_CMD_KEEP_PHY_LEN   7
 #define NCSI_OEM_BCM_CMD_GMA_LEN        12
 #define NCSI_OEM_MLX_CMD_GMA_LEN        8
 #define NCSI_OEM_MLX_CMD_SMAF_LEN        60
@@ -270,6 +274,7 @@ enum {
 	ncsi_dev_state_probe_channel,
 	ncsi_dev_state_probe_mlx_gma,
 	ncsi_dev_state_probe_mlx_smaf,
+	ncsi_dev_state_probe_keep_phy,
 	ncsi_dev_state_probe_cis,
 	ncsi_dev_state_probe_gvi,
 	ncsi_dev_state_probe_gc,
diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index ffff8da707b8..d78cca2a2b26 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -689,6 +689,37 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc,
 	return 0;
 }
 
+#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
+
+static int ncsi_oem_keep_phy_inl(struct ncsi_cmd_arg *nca)
+{
+	unsigned char data[NCSI_OEM_INL_CMD_KEEP_PHY_LEN];
+	int ret = 0;
+
+	nca->payload = NCSI_OEM_INL_CMD_KEEP_PHY_LEN;
+
+	memset(data, 0, NCSI_OEM_INL_CMD_KEEP_PHY_LEN);
+	*(unsigned int *)data = ntohl(NCSI_OEM_MFR_INL_ID);
+
+	/* Predefined data */
+	data[4] = NCSI_OEM_INL_CMD_KEEP_PHY;
+	data[5] = 0x0;
+
+	/* PHY Link up attribute */
+	data[6] = 0x1;
+
+	nca->data = data;
+
+	ret = ncsi_xmit_cmd(nca);
+	if (ret)
+		netdev_err(nca->ndp->ndev.dev,
+			   "NCSI: Failed to transmit cmd 0x%x during configure\n",
+			   nca->type);
+	return ret;
+}
+
+#endif
+
 #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
 
 /* NCSI OEM Command APIs */
@@ -1350,8 +1381,25 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
 		    ndp->mlx_multi_host)
 			nd->state = ncsi_dev_state_probe_mlx_gma;
 
+		if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY))
+			nd->state = ncsi_dev_state_probe_keep_phy;
+
 		schedule_work(&ndp->work);
 		break;
+#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
+	case ncsi_dev_state_probe_keep_phy:
+		ndp->pending_req_num = 1;
+
+		nca.type = NCSI_PKT_CMD_OEM;
+		nca.package = ndp->active_package->id;
+		nca.channel = 0;
+		ret = ncsi_oem_keep_phy_inl(&nca);
+		if (ret)
+			goto error;
+
+		nd->state = ncsi_dev_state_probe_cis;
+		break;
+#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */
 #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
 	case ncsi_dev_state_probe_mlx_gma:
 		ndp->pending_req_num = 1;
-- 
2.31.1


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

* [PATCH 2/2] net/ncsi: add dummy response handler for Intel boards
  2021-07-02 11:25 [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on Ivan Mikhaylov
  2021-07-02 11:25 ` [PATCH 1/2] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
@ 2021-07-02 11:25 ` Ivan Mikhaylov
  2021-07-02 20:47 ` [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ivan Mikhaylov @ 2021-07-02 11:25 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Samuel Mendoza-Jonas
  Cc: openbmc, linux-kernel, netdev, Ivan Mikhaylov

Add the dummy response handler for Intel boards to prevent incorrect
handling of OEM commands.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
---
 net/ncsi/ncsi-rsp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index 888ccc2d4e34..22330a80887b 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -699,12 +699,19 @@ static int ncsi_rsp_handler_oem_bcm(struct ncsi_request *nr)
 	return 0;
 }
 
+/* Response handler for Intel card */
+static int ncsi_rsp_handler_oem_inl(struct ncsi_request *nr)
+{
+	return 0;
+}
+
 static struct ncsi_rsp_oem_handler {
 	unsigned int	mfr_id;
 	int		(*handler)(struct ncsi_request *nr);
 } ncsi_rsp_oem_handlers[] = {
 	{ NCSI_OEM_MFR_MLX_ID, ncsi_rsp_handler_oem_mlx },
-	{ NCSI_OEM_MFR_BCM_ID, ncsi_rsp_handler_oem_bcm }
+	{ NCSI_OEM_MFR_BCM_ID, ncsi_rsp_handler_oem_bcm },
+	{ NCSI_OEM_MFR_INL_ID, ncsi_rsp_handler_oem_inl }
 };
 
 /* Response handler for OEM command */
-- 
2.31.1


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

* Re: [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on
  2021-07-02 11:25 [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on Ivan Mikhaylov
  2021-07-02 11:25 ` [PATCH 1/2] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
  2021-07-02 11:25 ` [PATCH 2/2] net/ncsi: add dummy response handler for Intel boards Ivan Mikhaylov
@ 2021-07-02 20:47 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2021-07-02 20:47 UTC (permalink / raw)
  To: i.mikhaylov; +Cc: netdev, openbmc, linux-kernel, kuba, sam

From: Ivan Mikhaylov <i.mikhaylov@yadro.com>
Date: Fri, 2 Jul 2021 14:25:17 +0300

> Add NCSI Intel OEM command to keep PHY link up and prevents any channel
> resets during the host load. Also includes dummy response handler for Intel
> manufacturer id.

Please fix the warnings found by:

https://patchwork.hopto.org/static/nipa/510079/12355969/build_32bit/stderr

Thank you.

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

end of thread, other threads:[~2021-07-02 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02 11:25 [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on Ivan Mikhaylov
2021-07-02 11:25 ` [PATCH 1/2] net/ncsi: add NCSI Intel OEM command to keep PHY up Ivan Mikhaylov
2021-07-02 11:25 ` [PATCH 2/2] net/ncsi: add dummy response handler for Intel boards Ivan Mikhaylov
2021-07-02 20:47 ` [PATCH 0/2] Add NCSI Intel OEM command to keep PHY link up on David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).