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 E8E0045B17; Sat, 12 Oct 2024 04:42:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 705E640687; Sat, 12 Oct 2024 04:41:53 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2132.outbound.protection.outlook.com [40.107.101.132]) by mails.dpdk.org (Postfix) with ESMTP id AF0704065E for ; Sat, 12 Oct 2024 04:41:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s3q6z1f7WSVmHmV+4Ki+Kcf/gJXL2lHy9c+55o79VCVXdYsrk1damJvfrCdS8evqjz6sgMNzwo6XlwM0wdzqhFVivwG9MmnsOr6In9pheibZWD8s/R72P6321lQTVrJypQ2bExSfirEyelv1tNLr+SbUSpwsraXGn8AQn+F3THKBu2Zq7Yxa/haEI89VF0Y/27Zltyl0XQguqpYRRe85ywQeBgwC9YB4F12f/pEYcZtgUYzSfZK0K3Gjg0oiKSF+fzEv3G2Q0LVYp0CtzRQM7wPAN7a1gv/QbQzVLvMBzbikyE4drMKS9+vfrGU9muPe+uHVqPEh3lRh4sRLQRmPGA== 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=viomsFD6tZb0DvLIIOWrflv4j2pNNclSq+64GjnHrF0=; b=f1+n+yrchg2MhKqC8PgcohWPk+J9okyYf5JZLFqHIZ1ZVPIlZoGdhAGRlEiWNfg8YeBUl8xk2skFefBV8mLrCf+m2LgAqjsEixL8/AwqIASF+BzpqAUH3iMnaPBOl9MhWuY9S5b0FdnAppwK0C8QLLyJQv8qnxqjMDpTVscMNtsf9txjWZdvSHj7Uww3Dpc8D3xNH/p1PMSBdnWKk8Wb9P5QenaTGOjqUzGaK/7/edwkQ7zD/C0SxS9BIW36V1Rz85t097hFWYHyBVxQJqf5S/id4h35uzsNHgue/ld1hAS856TE3teBxQfyThSu4SSt87f5XgrNxfonIVPMXgqr6g== 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=viomsFD6tZb0DvLIIOWrflv4j2pNNclSq+64GjnHrF0=; b=QrUc5174hDkvHn/SRnxT+HMYWm0ANQl3DUW2VNqVRziD2bViCWJz5GMlo3MSq5XRCr5pNk84j49q8xPEBfXz/3qqrjHSzkxZXZ+cxcw7wrNgMhuZFc2pr0xovfIL/C0A1ujOMuG99vVPvClIybb0jNMMg82QAaQ3jltY+QVmCAs= 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 CO1PR13MB4902.namprd13.prod.outlook.com (2603:10b6:303:f0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.21; Sat, 12 Oct 2024 02:41:48 +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.8048.017; Sat, 12 Oct 2024 02:41:48 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang , Stephen Hemminger Subject: [PATCH v2 06/10] net/nfp: add check logic for port up/down function Date: Sat, 12 Oct 2024 10:41:03 +0800 Message-Id: <20241012024107.3795935-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20241012024107.3795935-1-chaoyong.he@corigine.com> References: <20241010091716.3631747-1-chaoyong.he@corigine.com> <20241012024107.3795935-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0001.apcprd06.prod.outlook.com (2603:1096:4:186::21) To PH0PR13MB5568.namprd13.prod.outlook.com (2603:10b6:510:12b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO1PR13MB4902:EE_ X-MS-Office365-Filtering-Correlation-Id: 3bd14d79-1c16-442d-68e3-08dcea676b23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?MpEtNxH1r/mx+hD6FQ0s/7NHds0LEkGv1Mdim+Ajdr6nOt9dHX4BfBfbcRDM?= =?us-ascii?Q?zeYjcRAvsOukzlbCINWoj96dqBpVBkTC0ZZZPJdVtvrAejKGGZvcnpUYr36p?= =?us-ascii?Q?wHEsYghtxez+2V9IM1ziYpHEyPTyxDDpd7kPAeQCfT29O/BmxpQJb5u/tuhn?= =?us-ascii?Q?w9l6KS3pwMtSpTlWZS9sirOEMCyf+l7ZGijak7+DRXhsQCN170oDbemp77gd?= =?us-ascii?Q?G/enFOLuJKgkgwzxFM2VLQZMBy4TuCwMKOlBZpRMaj/XMap3/Cwcx28j1A9L?= =?us-ascii?Q?B4Y8amHUQvr9HARxHWztm393NcifYfTbYNuPwQc55GyZpRhig72TdoYafaVZ?= =?us-ascii?Q?gAkKfeQnSVutj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ccKB?= =?us-ascii?Q?DSi7EjkxLfoX/t+XXj6eWrl73E1nn985wxNqqForkG5cXPNA6Brd+YZDV7qA?= =?us-ascii?Q?KhytP/AL9mBxFPJ5HWuXItYGr8rX8LcA8+iRsPWcGS+71w=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)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5fl8as8Gk1G6lJrNJh/fuDG8TBFMGV9KMEfVUsjruMB10Y/m7/st0leEuZsz?= =?us-ascii?Q?2vLh6oBivZEPOyjN6VX9B/SZjaDHCeE0eprr8Xgosn7vjGjbE4JbYklw3c6z?= =?us-ascii?Q?Hj5PZ4MSwql9szbxoHmV5K9BFtOjyh5oVR/k57jTFd32e/Nh861ZSIrg+Nwo?= =?us-ascii?Q?IerbczEqZ7aZ0z1G1TgBSNAif9E77D253r3HWb8gfPsGD5GxcFoLvlLyDQpZ?= =?us-ascii?Q?NF0gMojbh3BDblBMkcxs0bfJcgBYf6O5Pr4i11GvxVEmuiYFmOAqWZ+HoFdE?= =?us-ascii?Q?8BqPFIH8J3vRXH4HW7r80NlfJE9ol9Np8E4itH6nIHNxt6qCv2NbIFfZ622y?= =?us-ascii?Q?jyqJHD0pZPcIUKUg48XUS7/+E3b/HRYJMWq4n2fI76PA9GM+LkFZWB6qjwiD?= =?us-ascii?Q?B4LkHqqGvqqmRTU96xCHH1/8FfvxeLC2b2QAme0yIUqy25dmR5BQMGR/x4ks?= =?us-ascii?Q?00aciVd5J5sLvNOXLTjbEMNIcdV9MrVnAA15xgZPWbAUU+zsCaP6XsgqvkJv?= =?us-ascii?Q?5FRe2mol3G5q1lUe+rFyGF+UPN+yiB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ifI1nrbhj5Sk8qsafqtMcZZAokWQxDIVScdhdcgb22ejZ1RKLXwh4LGp+WjA?= =?us-ascii?Q?Atcs0isgJzDqpYtIXiq07MREKTCOIl+ImCGyjAriLPYkXW8b1uuOcUVdynfU?= =?us-ascii?Q?5K7+03h/y3V7is8FG+3qZLnwqHo3bRXLggIJ959xWUwnnVv0JBX4Z382AINS?= =?us-ascii?Q?oQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bd14d79-1c16-442d-68e3-08dcea676b23 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB5568.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 02:41:48.2858 (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: rETnT7MPNOeYVCD0QMQeoUJBR5EwlGp0ti7RfVzs66VrMWpTucg5y1/1JqFj2cL+08LhjRsJP3v/NHc5ke9vE/0G32eitSVICdUlbBOPoYA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR13MB4902 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 Acked-by: Stephen Hemminger --- .../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