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 D9C7C4236A; Thu, 12 Oct 2023 03:28:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B6C540695; Thu, 12 Oct 2023 03:27:54 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2101.outbound.protection.outlook.com [40.107.220.101]) by mails.dpdk.org (Postfix) with ESMTP id A885E402E4 for ; Thu, 12 Oct 2023 03:27:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RNmMd8DsUy5WqnpwO86zLDOirvKxbUtRaPzRxh5OJmi7ygJHIrfZm6jJTybpc5QlpBkEIE70JbAUayUtjNDTxOBV8lCw420MaHL+AGUOf9GFQu315DSNoAE5y6Xi/Lz53c5bv84WOuWLFIF+4yDIHJLkLnOfcqzMysaEV452a2CKQmynZ5woixZ3LaEpKnUcZtKVNYO536Lj89v2csA7aHfmbXmfLNH53LnVeZoVOjVXFa8CZLl24L626xFntT22Mz2F2z10y1biMNLDlLizvP7DWe+a/+2ceo8PsPQJeu0ZHDh9ismKKtlOjN7QooytrU1UrYox00zp8AULeUGouA== 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=IJuInOpW4F5Zff9n9OhSJxO9SUC918cR0qa/G1DvFYg=; b=V8YSIqnAZECrvU3CbS3w4XZu1CVAjSMTgXoOhBKQCMtiI/5D52oVon4/wu7lXsHIsC7u8Qq8/yVlrWodohUBRZ1aUs/XNtrojPtEgENzyu0qrcbVG0Utj2SFxS1DrNn+T/I0Ubs9+DrxRBQ2FFkF3HxK7DijPBwpu4Wzh1mvUH2M1DizkQ44OOkTVtpFxhIhtIJpUUdz+MLOotZd80G0WqZdlIGcDPh34rq5dDN+vQldetYB0QbslScfy06vX8usWNVePE8bmEY8o3Tt889fMRm0BqLrkDEeEsUf7QquA/H4Z9ZVaNehhSPt73OeQ62qNm0OY7JzCZdB6oW7vgnX9Q== 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=IJuInOpW4F5Zff9n9OhSJxO9SUC918cR0qa/G1DvFYg=; b=jQmiqdn8hlnSAWtcx7VNkwY4t4tXcX3xJQ+e9i/D4tr/0EHnY7V58pfPAdw4soGbh09mEUlhiU9iw+VmaVkGLKBnCYGnQWrgKg4I++oKhoLVXLkRkK+TxY621Rer02lOwIFfiFOXnCmPhie3TUkEh7XIvJAWdil7CMfMUK2WygE= 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 PH0PR13MB5975.namprd13.prod.outlook.com (2603:10b6:510:16e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Thu, 12 Oct 2023 01:27:49 +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; Thu, 12 Oct 2023 01:27:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 03/11] net/nfp: unify the type of integer variable Date: Thu, 12 Oct 2023 09:26:56 +0800 Message-Id: <20231012012704.483828-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231012012704.483828-1-chaoyong.he@corigine.com> References: <20231007023339.1546659-1-chaoyong.he@corigine.com> <20231012012704.483828-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: PH8PR15CA0015.namprd15.prod.outlook.com (2603:10b6:510:2d2::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_|PH0PR13MB5975:EE_ X-MS-Office365-Filtering-Correlation-Id: df1f7275-708f-44bf-7ef9-08dbcac271db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I4YJsEE6bGWkTOUACMUI4h0DcktdDXYVUjv9egVEERsjKNea4RDGR0G71mP844qVHtjO8KCSy3vg71b/IHAOY4NsCNH+lB6Brnqa4av3wYr9nqjCte1wl5zfC5GQbiqWqCjok47gCNbuioLsa+UclWVEdPGsyumivGqD4IkT+ZQr7ARWYYF+vmlgCyGkTQo/UZaq6S5xxNgw7H2LowYuQ4aeoCpgRweP8N0JLZJMlkADXkBsjzLIxkLcqYl7RNyxGqW/nDqw6qZcjJCCs3cg04spCVooFfZuSayHgO24mLRUKTIEpy0Mssw4tYuW2NNAZI+KCz4WSRikhIEXoEyy0Rg+NHdbPOg8zVilbmhc7v5ibKZwaoltOjXxVpY16yLlS9hn8x1FdDGxf0/jM9CWff7zyJUBsDiGj+krYrZjvbyWct25IC5t+jtXH80gVdlkeC5ZtS+INuWmrovFOJ6RlSyLvGi/EobUPP1TlQhmXmP91tOPyX/7W6rhY2jOv/GUHyzKBdQseu2C9iWV2GyO7/wyaGewOhw0SrnM8Fw92n9GBQRORcPOx2Px2f7LPCi+gs8/XRBCztS/PrGePfEoBCZ3vqQd+6gCOlybUyhZY3Md84Tb4byIxzTnl37lbDJrAaPctvN0Ax0hMHnM8nsvm6Tz/jvMJPcIkxR7GhFQabM= 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)(346002)(39830400003)(136003)(366004)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(86362001)(38350700002)(36756003)(38100700002)(66946007)(6916009)(2906002)(30864003)(8936002)(478600001)(6486002)(6512007)(41300700001)(44832011)(5660300002)(4326008)(6506007)(52116002)(8676002)(6666004)(83380400001)(107886003)(66556008)(66476007)(54906003)(26005)(2616005)(316002)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kTlFuZgU8kkHxV/i8bJiTQrU2hvQYMQ6R3RuS9E+eZ+GxcdeMEtqlWvObxpf?= =?us-ascii?Q?fZEE6xj6sanxf8EPSy4VxuhY/Knw3F7gair36mfENeDJzBb3lyJbb0gxNGuD?= =?us-ascii?Q?GA5Dj+i++xwXBTK0MFBUCzUStQim7VV7ZVRfeIwC6s7eOqTIq8CPsx2fECi5?= =?us-ascii?Q?Ipf/ppvekEwNcBLlm4Wy5IhQOp7BH3QY54QBexzWSNe29TA5SZMgqxPQaepM?= =?us-ascii?Q?eTTfgGwebT/wK8p3i6T3PgSfiakRDFDF6HXVHtNtz4ppvleVBbPdL8+mp/vu?= =?us-ascii?Q?HLU/lMkQybu6wLtxCeNk8AncNhx3OzXDVdmkICWvqfkd41Lgb9sWZHtBuIEO?= =?us-ascii?Q?9LLUsky9n4WaMrhNgqqvPMUVybTyIC8lWtC6YGZ1Ih+xyv/Ip77fngwXbHHI?= =?us-ascii?Q?SVdonm0vO0MHrL6AQTUO7YG4yD9zAGThnie3g0vot4++u8GmHKjsFqFCN7S2?= =?us-ascii?Q?uH9qKpH9qs0xsq49KXnQez37duLqe2mTT/vK08EFuJWZ8IC3mrqpVQ0Cg4Su?= =?us-ascii?Q?cpEOYXHVlZ3CdwB3d7y1EHJVLkdTPES6xTr2yUQYvEKcANc5D+rBCez3h/oB?= =?us-ascii?Q?6i3TCKWOies6nzCtJmyEZBfBTmYQ62ZVduNc0eiOIXbT4+nuAJcrlrlYfc2K?= =?us-ascii?Q?QQf9wivxa1yEg2tONiQRx9Hd4cxYt+BRZO3VF/MW9somsSP7D/oQtJ2eZbyg?= =?us-ascii?Q?KP0PGspqQ8JgRU7xep+SuDwm7RbuS+9wfOSzhKPPjXRW9rzDcKpeVdkONVHe?= =?us-ascii?Q?TJLidpTgFgHj/THP0yKorpCCPcavVXRZaUA8H+zTZ2LKCgXFARJ8YOA7S4CC?= =?us-ascii?Q?DHy4m5Zf+9j2OCB0YJAi9DpYczu3Iy88QLK0/0xvJFyHJIXAcM4aqHIwc4pU?= =?us-ascii?Q?w+gsBTK840yI4tDJaJbo71A4Nazp6wBtNzgeGuZOm6+kzqKRAZdAk21gs4v5?= =?us-ascii?Q?2RcqEjkWSyDCPxsYFoG2q5QKXCaVpGUvfVpZDETaHKUSUs+C30KLpf1CnSGX?= =?us-ascii?Q?1c24s1KR3J+P63FQ1L3CxcQqXT9w+O624GnkgUSTryoRrvIQgnInFR2jevDg?= =?us-ascii?Q?gi/zQiV7H0s/iuu53XTI3zx600nferksUrMPNudSezaul9hFlQkHslbvDFVj?= =?us-ascii?Q?ZE3GRcoB9+zbdNUUyPmNKD9e81eKVKg4flRwmbslZaRVdtZ+92yYXjhnwt/y?= =?us-ascii?Q?BxVwpZGrQNXbJHr21y2su9VpfV2tar5lgYo+1CfEOaA2F4tpJhTgtOPmcqjX?= =?us-ascii?Q?Zbh7b9n7lrkK9ibdThPvNca5b1vwC17Pa4NSxN6XTjGKbvTHV0/0oerA3FoZ?= =?us-ascii?Q?CEdFSsxBapdwK0bUrpd0gsvV50KG1lDKcglTpbR3s9MDEd6WJu5lpu56nwrl?= =?us-ascii?Q?8uvhTbfAmDY2nep5iRWMoazZZWUyqMW6c4FZK1WdueNYbde79SxBNikAAkZz?= =?us-ascii?Q?NyZGdT5lRHjfvP3QDFkKqHYz5LihJEw8gWXqV90MLBe4IBNnOCY6MFMuPtxo?= =?us-ascii?Q?2NPvD7KOAoK0IHQHj+A8dVaV6e9mhdL5uAfqjO5Ks5gLTIVox+brW02O3NK5?= =?us-ascii?Q?k192O6/LMGRy2GnhCFhxNyqqJ3719HiBHuElTOkS1gcNRWn0LO9QMIMAQ5Dn?= =?us-ascii?Q?pg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: df1f7275-708f-44bf-7ef9-08dbcac271db X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2023 01:27:49.7151 (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: LP8DhQ+H1KExj/H3iSwqRoGSa+2+XU5P1XaZrF6rcLs0XjjawaVYa9fh9bN92qGJnV8rLjqwx1z14A/suPXlkynn85VNbq6YixrKCYNal2k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5975 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 Unify the type of integer variable to the DPDK prefer style. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 2 +- drivers/net/nfp/flower/nfp_flower_cmsg.c | 16 +++++----- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 6 ++-- drivers/net/nfp/nfp_common.c | 37 +++++++++++++----------- drivers/net/nfp/nfp_common.h | 16 +++++----- drivers/net/nfp/nfp_ethdev.c | 24 +++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- drivers/net/nfp/nfp_flow.c | 8 ++--- drivers/net/nfp/nfp_rxtx.c | 12 ++++---- drivers/net/nfp/nfp_rxtx.h | 2 +- 10 files changed, 64 insertions(+), 61 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 3352693d71..7dd1423aaf 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -26,7 +26,7 @@ nfp_pf_repr_enable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; uint64_t enabled_queues = 0; - int i; + uint16_t i; struct nfp_flower_representor *repr; repr = dev->data->dev_private; diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c index 6b9532f5b6..5d6912b079 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c @@ -64,10 +64,10 @@ nfp_flower_cmsg_mac_repr_init(struct rte_mbuf *mbuf, static void nfp_flower_cmsg_mac_repr_fill(struct rte_mbuf *m, - unsigned int idx, - unsigned int nbi, - unsigned int nbi_port, - unsigned int phys_port) + uint8_t idx, + uint32_t nbi, + uint32_t nbi_port, + uint32_t phys_port) { struct nfp_flower_cmsg_mac_repr *msg; @@ -81,11 +81,11 @@ nfp_flower_cmsg_mac_repr_fill(struct rte_mbuf *m, int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower) { - int i; + uint8_t i; uint16_t cnt; - unsigned int nbi; - unsigned int nbi_port; - unsigned int phys_port; + uint32_t nbi; + uint32_t nbi_port; + uint32_t phys_port; struct rte_mbuf *mbuf; struct nfp_eth_table *nfp_eth_table; diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index 64928254d8..5a84629ed7 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -227,9 +227,9 @@ nfp_net_nfd3_xmit_pkts_common(void *tx_queue, uint16_t nb_pkts, bool repr_flag) { - int i; - int pkt_size; - int dma_size; + uint16_t i; + uint32_t pkt_size; + uint16_t dma_size; uint8_t offset; uint64_t dma_addr; uint16_t free_descs; diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 9719a9212b..cb2c2afbd7 100644 --- a/drivers/net/nfp/nfp_common.c +++ b/drivers/net/nfp/nfp_common.c @@ -199,7 +199,7 @@ static int __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update) { - int cnt; + uint32_t cnt; uint32_t new; struct timespec wait; @@ -229,7 +229,7 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, } if (cnt >= NFP_NET_POLL_TIMEOUT) { PMD_INIT_LOG(ERR, "Reconfig timeout for 0x%08x after" - " %dms", update, cnt); + " %ums", update, cnt); return -EIO; } nanosleep(&wait, 0); /* waiting for a 1ms */ @@ -466,7 +466,7 @@ nfp_net_enable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; uint64_t enabled_queues = 0; - int i; + uint16_t i; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -575,7 +575,7 @@ nfp_configure_rx_interrupt(struct rte_eth_dev *dev, struct rte_intr_handle *intr_handle) { struct nfp_net_hw *hw; - int i; + uint16_t i; if (rte_intr_vec_list_alloc(intr_handle, "intr_vec", dev->data->nb_rx_queues) != 0) { @@ -832,7 +832,7 @@ int nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { - int i; + uint16_t i; struct nfp_net_hw *hw; struct rte_eth_stats nfp_dev_stats; @@ -923,7 +923,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, int nfp_net_stats_reset(struct rte_eth_dev *dev) { - int i; + uint16_t i; struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1398,7 +1398,7 @@ nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, { struct rte_pci_device *pci_dev; struct nfp_net_hw *hw; - int base = 0; + uint16_t base = 0; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1419,7 +1419,7 @@ nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, { struct rte_pci_device *pci_dev; struct nfp_net_hw *hw; - int base = 0; + uint16_t base = 0; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1619,9 +1619,10 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { - uint32_t reta, mask; - int i, j; - int idx, shift; + 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); @@ -1695,8 +1696,9 @@ nfp_net_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) { - uint8_t i, j, mask; - int idx, shift; + uint16_t i, j; + uint8_t mask; + uint16_t idx, shift; uint32_t reta; struct nfp_net_hw *hw; @@ -1720,7 +1722,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, /* Handling 4 RSS entries per loop */ idx = i / RTE_ETH_RETA_GROUP_SIZE; shift = i % RTE_ETH_RETA_GROUP_SIZE; - mask = (uint8_t)((reta_conf[idx].mask >> shift) & 0xF); + mask = (reta_conf[idx].mask >> shift) & 0xF; if (mask == 0) continue; @@ -1744,7 +1746,7 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev, uint64_t rss_hf; uint32_t cfg_rss_ctrl = 0; uint8_t key; - int i; + uint8_t i; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1835,7 +1837,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, uint64_t rss_hf; uint32_t cfg_rss_ctrl; uint8_t key; - int i; + uint8_t i; struct nfp_net_hw *hw; hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1893,7 +1895,8 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev) struct rte_eth_rss_reta_entry64 nfp_reta_conf[2]; uint16_t rx_queues = dev->data->nb_rx_queues; uint16_t queue; - int i, j, ret; + uint8_t i, j; + int ret; PMD_DRV_LOG(INFO, "setting default RSS conf for %u queues", rx_queues); diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h index e4fd394868..71153ea25b 100644 --- a/drivers/net/nfp/nfp_common.h +++ b/drivers/net/nfp/nfp_common.h @@ -245,14 +245,14 @@ nn_writeq(uint64_t val, */ static inline uint8_t nn_cfg_readb(struct nfp_net_hw *hw, - int off) + uint32_t off) { return nn_readb(hw->ctrl_bar + off); } static inline void nn_cfg_writeb(struct nfp_net_hw *hw, - int off, + uint32_t off, uint8_t val) { nn_writeb(val, hw->ctrl_bar + off); @@ -260,14 +260,14 @@ nn_cfg_writeb(struct nfp_net_hw *hw, static inline uint16_t nn_cfg_readw(struct nfp_net_hw *hw, - int off) + uint32_t off) { return rte_le_to_cpu_16(nn_readw(hw->ctrl_bar + off)); } static inline void nn_cfg_writew(struct nfp_net_hw *hw, - int off, + uint32_t off, uint16_t val) { nn_writew(rte_cpu_to_le_16(val), hw->ctrl_bar + off); @@ -275,14 +275,14 @@ nn_cfg_writew(struct nfp_net_hw *hw, static inline uint32_t nn_cfg_readl(struct nfp_net_hw *hw, - int off) + uint32_t off) { return rte_le_to_cpu_32(nn_readl(hw->ctrl_bar + off)); } static inline void nn_cfg_writel(struct nfp_net_hw *hw, - int off, + uint32_t off, uint32_t val) { nn_writel(rte_cpu_to_le_32(val), hw->ctrl_bar + off); @@ -290,14 +290,14 @@ nn_cfg_writel(struct nfp_net_hw *hw, static inline uint64_t nn_cfg_readq(struct nfp_net_hw *hw, - int off) + uint32_t off) { return rte_le_to_cpu_64(nn_readq(hw->ctrl_bar + off)); } static inline void nn_cfg_writeq(struct nfp_net_hw *hw, - int off, + uint32_t off, uint64_t val) { nn_writeq(rte_cpu_to_le_64(val), hw->ctrl_bar + off); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 65473d87e8..140d20dcf7 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -23,7 +23,7 @@ static int nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_fw_nic, - int port) + uint16_t port) { struct nfp_eth_table *nfp_eth_table; struct nfp_net_hw *hw = NULL; @@ -255,7 +255,7 @@ nfp_net_close(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev; struct nfp_pf_dev *pf_dev; struct nfp_app_fw_nic *app_fw_nic; - int i; + uint8_t i; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -487,7 +487,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) struct rte_ether_addr *tmp_ether_addr; uint64_t rx_base; uint64_t tx_base; - int port = 0; + uint16_t port = 0; int err; PMD_INIT_FUNC_TRACE(); @@ -501,7 +501,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx; - if (port < 0 || port > 7) { + if (port > 7) { PMD_DRV_LOG(ERR, "Port value is wrong"); return -ENODEV; } @@ -761,10 +761,10 @@ static int nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, const struct nfp_dev_info *dev_info) { - int i; + uint8_t i; int ret; int err = 0; - int total_vnics; + uint32_t total_vnics; struct nfp_net_hw *hw; unsigned int numa_node; struct rte_eth_dev *eth_dev; @@ -785,7 +785,7 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, /* Read the number of vNIC's created for the PF */ total_vnics = nfp_rtsym_read_le(pf_dev->sym_tbl, "nfd_cfg_pf0_num_ports", &err); - if (err != 0 || total_vnics <= 0 || total_vnics > 8) { + if (err != 0 || total_vnics == 0 || total_vnics > 8) { PMD_INIT_LOG(ERR, "nfd_cfg_pf0_num_ports symbol with wrong value"); ret = -ENODEV; goto app_cleanup; @@ -795,7 +795,7 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, * For coreNIC the number of vNICs exposed should be the same as the * number of physical ports */ - if (total_vnics != (int)nfp_eth_table->count) { + if (total_vnics != nfp_eth_table->count) { PMD_INIT_LOG(ERR, "Total physical ports do not match number of vNICs"); ret = -ENODEV; goto app_cleanup; @@ -1053,15 +1053,15 @@ nfp_secondary_init_app_fw_nic(struct rte_pci_device *pci_dev, struct nfp_rtsym_table *sym_tbl, struct nfp_cpp *cpp) { - int i; + uint32_t i; int err = 0; int ret = 0; - int total_vnics; + uint32_t total_vnics; struct nfp_net_hw *hw; /* Read the number of vNIC's created for the PF */ total_vnics = nfp_rtsym_read_le(sym_tbl, "nfd_cfg_pf0_num_ports", &err); - if (err != 0 || total_vnics <= 0 || total_vnics > 8) { + if (err != 0 || total_vnics == 0 || total_vnics > 8) { PMD_INIT_LOG(ERR, "nfd_cfg_pf0_num_ports symbol with wrong value"); return -ENODEV; } @@ -1069,7 +1069,7 @@ nfp_secondary_init_app_fw_nic(struct rte_pci_device *pci_dev, for (i = 0; i < total_vnics; i++) { struct rte_eth_dev *eth_dev; char port_name[RTE_ETH_NAME_MAX_LEN]; - snprintf(port_name, sizeof(port_name), "%s_port%d", + snprintf(port_name, sizeof(port_name), "%s_port%u", pci_dev->device.name, i); PMD_INIT_LOG(DEBUG, "Secondary attaching to port %s", port_name); diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index ac6a10685d..892300a909 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -260,7 +260,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) uint64_t tx_bar_off = 0, rx_bar_off = 0; uint32_t start_q; - int port = 0; + uint16_t port = 0; int err; const struct nfp_dev_info *dev_info; diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 6d9a1c249f..4c9904e36c 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -121,7 +121,7 @@ struct nfp_flow_item_proc { /* Bit-mask to use when @p item->mask is not provided. */ const void *mask_default; /* Size in bytes for @p mask_support and @p mask_default. */ - const unsigned int mask_sz; + const size_t mask_sz; /* Merge a pattern item into a flow rule handle. */ int (*merge)(struct nfp_app_fw_flower *app_fw_flower, struct rte_flow *nfp_flow, @@ -1941,8 +1941,8 @@ static int nfp_flow_item_check(const struct rte_flow_item *item, const struct nfp_flow_item_proc *proc) { + size_t i; int ret = 0; - unsigned int i; const uint8_t *mask; /* item->last and item->mask cannot exist without item->spec. */ @@ -2037,7 +2037,7 @@ nfp_flow_compile_item_proc(struct nfp_flower_representor *repr, char **mbuf_off_mask, bool is_outer_layer) { - int i; + uint32_t i; int ret = 0; bool continue_flag = true; const struct rte_flow_item *item; @@ -2271,7 +2271,7 @@ nfp_flow_action_set_ipv6(char *act_data, const struct rte_flow_action *action, bool ip_src_flag) { - int i; + uint32_t i; rte_be32_t tmp; size_t act_size; struct nfp_fl_act_set_ipv6_addr *set_ip; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 7885166753..8cbb9b74a2 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -190,7 +190,7 @@ nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq) { struct nfp_net_dp_buf *rxe = rxq->rxbufs; uint64_t dma_addr; - unsigned int i; + uint16_t i; PMD_RX_LOG(DEBUG, "Fill Rx Freelist for %u descriptors", rxq->rx_count); @@ -229,7 +229,7 @@ nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq) int nfp_net_rx_freelist_setup(struct rte_eth_dev *dev) { - int i; + uint16_t i; for (i = 0; i < dev->data->nb_rx_queues; i++) { if (nfp_net_rx_fill_freelist(dev->data->rx_queues[i]) != 0) @@ -840,7 +840,7 @@ nfp_net_recv_pkts(void *rx_queue, static void nfp_net_rx_queue_release_mbufs(struct nfp_net_rxq *rxq) { - unsigned int i; + uint16_t i; if (rxq->rxbufs == NULL) return; @@ -992,11 +992,11 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, * @txq: TX queue to work with * Returns number of descriptors freed */ -int +uint32_t nfp_net_tx_free_bufs(struct nfp_net_txq *txq) { uint32_t qcp_rd_p; - int todo; + uint32_t todo; PMD_TX_LOG(DEBUG, "queue %hu. Check for descriptor with a complete" " status", txq->qidx); @@ -1032,7 +1032,7 @@ nfp_net_tx_free_bufs(struct nfp_net_txq *txq) static void nfp_net_tx_queue_release_mbufs(struct nfp_net_txq *txq) { - unsigned int i; + uint32_t i; if (txq->txbufs == NULL) return; diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 9a30ebd89e..98ef6c3d93 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -253,7 +253,7 @@ int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); -int nfp_net_tx_free_bufs(struct nfp_net_txq *txq); +uint32_t nfp_net_tx_free_bufs(struct nfp_net_txq *txq); void nfp_net_set_meta_vlan(struct nfp_net_meta_raw *meta_data, struct rte_mbuf *pkt, uint8_t layer); -- 2.39.1