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 1672045C22; Fri, 1 Nov 2024 03:58:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4002E434EE; Fri, 1 Nov 2024 03:57:43 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2109.outbound.protection.outlook.com [40.107.220.109]) by mails.dpdk.org (Postfix) with ESMTP id 0F376434A3 for ; Fri, 1 Nov 2024 03:57:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oYgJ1mW1Do9rGQ5hkvi9fP7jueyYLZHnceLNV19I59Jo/wmUTvxhOp82n0xfPt2W4gGV63weTZ8rb/QoFatC50dHeGnNbYhy+5HrBVEjxFMQtUjRu5YwujzCprGAjkjcfQamb3WVE49vt5xpmjUwvmGbEti3XNqiW/W+mkswc5n9pHISZPAJCyQfxEct4pIFEEc4bQmD9TmvTK0c1M45YgyrotkMU/NvaG8TZ5R3NlMJxZkRlt3en8+PM5viQ72H/NoACSFpxHf+bhbRVwJ8QliUc0TXJR8TS1A92Jq2IdP9ji5DKttmzgS2jO1dVf2ULrHRwTwdMVlLEZNDBNh29w== 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=zwHX9gF72M9iuQHI9rNxibpohKVJN9dcEhTsoWXhqp4=; b=Pv6Ijq4g5n5cRcOcC+UqN3EXg4vzJdjuC89yV6CTEo63wAHF0I4TgQyC2SoWHLP5OhjrYLIENedYtI8iS5rsNczHJRUq0nSNTL3t57Vp2Fq1CWk9Q1OyA7CVsRZHevS/FxROvWtxHzc3t/gmSlQXww23PBfv602xUjQRJ1Z6w2m5XRGGh0eN4lPYfk+7DNhRSwr7i1Kv9L27wnDIZzhQ2zTdBminju7zSLQkqTTNELVnhp+k2IFcPc+8T5eNhVgy4YpqDXu9rjN6wCJzJ3gj+lVvlsXCyP7XMWgvdCUFt1U2OMKHcLXx4MmPPUH4RuBLPKq1O3FpxQ2EGWRxAikEMg== 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=zwHX9gF72M9iuQHI9rNxibpohKVJN9dcEhTsoWXhqp4=; b=a5yCnA0n63B9SXeb68uPzCUlRmePOmu9pcN2QjukoNmKZJR/ktsw01gr7P3S8C3dxUDj69WfL6PfPuVuIp+8O5Tina9IItN5FvX4mqhCQgOMGY/zMMN4RknI+I11klka8bM2vYOI3DGkRLguKPT91qIGhfWId9T4qu2/tUhF0Ww= 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 PH0PR13MB4891.namprd13.prod.outlook.com (2603:10b6:510:96::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 02:57:38 +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; Fri, 1 Nov 2024 02:57:38 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , James Hershaw Subject: [PATCH v3 4/4] net/nfp: add support for port identify Date: Fri, 1 Nov 2024 10:57:13 +0800 Message-ID: <20241101025713.290462-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241101025713.290462-1-chaoyong.he@corigine.com> References: <20241030082759.209617-1-chaoyong.he@corigine.com> <20241101025713.290462-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TP0P295CA0031.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:4::12) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB4891:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f4477e0-d73f-49ac-9e37-08dcfa20f1bb 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?9+MkEHhGBeBACqTJIq8Ncgc15lcyvyRvEyCuz6qHnw9kmZM0fPnJJaRuDmQR?= =?us-ascii?Q?7A7whQNDaR75tMWo2UaTS17O3xKllhs8OrMDSSqBlFC8/thTtOFtklV5UiPb?= =?us-ascii?Q?ZkOWMxeqq37Cv41PyNt/WQ9p4gSuKbdF1MDejLMuoDnaWuTdf8fMLDbnGjS1?= =?us-ascii?Q?t2KDIz+X0PmuxAWFlLQw/nolR7NRgAFe69pIPAt1LykEW1gzOfGEgtQwIJlR?= =?us-ascii?Q?wxtuezugfAd6xPlXtl6Y5TwQFOwczbVokbx86Sv4yS88jtMnuOzNkzWXBezF?= =?us-ascii?Q?iQXfaimHFPPTtRYHLahE3EFrxn6rRZJ2myDVbfCKAjqdEnR7n0HrKZ2pOWOj?= =?us-ascii?Q?bN5Jb1tY+WB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XQY?= =?us-ascii?Q?HMM70dDYRpqKmo+0K3uCiTcozX7feA/0MWK3vl4bY+/B20UNmKe3A78npGpV?= =?us-ascii?Q?dIhDyMgMMbvpOwPszwNY3RRUExNeTMJIvDG/5otCXj+bLRghEyuehrQF7Kes?= =?us-ascii?Q?VYhHV2A=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?cnm2M1qnD976nAbzaFKkNzgQSivc/1Ciq8TfrjYt9nm70+VgUlYZb9M0seVI?= =?us-ascii?Q?dbxpKN0w6LVALvFJ3ec9D1IhZwR1XKoJ8T1i8IvW2Hy57QVH18zx9UrY/0at?= =?us-ascii?Q?RsvnEZiHSl2F0PfVlRY9LEhuXM4fk7Cx0SabjqXoZkKnl1Xnv6mixlB2OuR/?= =?us-ascii?Q?ZWvdAoGNgouYKLMVOzx5G6I1RZHXZnXmtQewIN141Qtdav83mG/5p54srKnN?= =?us-ascii?Q?qBObjlaOytvaNPd1su3bHIobEWJRnR+3PCSmBwxtAOK7XU1rrccvMBaryEte?= =?us-ascii?Q?l5JJzTEHZD1DZL9mz50Duz8TzktVmZ6xTCS1YBd5mRg8CyiAe69f2RHJf3OP?= =?us-ascii?Q?7740Rv79zro+1DtvSxwCZjemCK/5p3Tno8BPqOU1aQaSB2/Sav1CvfId4WML?= =?us-ascii?Q?u/9zGJcSWbzTa/2VXy8J7by+xJ4ZWpqsdXOsJ83V/7u0LYSM7MIBbGYc0vyE?= =?us-ascii?Q?UGm7GdADdD++a2pHt1aFgxm/Ro6hCNWnTx1e72yu/J93A7Hb2lLu7NDO4k9h?= =?us-ascii?Q?DDGP5eL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XL?= =?us-ascii?Q?EdNNl97cy/ErCkNIx0TYhiyB/2fVi/3NCUJSjrZH3F0P7/7xd6GAJ2tfL331?= =?us-ascii?Q?lriiBBML/ceIm96V8e3hovSvRYGBXXQ0uR+6YS839YbtyGHzrnKRARRfEvB7?= =?us-ascii?Q?opY0/B07w7Vj8Vp0234SHMpTv/11/3TqudxPbQn4IKQnAmn00hILU3dPKDc9?= =?us-ascii?Q?Zw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f4477e0-d73f-49ac-9e37-08dcfa20f1bb X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 02:57:38.3067 (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: WJX/d706qhqOHvszg6wmyzeRmaqIYy48OjTWoVtlGxgMqpNFWqTD4VEbGlHR0Z8HMTDxcJE/im+cqGe+azrxz1Y/bVWUMifihOhGltm/AWA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4891 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 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