From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBF2D45C2A; Mon, 4 Nov 2024 02:35:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D81C7406BB; Mon, 4 Nov 2024 02:35:35 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2116.outbound.protection.outlook.com [40.107.101.116]) by mails.dpdk.org (Postfix) with ESMTP id 24A4540697 for ; Mon, 4 Nov 2024 02:35:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lNkWasC7ccEIqW2s4nfzPuyAJz+tbnA3sweZEgALVQzy95ycdctobf+bnEXvRY2k84cXSxhb+QAQOBzXb8GW6KwDrOxpqkOJX2RS1ABnUEfbUJ+lrq+HwZism3PBKjeX6oFFDC2StVCmsp7QwCKyTiZfPWtR96PBfdqgIoOV2j1yHEtNEbJF7zTQYfFXVcqCn+BIElZXx6OuiozRIx7/yuVSJfp0/YKFDutozydbPuFZJiXlDiTjFIpw6xlBuDBQz85wFlZfWGfxKMN1gDaWkff+1+hYYkPhVOyYwlQvnHDSnG1Gun3wYPineHCWzciOv+WBBP7UvrJ7aWKiw5HzmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sOD0YteqMBztQIn6ZbN+48swl1YlxHSyrq7ePoRg7gY=; b=g4kS3ig+ALSiJnAUYzOCTtKu01il5zY5tsbyQzn7rtS4u6n1IFFUhdjg+Is4WkskDVOBH+UXNSIQyexKlwg39MkaZ4nPz3yO+giL8TvJlR7Gb6L/LxhrCZ9karvJ0X22sDy5rFUSwAqvKgme7F2nBe75Wfsre0cjSDV8OBvMrVFwJnBU+zwKpCARIWIMRhahI02uowkeBB3EOs5rRI6WLaXh+ISYYmadTxjRTJ00XhlFB4I5gJ+iV4mI9YKb1Aas1mJzyh+usrsbnFpKWnob1/j5+rIRCxlv/jazcsIhWZjseF6HgKhfVVa+PtDFcqNEyHo4r3ST25OWgMNEcRogfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sOD0YteqMBztQIn6ZbN+48swl1YlxHSyrq7ePoRg7gY=; b=OqPeM8gcSOxDNgrup79ONpcQbqdQH96lg8xg6DeuhU1JmS6aBiDu8wpe6D3wL5sdXGtnlqOGqkjS0MSeLg8/PmUtimWe0/uAU2q4fp7Mpyl4EFAL7eiRxRaXKPNRdVY4m+TXUViAvCIQYRRT+Yzu1UE6WtdisnatMDg6thPWrg4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by SN7PR13MB6158.namprd13.prod.outlook.com (2603:10b6:806:323::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 01:35:23 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8114.028; Mon, 4 Nov 2024 01:35:23 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , James Hershaw Subject: [PATCH v4 4/4] net/nfp: add LED support Date: Mon, 4 Nov 2024 09:34:42 +0800 Message-ID: <20241104013442.308780-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241104013442.308780-1-chaoyong.he@corigine.com> References: <20241101025713.290462-1-chaoyong.he@corigine.com> <20241104013442.308780-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0009.apcprd06.prod.outlook.com (2603:1096:4:186::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SN7PR13MB6158:EE_ X-MS-Office365-Filtering-Correlation-Id: 37633cfe-f821-44e2-cf2f-08dcfc70f380 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?t4uTdAfsbkumpHv+DIEGNBCD0n7mjEaxoSoZY/fK9jMzdnrjcVQGxzFMgv8S?= =?us-ascii?Q?uptKdhY940DBb3u38Elsm++wL7epZvPfXyFne1eY85BvBbhVD1D0rXEivoDI?= =?us-ascii?Q?W5wJFymBfvdvPOfFaNWThUxBg7ACjP1cA6btjfcbRaM0n4g58OiFxQZG8bsU?= =?us-ascii?Q?VA8uKeCzuYNIviOp9mXtPFA6LmM1LTTbdeRDA134YFG5+tnE9kInNBsVP6L+?= =?us-ascii?Q?lcbOUIhOf3oV5qMlj3r68tHWjwCFoyK0XE0W4LiSfhCGLov6vLW3CH3DpaLT?= =?us-ascii?Q?gVIliJOUbTE06h+ga1ImKr2viMPc+2oeR0uwtgHkce06PUmktBs3jCQae16H?= =?us-ascii?Q?aYV6CAokiwpE6eQh2ZgGA1GZkdOB+QS6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?= =?us-ascii?Q?JxtB1IPBJvRGYWuJuIPz5YWngZsYZXpVcZTNRbxH8W1TO+TVraxS4huk0idk?= =?us-ascii?Q?IybcMwelXVfwvvesRjCwo4ZwAJ4RKBPNWxotE8eYagoLnVn+26nDEHvNzsXm?= =?us-ascii?Q?24W9bd4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jNFIcdjlKGUM3Tw3TpT9D4GCU8mvefS/HqJ/HtHMoKzu6u0dPgCmO7H7ldyZ?= =?us-ascii?Q?W9Ai/VtpFPcEnXPEGNCHHmppLR1YYfvoAStElKBRUqFMvtjNz1wY8DDldPKk?= =?us-ascii?Q?yMDdrsni5DN/46LDeEuEHk8o2mwif++kgeCNUGuZWUP+ff5YmczwsnXZZsH3?= =?us-ascii?Q?Zftv5nDF8z2mXtBQGULgvVSpQMKped+CEn5k3v7w7tH5Jwradv29/V1w6eKM?= =?us-ascii?Q?NFrvvAqI+84Gaa8Mu/AjCc3FHAl4JCZ8SsN1Y0d8707F3qblWR3s/IU9mKNh?= =?us-ascii?Q?oGTCNqVP8WI2Dl6aldob8SgIGp2smCR+zHriMAG2Ak+tXCmuo34rs9n7cxu6?= =?us-ascii?Q?CrX8icbAUIsziFmwhXDC6McYb/GQBcBNrKNBU7fn4UPvqxXncWSMd8P7ItEK?= =?us-ascii?Q?1pgcyO7TXcCxMCBthkllPJHQXGbKCmt+XiNAfbGFwrtaeTWCRrKtjxQ8s3JI?= =?us-ascii?Q?O60jJphbByinRfMdLbDv1Vrqkf/3ZTAqdYKph5pFIeuFjIaDmv0rAjJxJ53l?= =?us-ascii?Q?WOZ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7XVg1HrVlW0kasBLzIqPtE4?= =?us-ascii?Q?qVzFez2UJZDOjL23iEAfUT1wBieIM1r88NVUJfjKyCIQeYfzNV+VyG4735UY?= =?us-ascii?Q?mx0EkA+9DR5WPz77BFQst8E359BGW5zr3ZGWxOg9Bd6Lwa68pMhDYCF//0tI?= =?us-ascii?Q?YJ6QgjzE9d//Vww+cfhr24XllrpUtW9e3ztCS1dj5nJPdCnfRTssBpIl4T7q?= =?us-ascii?Q?Ew=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37633cfe-f821-44e2-cf2f-08dcfc70f380 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 01:35:23.3490 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mdNZmdIgqI+N9bVJZLGPBWQkR66MwHNrLpLY106VXyrFAOOsrbMj4+5BxuxC9fSSOo/CEUKrYPIN6jaswaZhj8fy2uO+y735QutdAS0plIs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR13MB6158 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Implement the necessary functions to allow user to visually identify a physical port associated with a netdev by blinking an LED on that port. Signed-off-by: James Hershaw Signed-off-by: Chaoyong He --- doc/guides/nics/features/nfp.ini | 1 + .../net/nfp/flower/nfp_flower_representor.c | 30 ++++++++++++++++ drivers/net/nfp/nfp_ethdev.c | 2 ++ drivers/net/nfp/nfp_net_common.c | 32 +++++++++++++++++ drivers/net/nfp/nfp_net_common.h | 2 ++ drivers/net/nfp/nfpcore/nfp_nsp.h | 1 + drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 36 +++++++++++++++++++ 7 files changed, 104 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 5303b3abf5..124663ae00 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -27,6 +27,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Module EEPROM dump = Y +LED = Y Linux = Y Multiprocess aware = Y x86-64 = Y diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 04536ce15f..4017f602a2 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -88,6 +88,30 @@ nfp_repr_get_module_eeprom(struct rte_eth_dev *dev, return nfp_net_get_module_eeprom(dev, info); } +static int +nfp_flower_repr_led_on(struct rte_eth_dev *dev) +{ + struct nfp_flower_representor *repr; + + repr = dev->data->dev_private; + if (!nfp_flower_repr_is_phy(repr)) + return -EOPNOTSUPP; + + return nfp_net_led_on(dev); +} + +static int +nfp_flower_repr_led_off(struct rte_eth_dev *dev) +{ + struct nfp_flower_representor *repr; + + repr = dev->data->dev_private; + if (!nfp_flower_repr_is_phy(repr)) + return -EOPNOTSUPP; + + return nfp_net_led_off(dev); +} + static int nfp_flower_repr_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) @@ -623,6 +647,9 @@ static const struct eth_dev_ops nfp_flower_multiple_pf_repr_dev_ops = { .set_eeprom = nfp_repr_set_eeprom, .get_module_info = nfp_repr_get_module_info, .get_module_eeprom = nfp_repr_get_module_eeprom, + + .dev_led_on = nfp_flower_repr_led_on, + .dev_led_off = nfp_flower_repr_led_off, }; static const struct eth_dev_ops nfp_flower_repr_dev_ops = { @@ -661,6 +688,9 @@ static const struct eth_dev_ops nfp_flower_repr_dev_ops = { .set_eeprom = nfp_repr_set_eeprom, .get_module_info = nfp_repr_get_module_info, .get_module_eeprom = nfp_repr_get_module_eeprom, + + .dev_led_on = nfp_flower_repr_led_on, + .dev_led_off = nfp_flower_repr_led_off, }; static uint32_t diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 2ee76d309c..f54483822f 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -983,6 +983,8 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .set_eeprom = nfp_net_set_eeprom, .get_module_info = nfp_net_get_module_info, .get_module_eeprom = nfp_net_get_module_eeprom, + .dev_led_on = nfp_net_led_on, + .dev_led_off = nfp_net_led_off, }; static inline void diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index a45837353a..e68ce68229 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -3181,3 +3181,35 @@ nfp_net_get_module_eeprom(struct rte_eth_dev *dev, nfp_nsp_close(nsp); return ret; } + +static int +nfp_net_led_control(struct rte_eth_dev *dev, + bool is_on) +{ + int ret; + uint32_t nfp_idx; + struct nfp_net_hw_priv *hw_priv; + + hw_priv = dev->process_private; + nfp_idx = nfp_net_get_nfp_index(dev); + + ret = nfp_eth_set_idmode(hw_priv->pf_dev->cpp, nfp_idx, is_on); + if (ret < 0) { + PMD_DRV_LOG(ERR, "Set nfp idmode failed."); + return ret; + } + + return 0; +} + +int +nfp_net_led_on(struct rte_eth_dev *dev) +{ + return nfp_net_led_control(dev, true); +} + +int +nfp_net_led_off(struct rte_eth_dev *dev) +{ + return nfp_net_led_control(dev, false); +} diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 5ad698cad2..d85a00a75e 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -399,6 +399,8 @@ int nfp_net_get_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eepr int nfp_net_set_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *eeprom); int nfp_net_get_module_info(struct rte_eth_dev *dev, struct rte_eth_dev_module_info *info); int nfp_net_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); +int nfp_net_led_on(struct rte_eth_dev *dev); +int nfp_net_led_off(struct rte_eth_dev *dev); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.h b/drivers/net/nfp/nfpcore/nfp_nsp.h index 0ae10dabfb..6230a84e34 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp.h +++ b/drivers/net/nfp/nfpcore/nfp_nsp.h @@ -216,6 +216,7 @@ int nfp_eth_set_speed(struct nfp_nsp *nsp, uint32_t speed); int nfp_eth_set_split(struct nfp_nsp *nsp, uint32_t lanes); int nfp_eth_set_tx_pause(struct nfp_nsp *nsp, bool tx_pause); int nfp_eth_set_rx_pause(struct nfp_nsp *nsp, bool rx_pause); +int nfp_eth_set_idmode(struct nfp_cpp *cpp, uint32_t idx, bool is_on); /* NSP static information */ struct nfp_nsp_identify { diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c index 1fcd54656a..404690d05f 100644 --- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c +++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c @@ -44,6 +44,7 @@ #define NSP_ETH_CTRL_SET_LANES RTE_BIT64(5) #define NSP_ETH_CTRL_SET_ANEG RTE_BIT64(6) #define NSP_ETH_CTRL_SET_FEC RTE_BIT64(7) +#define NSP_ETH_CTRL_SET_IDMODE RTE_BIT64(8) #define NSP_ETH_CTRL_SET_TX_PAUSE RTE_BIT64(10) #define NSP_ETH_CTRL_SET_RX_PAUSE RTE_BIT64(11) @@ -736,3 +737,38 @@ nfp_eth_set_rx_pause(struct nfp_nsp *nsp, return NFP_ETH_SET_BIT_CONFIG(nsp, NSP_ETH_RAW_STATE, NSP_ETH_STATE_RX_PAUSE, rx_pause, NSP_ETH_CTRL_SET_RX_PAUSE); } + +int +nfp_eth_set_idmode(struct nfp_cpp *cpp, + uint32_t idx, + bool is_on) +{ + uint64_t reg; + struct nfp_nsp *nsp; + union eth_table_entry *entries; + + nsp = nfp_eth_config_start(cpp, idx); + if (nsp == NULL) + return -EIO; + + /* + * Older ABI versions did support this feature, however this has only + * been reliable since ABI 32. + */ + if (nfp_nsp_get_abi_ver_minor(nsp) < 32) { + PMD_DRV_LOG(ERR, "Operation only supported on ABI 32 or newer."); + nfp_eth_config_cleanup_end(nsp); + return -ENOTSUP; + } + + entries = nfp_nsp_config_entries(nsp); + + reg = rte_le_to_cpu_64(entries[idx].control); + reg &= ~NSP_ETH_CTRL_SET_IDMODE; + reg |= FIELD_PREP(NSP_ETH_CTRL_SET_IDMODE, is_on); + entries[idx].control = rte_cpu_to_le_64(reg); + + nfp_nsp_config_set_modified(nsp, 1); + + return nfp_eth_config_commit_end(nsp); +} -- 2.43.5