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 A2CFE45909; Thu, 5 Sep 2024 08:26:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C631A42DC3; Thu, 5 Sep 2024 08:25:43 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2106.outbound.protection.outlook.com [40.107.220.106]) by mails.dpdk.org (Postfix) with ESMTP id 09F8742DC3 for ; Thu, 5 Sep 2024 08:25:42 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Auqugb1+NamK7U1TNiI4R6rctHqy8WXkJ2indobe3nBnMS+4AmKJE0bFKKT7vFiZTwdEjFj5lVfvv0Cz1kR6H1fUaXAidwV0cFKj5sG6vWsOL9DZioB4E6H3y+tGQq565Olsg2WmtjRajL3/IOC1CY8EP6+5mU3KcSIhq0T7OAAsizOmz1LIiOwYc8xdcrPjAx/WHXLRFQLHVI67dIXPhA9IzyO/bQ0/wb3IuEc6O5c1H2jCfk9t1TiZOy9r+nMfLHEMLAYnEY3Kaa/UTYNGuRteM6aSMb7zyHe7hjpaolrl22BpxgZq+MpeZEjG9U58OSsC1ubbC2ZsjF89Ew87VA== 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=ZZdWFuIjqbtNUDANYF137bYyy5OjJ7+RfGRquQpCCDk=; b=wdQgaBFlU3D+as4sTiUKUHdsdAK7/EYL2Q6/KcA7cHAB9n6wbpERVUY310R3C2J+o1DSIBbcweABDxXURMh7HTqVPMXkIFKiu1I7cYNmJjPadsKHO8ueSix5c2Xs8WXHiIvU6PiIROI96M7Jx3EaNZwPT4oSjrPJ3cgQvAK+aeg5ktnwadvUYxzu2q3ZMZ3JlUgd6bXTpheRsqCnBsGZjfCCdoro3ibfNwgCoVl8Z3WHCLQq0tt6cgU01BcPqByLKvvYPGTMA1BYyOPNfr6T4pVrYO51BdkY2dJj9Fjvqa6XL7zagCWUOSDymAYX3YCvBmMZk6139MNvQpWMhJ/IBQ== 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=ZZdWFuIjqbtNUDANYF137bYyy5OjJ7+RfGRquQpCCDk=; b=shtR5VwEof/2sHjwRk9r86c7r/PBJu9sq+BfapIVWnfI+lCC16KhHEEY9O5S3pKSFxEPs1oLQU/PVYE0F2etjrfIeHCsxuMjEIF0cMFx1M5zjaFRJOVoUyhgtXJ0rJXEXTtuzVJ4EvGFIrfWW6mp/Rgjo8wf9HfMTTckz8W/qCo= 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 BLAPR13MB4610.namprd13.prod.outlook.com (2603:10b6:208:306::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Thu, 5 Sep 2024 06:25:40 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7918.024; Thu, 5 Sep 2024 06:25:40 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Qin Ke , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 3/8] net/nfp: add help function to update VF link speed Date: Thu, 5 Sep 2024 14:25:06 +0800 Message-Id: <20240905062511.2710102-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240905062511.2710102-1-chaoyong.he@corigine.com> References: <20240905062511.2710102-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BLAPR13MB4610:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bd0dcce-da57-43e3-b3dd-08dccd739004 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?56JmWVjh/8Ju4DHMIHew185/UNR3LNVvIREhKBipzkEwA9GqFDr29Py/oGYl?= =?us-ascii?Q?pmejinY0kQUiR+cTaWVI6C/63gCXL/R+C0QnqroavX42IhUn5r46ISaWveuf?= =?us-ascii?Q?Jq1w4v80eNyjldHHNESWIE8sAfrQqt8A10+jOlFrZj8LwM48T43Kuuxa3eE7?= =?us-ascii?Q?okehjLRWDZFqermk2NbSLZwSrQ50PaymlNS11hof8jGPmqJzpt38i2Jf/6uN?= =?us-ascii?Q?AgJQKitlRpguVFvNfWJVSu9WuXaBRgs+yjuW3/V6EB5vLSkMwk4XyJhM2u1U?= =?us-ascii?Q?TcNuxssNCSqZdCDEt3brBh6W+mV6i2DdZLqyJOLzJQx/vuB/QTd/WHs/m8l4?= =?us-ascii?Q?JrcfC9NINVQo6Q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Q?iKT7DoSOCwufIh8o4JUjYvrRAMV6mr3dma8/aT9v/VBdBOm+nhiGd9jJq3X/?= =?us-ascii?Q?Dj8vwIPTYFNNRnnV36Ipzgm0Q0ZfuTqFWQh5Wi2Kq1Hn5Rp1Veq2+7qgnN9s?= =?us-ascii?Q?PePno6yiqqSWhZL9OHp8KA+XY1kuMIQHn1LumyUbN55dhhp/EA=3D=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)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xD+wQe1H2K7nG6nbyyqEHEf7Yb4wWTxIfR0AGCjVhFMqqwsLbSqZX0BW6N6O?= =?us-ascii?Q?crIp2QQE1JeqbdYtC24IMn7d/6kjR4jzzE+iIr0cR0SGOD1rSTDf0uW2k3jv?= =?us-ascii?Q?sHfz+3DdYWL7l34vqlazwX42oZWBFNGw0R9VVgZpGu0Ej0NuDyYIJ9zBDdR2?= =?us-ascii?Q?crrR3ncwzAvZZA/vDk3RIZo9I5nsOiCRfMdEiROguJdiAEm8bevtZEJuQtwV?= =?us-ascii?Q?Za/N0wJUYF3yPwWl+lzJA5YLI/ssgrV5C13w6rtQzb3J3yVPcghlSyyOF649?= =?us-ascii?Q?ljbse3VfvqByzxVbT5NJKglt2wZHMR9qxEqtojecrsKJUvUgmWGHgo7IFoR3?= =?us-ascii?Q?VwM5QrsAAEraow7IBSD6jRqd9kPb/RCGMRsjO2dpysON0e2ii0IRUvwvcisk?= =?us-ascii?Q?LIIzGE984bJFUmoS8vWpEH5/AQuNe09IVdY6mPEdAbWLMx8CmxQJAHGaYynx?= =?us-ascii?Q?ElrLLB2/7jm9ewUuA9QphNc+Bpbtw71IL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50AGjGvPa4Lc9ETWp6WdIbJt3hWQyUcJT4ZU3VNR6h54FKPWVLAR?= =?us-ascii?Q?kq/SYYEf483Re0iiB/EeA9X1EbWH4H/GddGP/mrVV+4SuhJIPp3R9kMWQXL5?= =?us-ascii?Q?8UaVeMYADL9xxkn7PxofZw/4ZFDXnyXjzqKlb5hIrh3YrdIQHh34JMn43bil?= =?us-ascii?Q?jGCQrvZtqDmXCEXv0mNGVjwhArUzQ2uMC8AdB37laI08Vt+UE88GRH0Tw9mC?= =?us-ascii?Q?KA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bd0dcce-da57-43e3-b3dd-08dccd739004 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 06:25:40.2539 (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: u4JbET+PuDy7lmmgL/Xlu59F+j7uNCHwuLlqO7emcYsUkrH0OrC7aPJnnZEsoL4XoFbo/0e1b1hG0eQEO5IwOTPMOY67nt2di2C/pxjEzak= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR13MB4610 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 From: Qin Ke Add help function to encapsulate logic of updating vf link speed. Signed-off-by: Qin Ke Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/nfp_net_common.c | 33 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 25872a4131..c918469047 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -777,6 +777,24 @@ nfp_net_speed_aneg_update(struct rte_eth_dev *dev, link->link_autoneg = RTE_ETH_LINK_AUTONEG; } +static void +nfp_net_vf_speed_update(struct rte_eth_link *link, + uint32_t link_status) +{ + size_t link_rate_index; + + /* + * Shift and mask link_status so that it is effectively the value + * at offset NFP_NET_CFG_STS_NSP_LINK_RATE. + */ + link_rate_index = (link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) & + NFP_NET_CFG_STS_LINK_RATE_MASK; + if (link_rate_index < RTE_DIM(nfp_net_link_speed_nfp2rte)) + link->link_speed = nfp_net_link_speed_nfp2rte[link_rate_index]; + else + link->link_speed = RTE_ETH_SPEED_NUM_NONE; +} + int nfp_net_link_update_common(struct rte_eth_dev *dev, struct nfp_net_hw *hw, @@ -784,23 +802,14 @@ nfp_net_link_update_common(struct rte_eth_dev *dev, uint32_t link_status) { int ret; - uint32_t nn_link_status; struct nfp_net_hw_priv *hw_priv; hw_priv = dev->process_private; if (link->link_status == RTE_ETH_LINK_UP) { - if (hw_priv->is_pf) { + if (hw_priv->is_pf) nfp_net_speed_aneg_update(dev, hw, hw_priv, link); - } else { - /* - * Shift and mask nn_link_status so that it is effectively the value - * at offset NFP_NET_CFG_STS_NSP_LINK_RATE. - */ - nn_link_status = (link_status >> NFP_NET_CFG_STS_LINK_RATE_SHIFT) & - NFP_NET_CFG_STS_LINK_RATE_MASK; - if (nn_link_status < RTE_DIM(nfp_net_link_speed_nfp2rte)) - link->link_speed = nfp_net_link_speed_nfp2rte[nn_link_status]; - } + else + nfp_net_vf_speed_update(link, link_status); } ret = rte_eth_linkstatus_set(dev, link); -- 2.39.1