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 A680A45B00; Thu, 10 Oct 2024 11:18:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EE1040674; Thu, 10 Oct 2024 11:17:55 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2095.outbound.protection.outlook.com [40.107.223.95]) by mails.dpdk.org (Postfix) with ESMTP id E59C040664 for ; Thu, 10 Oct 2024 11:17:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aymA/Ehv1YkmiH7Wrx4dDm6LPmKkmtrjlWUTA4EyDu6kyN0v/bJkwGvxzT0lETJAH996xyV4oa9lZE1PrzRwukV3546NqZY/DkJ4WILw8hReM257Pk7HLJI1GlWLfnIoT3oNFaYNW8ciOD5NRGDLXesvE3YXzYWIGAcLsRnmWdMxRZzPMbTQYJsAhskAgj1tZ/izIuebR6FgGNsQEYuZZ58Otze49Bb2Zk/Oo8zrVVjrF18HACg8ZYAWTs0N52TEw8PfV8t4DeHcawNFG4BaAq1Ts/LC5mnEaP43rpwrmab3Yd77FoCqLHYKIq8/J66JSxXE15IT9AlrtujgfYTbjQ== 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=5pufABaLS9KSPEdO3iEiMhjrWUn64zF3/4XBcyJX35A=; b=AAUt6nhT/H/WraF1Z1vh742F2hPEJpRALOIMqe55oFx52vFwhkyPN3dydX0CbtjJGvFAI9FHbBQ3xZqJibkZHtK9kGMPhG/ZycDz8ZjVv3WGPSdhCMFmSZTmYkNZHIiTyqR49IoTwQUb3UFWdeV3EAQoTEaEGiN3ez99izzqIyvgMaUBWBPy14DeCp/4e/vXQ/U8gs1D0xMMR65NL48YiN9l6UiPLWsoyy7Qz7AJ88p7LNNJCrxbl082eM9Z4DtvskaXMTWGOS8PlWFVlcWs7aVBprst4HWYq4KkwD7gszsZ2dRjIjEtHB0zaw+Z2Ln+MRuQVDN8kY9o4sivuhoQsQ== 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=5pufABaLS9KSPEdO3iEiMhjrWUn64zF3/4XBcyJX35A=; b=sWn43ATYIZ696wtM9Qw6zihLYaaAaCtlsLQGLuPzmyGQH6bSusGD7xywUfURoHat+kzrDy6bTXT5Vp50JryH+MY7BU3kxi0HikWbWbux1qPyEJanhDpo8izxD8s3L+ut/tOPz/2PVh30Mr2kFUKgJF4DeejMHogLa459+8cOV64= 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 MW3PR13MB3980.namprd13.prod.outlook.com (2603:10b6:303:5c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Thu, 10 Oct 2024 09:17:49 +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.8026.020; Thu, 10 Oct 2024 09:17:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 06/10] net/nfp: add check logic for port up/down function Date: Thu, 10 Oct 2024 17:17:12 +0800 Message-Id: <20241010091716.3631747-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20241010091716.3631747-1-chaoyong.he@corigine.com> References: <20241010091716.3631747-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TP0P295CA0060.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:3::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB3980:EE_ X-MS-Office365-Filtering-Correlation-Id: 7da4b0e2-78bc-4f93-3e7f-08dce90c690e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+dEWEcpVIEE47EUCKJhdlJ4EhJ/BFb/nr5d+To1Jr26cW7kad61ynCspwNGW?= =?us-ascii?Q?TEdFRJOWxcBg5nMdRovYacCvEKBbgcbRucKkPrPSxVEGOoaj/gQHOtiXA7In?= =?us-ascii?Q?EgPXhDGXCAVzLtihWvV1vSytQc2tDsX16UPqTa14CjQagqilyFfzgNgZ7XjN?= =?us-ascii?Q?5Md4Zree0b70nyTPgR50q54t1PIjQj1q6yuU7nAV257Ne+WAX/y74XIWFCYY?= =?us-ascii?Q?4Y7QRIpF3E/fao0KIMqgKA3X5Y4rfhaA4ghg1F/R5CCGXMqGMIJ+/hg9mzwk?= =?us-ascii?Q?2p7KrvbIaVjk34qmuMFK95vLxvB0PFQbl6rK2502/YZrKE8r4LE8qS5utbGi?= =?us-ascii?Q?SUIU7tWhGtDABUaW8wsSFH7c+ObicP1uKWh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cBkwwwyy9/l+CeXHEi9AJSeGLXTkiaEBW0X9NxrSy/7D3+ih9/HG?= =?us-ascii?Q?Ug3EsjhohMe2Spi71LgjK3r4S4MkHM9XiBUBnFQx7lM22Q=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)(376014)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?m+bBddA+RGH2Z7gFssvBd7xBt0ePLWhvmIz/vp7yuNBOSQ4VZskF4gRtEzgV?= =?us-ascii?Q?886N1tkpZYHUsAvgMDKySUq70PaxstbetS6NiEhIvFjWO3ShVgQMtpNkcPOH?= =?us-ascii?Q?ACw+3dY2A0AvRWJZUuXPbUXEDUePpT7BE2JRPV8UDfPy+hWvM8R/cnP7rwIN?= =?us-ascii?Q?aUIteQml8N/SAgP2beEOsw4VYypmjmAq0v1mnziwFHKZc69Iu8bCMntZymbF?= =?us-ascii?Q?P0MDDCvuKn3+d4XMOrLVo6YiHR2ZbQJcmAJjOrLeZM8DGtJxfmPV7RHGNlIi?= =?us-ascii?Q?SOG7gDsHRuS5ZAyQxC0EJLY0xt1pgbneSX2FKu9eZPVB6EdQrhFjYvD4/4++?= =?us-ascii?Q?DqbDkvKL62WbwRvDf5v56ui9klCsm8tJJt4941EicS6BvyA3hdMK0mSz6qav?= =?us-ascii?Q?EJSwO5P4kTLd8/T9E3FVzpYJXMz5Kka4mcQb6KIjdE4QPG4JI3v0zft1FSJu?= =?us-ascii?Q?je4w73PRVoF7hymml3SbO5xW4CSWcUhaeoKihwR+Nusj7UKQG1e+U5owKWGh?= =?us-ascii?Q?+8RK9pm74lHN1fz47ABb6sG8Y/VxUQwJn18rlvii30OPu2dgI7s+gUdC3/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IH1+Vp46pFqRV3Q1vgd78irhKnpPvY8W?= =?us-ascii?Q?0D+FDMTfOR7kV4oj0PLUNOZYzQrUn+u6+b2VIuRHFaLpJbx18fthYyM4bB+4?= =?us-ascii?Q?oa0FTSe5Us/itDug9Znn7RSIxpwcND7uLR0GG9bzKOBaxcXOqcpZtulKWd5c?= =?us-ascii?Q?nA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7da4b0e2-78bc-4f93-3e7f-08dce90c690e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 09:17:49.2971 (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: QGGBrXj9GLlN4fRJnKjoWolKd/54IAnsRrotbRUywZmBBGCosnxFt2hfjydgmwJ0vrJ6j6JLgKpyglLftatmzxTykRdAoLdgU6y7sK9QSRg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB3980 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 The 'nfp_eth_set_configured()' function is not always success, so need to check the return value of it. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- .../net/nfp/flower/nfp_flower_representor.c | 18 +++++++++++++----- drivers/net/nfp/nfp_ethdev.c | 4 +++- drivers/net/nfp/nfp_net_common.c | 5 ++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index d1558b905c..eb0a02874b 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -83,6 +83,7 @@ nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev, static int nfp_flower_repr_dev_start(struct rte_eth_dev *dev) { + int ret; uint16_t i; struct nfp_net_hw_priv *hw_priv; struct nfp_flower_representor *repr; @@ -92,8 +93,11 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev) hw_priv = dev->process_private; app_fw_flower = repr->app_fw_flower; - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) - nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 1); + if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 1); + if (ret < 0) + return ret; + } nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, true); @@ -109,6 +113,7 @@ static int nfp_flower_repr_dev_stop(struct rte_eth_dev *dev) { uint16_t i; + int ret = 0; struct nfp_net_hw_priv *hw_priv; struct nfp_flower_representor *repr; struct nfp_app_fw_flower *app_fw_flower; @@ -119,15 +124,18 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev) nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, false); - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) - nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 0); + if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 0); + if (ret == 1) + ret = 0; + } for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; for (i = 0; i < dev->data->nb_tx_queues; i++) dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED; - return 0; + return ret; } static int diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 2fe6b1a292..302149e9dc 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -495,7 +495,9 @@ nfp_net_start(struct rte_eth_dev *dev) } /* Configure the physical port up */ - nfp_eth_set_configured(pf_dev->cpp, net_hw->nfp_idx, 1); + ret = nfp_eth_set_configured(pf_dev->cpp, net_hw->nfp_idx, 1); + if (ret < 0) + goto error; for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 86a1fbfaf2..80d60515d8 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -2427,6 +2427,7 @@ nfp_net_ctrl_bar_size_set(struct nfp_pf_dev *pf_dev) int nfp_net_stop(struct rte_eth_dev *dev) { + int ret; struct nfp_net_hw *hw; struct nfp_net_hw_priv *hw_priv; @@ -2439,7 +2440,9 @@ nfp_net_stop(struct rte_eth_dev *dev) nfp_net_stop_tx_queue(dev); nfp_net_stop_rx_queue(dev); - nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0); + ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0); + if (ret < 0) + return ret; return 0; } -- 2.39.1