Commit 5702b81e authored by David S. Miller's avatar David S. Miller

Merge branch 'ncsi-phy-link-up'

Ivan Mikhaylov says:

====================
net/ncsi: Add NCSI Intel OEM command to keep PHY link up

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

Changes from v1:
 1. sparse fixes about casts
 2. put it after ncsi_dev_state_probe_cis instead of
    ncsi_dev_state_probe_channel because sometimes channel is not ready
    after it
 3. inl -> intel
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 96248d6d 163f5de5
...@@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC ...@@ -17,3 +17,9 @@ config NCSI_OEM_CMD_GET_MAC
help help
This allows to get MAC address from NCSI firmware and set them back to This allows to get MAC address from NCSI firmware and set them back to
controller. 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.
...@@ -78,6 +78,9 @@ enum { ...@@ -78,6 +78,9 @@ enum {
/* OEM Vendor Manufacture ID */ /* OEM Vendor Manufacture ID */
#define NCSI_OEM_MFR_MLX_ID 0x8119 #define NCSI_OEM_MFR_MLX_ID 0x8119
#define NCSI_OEM_MFR_BCM_ID 0x113d #define NCSI_OEM_MFR_BCM_ID 0x113d
#define NCSI_OEM_MFR_INTEL_ID 0x157
/* Intel specific OEM command */
#define NCSI_OEM_INTEL_CMD_KEEP_PHY 0x20 /* CMD ID for Keep PHY up */
/* Broadcom specific OEM Command */ /* Broadcom specific OEM Command */
#define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */ #define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */
/* Mellanox specific OEM Command */ /* Mellanox specific OEM Command */
...@@ -86,6 +89,7 @@ enum { ...@@ -86,6 +89,7 @@ enum {
#define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set MC Affinity */ #define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set MC Affinity */
#define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for SMAF */ #define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for SMAF */
/* OEM Command payload lengths*/ /* OEM Command payload lengths*/
#define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7
#define NCSI_OEM_BCM_CMD_GMA_LEN 12 #define NCSI_OEM_BCM_CMD_GMA_LEN 12
#define NCSI_OEM_MLX_CMD_GMA_LEN 8 #define NCSI_OEM_MLX_CMD_GMA_LEN 8
#define NCSI_OEM_MLX_CMD_SMAF_LEN 60 #define NCSI_OEM_MLX_CMD_SMAF_LEN 60
...@@ -271,6 +275,7 @@ enum { ...@@ -271,6 +275,7 @@ enum {
ncsi_dev_state_probe_mlx_gma, ncsi_dev_state_probe_mlx_gma,
ncsi_dev_state_probe_mlx_smaf, ncsi_dev_state_probe_mlx_smaf,
ncsi_dev_state_probe_cis, ncsi_dev_state_probe_cis,
ncsi_dev_state_probe_keep_phy,
ncsi_dev_state_probe_gvi, ncsi_dev_state_probe_gvi,
ncsi_dev_state_probe_gc, ncsi_dev_state_probe_gc,
ncsi_dev_state_probe_gls, ncsi_dev_state_probe_gls,
......
...@@ -689,6 +689,35 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, ...@@ -689,6 +689,35 @@ static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc,
return 0; return 0;
} }
#if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)
static int ncsi_oem_keep_phy_intel(struct ncsi_cmd_arg *nca)
{
unsigned char data[NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN];
int ret = 0;
nca->payload = NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN;
memset(data, 0, NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN);
*(unsigned int *)data = ntohl((__force __be32)NCSI_OEM_MFR_INTEL_ID);
data[4] = NCSI_OEM_INTEL_CMD_KEEP_PHY;
/* 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) #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC)
/* NCSI OEM Command APIs */ /* NCSI OEM Command APIs */
...@@ -700,7 +729,7 @@ static int ncsi_oem_gma_handler_bcm(struct ncsi_cmd_arg *nca) ...@@ -700,7 +729,7 @@ static int ncsi_oem_gma_handler_bcm(struct ncsi_cmd_arg *nca)
nca->payload = NCSI_OEM_BCM_CMD_GMA_LEN; nca->payload = NCSI_OEM_BCM_CMD_GMA_LEN;
memset(data, 0, NCSI_OEM_BCM_CMD_GMA_LEN); memset(data, 0, NCSI_OEM_BCM_CMD_GMA_LEN);
*(unsigned int *)data = ntohl(NCSI_OEM_MFR_BCM_ID); *(unsigned int *)data = ntohl((__force __be32)NCSI_OEM_MFR_BCM_ID);
data[5] = NCSI_OEM_BCM_CMD_GMA; data[5] = NCSI_OEM_BCM_CMD_GMA;
nca->data = data; nca->data = data;
...@@ -724,7 +753,7 @@ static int ncsi_oem_gma_handler_mlx(struct ncsi_cmd_arg *nca) ...@@ -724,7 +753,7 @@ static int ncsi_oem_gma_handler_mlx(struct ncsi_cmd_arg *nca)
nca->payload = NCSI_OEM_MLX_CMD_GMA_LEN; nca->payload = NCSI_OEM_MLX_CMD_GMA_LEN;
memset(&u, 0, sizeof(u)); memset(&u, 0, sizeof(u));
u.data_u32[0] = ntohl(NCSI_OEM_MFR_MLX_ID); u.data_u32[0] = ntohl((__force __be32)NCSI_OEM_MFR_MLX_ID);
u.data_u8[5] = NCSI_OEM_MLX_CMD_GMA; u.data_u8[5] = NCSI_OEM_MLX_CMD_GMA;
u.data_u8[6] = NCSI_OEM_MLX_CMD_GMA_PARAM; u.data_u8[6] = NCSI_OEM_MLX_CMD_GMA_PARAM;
...@@ -747,7 +776,7 @@ static int ncsi_oem_smaf_mlx(struct ncsi_cmd_arg *nca) ...@@ -747,7 +776,7 @@ static int ncsi_oem_smaf_mlx(struct ncsi_cmd_arg *nca)
int ret = 0; int ret = 0;
memset(&u, 0, sizeof(u)); memset(&u, 0, sizeof(u));
u.data_u32[0] = ntohl(NCSI_OEM_MFR_MLX_ID); u.data_u32[0] = ntohl((__force __be32)NCSI_OEM_MFR_MLX_ID);
u.data_u8[5] = NCSI_OEM_MLX_CMD_SMAF; u.data_u8[5] = NCSI_OEM_MLX_CMD_SMAF;
u.data_u8[6] = NCSI_OEM_MLX_CMD_SMAF_PARAM; u.data_u8[6] = NCSI_OEM_MLX_CMD_SMAF_PARAM;
memcpy(&u.data_u8[MLX_SMAF_MAC_ADDR_OFFSET], memcpy(&u.data_u8[MLX_SMAF_MAC_ADDR_OFFSET],
...@@ -1391,8 +1420,24 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp) ...@@ -1391,8 +1420,24 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
goto error; goto error;
} }
nd->state = ncsi_dev_state_probe_gvi;
if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY))
nd->state = ncsi_dev_state_probe_keep_phy;
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_intel(&nca);
if (ret)
goto error;
nd->state = ncsi_dev_state_probe_gvi; nd->state = ncsi_dev_state_probe_gvi;
break; break;
#endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */
case ncsi_dev_state_probe_gvi: case ncsi_dev_state_probe_gvi:
case ncsi_dev_state_probe_gc: case ncsi_dev_state_probe_gc:
case ncsi_dev_state_probe_gls: case ncsi_dev_state_probe_gls:
......
...@@ -403,7 +403,7 @@ static int ncsi_rsp_handler_ev(struct ncsi_request *nr) ...@@ -403,7 +403,7 @@ static int ncsi_rsp_handler_ev(struct ncsi_request *nr)
/* Update to VLAN mode */ /* Update to VLAN mode */
cmd = (struct ncsi_cmd_ev_pkt *)skb_network_header(nr->cmd); cmd = (struct ncsi_cmd_ev_pkt *)skb_network_header(nr->cmd);
ncm->enable = 1; ncm->enable = 1;
ncm->data[0] = ntohl(cmd->mode); ncm->data[0] = ntohl((__force __be32)cmd->mode);
return 0; return 0;
} }
...@@ -699,12 +699,19 @@ static int ncsi_rsp_handler_oem_bcm(struct ncsi_request *nr) ...@@ -699,12 +699,19 @@ static int ncsi_rsp_handler_oem_bcm(struct ncsi_request *nr)
return 0; return 0;
} }
/* Response handler for Intel card */
static int ncsi_rsp_handler_oem_intel(struct ncsi_request *nr)
{
return 0;
}
static struct ncsi_rsp_oem_handler { static struct ncsi_rsp_oem_handler {
unsigned int mfr_id; unsigned int mfr_id;
int (*handler)(struct ncsi_request *nr); int (*handler)(struct ncsi_request *nr);
} ncsi_rsp_oem_handlers[] = { } ncsi_rsp_oem_handlers[] = {
{ NCSI_OEM_MFR_MLX_ID, ncsi_rsp_handler_oem_mlx }, { 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_INTEL_ID, ncsi_rsp_handler_oem_intel }
}; };
/* Response handler for OEM command */ /* Response handler for OEM command */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment