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 53E1943220; Sat, 28 Oct 2023 08:16:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5621402D2; Sat, 28 Oct 2023 08:16:33 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2098.outbound.protection.outlook.com [40.107.220.98]) by mails.dpdk.org (Postfix) with ESMTP id 2F3C840291 for ; Sat, 28 Oct 2023 08:16:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQz+bqCuz8sjL9LWjehmgcOGoecNim/IJxtwBu654uOzQRpZfLNjlEdetR6zB+ujKiKWrR6cd7LwsuuyeyVC2QxjYEbiIh2VLNUyChOpcTs1v1UVnHqQxcDgC+hp2I2cEpXqaGJ5qnvzX5HsqbwjuozvorsNMAB/LyNa7mBP/0bTBZ3QFLLAOLIGnPb0SYS3JvFnuyDZKNMwRv2L/kMqb4RaaArZPbjllK3me4B/D7RdBZigy1gN01pd2JzbNlxFswZTG3B2TC4okzEvtQxVMPdrazn9xzQBrQl52WBbTV3LWi1wxrg9IKlMCMYtf+K9seICLmJTgASMdmMMcez4/Q== 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=X6sGhaqQp22CwXc9OSGYlMKmLfsNldGUQsJo4k9LwaetHvXoWhxyYMDJyGTerCEl4vhxbeI0vQUbMjseP77NXazF0zkP30Hw+dGMrq6gvZvldVV7JxtYTChptXXlAk9MdT05gYd7f+zR3MXrAHHxFBgXf/jVcsagLUBWiqW3LBesPETZQgEzDIQYrXh2j4asGBKoavGBOK41yYKH/IdwBxtsAgQ/eHey2SbPJIR4Dlm2Pxbupj5W6XtZbJyIuORm5ABdECKUDjVZnhSwQlMBySg/rIMuBDjQ+Q3+wu1GEr5MdsaB+SYZCIe/BXv2VtIrB8kb4wEMGzAlXDsNGhCU8w== 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=q54QSjorfwrWjJp+uiNrbE4g8UK0QlMs4t6HzeWMK7J7MONEZH/AHoAIXoEup6OXyZhhbsVa0vInDp6MENRr9hnmMXskYxw8N7lNsvDIGRNgJDdqt48WJ6fmsoKl84YU9xnVm+7iNJaIdzKQ2V+39vp2bjlr+ezC9XgQnRSHyfE= 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 PH7PR13MB5551.namprd13.prod.outlook.com (2603:10b6:510:139::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.29; Sat, 28 Oct 2023 06:16:28 +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:16:28 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH 01/11] net/nfp: use the suitable helper macro Date: Sat, 28 Oct 2023 14:15:48 +0800 Message-Id: <20231028061558.1842855-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028061558.1842855-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0246.namprd03.prod.outlook.com (2603:10b6:a03:3a0::11) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB5551:EE_ X-MS-Office365-Filtering-Correlation-Id: 4649a92f-e398-4c60-cbef-08dbd77d6b86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: adwsjO+yUE1zTRzafP/qpmU6MiwM7/hF614cbh6T41JhjGLKsiOGGallnR3KW9M/N85zoID0KN6Tpz+IX4xb5GdzkJD1RGIHtV7SGf6bW57usKK/u1KtZJGyGembi5/gOP1MfPGod6K0UsKFUefW8s4aN8KAc2HiBsDohLMm1JTqEuL/q83pIA0StAqO/7tBtAwT4lnKkg5XTP0ZgeMS5wQaDKS9dPUZ6ZN8ZbsKxiNjDudhVkOAr2CUrcJGLtNexgpLaGxF2mnLCv/dfe4YWyT4IwpUKLwM+VhKmPitfMMgfql7ktT4LYpQ4jXfqJnLzFZwidGjs//GK8UzaXAECj87RWxJ1ZkyFmh0eyQ+fyWdfNYGlww2nPHiDCVyPlGoBSIDNVYjU5MyUrhQgacEbIvjKWdKZpoKtoBEpKFDPV1Q9vyNmwo/Yj55d1DPLjch34ANRtaOfwz/Kg7YH/v4qnWhEN0M2BbWauJ/NdNBY3YPZt70C3b5jf93YZ8QITbNQ27fkbWCwlYr+CMMd40sCMy2sU2aIlSpShWfDgoW1KSjEUNPUt5lBN8Q/2Z8+7l/vMtxrKe90QQ6JV63f46VQE8Nw9+e2+e8pAA8OxQo8SylvKDVMTNpXEZkbeEFGYrtsKmeQ7A6O4wzAR5zI8iO8I8n0LW2TYKqDER/YFWbhHo= 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)(376002)(39830400003)(346002)(136003)(366004)(396003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(6512007)(54906003)(107886003)(6506007)(26005)(6666004)(52116002)(83380400001)(2906002)(44832011)(5660300002)(4326008)(8676002)(2616005)(6486002)(41300700001)(478600001)(8936002)(66476007)(38100700002)(6916009)(316002)(66946007)(86362001)(66556008)(36756003)(1076003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7SA7UpXYzKGb4d7ElQkV4hNxV/mv/QttpvPdFdlJwz2RQ4O/MbFY1O1CuSCX?= =?us-ascii?Q?QAL38vFpNiz3QO9Zp/vQQDxLnrz0PeXjDAABMeS+LgTCEMVxf2P1Jiq5cSXd?= =?us-ascii?Q?+MdDRNZNZ0VA7R+3VPYw72LtrEnUlH+0faN6m/At8cJpUjaB+jHCxpCOmFEw?= =?us-ascii?Q?AzPAU47IP8noH5a5dz0DaTcge9WNzbjQTWS7E/5jx9Tvh7/Fxu80d1N/NqIR?= =?us-ascii?Q?v5h+yx0klm2vgl5jHSPvatXbVM2lfpQfki/YqYJUFhEFRzgDqX27SNi4trdc?= =?us-ascii?Q?HbrF/U5NGVDWdci4XvIrE2I5SdoyJztTtCnbKBwupO10rqPgMTy3Xywecmek?= =?us-ascii?Q?IE/Zv5Xw/IGuisUguidmS1Tff2LF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?7WeikZ1cfSMCxtSWcNjGAQsrOdpGTHZSeA+UDjdm6lPO4BeILzl36rjLEQIC?= =?us-ascii?Q?Nph/R6kAIKA/oUPm6jsw3Nc/JVmLJEi/0yQS/+dTVnIBkCp7sGVByQbRiHqi?= =?us-ascii?Q?+N9YXoJTUyRMhZthSFcyHzmxmOCz9bbZi6TAfzwqWH27Jxsbr6FeCTc6gZVJ?= =?us-ascii?Q?UcxB8liT0xtWexHEI6uzxQO8HvAX7mCXgPd1lW9pWArZmSG0C8wT9chZPTWw?= =?us-ascii?Q?+Ko/xhJIu9CT8zrUvNCPf+O1kt1ImTyJvR6s6yudXhti4xA/QsTj5eMb1+NN?= =?us-ascii?Q?iguAjrO68ac3+uBbVizO1Z+0NY7MiljMCtRhz98dYFm/Z7JBOsNROJx8/lIe?= =?us-ascii?Q?ng=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4649a92f-e398-4c60-cbef-08dbd77d6b86 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:16:28.1441 (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: dBv7rgu56iOIiXFNgspOLoCpWxxxNW9ZUMAWQNhcMHzebJ0sqiBZFHwXj5r89AUFXAmy6K09Xk5U/ZbVg/Kl2idhOITl7TTfg73DMrQSAH4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5551 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