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 9CB7A43220; Sat, 28 Oct 2023 08:53:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CA20402DE; Sat, 28 Oct 2023 08:53:49 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2093.outbound.protection.outlook.com [40.107.101.93]) by mails.dpdk.org (Postfix) with ESMTP id 82F6740272 for ; Sat, 28 Oct 2023 08:53:45 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dixV2LqVo6dyY/yOLDHhDBY8besmVtpCmP1OOVwtAo+LVwtKB5QU18pHRGU/RHg9O5KVWDEho7NP9pEkdCvT865k4iiMxfCFR6vgDX1u2Ox+rcEytrCJrvOWaxPnhStfdwZQ3LwA2sv7HVStLJTCAgbatAcXWMee/xTKz7Cs/qWzsW2bv0why6AkjexS/hTx+VMk6wXDjK6OOpEIRedLqexQhkw0fxkW3/m0M3eyCv9CG3tvdkXvV7/EryWvI4R5VDpugu/+31Y/KA1t/cUF/Eep/DBY9/1qWiyLaVw4xG3zYcxxD4I9huz+Z+NEiBTbVnD4b9CX00psN24Pk+ofEw== 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=ngAzIZj7ZKSlER+atxQd3+kIA+MCvahvi3zEZ8i/4Xk=; b=SG7Aplm30SB02inAo04wG7XvdbkVQCxLoAd3yMTkGHjuGVAebpqgT72xlXApaLgvyG2PVX8yvLLzImF2i2/j9+8wW4jmhNPQwusHasUPfpLQJ/YrcY5h5xnNGV5LkgQ1cS533/pEU4ulE/XyUifXN1876ZcE3W+q0sFTxAi4TNiSxPiRePkyy+l4xgCLHcaoARizWjPpdDE4KOoXaaC0o6y+9kGwIKdbHxc5Ty/FLveFFieijs4ySFITUOUdIfE+o2nAa7KNhdECAsVRKuxmPFAqcY9we8bEvaQjtu4W9j6vHJVSfq04/srhUqeWS3KbQKR5yKQNHApxpiGt5DTJnQ== 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=ngAzIZj7ZKSlER+atxQd3+kIA+MCvahvi3zEZ8i/4Xk=; b=G7cx2Cx0CUv3YuV6Mjg3H8B+wYBuoqlrUi2mcl5yZQE8dt8k1uDoA403BeSei6pDhCnJcnkAeEkUyrsK4Nlo5esyjhKc76iErOZwdQf8j7Akpl7gJ2uoqwJyhjNqbMzh88ZzZFAfpkBSKhUthdqtp1XBE7RPdbXDEECWbdXDfXA= 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 SA1PR13MB6055.namprd13.prod.outlook.com (2603:10b6:806:338::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Sat, 28 Oct 2023 06:53:43 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.6933.022; Sat, 28 Oct 2023 06:53:43 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH v2 01/11] net/nfp: use the suitable helper macro Date: Sat, 28 Oct 2023 14:53:05 +0800 Message-Id: <20231028065315.1937188-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028065315.1937188-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> <20231028065315.1937188-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:d3::25) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: 648d9d16-5912-4c78-ffbd-08dbd7829fde X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: etGVYj6n05HjK+ds6tEzWzgx+Wx2tSqzYHlYx3cOvy+fN8Q4UECDDsTZsy39N/ouJkr+YbBhPDxXs4E0qffKiOYWRrlWfw39WrZnJXYJwQbZbblQ2paN9hvrjNj2SJHiZMnKTREq0xJP+zpzoBuP+L/DW8xMAXOQXsqmsOsn5jV3f91RRz5IqWGid1N/NOsC8DLxM1pBnpeVHw9eMkCclveYJWSgFYKqjER/5NgJdNbY7nhtXclx9QW5avsnbeQqitz7YXJGeZFNnNWDGJH3EFZgGF8AWXMZgBEc4r0RwKV2aG9fdgfHygRcoBBZeYwZSluIT71eelU2mWFfspdBMTZeHEW1p20o9nMdRq8PQp8ESIAmabZZFZDDovP9x40yoRcpfpiwcH496TnjhZqmU5ET2pMf6Szbkz/ltf5GNMV1Plsy+EHAhElZw6Y22ZVmZPGtrQ5RwlBvRVbb+BiMObJFAU8ZIxgobdoZ/wk+BDcwLLGSVUWWOUJ8IQSUMTXJ7abVYtT3jNYsFIFckyc4M4x/wdPMEmCKLha0u9cRDRVDboRhPBZL1oMaBqyG69N2UllJM0up2pO1BNT30PRNFrUAD9lokuSSfUjw8sb+0K/SdGyf/+ez2UjI9N/VBR2mDHscL1dbClAW65XwHVlF+lfkph8RrY4EezXj8fXkyNc= 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)(346002)(136003)(396003)(366004)(39830400003)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(6486002)(8676002)(8936002)(478600001)(6666004)(54906003)(66476007)(66946007)(66556008)(86362001)(4326008)(41300700001)(5660300002)(6916009)(2906002)(44832011)(316002)(6506007)(52116002)(38100700002)(36756003)(2616005)(1076003)(107886003)(6512007)(26005)(38350700005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jUSyfQFI0BChJna+SMv1Fz3bOSEBAnxDvmNMMgyDVGaXy69sxviGE5XgHop4?= =?us-ascii?Q?EXO1bsXYyRLmPoCtrWWa5G7Wgadq8aKJY7XTxzkvOYta11iahc5XQ9kw3e/k?= =?us-ascii?Q?50eEAWvy9pam6W+pBRhzSaiWF8fwiRZhaXq6KSNU1Lyv5FnaZn304SSnQBex?= =?us-ascii?Q?YEROZNoXMfcCNx4c4hdxq50+wjYcuiogmq0dOrxuUhHAz+dcdCPHkGHg/i83?= =?us-ascii?Q?IFbQ9plNOCqHxCzHOauwouPoNUwPbfe2G9m9eFTtR92flkRtKF7W2yZafKiD?= =?us-ascii?Q?eSJJApz8bGQQFDk/0ljQeM1QPqPU2qXrQdoJ3y1pYowi+dBto+ePJBg2qb/q?= =?us-ascii?Q?s2hYrIlitW0ku7PYUk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sb9Dt9gojl?= =?us-ascii?Q?xjsWjb43X+izOl9YyIPVyp/jJ3LY6I+0GiwXO1FC1+pqznF/XJWGK1xJys6p?= =?us-ascii?Q?7k8OokZCxzo7Ir70UeiCZTh32d/VLfhtgWJ9qzFT/0AyShrLoW515CCciUXW?= =?us-ascii?Q?mz7AG7ZjXQOowzZX3gA+180yewXk9rOGULo5QxSDDBWcOS3gJlLd1pd9HzRS?= =?us-ascii?Q?Vtb8ofZBNSpBkUBHfUuY3JYHJrzTAGQ1/CLtqUpFvrrJ4G9d2Cy94yR4faOe?= =?us-ascii?Q?jH+GZhtxB+eRrd1HAELqvpzp1ig6IJdJ9DlpZmL8PvP3G22xdZVNEOk+maIn?= =?us-ascii?Q?aacPep9vvE6SWI1q2zb43YV2JUsiwnSFQvKsovS/VlBCLFqgBL1p3SsNqpob?= =?us-ascii?Q?Bg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 648d9d16-5912-4c78-ffbd-08dbd7829fde X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2023 06:53:43.4411 (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: rRgyY2tnUwmeckqlFPjP0iIDgehR8KSA3PBUK1DY4db2W5gZnPnldQfgdf4Mc2DBmzzNrLtdxe0bMotCEycGiCOsk+SWFH367ahNPMendsA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB6055 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 Replace the `rte_pktmbuf_mtod()` macro to with the more suitable `rte_pktmbuf_mtod_offset()`. Signed-off-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower_cmsg.c | 2 +- drivers/net/nfp/flower/nfp_flower_ctrl.c | 4 ++-- drivers/net/nfp/nfp_rxtx.c | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c index 2ec9498d22..4013b32fd0 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.c +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c @@ -13,7 +13,7 @@ static char* nfp_flower_cmsg_get_data(struct rte_mbuf *m) { - return rte_pktmbuf_mtod(m, char *) + 4 + 4 + NFP_FLOWER_CMSG_HLEN; + return rte_pktmbuf_mtod_offset(m, char *, 4 + 4 + NFP_FLOWER_CMSG_HLEN); } static void * diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index b4be28ccdf..d19b60bc69 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -375,7 +375,7 @@ nfp_flower_cmsg_rx_stats(struct nfp_flow_priv *flow_priv, uint32_t ctx_id; struct nfp_flower_stats_frame *stats; - msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN; + msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN); msg_len = mbuf->data_len - NFP_FLOWER_CMSG_HLEN; count = msg_len / sizeof(struct nfp_flower_stats_frame); @@ -398,7 +398,7 @@ nfp_flower_cmsg_rx_qos_stats(struct nfp_mtr_priv *mtr_priv, struct nfp_mtr *mtr; struct nfp_mtr_stats_reply *mtr_stats; - msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN; + msg = rte_pktmbuf_mtod_offset(mbuf, char *, NFP_FLOWER_CMSG_HLEN); mtr_stats = (struct nfp_mtr_stats_reply *)msg; profile_id = rte_be_to_cpu_32(mtr_stats->head.profile_id); diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index fc94e5f0b9..644be2700e 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -448,8 +448,7 @@ nfp_net_parse_meta(struct nfp_net_rx_desc *rxds, if (unlikely(NFP_DESC_META_LEN(rxds) == 0)) return; - meta_base = rte_pktmbuf_mtod(mb, uint8_t *); - meta_base -= NFP_DESC_META_LEN(rxds); + meta_base = rte_pktmbuf_mtod_offset(mb, uint8_t *, -NFP_DESC_META_LEN(rxds)); meta_header = *(rte_be32_t *)meta_base; switch (hw->meta_format) { -- 2.39.1