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 BBA9942354; Fri, 13 Oct 2023 08:08:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA4A6406B8; Fri, 13 Oct 2023 08:07:34 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2134.outbound.protection.outlook.com [40.107.220.134]) by mails.dpdk.org (Postfix) with ESMTP id AED2040691 for ; Fri, 13 Oct 2023 08:07:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SvqwYQ5iJEnaYlRLZxBFExd4UAE5ArNaEIF9hT8cYvFGPXh9z7bFkizJMy5TPnyYIHzqC75j7zO19jz1S4apLBAbLdm2XpnjC9z72I53xHdh1LWcykmuESRW1t4fU/JoofVSphQvVlfwXSaK5w5UQ1AZlA1/zTidgzS/YhxJFZNwVTqT1f38d5ovEfyMaXjZFgD1EUiRnbGn9UVoWtek6NIihJa3tcyswXU8oX1XVhXP1CvQDw+X/phKaDY97YTIXKIUwuTp191vkaqufl0dx7qObxNXAs6Y08UjcB7itVXqCC9Q+vP1vqPjMgW4Tvzcqv6JXi8o0q8maC9qBu+bNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=R5Ns+QvXT21Irh1DoWIzXPe151Kx/BIspbWI/40noyE=; b=jAJxZzYNsVi9H83h54MipakAGsIII5FGYc0t7BU9Xe6LTSpNhrgobZhCEV8lYVlGwJsBDvzp0w8gUovluB3nWKV6IRVVHvr2wSHrrtrJ2xZ+XmStAKjVTkSdOH0xM37Qv6yQIZbN3E1pk83wwjVQwEcfRoB71S0f9MnZHUltoh2pIG54H+vL2X27eliOD/IMiaBho0HUc0zO0Fd2TjoE1GmBE/mdPHqrwMOvwGOnAbkf8VqPF12qsl5JiUcs8Wo0P9IRrYMEcXKLKOiJEzXEN5RnxxxiJG6u7UkPw1nCcBM29amO4z3+IJju7CASKJVtYRVW2jL8RH2ww0uaVn8p6Q== 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=R5Ns+QvXT21Irh1DoWIzXPe151Kx/BIspbWI/40noyE=; b=RtLW8EsFTiUpNSxuuZ2QcTo1LsKQII1+GgnNg24lruhk2IcS2AcloKy7PLTkDk9vxdOKtJoF05s5gjf9iIDW1ua/XFhR5KEBdqec8EP4mWoOR7WzO8cC1ZZZVmafaeszAvtiNTXalXLLvCQy9xXWalbRwFcBRlBDie2EqAqoGDc= 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 PH7PR13MB6296.namprd13.prod.outlook.com (2603:10b6:510:237::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 06:07:31 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::2d5:f7d6:ecde:c93a]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::2d5:f7d6:ecde:c93a%4]) with mapi id 15.20.6863.032; Fri, 13 Oct 2023 06:07:31 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v3 04/11] net/nfp: standard the local variable coding style Date: Fri, 13 Oct 2023 14:06:46 +0800 Message-Id: <20231013060653.1006410-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231013060653.1006410-1-chaoyong.he@corigine.com> References: <20231012012704.483828-1-chaoyong.he@corigine.com> <20231013060653.1006410-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0008.apcprd06.prod.outlook.com (2603:1096:4:186::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB6296:EE_ X-MS-Office365-Filtering-Correlation-Id: aecd4fa6-535b-4698-b298-08dbcbb2af9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+K2K5yY6zQh+YOChswCHafYeLY4zFopcJ5GDon7oL09OEdx3A3JDPPHA9Gp4UbR2XrB0V9fYbbrgJtXFZNkRUxnOeWUHfgHkOkgUqFNJWjjk/rGSsz+qj+DwuwCqbx6HmOdDhE7rfaxTVsCmVATL5Toq2fAQAslvrXh0zvYi8Ho4ruJbBjmAZgm1xaCqKD/nswCnXufIGf4FArSZdT6nObIpKEM0M0gsWUpc/hDA3rtEDhAii+kXhg3mhQaDFFQn8gcKFG7j8asy9vmVVzgAQiFYDwwOKS9vmn0wL3SZ/EPqjtnj99mDvR1f3QaPL+zm6axJCdzE9rO+FanaI3xYawUJ/Qa4Ta2j9sK++vcXzSk6wMlTotrTElNWEigHU8fa70E8x7LgdJqIfrsvpBpaAVsD0+hhJv1yfNik4vSTayCk1DW7CjuxMv0Emt2sK9EDpUnlc0gMyx9RsC18AOf2Zo/AZfjRe3T1KdAQ+yGKD16V03lEOLzel9LMb49C/StYVza0Z4y8PywnnJ1CQNdQbhHsdosQw4yO/glr6KACY61Us4Ei3RMiGN6x3egXNhAQA6xv81qqyIcO1ffPoPBZ2MlwFXlckU9J0kaSJVGMYIUmvaFi5ncHng6sb0BhK3l+0vI+De4CBNiYY8MlSnYn8J/sX55tcXHGvkmD5bxqlA= 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:(13230031)(396003)(366004)(346002)(39830400003)(376002)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(30864003)(86362001)(36756003)(83380400001)(2906002)(38350700002)(38100700002)(44832011)(5660300002)(8676002)(8936002)(4326008)(6666004)(316002)(66556008)(54906003)(66946007)(66476007)(52116002)(6512007)(6916009)(6506007)(41300700001)(6486002)(107886003)(1076003)(26005)(478600001)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?V3xu5gFmMulWDwidhqV0E0A0w0PFNAYNpVmYFWQCuXYTfuD9EGPSmoL+E9LV?= =?us-ascii?Q?KFEKT8B977j/66oivsT4WOEKNIho3Pze7eOIDywgnvZawqWl9GB0utK2nLRD?= =?us-ascii?Q?YO2pMVCROPrE3wO5X++VluWMx3014EfN4Y8Xqce7atBrup02zffsgi/hSfat?= =?us-ascii?Q?ctAmAPHS+7O324ihyvu9WreclGiXjccPqIq+dSfhtaJPRk5ajigWhLehIHaP?= =?us-ascii?Q?BsjzOBFLXgol9JUM4PCxSfDwxRZTEmKNj9/ZzRvLDwT2nrjwFaCgHVF+1owI?= =?us-ascii?Q?WO1feR4otBuVrIRFIDoEZjh6l7D5bRjDd3CzFAtZeoFPmcV/z6r8vrPL+LbY?= =?us-ascii?Q?xHpBwau+G1xK9peZ6pTy1IEX18debcgEhHwT/sr4/D2WhconLKFrvE87PED9?= =?us-ascii?Q?wm+Gkx4X2Oefw1n9sst5ojDB2542aeeHReVqKC0Sw9Mcu+YmwXH0YMaV93H/?= =?us-ascii?Q?uFDiDyG4JP99ZWjxXFGqyPdWikMgGdcRteou5fr2+3UACIreanPKk9N+BkvZ?= =?us-ascii?Q?I0uzcLzF/UosKYzZ8NT3wlXO3xfmGDhKDvui47mQ0wekfL9N0Lbq6fPYR+GY?= =?us-ascii?Q?G5+O1sMRi9Ljrn2RIEoizB2aMMnFKJafOa7Mu8juK4Qjv8Zked7SkBtyEytl?= =?us-ascii?Q?5ucrKIeQ/VjYj1zgnH7euhxH4SOV5y58mNXPoNHxGurN5eWpu15deY73uLLx?= =?us-ascii?Q?UmdZqnflRcsyzCku+gAy66DHoADFcV/gFYi2ekg7ulYOE6o2H/8fcl91e+bi?= =?us-ascii?Q?JLo+S/gkncb/W+OJoYrl9SLC+Xs7GSm730yeQv1rUfjgSpf7NFZu8JJAxZka?= =?us-ascii?Q?NkrqQzbJ9vDf6rRNJTdi30yDcC9WmnV6XofzzPgJfV3Vqa+tiEq8pHrfCXQY?= =?us-ascii?Q?xpZPUgV8q37NpA8sDIUov2cReKvZ4v9AgzZ9ytEVNYpWev39C9+4IXw71gCw?= =?us-ascii?Q?oG4ytZTH1B+uBdTQ27QRYNNP8SDzbdYm4aG2kaTAdcyKqQjBBp5eW6SJn+Yz?= =?us-ascii?Q?E/6pkbmyyQWWbZj9A6BIuMzUuJ1YpSA9QxTd8LyHsjveQYe8XbBNg/a5ZnUc?= =?us-ascii?Q?kV/a9Z3zze9+DJCUsUfOXnu27iDiz2u7+hC/gWcDPTo/RWD8ywg5N8a0G9Nc?= =?us-ascii?Q?FQaK1R6MtBg3RvMcaqXyk85NO1/CHoDKzteFTZrNnFKOVZN12GkJwdvsc0UG?= =?us-ascii?Q?b9LZzJEQMVMJdg9DZ2/fhv0WQrxSu7PXIXdth/re1X7QcovaQcQDLWDHBrIY?= =?us-ascii?Q?ahEXmIRmmUGNabbaFSQFg3F7qaBWe6XKgylfV/cuWYC6unmGuL/fmBIYqElt?= =?us-ascii?Q?QwtYgItkdMT9pUVMMY1Jrr9fNdnGzs0xfsL2Vdb1Bq925mR1cSvJA7yj9gvn?= =?us-ascii?Q?/MWCmrG7NU6XyOAsdLs1XdeXC+Wz0C1A4R1gPj2rMYoyKQlSsVp0RVM1CsLG?= =?us-ascii?Q?deoFH+sUGrNf1J9ur3PWW5+Ia6AtubpvMGXk9AALQMSyobuGn0hwlqffGauT?= =?us-ascii?Q?0E4h3XB1hFxUtbiX70nihp6UXDL2Bn3c79q2Pk0CX8Ex47Kgz+5lzrd7NjwV?= =?us-ascii?Q?427v6PJCgpExd8aSYDD5A3kXGVdTx5iRbrckI/CdEyWbQ43b2/U0aCHFgOZq?= =?us-ascii?Q?iQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: aecd4fa6-535b-4698-b298-08dbcbb2af9a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 06:07:31.6676 (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: PlW/eZol49TSh+U8hbpNa3sEHB+tNX07nP4NsrGScNp0wwWvlPcJ5GAma0HTH5tG6vCwlHb5QO//gtnE4trVC6W6dgc2HDZFMTiEvJsYXSw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6296 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 There should only declare one local variable in each line, and the local variable should obey the unify sequence. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 6 +- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 4 +- drivers/net/nfp/nfp_common.c | 97 ++++++++++++++++------------- drivers/net/nfp/nfp_common.h | 3 +- drivers/net/nfp/nfp_cpp_bridge.c | 39 ++++++++---- drivers/net/nfp/nfp_ethdev.c | 47 +++++++------- drivers/net/nfp/nfp_ethdev_vf.c | 23 +++---- drivers/net/nfp/nfp_flow.c | 28 ++++----- drivers/net/nfp/nfp_rxtx.c | 38 +++++------ 9 files changed, 154 insertions(+), 131 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 7dd1423aaf..7a4e671178 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -24,9 +24,9 @@ static void nfp_pf_repr_enable_queues(struct rte_eth_dev *dev) { + uint16_t i; struct nfp_net_hw *hw; uint64_t enabled_queues = 0; - uint16_t i; struct nfp_flower_representor *repr; repr = dev->data->dev_private; @@ -50,9 +50,9 @@ nfp_pf_repr_enable_queues(struct rte_eth_dev *dev) static void nfp_pf_repr_disable_queues(struct rte_eth_dev *dev) { - struct nfp_net_hw *hw; + uint32_t update; uint32_t new_ctrl; - uint32_t update = 0; + struct nfp_net_hw *hw; struct nfp_flower_representor *repr; repr = dev->data->dev_private; diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index 5a84629ed7..699f65ebef 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -228,13 +228,13 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue, bool repr_flag) { uint16_t i; + uint8_t offset; uint32_t pkt_size; uint16_t dma_size; - uint8_t offset; uint64_t dma_addr; uint16_t free_descs; - uint16_t issued_descs; struct rte_mbuf *pkt; + uint16_t issued_descs; struct nfp_net_hw *hw; struct rte_mbuf **lmbuf; struct nfp_net_txq *txq; diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index cb2c2afbd7..18291a1cde 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -375,10 +375,10 @@ nfp_net_mbox_reconfig(struct nfp_net_hw *hw, int nfp_net_configure(struct rte_eth_dev *dev) { + struct nfp_net_hw *hw; struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; struct rte_eth_txmode *txmode; - struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -464,9 +464,9 @@ nfp_net_enbable_rxvlan_cap(struct nfp_net_hw *hw, void nfp_net_enable_queues(struct rte_eth_dev *dev) { + uint16_t i; struct nfp_net_hw *hw; uint64_t enabled_queues = 0; - uint16_t i; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -488,8 +488,9 @@ nfp_net_enable_queues(struct rte_eth_dev *dev) void nfp_net_disable_queues(struct rte_eth_dev *dev) { + uint32_t update; + uint32_t new_ctrl; struct nfp_net_hw *hw; - uint32_t new_ctrl, update = 0; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -528,9 +529,10 @@ void nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) { - uint32_t mac0 = *(uint32_t *)mac; + uint32_t mac0; uint16_t mac1; + mac0 = *(uint32_t *)mac; nn_writel(rte_cpu_to_be_32(mac0), hw->ctrl_bar + NFP_NET_CFG_MACADDR); mac += 4; @@ -543,8 +545,9 @@ int nfp_net_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { + uint32_t ctrl; + uint32_t update; struct nfp_net_hw *hw; - uint32_t update, ctrl; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 && @@ -574,8 +577,8 @@ int nfp_configure_rx_interrupt(struct rte_eth_dev *dev, struct rte_intr_handle *intr_handle) { - struct nfp_net_hw *hw; uint16_t i; + struct nfp_net_hw *hw; if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", dev->data->nb_rx_queues) != 0) { @@ -615,11 +618,11 @@ nfp_configure_rx_interrupt(struct rte_eth_dev *dev, uint32_t nfp_check_offloads(struct rte_eth_dev *dev) { + uint32_t ctrl = 0; struct nfp_net_hw *hw; struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; struct rte_eth_txmode *txmode; - uint32_t ctrl = 0; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -682,9 +685,10 @@ nfp_check_offloads(struct rte_eth_dev *dev) int nfp_net_promisc_enable(struct rte_eth_dev *dev) { - uint32_t new_ctrl, update = 0; - struct nfp_net_hw *hw; int ret; + uint32_t new_ctrl; + uint32_t update = 0; + struct nfp_net_hw *hw; struct nfp_flower_representor *repr; PMD_DRV_LOG(DEBUG, "Promiscuous mode enable"); @@ -725,9 +729,10 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev) int nfp_net_promisc_disable(struct rte_eth_dev *dev) { - uint32_t new_ctrl, update = 0; - struct nfp_net_hw *hw; int ret; + uint32_t new_ctrl; + uint32_t update = 0; + struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -764,8 +769,8 @@ nfp_net_link_update(struct rte_eth_dev *dev, { int ret; uint32_t i; - uint32_t nn_link_status; struct nfp_net_hw *hw; + uint32_t nn_link_status; struct rte_eth_link link; struct nfp_eth_table *nfp_eth_table; @@ -988,12 +993,13 @@ nfp_net_stats_reset(struct rte_eth_dev *dev) uint32_t nfp_net_xstats_size(const struct rte_eth_dev *dev) { - /* If the device is a VF, then there will be no MAC stats */ - struct nfp_net_hw *hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint32_t count; + struct nfp_net_hw *hw; const uint32_t size = RTE_DIM(nfp_net_xstats); + /* If the device is a VF, then there will be no MAC stats */ + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (hw->mac_stats == NULL) { - uint32_t count; for (count = 0; count < size; count++) { if (nfp_net_xstats[count].group == NFP_XSTAT_GROUP_MAC) break; @@ -1396,9 +1402,9 @@ int nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_pci_device *pci_dev; - struct nfp_net_hw *hw; uint16_t base = 0; + struct nfp_net_hw *hw; + struct rte_pci_device *pci_dev; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1417,9 +1423,9 @@ int nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) { - struct rte_pci_device *pci_dev; - struct nfp_net_hw *hw; uint16_t base = 0; + struct nfp_net_hw *hw; + struct rte_pci_device *pci_dev; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1436,8 +1442,8 @@ nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, static void nfp_net_dev_link_status_print(struct rte_eth_dev *dev) { - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_eth_link link; + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); rte_eth_linkstatus_get(dev, &link); if (link.link_status != 0) @@ -1573,16 +1579,16 @@ int nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask) { - uint32_t new_ctrl, update; + int ret; + uint32_t update; + uint32_t new_ctrl; struct nfp_net_hw *hw; + uint32_t rxvlan_ctrl = 0; struct rte_eth_conf *dev_conf; - uint32_t rxvlan_ctrl; - int ret; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); dev_conf = &dev->data->dev_conf; new_ctrl = hw->ctrl; - rxvlan_ctrl = 0; nfp_net_enbable_rxvlan_cap(hw, &rxvlan_ctrl); @@ -1619,12 +1625,15 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { + uint16_t i; + uint16_t j; + uint16_t idx; uint8_t mask; uint32_t reta; - uint16_t i, j; - uint16_t idx, shift; - struct nfp_net_hw *hw = - NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + uint16_t shift; + struct nfp_net_hw *hw; + + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) { PMD_DRV_LOG(ERR, "The size of hash lookup table configured " @@ -1670,11 +1679,11 @@ nfp_net_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { - struct nfp_net_hw *hw = - NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t update; int ret; + uint32_t update; + struct nfp_net_hw *hw; + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) return -EINVAL; @@ -1696,10 +1705,12 @@ nfp_net_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { - uint16_t i, j; + uint16_t i; + uint16_t j; + uint16_t idx; uint8_t mask; - uint16_t idx, shift; uint32_t reta; + uint16_t shift; struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1742,11 +1753,11 @@ static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { - struct nfp_net_hw *hw; + uint8_t i; + uint8_t key; uint64_t rss_hf; + struct nfp_net_hw *hw; uint32_t cfg_rss_ctrl = 0; - uint8_t key; - uint8_t i; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1834,10 +1845,10 @@ int nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) { + uint8_t i; + uint8_t key; uint64_t rss_hf; uint32_t cfg_rss_ctrl; - uint8_t key; - uint8_t i; struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1890,13 +1901,14 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, int nfp_net_rss_config_default(struct rte_eth_dev *dev) { + int ret; + uint8_t i; + uint8_t j; + uint16_t queue = 0; struct rte_eth_conf *dev_conf; struct rte_eth_rss_conf rss_conf; - struct rte_eth_rss_reta_entry64 nfp_reta_conf[2]; uint16_t rx_queues = dev->data->nb_rx_queues; - uint16_t queue; - uint8_t i, j; - int ret; + struct rte_eth_rss_reta_entry64 nfp_reta_conf[2]; PMD_DRV_LOG(INFO, "setting default RSS conf for %u queues", rx_queues); @@ -1904,7 +1916,6 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev) nfp_reta_conf[0].mask = ~0x0; nfp_reta_conf[1].mask = ~0x0; - queue = 0; for (i = 0; i < 0x40; i += 8) { for (j = i; j < (i + 8); j++) { nfp_reta_conf[0].reta[j] = queue; diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index 71153ea25b..9cb889c4a6 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -222,8 +222,9 @@ nn_writew(uint16_t val, static inline uint64_t nn_readq(volatile void *addr) { + uint32_t low; + uint32_t high; const volatile uint32_t *p = addr; - uint32_t low, high; high = nn_readl((volatile const void *)(p + 1)); low = nn_readl((volatile const void *)p); diff --git a/drivers/net/nfp/nfp_cpp_bridge.c b/drivers/net/nfp/nfp_cpp_bridge.c index 85a8bf9235..727ec7a7b2 100644 --- a/drivers/net/nfp/nfp_cpp_bridge.c +++ b/drivers/net/nfp/nfp_cpp_bridge.c @@ -119,12 +119,16 @@ static int nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp) { - struct nfp_cpp_area *area; - off_t offset, nfp_offset; - uint32_t cpp_id, pos, len; + int err; + off_t offset; + uint32_t pos; + uint32_t len; + size_t count; + size_t curlen; + uint32_t cpp_id; + off_t nfp_offset; uint32_t tmpbuf[16]; - size_t count, curlen; - int err = 0; + struct nfp_cpp_area *area; PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__, sizeof(off_t), sizeof(size_t)); @@ -220,12 +224,16 @@ static int nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp) { - struct nfp_cpp_area *area; - off_t offset, nfp_offset; - uint32_t cpp_id, pos, len; + int err; + off_t offset; + uint32_t pos; + uint32_t len; + size_t count; + size_t curlen; + uint32_t cpp_id; + off_t nfp_offset; uint32_t tmpbuf[16]; - size_t count, curlen; - int err = 0; + struct nfp_cpp_area *area; PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__, sizeof(off_t), sizeof(size_t)); @@ -319,8 +327,10 @@ static int nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp) { - uint32_t cmd, ident_size, tmp; int err; + uint32_t cmd; + uint32_t tmp; + uint32_t ident_size; /* Reading now the IOCTL command */ err = recv(sockfd, &cmd, 4, 0); @@ -375,10 +385,13 @@ nfp_cpp_bridge_serve_ioctl(int sockfd, static int nfp_cpp_bridge_service_func(void *args) { - struct sockaddr address; + int op; + int ret; + int sockfd; + int datafd; struct nfp_cpp *cpp; + struct sockaddr address; struct nfp_pf_dev *pf_dev; - int sockfd, datafd, op, ret; struct timeval timeout = {1, 0}; unlink("/tmp/nfp_cpp"); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 140d20dcf7..7d149decfb 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -25,8 +25,8 @@ static int nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_fw_nic, uint16_t port) { + struct nfp_net_hw *hw; struct nfp_eth_table *nfp_eth_table; - struct nfp_net_hw *hw = NULL; /* Grab a pointer to the correct physical port */ hw = app_fw_nic->ports[port]; @@ -42,18 +42,19 @@ nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_fw_nic, static int nfp_net_start(struct rte_eth_dev *dev) { - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - uint32_t new_ctrl, update = 0; + int ret; + uint32_t new_ctrl; + uint32_t update = 0; uint32_t cap_extend; - uint32_t ctrl_extend = 0; + uint32_t intr_vector; struct nfp_net_hw *hw; + uint32_t ctrl_extend = 0; struct nfp_pf_dev *pf_dev; - struct nfp_app_fw_nic *app_fw_nic; struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; - uint32_t intr_vector; - int ret; + struct nfp_app_fw_nic *app_fw_nic; + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -251,11 +252,11 @@ nfp_net_set_link_down(struct rte_eth_dev *dev) static int nfp_net_close(struct rte_eth_dev *dev) { + uint8_t i; struct nfp_net_hw *hw; - struct rte_pci_device *pci_dev; struct nfp_pf_dev *pf_dev; + struct rte_pci_device *pci_dev; struct nfp_app_fw_nic *app_fw_nic; - uint8_t i; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -480,15 +481,15 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, static int nfp_net_init(struct rte_eth_dev *eth_dev) { - struct rte_pci_device *pci_dev; + int err; + uint16_t port; + uint64_t rx_base; + uint64_t tx_base; + struct nfp_net_hw *hw; struct nfp_pf_dev *pf_dev; + struct rte_pci_device *pci_dev; struct nfp_app_fw_nic *app_fw_nic; - struct nfp_net_hw *hw; struct rte_ether_addr *tmp_ether_addr; - uint64_t rx_base; - uint64_t tx_base; - uint16_t port = 0; - int err; PMD_INIT_FUNC_TRACE(); @@ -650,14 +651,14 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) { - struct nfp_cpp *cpp = nfp_nsp_cpp(nsp); void *fw_buf; - char fw_name[125]; - char serial[40]; size_t fsize; + char serial[40]; + char fw_name[125]; uint16_t interface; uint32_t cpp_serial_len; const uint8_t *cpp_serial; + struct nfp_cpp *cpp = nfp_nsp_cpp(nsp); cpp_serial_len = nfp_cpp_serial(cpp, &cpp_serial); if (cpp_serial_len != NFP_SERIAL_LEN) @@ -713,10 +714,10 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_eth_table *nfp_eth_table, struct nfp_hwinfo *hwinfo) { + int err; + char card_desc[100]; struct nfp_nsp *nsp; const char *nfp_fw_model; - char card_desc[100]; - int err = 0; nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "nffw.partno"); if (nfp_fw_model == NULL) @@ -897,9 +898,9 @@ nfp_pf_init(struct rte_pci_device *pci_dev) uint64_t addr; uint32_t cpp_id; struct nfp_cpp *cpp; - enum nfp_app_fw_id app_fw_id; struct nfp_pf_dev *pf_dev; struct nfp_hwinfo *hwinfo; + enum nfp_app_fw_id app_fw_id; char name[RTE_ETH_NAME_MAX_LEN]; struct nfp_rtsym_table *sym_tbl; struct nfp_eth_table *nfp_eth_table; @@ -1220,8 +1221,8 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { static int nfp_pci_uninit(struct rte_eth_dev *eth_dev) { - struct rte_pci_device *pci_dev; uint16_t port_id; + struct rte_pci_device *pci_dev; pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 892300a909..aaef6ea91a 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -29,14 +29,15 @@ nfp_netvf_read_mac(struct nfp_net_hw *hw) static int nfp_netvf_start(struct rte_eth_dev *dev) { - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); - struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - uint32_t new_ctrl, update = 0; + int ret; + uint32_t new_ctrl; + uint32_t update = 0; + uint32_t intr_vector; struct nfp_net_hw *hw; struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; - uint32_t intr_vector; - int ret; + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -254,15 +255,15 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, static int nfp_netvf_init(struct rte_eth_dev *eth_dev) { - struct rte_pci_device *pci_dev; - struct nfp_net_hw *hw; - struct rte_ether_addr *tmp_ether_addr; - - uint64_t tx_bar_off = 0, rx_bar_off = 0; + int err; uint32_t start_q; uint16_t port = 0; - int err; + struct nfp_net_hw *hw; + uint64_t tx_bar_off = 0; + uint64_t rx_bar_off = 0; + struct rte_pci_device *pci_dev; const struct nfp_dev_info *dev_info; + struct rte_ether_addr *tmp_ether_addr; PMD_INIT_FUNC_TRACE(); diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 4c9904e36c..84b48daf85 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -761,9 +761,9 @@ nfp_flow_compile_metadata(struct nfp_flow_priv *priv, uint32_t stats_ctx, uint64_t cookie) { - struct nfp_fl_rule_metadata *nfp_flow_meta; - char *mbuf_off_exact; char *mbuf_off_mask; + char *mbuf_off_exact; + struct nfp_fl_rule_metadata *nfp_flow_meta; /* * Convert to long words as firmware expects @@ -974,9 +974,9 @@ nfp_flow_key_layers_calculate_actions(const struct rte_flow_action actions[], int ret = 0; bool meter_flag = false; bool tc_hl_flag = false; - bool mac_set_flag = false; bool ip_set_flag = false; bool tp_set_flag = false; + bool mac_set_flag = false; bool ttl_tos_flag = false; const struct rte_flow_action *action; @@ -3201,11 +3201,11 @@ nfp_flow_action_geneve_encap_v4(struct nfp_app_fw_flower *app_fw_flower, { uint64_t tun_id; const struct rte_ether_hdr *eth; + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; const struct rte_flow_item_udp *udp; const struct rte_flow_item_ipv4 *ipv4; const struct rte_flow_item_geneve *geneve; - struct nfp_fl_act_pre_tun *pre_tun; - struct nfp_fl_act_set_tun *set_tun; size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); @@ -3241,11 +3241,11 @@ nfp_flow_action_geneve_encap_v6(struct nfp_app_fw_flower *app_fw_flower, uint8_t tos; uint64_t tun_id; const struct rte_ether_hdr *eth; + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; const struct rte_flow_item_udp *udp; const struct rte_flow_item_ipv6 *ipv6; const struct rte_flow_item_geneve *geneve; - struct nfp_fl_act_pre_tun *pre_tun; - struct nfp_fl_act_set_tun *set_tun; size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); @@ -3281,10 +3281,10 @@ nfp_flow_action_nvgre_encap_v4(struct nfp_app_fw_flower *app_fw_flower, { uint64_t tun_id; const struct rte_ether_hdr *eth; - const struct rte_flow_item_ipv4 *ipv4; - const struct rte_flow_item_gre *gre; struct nfp_fl_act_pre_tun *pre_tun; struct nfp_fl_act_set_tun *set_tun; + const struct rte_flow_item_gre *gre; + const struct rte_flow_item_ipv4 *ipv4; size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); @@ -3319,10 +3319,10 @@ nfp_flow_action_nvgre_encap_v6(struct nfp_app_fw_flower *app_fw_flower, uint8_t tos; uint64_t tun_id; const struct rte_ether_hdr *eth; - const struct rte_flow_item_ipv6 *ipv6; - const struct rte_flow_item_gre *gre; struct nfp_fl_act_pre_tun *pre_tun; struct nfp_fl_act_set_tun *set_tun; + const struct rte_flow_item_gre *gre; + const struct rte_flow_item_ipv6 *ipv6; size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); @@ -3467,12 +3467,12 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor, uint32_t count; char *position; char *action_data; - bool ttl_tos_flag = false; - bool tc_hl_flag = false; bool drop_flag = false; + bool tc_hl_flag = false; bool ip_set_flag = false; bool tp_set_flag = false; bool mac_set_flag = false; + bool ttl_tos_flag = false; uint32_t total_actions = 0; const struct rte_flow_action *action; struct nfp_flower_meta_tci *meta_tci; @@ -4283,10 +4283,10 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev) size_t stats_size; uint64_t ctx_count; uint64_t ctx_split; + struct nfp_flow_priv *priv; char mask_name[RTE_HASH_NAMESIZE]; char flow_name[RTE_HASH_NAMESIZE]; char pretun_name[RTE_HASH_NAMESIZE]; - struct nfp_flow_priv *priv; struct nfp_app_fw_flower *app_fw_flower; const char *pci_name = strchr(pf_dev->pci_dev->name, ':') + 1; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 8cbb9b74a2..db6122eac3 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -188,9 +188,9 @@ nfp_net_rx_cksum(struct nfp_net_rxq *rxq, static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq) { - struct nfp_net_dp_buf *rxe = rxq->rxbufs; - uint64_t dma_addr; uint16_t i; + uint64_t dma_addr; + struct nfp_net_dp_buf *rxe = rxq->rxbufs; PMD_RX_LOG(DEBUG, "Fill Rx Freelist for %u descriptors", rxq->rx_count); @@ -241,17 +241,15 @@ nfp_net_rx_freelist_setup(struct rte_eth_dev *dev) uint32_t nfp_net_rx_queue_count(void *rx_queue) { + uint32_t idx; + uint32_t count = 0; struct nfp_net_rxq *rxq; struct nfp_net_rx_desc *rxds; - uint32_t idx; - uint32_t count; rxq = rx_queue; idx = rxq->rd_p; - count = 0; - /* * Other PMDs are just checking the DD bit in intervals of 4 * descriptors and counting all four if the first has the DD @@ -282,9 +280,9 @@ nfp_net_parse_chained_meta(uint8_t *meta_base, rte_be32_t meta_header, struct nfp_meta_parsed *meta) { - uint8_t *meta_offset; uint32_t meta_info; uint32_t vlan_info; + uint8_t *meta_offset; meta_info = rte_be_to_cpu_32(meta_header); meta_offset = meta_base + 4; @@ -683,15 +681,15 @@ nfp_net_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct nfp_net_rxq *rxq; - struct nfp_net_rx_desc *rxds; - struct nfp_net_dp_buf *rxb; - struct nfp_net_hw *hw; + uint64_t dma_addr; + uint16_t avail = 0; struct rte_mbuf *mb; + uint16_t nb_hold = 0; + struct nfp_net_hw *hw; struct rte_mbuf *new_mb; - uint16_t nb_hold; - uint64_t dma_addr; - uint16_t avail; + struct nfp_net_rxq *rxq; + struct nfp_net_dp_buf *rxb; + struct nfp_net_rx_desc *rxds; uint16_t avail_multiplexed = 0; rxq = rx_queue; @@ -706,8 +704,6 @@ nfp_net_recv_pkts(void *rx_queue, hw = rxq->hw; - avail = 0; - nb_hold = 0; while (avail + avail_multiplexed < nb_pkts) { rxb = &rxq->rxbufs[rxq->rd_p]; if (unlikely(rxb == NULL)) { @@ -883,12 +879,12 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp) { + uint32_t rx_desc_sz; uint16_t min_rx_desc; uint16_t max_rx_desc; - const struct rte_memzone *tz; - struct nfp_net_rxq *rxq; struct nfp_net_hw *hw; - uint32_t rx_desc_sz; + struct nfp_net_rxq *rxq; + const struct rte_memzone *tz; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -995,8 +991,8 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint32_t nfp_net_tx_free_bufs(struct nfp_net_txq *txq) { - uint32_t qcp_rd_p; uint32_t todo; + uint32_t qcp_rd_p; PMD_TX_LOG(DEBUG, "queue %hu. Check for descriptor with a complete" " status", txq->qidx); @@ -1072,8 +1068,8 @@ nfp_net_set_meta_vlan(struct nfp_net_meta_raw *meta_data, struct rte_mbuf *pkt, uint8_t layer) { - uint16_t vlan_tci; uint16_t tpid; + uint16_t vlan_tci; tpid = RTE_ETHER_TYPE_VLAN; vlan_tci = pkt->vlan_tci; -- 2.39.1