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 BFDE745ED6; Wed, 18 Dec 2024 07:53:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8CB354066E; Wed, 18 Dec 2024 07:53:17 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2122.outbound.protection.outlook.com [40.107.93.122]) by mails.dpdk.org (Postfix) with ESMTP id 6870A402AE; Wed, 18 Dec 2024 07:53:16 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xhPMBQD0j6QnEAtpcaGFHWX2+4wUA8Z65incel44sYJNQqOVTQY6NfSXrdBdJ7lMfk7MmGtkBMj6mVsqd+Wc2E3W0xZSMFryiVK5ckfIF3eYELRbAUVwMRhg/mS5r4joGDRZuffsFmNbkoJ/BPyTOX1gZLJL5W3QazMriVPTSfuMVqtvoG47RQFPOrIbihFINAoOpIjQFnyRBGrnF3rIiJa+S9maWhgCwldYKUyaVINe+iLJf2c9xOnsjXTlXxMOxO2LTbxMlVfuDAb+0TcFD6qDRUvr+R0BZ8arSBkKRum1QTrfVtCPUmclRJ61g6SoYtE3ElQES7tjpyoADgFPgA== 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=i5LsdvHmMuI6ZLQnXP7F0HbEaQoahkssLq+yLN68FWw=; b=vBZJngCK5s12H9Uo+hxrEWBKuFiDWaydbf5BjYJLIPeysipZ1POSRxYJX6CtimKSNA1qwfPUaKKtfg560tstFOd2TZw/fh5gpfN0RQLH7Hx+nXsKFrrhc9hhynQoL+2A0zc9sG9L3pK57AMgofDQdWElQJDhtzxaijC+YrrThrMKcWeOP3iE4t/R8rG8Tu4nyTFnzW7KHhIT8yTwZzAcSSIcWBrjqDidm0Q6JAgHHzM0N6LiFadNdJQdAQYZQHaGr1eAPOKk0UzgyfBtvvtO3UV1qNJFnimfnUs1z+6h6UB9Ug6TbT4v6etfKwApu08BBzuyGrCiNqh9BL5TyQ74LQ== 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=i5LsdvHmMuI6ZLQnXP7F0HbEaQoahkssLq+yLN68FWw=; b=tmlUUPYTwRsyQ/qr4fW/ImlR/h45WH5V7fQHhRi9SibCBgKAnHTWnIIjueaZJTKTvzSDEkFrXsgzrPa/DvLqim0u14EgzJl1quZMAUcY9YJvYir7sNdU0d0Pa7HwFEU1gHesMiCmnPKQf0mT1bAL0xz6cDfs9SJj97SpSsvEjWU= 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 SJ0PR13MB5426.namprd13.prod.outlook.com (2603:10b6:a03:420::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.20; Wed, 18 Dec 2024 06:53:14 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%6]) with mapi id 15.20.8251.008; Wed, 18 Dec 2024 06:53:13 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , stable@dpdk.org, Chaoyong He Subject: [PATCH] net/nfp: fix VF link speed problem Date: Wed, 18 Dec 2024 14:52:55 +0800 Message-ID: <20241218065255.1698520-1-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0022.apcprd02.prod.outlook.com (2603:1096:4:1f4::16) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ0PR13MB5426:EE_ X-MS-Office365-Filtering-Correlation-Id: e158c8a0-374d-4d93-9fa3-08dd1f30a491 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?/pRmlY3cGhfZkOF+KdQA+d+HwZlQfKsAKXv5foASL0GsAYw0NLvu1miJSFFD?= =?us-ascii?Q?WElHFCRoxkqOO9S6596oCioinTCgEcCVY/zY1+6Ld0stUEoxcm2lfGZ4PMr5?= =?us-ascii?Q?hFldnC1cRnlXiAVA3D6FfMNsQPBYPG7OJuwg8DTANuDWyHTvC83j5v5pK758?= =?us-ascii?Q?TJ4+MsAD+3U034wLdb43NNweUO44raNJCLXRL7zT157P9fScwCUteFxsiIKd?= =?us-ascii?Q?IxvMXuPpta8rE9NzrvaJYQGBlsXNynvcobLpDal+mFyx6nXK/Kv+m078f2xe?= =?us-ascii?Q?8jfcc9GYYnGeIYFMGh4HJ3aIH8yaSz0fkNT3ITXIxTjMfwNxsVsshMahZCem?= =?us-ascii?Q?ZesWkkeAkuqP/uG0P0wa977Vx4ECAG/QREdJgfUkO9BmF0fm8ycZCThIo+WU?= =?us-ascii?Q?cU3FMZVCUXncPuW38JvNUne0SZhOLSyEstZj+G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J7nw1vgR0f/XhvPSkJ1BXqD3kptlxmrPyMknOnXV9MLmZjiKcE3?= =?us-ascii?Q?1wsgVUxANBUE7aLvoP59JCCJL6RlYhX3mUZ5SMEsDz3CPmSMkTOd/vF1X8L5?= =?us-ascii?Q?pE3P5eInvz3xIfPRPvzfsfqifaKyh5/e?= 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?qDn6Ob0drEWv1/p8XwaZ1lCpjZKf8b08U/ht9qIm4KhXMeuAH8xHoi+w2SSD?= =?us-ascii?Q?USuiTYHeoSvbK3mWfssQo8JVRmE7YnRVxGr9M7CWTDhjIQKNEqUMMuZ9IPYr?= =?us-ascii?Q?6xxRTyTTsiZmHc4HhzkqVPKiP4cWd2OVaE/EDI5GTcVNDZtqOXRtvQ2CY6t+?= =?us-ascii?Q?Z20aE90saN3fqACqmnPq8iaRLEKOYQJ94b7IapZ+JoLeO0k/xzmkT1xVXsc6?= =?us-ascii?Q?u1Z3qtTwiaX2K6Do7SuDRZvMwMNpTwKQTFKPEE2GnCc5vIFx0Cxhs7m8NROl?= =?us-ascii?Q?y0q5eAbFFuLfMtPCfdhUaswGQNagkebInOaql3MUISsYrC5RmT+u6GkvfmqO?= =?us-ascii?Q?fnfIcBln+uwug2owN+zje+OrvGpP+zrPAKu+f1pmenDW4N4dVcjoBZoFzUr7?= =?us-ascii?Q?NXK0m4u6Qoerdsea29wZ2IhtOly8K2fhw+QzLTyhxBR1OMrt3gvag8DPUl6z?= =?us-ascii?Q?GqmmRyKBy2PWmx6wJcromD27wplrbs39Avh8Tqrgavnz5st9IZeoej39lVkQ?= =?us-ascii?Q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dlwRopX/D/OO0Ai9md8ZAt6?= =?us-ascii?Q?dXWJ4vxeL5kcjIyJZvwVdsyoxafu2PYQAnLksVshFJtoEtB35hkRJ6QZRZqf?= =?us-ascii?Q?Dy+TyJOwOAggQ2oRFXrbUQGhmkEbUXeK8/N1ZXKcmbl2ebxrg1vkhR6dbZmn?= =?us-ascii?Q?kzRt5t9d+z9BbugIXeamtLeHQ/NGPu1FVbj0IhztksPB56dDgtoIZOHUCleK?= =?us-ascii?Q?pg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e158c8a0-374d-4d93-9fa3-08dd1f30a491 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2024 06:53:13.8185 (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: f806m2p1maQUcyADrbGVGt2u6qljK74bAeujkDzJuvX5ynF5qBU4SWAlajuO2W8djcKnA1WTnjFDA7/kSSxy2X3UhQbNumCzcJzhgzT4AF4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR13MB5426 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: Long Wu The previous logic does not update the 'rte_eth_device' link status when the port link status changed, which cause the firmware won't be notified by the PMD. Furthermore, the physical representor port should also notify firmware its current speed with multi-pf firmware. Fix these problems by modify the related logic, also add needed helper function at the same time. Fixes: eae7dadbe987 ("net/nfp: update link status reporting") Cc: stable@dpdk.org Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower_ctrl.c | 14 ++++++++++++++ .../net/nfp/flower/nfp_flower_representor.c | 19 +++++++++++++++++-- .../net/nfp/flower/nfp_flower_representor.h | 3 +++ drivers/net/nfp/nfp_net_common.c | 11 ++++++++++- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 92887ce1be..21bf26b738 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -420,6 +420,8 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv, { uint32_t port; uint32_t index; + uint16_t link_status; + struct rte_eth_dev *eth_dev; struct nfp_flower_representor *repr; struct nfp_flower_cmsg_port_mod *msg; struct nfp_app_fw_flower *app_fw_flower; @@ -456,11 +458,23 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv, } repr->link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; + + link_status = repr->link.link_status; if ((msg->info & NFP_FLOWER_CMSG_PORT_MOD_INFO_LINK) != 0) repr->link.link_status = RTE_ETH_LINK_UP; else repr->link.link_status = RTE_ETH_LINK_DOWN; + if (link_status != repr->link.link_status) { + eth_dev = rte_eth_dev_get_by_name(repr->name); + if (eth_dev == NULL) { + PMD_DRV_LOG(ERR, "Can not get 'eth_dev' by name %s.", repr->name); + return -EINVAL; + } + + nfp_flower_repr_link_update(eth_dev, 0); + } + return 0; } diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 4017f602a2..9601aa5f96 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -24,6 +24,21 @@ struct nfp_repr_init { struct nfp_net_hw_priv *hw_priv; }; +bool +nfp_flower_repr_is_pf(struct rte_eth_dev *dev) +{ + struct nfp_net_hw_priv *hw_priv; + struct nfp_flower_representor *repr; + + hw_priv = dev->process_private; + repr = dev->data->dev_private; + + if (hw_priv->pf_dev->multi_pf.enabled) + return repr->repr_type == NFP_REPR_TYPE_PHYS_PORT; + else + return repr->repr_type == NFP_REPR_TYPE_PF; +} + static int nfp_repr_get_eeprom_len(struct rte_eth_dev *dev) { @@ -112,7 +127,7 @@ nfp_flower_repr_led_off(struct rte_eth_dev *dev) return nfp_net_led_off(dev); } -static int +int nfp_flower_repr_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { @@ -125,7 +140,7 @@ nfp_flower_repr_link_update(struct rte_eth_dev *dev, ret = nfp_net_link_update_common(dev, link, link->link_status); - if (repr->repr_type == NFP_REPR_TYPE_PF) + if (nfp_flower_repr_is_pf(dev)) nfp_net_notify_port_speed(repr->app_fw_flower->pf_hw, link); return ret; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h index 3f6ee32fe4..a7416eccab 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.h +++ b/drivers/net/nfp/flower/nfp_flower_representor.h @@ -32,5 +32,8 @@ int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, bool nfp_flower_repr_is_vf(struct nfp_flower_representor *repr); bool nfp_flower_repr_is_phy(struct nfp_flower_representor *repr); int nfp_flower_repr_stats_reset(struct rte_eth_dev *ethdev); +int nfp_flower_repr_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete); +bool nfp_flower_repr_is_pf(struct rte_eth_dev *dev); #endif /* __NFP_FLOWER_REPRESENTOR_H__ */ diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index e68ce68229..aaa515bac2 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -159,6 +159,15 @@ static const uint32_t nfp_net_link_speed_nfp2rte[] = { [NFP_NET_CFG_STS_LINK_RATE_100G] = RTE_ETH_SPEED_NUM_100G, }; +static bool +nfp_net_is_pf(struct rte_eth_dev *dev) +{ + if (rte_eth_dev_is_repr(dev)) + return nfp_flower_repr_is_pf(dev); + + return ((struct nfp_net_hw_priv *)dev->process_private)->is_pf; +} + static size_t nfp_net_link_speed_rte2nfp(uint32_t speed) { @@ -826,7 +835,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) + if (nfp_net_is_pf(dev)) nfp_net_pf_speed_update(dev, hw_priv, link); else nfp_net_vf_speed_update(link, link_status); -- 2.43.5