Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <i.mikhaylov@yadro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ivan Mikhaylov and committed by
David S. Miller
abd2fddc 27fa107d

+56
+6
net/ncsi/Kconfig
··· 17 17 help 18 18 This allows to get MAC address from NCSI firmware and set them back to 19 19 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.
+5
net/ncsi/internal.h
··· 78 78 /* OEM Vendor Manufacture ID */ 79 79 #define NCSI_OEM_MFR_MLX_ID 0x8119 80 80 #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 */ 81 84 /* Broadcom specific OEM Command */ 82 85 #define NCSI_OEM_BCM_CMD_GMA 0x01 /* CMD ID for Get MAC */ 83 86 /* Mellanox specific OEM Command */ ··· 89 86 #define NCSI_OEM_MLX_CMD_SMAF 0x01 /* CMD ID for Set MC Affinity */ 90 87 #define NCSI_OEM_MLX_CMD_SMAF_PARAM 0x07 /* Parameter for SMAF */ 91 88 /* OEM Command payload lengths*/ 89 + #define NCSI_OEM_INTEL_CMD_KEEP_PHY_LEN 7 92 90 #define NCSI_OEM_BCM_CMD_GMA_LEN 12 93 91 #define NCSI_OEM_MLX_CMD_GMA_LEN 8 94 92 #define NCSI_OEM_MLX_CMD_SMAF_LEN 60 ··· 275 271 ncsi_dev_state_probe_mlx_gma, 276 272 ncsi_dev_state_probe_mlx_smaf, 277 273 ncsi_dev_state_probe_cis, 274 + ncsi_dev_state_probe_keep_phy, 278 275 ncsi_dev_state_probe_gvi, 279 276 ncsi_dev_state_probe_gc, 280 277 ncsi_dev_state_probe_gls,
+45
net/ncsi/ncsi-manage.c
··· 689 689 return 0; 690 690 } 691 691 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 + 692 721 #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_GET_MAC) 693 722 694 723 /* NCSI OEM Command APIs */ ··· 1421 1392 } 1422 1393 1423 1394 nd->state = ncsi_dev_state_probe_gvi; 1395 + if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY)) 1396 + nd->state = ncsi_dev_state_probe_keep_phy; 1424 1397 break; 1398 + #if IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) 1399 + case ncsi_dev_state_probe_keep_phy: 1400 + ndp->pending_req_num = 1; 1401 + 1402 + nca.type = NCSI_PKT_CMD_OEM; 1403 + nca.package = ndp->active_package->id; 1404 + nca.channel = 0; 1405 + ret = ncsi_oem_keep_phy_intel(&nca); 1406 + if (ret) 1407 + goto error; 1408 + 1409 + nd->state = ncsi_dev_state_probe_gvi; 1410 + break; 1411 + #endif /* CONFIG_NCSI_OEM_CMD_KEEP_PHY */ 1425 1412 case ncsi_dev_state_probe_gvi: 1426 1413 case ncsi_dev_state_probe_gc: 1427 1414 case ncsi_dev_state_probe_gls: