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 3331145C11; Wed, 30 Oct 2024 09:20:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 97E2643351; Wed, 30 Oct 2024 09:19:49 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2137.outbound.protection.outlook.com [40.107.94.137]) by mails.dpdk.org (Postfix) with ESMTP id CA6714332E for ; Wed, 30 Oct 2024 09:19:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EnmlFxNkPyE8moGfc7Zj1ZbiW9IpCC0vjcm4J2XRtBJhtsl25si8cVeHdpGjdBFgY9xcc6lpiZXXO9huGBhCwZTS9m7MydUim5NpzcREm5smq9x/aIDHXvg6GgFRdtblP7XG5mKa3QqpbUWgTCF6dAzGTUlGGXqdtp4eLhFeiTqbskeRBQleQ6GI4wCR6Bv8ZFD4auWacPHqLt/vu9I0UiVnRDAcH9ouYmANwUShCMfjkSPuVrRyN66uTOolp/7B0Ntwf3/W3SL6zKaAaQIEeUBeJ+laVTQOO9RMgJCziqQ1Nx0l2CuM4YAfH/tSRk8yb2KBWH9qUdL9+dIhRpAGyw== 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=M+SbFBTVK75iHA311/NfHprNoOGYPCM+hGwVtQc86ts=; b=v/IAbO8YghZGdjuQoCObEl1H+Hd5slxobxo1P5T1y/o+QNJ7JueMyk0ZPf09NcyWh+C8OPu/h7Sp4W9znPAOPBqTDBnprhQmhpimSRV9ONJZc1bIxUFbdK2BswvrCUUDy/oHgJq3OvqSllwYqUffJCJ55vwE95rBo4tTtlvcNysWLCx0W/sbEQfp7BRwtQGndtcEEs0oqF6jsB9WAdNeSvMnoF3ZG3ViMtTEwxe3yPlPb9W6Rxy34PIXUf9RDr7BDtsefUpIxDjwham6uTLqvIL/OPfHkm6AtJ1l7x0EOWfVBdTM3AwE7mnhZ2aObbJfS5jO92RoZeiDglr47YePXQ== 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=M+SbFBTVK75iHA311/NfHprNoOGYPCM+hGwVtQc86ts=; b=oGf9BJEuMUTWpNRMAUXVgg1I8SkjZrHION0r8GevQ29Y2t6ZNJjDXQ1os1uHwdVuckNuMqbB17wPwBG93Cqu3LqHB3XrlLSURUreZHmGQLGUq0gG9wWRE/oPRSQusf5tdLIJGeWJ/KlLxgOkcmcJ3c2iK0UD+zsHusa58j0wm9M= 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 LV8PR13MB6775.namprd13.prod.outlook.com (2603:10b6:408:233::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 08:19:37 +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.8093.027; Wed, 30 Oct 2024 08:19:37 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , James Hershaw Subject: [PATCH 3/3] net/nfp: add support for port identify Date: Wed, 30 Oct 2024 16:19:10 +0800 Message-ID: <20241030081910.209308-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241030081910.209308-1-chaoyong.he@corigine.com> References: <20241030081910.209308-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR04CA0003.apcprd04.prod.outlook.com (2603:1096:4:197::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|LV8PR13MB6775:EE_ X-MS-Office365-Filtering-Correlation-Id: 68be4067-20bd-4101-6ad0-08dcf8bb981a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?RO3pkclG9lICwnVVAGR12nOAX+ZdgMThCWsjRh7h3qbhU3fWxoxseTv21zb2?= =?us-ascii?Q?BlDM3T2Bu5FrJiESk/xGsbmZbOq25OECZeyRU3coLZRmb1Q/a0hlg8Jy4ZO7?= =?us-ascii?Q?MzBeaWPL5e86Ds9+awyNyZFlt5G/g+d0KfmtzRWYYGgtQktTX7tlzTkRJCZd?= =?us-ascii?Q?raWDQRBvoTnlftca4wcyOEOAYob7rNtf9XDiLXiWhm5qFDt3R3l/1TDD6z7w?= =?us-ascii?Q?yD0YD1r4mOaviEftJIZejVMil47tP8NJTMzsUiqvtzxmhjoF7980fk+1P2kW?= =?us-ascii?Q?kyuIdsIiyr1cFavtoSOBSKD4czoKiYgNVLMZRTWA5oAMZZzcgDsffEU2A9B6?= =?us-ascii?Q?wOvWxF8z/U+yzxWsC3D02yR6qTJY7vNSzCeILgirL1sfXwePevW6VTz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PJL3H4HOUV2728lHDjz4mOlIZTj/4Gyjm?= =?us-ascii?Q?eB0w3S7VOJbSutKK26gRHeu/vAO3AilM8lTCc2cLX0DQbh+IyDS/yGUZKDPZ?= =?us-ascii?Q?gBHc8CU=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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wWFVLa2I0GO2+2HM40z7jn6ZgTj0SlyXy0O3c9FdgWDxPuPcDS+sTMX232E4?= =?us-ascii?Q?+tYjmeAEgiSPgIbzsZknvNCHx9+LZRw3KScet5Sigy953z+aUMB9JOFCn5VG?= =?us-ascii?Q?4BZeRCBj5gGGLyvasVGWKRQpnUfWqEUfM1j8j6lHSCa5kslUieCOYeoYNji1?= =?us-ascii?Q?S3SQXvn4avLY99RgI8rI/ArhLgJ9lcgkPbFfvCSvRqguubVhIhLKahXIz3ik?= =?us-ascii?Q?ac8f3A7UrjxpVDXzTRUaGbKe6vyN43lph7EH528H7l6hcTZZM3hoNhgj74q6?= =?us-ascii?Q?SNnGVGA2FEMcTyWcGeBM3FBxGAHzrgXwA/No1IHLPJ3i7ntsN1BTPNDpZs46?= =?us-ascii?Q?26U30YwEaQCvWMLp4OcAHeWHuLxrynqkit/3u3gS08ccRw4E6AuZbQQ9rcwn?= =?us-ascii?Q?t1PAocOsQ6ooFbjZo/i0C2K0x6kB0lckLM0YeKpQkHKzT3N61OooHpSMc+A7?= =?us-ascii?Q?Xpf41BBiEwfk+3T5y2i5b7gzlIhpLynXq21Wu+To9Mg6z8coP3weU4bRnGxH?= =?us-ascii?Q?7lI5Adus90gVkRJbBNZYI6zQvBVNRjTd6BzntjcsqEMVA3oIB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FXiIDbUuJo2JZb1nkrMzR3SsudjwH4oJ3ZO38efsjYO62a1Dcfsa?= =?us-ascii?Q?Nr8KFkIOQIYjbGSo0Hmw8LDdYeK59cv7XvEd6gJktvop9ir7A3jsISS1Jk8D?= =?us-ascii?Q?OT9u7KbrWMi1tVp0zN4NojkiI0wBsefCV09J2VjWn/7QipFrMYCkZLG+ZY/P?= =?us-ascii?Q?dw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68be4067-20bd-4101-6ad0-08dcf8bb981a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 08:19:37.5843 (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: b0f2ZkqXyrSrd6fER5xZkYmR9AoGrubuJhkVApOQG5PrYtcdR2pJP6xaXr5NVEGhPKGDpgXW6RZQT8+/2Ott+z1rVIC6T9M1ZVk2T+xYzIg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR13MB6775 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 --- .../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 +++++++++++++++++++ 6 files changed, 103 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 3d043e052a..01ca8a6768 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