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 1545C4590B for ; Thu, 5 Sep 2024 08:25:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 81E6642DE4; Thu, 5 Sep 2024 08:25:52 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2110.outbound.protection.outlook.com [40.107.92.110]) by mails.dpdk.org (Postfix) with ESMTP id 40B9042DD6; Thu, 5 Sep 2024 08:25:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PFGo2yhUiugqTP6Ax7W73qVvr8sHlzE0QbSzhwAJ/KXpyYi7zy/CQqOxV4o81TW0v8TwaTPAl7v2Xh/FPCipTrGJ99f7AxkYeRLYvbysni6ahH2NXS64AoifSUuP/Yy2uQvQtlDkvlwnELAnMKhHlXiZ7poLctKMXCQzOcTXUjKJz+Mvlng9JOkhbhF6dG/fft3JULnF6rzjk87RxoQOVtBElRqK1+gX2pLfE4YWfFO56Y6xTIgqgcHvTxoLRYhe+DzYkh/9B7Dla0bLsHy11n/VCWEARd7VtRt2dFPrRHP3MAEQtRX15qpfkVMY/YvJFjKJeJiwUBsSd/zdd5ORgQ== 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=rjm60yfkMqPW249BB6tUE8QaZ5nZjGuZkE0F7pKyE8U=; b=lsS9xP49MmDcqcD9mYSLYwoN9+uduMSQyKM6m3er64pvZg1FO7azyaTqhnk9T/a84cfqcVCSgkY1WbWrm6cDHO/8PAKhRyZXjMeF6sAcEf3CiDJpjTIn1w9AoMq22/ItIHY9NV7JT9SHzCoc5+FAvk6em5ogMVifVafA+gwzcoch29MV+XxVIQ0SKXn8Vaf/y9Sh/Dco29CuRXjeD+EOL1Wkb1EtkGt+1Yfm+ZgolRvI20Qpk4Zc7k8kB9t45m1LoWu2T3TDVgvUpM8iQnszy+EwXzlCcGt7+9UeQdTfKJP9yfU2h+H39xc++TZIw17Ssasnd8Pqfjtx+Wcxhb/wTw== 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=rjm60yfkMqPW249BB6tUE8QaZ5nZjGuZkE0F7pKyE8U=; b=Mx42RHwyV10nijWPfljtia8BnyhIKGvc5LtMAfUWA5GrDW+ArnqsF3AdExmLIR31QEJa8FqXzFRbt4m9+S1P90UcSSpex9I6/kv61XG4AbMDprdxxVmDtXNJPPKJIaXOVQTyBC74qq7FItk6jgcXGClW02vvt+Gd++daPmBzM/M= 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 DM6PR13MB4147.namprd13.prod.outlook.com (2603:10b6:5:2a0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Thu, 5 Sep 2024 06:25:47 +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:47 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Qin Ke , zerun.fu@corigine.com, stable@dpdk.org, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 6/8] net/nfp: fix representor port link speed update problem Date: Thu, 5 Sep 2024 14:25:09 +0800 Message-Id: <20240905062511.2710102-7-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_|DM6PR13MB4147:EE_ X-MS-Office365-Filtering-Correlation-Id: 8586e56e-cb90-437f-776e-08dccd73948c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Xk5Pr2bZfpCyY/Qv+vmZn6eFUeSNFUBPQ5+/fGwKVCMbr6I4uInu7ZCrB4S3?= =?us-ascii?Q?0G/utsmO8fcwUCHsVJLayZmKpmwagDyhbtInEZYEdy7EyN3pALbvxwTR71Q5?= =?us-ascii?Q?/eJMww4u9nF6zhsfL1FRm8gF0AlYfRkrT6SgBaJRHCET7ryatciu4wmAXKus?= =?us-ascii?Q?aCFTshUCGcnPcNlnAiybkWt6VF/H2Fbma/ybdfz4yk/4rG+gyCuH8C78QR2+?= =?us-ascii?Q?keT9iTh7txyj0wTbuEGH4fPgsRPP62+q27i/hGJ9qR1P384GABWmTFKEUfrc?= =?us-ascii?Q?TryGKzWJqFM3xMXw/d78Gae+ACe5YoVl/h6eySFeOgAGrFdFEkrMVTx3XCt0?=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dqCtK95D6iCRDbk38OooWJpD/H+eeLaLWviml93?= =?us-ascii?Q?hw2nzWPfabeDxd/SwhTBKyOzCtxeQ6F47CRPjsMkCXtP/0RCrSYcDEBnxzUw?= =?us-ascii?Q?t/wigFLVjW0etP2d2Y70hZBh9IILdbyUrPHT0aCA0eHLaGeQHnSG97Ei0XiQ?= =?us-ascii?Q?y7uFV/zN+sthucGjX7g9lXbU0hI1PYwtIy1ogOBuhATtm8MFxw=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)(1800799024)(376014)(366016)(52116014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SqCJcBcigcQXBAL12AQZfHgbi6xU6heHANiwjq9TWZunWdjxKxZxg5AspSEQ?= =?us-ascii?Q?jWEiIRHa3kvb5LTDThDm9KAseuEtVwdSRYUPtt4fgEETDS0UWUKI6wFphz2A?= =?us-ascii?Q?8zk59IAng+9QRO5Zt5U+yG4QfRCRZICtX3/6LtEI8lRDrUHw/fMmemxWdCAY?= =?us-ascii?Q?yu369/8irnYEuECXaZ3T52M/JsNnBAuxjDrp3swTq1gGpRmVLSgXWybZhnZ8?= =?us-ascii?Q?74r5wzYwNvkzgX8Mz2sHnORbUR53nMg/8sE7VpwToHGstdoP5rMAQ3WS5Qew?= =?us-ascii?Q?YYhJ58T57arSfHa3t/6bDXAEJOOcdC00Yrw6SIupnl7qrhsUeCLF/L0rxSXP?= =?us-ascii?Q?y1Qio9flYgZZm3Aoygsi1l69+4MifHuNMyK+fDnJtUFNEwtX+kjJ09zHkZX1?= =?us-ascii?Q?MgPt1NGeU8fg+pb0lbwRMK397x9a+FpWIHDM2wlRHgQmI/8BWvy54vHMdFlZ?= =?us-ascii?Q?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JmY225V?= =?us-ascii?Q?mPNGCIWnBim1yQJqDvvbbZkPUYsQhp1hytVSrIBC5qeSfK6iRNdLOZVSLre0?= =?us-ascii?Q?JS3LevFQLfvilE4DBEGK8BJ+AlnrBnip04MG4GAZF3S1tfhib+mJSIQVKs5I?= =?us-ascii?Q?rh3g4OKTFJGbr7XipU9Lb3ElOkaou3sBxDaaQwLpL4r9FKXNKaghobaaZ94r?= =?us-ascii?Q?Kt+nh4IHv/71sml8SoJJIb3TPRh2pCwvNWa6hZR369yABl94GabpmG5jX6L4?= =?us-ascii?Q?pA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8586e56e-cb90-437f-776e-08dccd73948c 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:47.8542 (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: 1gdz5Us2flLr3h+E21FfgFeJLDjaB4xU5Saip/snkxa9PCvRY6ZJqobvaj3l5DJejpfx/nCD+Nej8x7XIb6RY7OzW+9G9y6Ib2AzL3xbyyI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4147 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Qin Ke For representor port link speed, the original logic finally calls 'nfp_net_speed_aneg_update()' to update it. But the reference of 'hw->idx' in this function is invalid for representor port devices, the logic has problem. Fix it by getting correct 'idx' for all type of deives including representor port and make reference to it. Fixes: 8412feed3f26 ("net/nfp: modify link update function") Cc: zerun.fu@corigine.com Cc: stable@dpdk.org Signed-off-by: Qin Ke Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- .../net/nfp/flower/nfp_flower_representor.c | 2 +- drivers/net/nfp/nfp_net_common.c | 32 +++++++++++++++---- drivers/net/nfp/nfp_net_common.h | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index e7593313e2..054ea1a938 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -40,7 +40,7 @@ nfp_flower_repr_link_update(struct rte_eth_dev *dev, pf_hw = repr->app_fw_flower->pf_hw; nn_link_status = nn_cfg_readw(&pf_hw->super, NFP_NET_CFG_STS); - ret = nfp_net_link_update_common(dev, pf_hw, link, nn_link_status); + ret = nfp_net_link_update_common(dev, link, nn_link_status); return ret; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 6761a16ef2..daed57e374 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -311,6 +311,24 @@ nfp_net_get_hw(const struct rte_eth_dev *dev) return hw; } +uint8_t +nfp_net_get_idx(const struct rte_eth_dev *dev) +{ + uint8_t idx; + + if (rte_eth_dev_is_repr(dev)) { + struct nfp_flower_representor *repr; + repr = dev->data->dev_private; + idx = repr->idx; + } else { + struct nfp_net_hw *hw; + hw = dev->data->dev_private; + idx = hw->idx; + } + + return idx; +} + /* * Configure an Ethernet device. * @@ -743,17 +761,18 @@ nfp_net_allmulticast_disable(struct rte_eth_dev *dev) static void nfp_net_pf_speed_update(struct rte_eth_dev *dev, - struct nfp_net_hw *hw, struct nfp_net_hw_priv *hw_priv, struct rte_eth_link *link) { + uint8_t idx; enum nfp_eth_aneg aneg; struct nfp_pf_dev *pf_dev; struct nfp_eth_table *nfp_eth_table; struct nfp_eth_table_port *eth_port; pf_dev = hw_priv->pf_dev; - aneg = pf_dev->nfp_eth_table->ports[hw->idx].aneg; + idx = nfp_net_get_idx(dev); + aneg = pf_dev->nfp_eth_table->ports[idx].aneg; /* Compare whether the current status has changed. */ if (pf_dev->speed_updated || aneg == NFP_ANEG_AUTO) { @@ -761,14 +780,14 @@ nfp_net_pf_speed_update(struct rte_eth_dev *dev, if (nfp_eth_table == NULL) { PMD_DRV_LOG(WARNING, "Failed to update port speed."); } else { - pf_dev->nfp_eth_table->ports[hw->idx] = nfp_eth_table->ports[hw->idx]; + pf_dev->nfp_eth_table->ports[idx] = nfp_eth_table->ports[idx]; free(nfp_eth_table); pf_dev->speed_updated = false; } } nfp_eth_table = pf_dev->nfp_eth_table; - eth_port = &nfp_eth_table->ports[hw->idx]; + eth_port = &nfp_eth_table->ports[idx]; link->link_speed = nfp_net_link_speed_nfp2rte_check(eth_port->speed); @@ -797,7 +816,6 @@ nfp_net_vf_speed_update(struct rte_eth_link *link, int nfp_net_link_update_common(struct rte_eth_dev *dev, - struct nfp_net_hw *hw, struct rte_eth_link *link, uint32_t link_status) { @@ -807,7 +825,7 @@ nfp_net_link_update_common(struct rte_eth_dev *dev, hw_priv = dev->process_private; if (link->link_status == RTE_ETH_LINK_UP) { if (hw_priv->is_pf) - nfp_net_pf_speed_update(dev, hw, hw_priv, link); + nfp_net_pf_speed_update(dev, hw_priv, link); else nfp_net_vf_speed_update(link, link_status); } @@ -851,7 +869,7 @@ nfp_net_link_update(struct rte_eth_dev *dev, link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; - ret = nfp_net_link_update_common(dev, hw, &link, nn_link_status); + ret = nfp_net_link_update_common(dev, &link, nn_link_status); if (ret == -EIO) return ret; diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index be5705636f..a32f3b330a 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -293,7 +293,6 @@ int nfp_net_promisc_disable(struct rte_eth_dev *dev); int nfp_net_allmulticast_enable(struct rte_eth_dev *dev); int nfp_net_allmulticast_disable(struct rte_eth_dev *dev); int nfp_net_link_update_common(struct rte_eth_dev *dev, - struct nfp_net_hw *hw, struct rte_eth_link *link, uint32_t link_status); int nfp_net_link_update(struct rte_eth_dev *dev, @@ -356,6 +355,7 @@ int nfp_net_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size bool nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version); bool nfp_net_is_valid_version_class(struct nfp_net_fw_ver version); struct nfp_net_hw *nfp_net_get_hw(const struct rte_eth_dev *dev); +uint8_t nfp_net_get_idx(const struct rte_eth_dev *dev); int nfp_net_stop(struct rte_eth_dev *dev); int nfp_net_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); -- 2.39.1