Skip to content

Commit abd2fdd

Browse files
Ivan Mikhaylovdavem330
authored andcommitted
net/ncsi: add NCSI Intel OEM command to keep PHY up
This allows to keep PHY link up and prevents any channel resets during the host load. It is KEEP_PHY_LINK_UP option(Veto bit) in i210 datasheet which block PHY reset and power state changes. Signed-off-by: Ivan Mikhaylov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 27fa107 commit abd2fdd

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

net/ncsi/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC
1717
help
1818
This allows to get MAC address from NCSI firmware and set them back to
1919
controller.
20+
config NCSI_OEM_CMD_KEEP_PHY
21+
bool "Keep PHY Link up"
22+
depends on NET_NCSI
23+
help
24+
This allows to keep PHY link up and prevents any channel resets during
25+
the host load.

net/ncsi/internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ enum {
7878
/* OEM Vendor Manufacture ID */
7979
#define NCSI_OEM_MFR_MLX_ID 0x8119
8080
#define NCSI_OEM_MFR_BCM_ID 0x113d
81+
#define NCSI_OEM_MFR_INTEL_ID 0x157
82+
/* Intel specific OEM command */
83+
#define NCSI_OEM_INTEL_CMD_KEEP_PHY 0x20 /* CMD ID for Keep PHY up */
8184
/* Broadcom specific OEM Command */
8285
#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */
8386
/* Mellanox specific OEM Command */
@@ -86,6 +89,7 @@ enum {
8689
#define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set MC Affinity */
8790
#define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for SMAF */
8891
/* OEM Command payload lengths*/
92+
#define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7
8993
#define NCSI_OEM_BCM_CMD_GMA_LEN 12
9094
#define NCSI_OEM_MLX_CMD_GMA_LEN 8
9195
#define NCSI_OEM_MLX_CMD_SMAF_LEN 60
@@ -271,6 +275,7 @@ enum {
271275
ncsi_dev_state_probe_mlx_gma,
272276
ncsi_dev_state_probe_mlx_smaf,
273277
ncsi_dev_state_probe_cis,
278+
ncsi_dev_state_probe_keep_phy,
274279
ncsi_dev_state_probe_gvi,
275280
ncsi_dev_state_probe_gc,
276281
ncsi_dev_state_probe_gls,

net/ncsi/ncsi-manage.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,35 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc,
689689
return 0;
690690
}
691691

692+
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
693+
694+
static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)
695+
{
696+
unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN];
697+
int ret = 0;
698+
699+
nca->payload = NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN;
700+
701+
memset(data, 0, NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN);
702+
*(unsigned int *)data = ntohl((__force __be32)NCSI_OEM_MFR_INTEL_ID);
703+
704+
data[4] = NCSI_OEM_INTEL_CMD_KEEP_PHY;
705+
706+
/* PHY Link up attribute */
707+
data[6] = 0x1;
708+
709+
nca->data = data;
710+
711+
ret = ncsi_xmit_cmd(nca);
712+
if (ret)
713+
netdev_err(nca->ndp->ndev.dev,
714+
"NCSI: Failed to transmit cmd 0x%x during configure\n",
715+
nca->type);
716+
return ret;
717+
}
718+
719+
#endif
720+
692721
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
693722

694723
/* NCSI OEM Command APIs */
@@ -1391,8 +1420,24 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
13911420
goto error;
13921421
}
13931422

1423+
nd->state = ncsi_dev_state_probe_gvi;
1424+
if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY))
1425+
nd->state = ncsi_dev_state_probe_keep_phy;
1426+
break;
1427+
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
1428+
case ncsi_dev_state_probe_keep_phy:
1429+
ndp->pending_req_num = 1;
1430+
1431+
nca.type = NCSI_PKT_CMD_OEM;
1432+
nca.package = ndp->active_package->id;
1433+
nca.channel = 0;
1434+
ret = ncsi_oem_keep_phy_intel(&nca);
1435+
if (ret)
1436+
goto error;
1437+
13941438
nd->state = ncsi_dev_state_probe_gvi;
13951439
break;
1440+
#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */
13961441
case ncsi_dev_state_probe_gvi:
13971442
case ncsi_dev_state_probe_gc:
13981443
case ncsi_dev_state_probe_gls:

0 commit comments

Comments
 (0)