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 2608442A7F; Sat, 6 May 2023 18:04:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9122D42D1A; Sat, 6 May 2023 18:04:09 +0200 (CEST) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id 67170406B8 for ; Sat, 6 May 2023 18:04:08 +0200 (CEST) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6439df6c268so1340632b3a.0 for ; Sat, 06 May 2023 09:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1683389047; x=1685981047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S/fBocBp4c6TNBaX8tRmecKLA8o4i54C4sI6m9zFMbM=; b=UV479DoY+iO3J2m5G7TiVnglczSHjqimslEM6IWWVEAV64STi3SJ8h0PTgldo5l4pb G/9zfiWZDQ2lvdKu3m1EHr15HMa2MKDWJ9I0JzCVv/m4R7MKjjcMce1mj3eMGscz94sR codKmMrQOP9gLzE6O8YT2rSJvxKYfxEdMfdlG+JYcAr2JKrsO7QU8W5i28fMDvnP3ebB 98NJe7hAgyjjuAvsxlLNPSfvXClFy9TbPGs5HhrRBiO23hfuCWAvOG3Y1rLkitmKdRx/ dWxP2ZF9UdaVLYygiSjtMnFT3SBrh+dtJa3lK2UNlx53gFsphytFFqKBJ+DoG56nDelF kaJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683389047; x=1685981047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S/fBocBp4c6TNBaX8tRmecKLA8o4i54C4sI6m9zFMbM=; b=iewCqrYfFLVTGeU+kfcVfA/EQhUiojuNyBZPrXHoQNbwKf6ZxefhgxFs1mRiLo0XTh jlkLEZXSoYE8fmqWEMHPXeQMAMOjr1iKnqQ2nbhyBKL0Tp4dUTEwMmHTAlwe516dAXtz eciVBYXiZr1mKXCHDwDr1NyYa2zJPyxQD8vbuZeyCHsp1XSUVgKOQ8IBaSR/ML/HQhTA 8eem0L31mi/Ww/T4rrc1tZM/mqf+qAmQt/mZfgrnTa7/5lBlOWmyZjR3/XhGgYmWCVLz Z3zUYHebACMLTu9Bow+DiCTQi32I5tSM0ekcG3fTmW5XS1dR5pW1urqzIT0amdC47+HB UPrA== X-Gm-Message-State: AC+VfDwBE9bHoF4psn8Dqe2RUfKuhTNc/Jfw7g/ceQ+Ub6Q5P1WuHVty 2B4fHRdhNm90hlANtQcb9AfaXTnfC27PXnkJ85aYQQ== X-Google-Smtp-Source: ACHHUZ5kP8WLGA8rxG9fonfZf4i/3zMOYRkOcCQvvJrzt2OOZJv4SwNzYd6NfnfDtJmJXHjGjDxgQw== X-Received: by 2002:aa7:8882:0:b0:643:5da1:d527 with SMTP id z2-20020aa78882000000b006435da1d527mr7900753pfe.27.1683389047335; Sat, 06 May 2023 09:04:07 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id e14-20020a62ee0e000000b006436ffa3dc4sm3369890pfi.24.2023.05.06.09.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 May 2023 09:04:06 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jiayu Hu Subject: [PATCH v2 01/14] gro: use rte_pktmbuf_mtod_offset Date: Sat, 6 May 2023 09:03:50 -0700 Message-Id: <20230506160404.7423-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230506160404.7423-1-stephen@networkplumber.org> References: <20230505174813.133894-1-stephen@networkplumber.org> <20230506160404.7423-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Use rte_pktmbuf_mtod_offset. Change was automatically generated by cocci/mtod-offset.cocci. Signed-off-by: Stephen Hemminger --- lib/gro/gro_tcp4.c | 4 ++-- lib/gro/gro_tcp4.h | 4 ++-- lib/gro/gro_udp4.c | 4 ++-- lib/gro/gro_vxlan_tcp4.c | 4 ++-- lib/gro/gro_vxlan_udp4.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 0014096e6332..6f8466e70211 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -182,8 +182,8 @@ update_header(struct gro_tcp4_item *item) struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + - pkt->l2_len); + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); } diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index 212f97a0427c..c76f1f5686d1 100644 --- a/lib/gro/gro_tcp4.h +++ b/lib/gro/gro_tcp4.h @@ -272,8 +272,8 @@ check_seq_option(struct gro_tcp4_item *item, struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + - l2_offset + pkt_orig->l2_len); + iph_orig = rte_pktmbuf_mtod_offset(pkt_orig, struct rte_ipv4_hdr *, + l2_offset + pkt_orig->l2_len); tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c index 42596d33b6dc..019e05bcdea5 100644 --- a/lib/gro/gro_udp4.c +++ b/lib/gro/gro_udp4.c @@ -179,8 +179,8 @@ update_header(struct gro_udp4_item *item) struct rte_mbuf *pkt = item->firstseg; uint16_t frag_offset; - ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + - pkt->l2_len); + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); diff --git a/lib/gro/gro_vxlan_tcp4.c b/lib/gro/gro_vxlan_tcp4.c index 3be4deb7c76f..b93a02c149cc 100644 --- a/lib/gro/gro_vxlan_tcp4.c +++ b/lib/gro/gro_vxlan_tcp4.c @@ -269,8 +269,8 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + - pkt->outer_l2_len); + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); /* Update the outer UDP header. */ diff --git a/lib/gro/gro_vxlan_udp4.c b/lib/gro/gro_vxlan_udp4.c index b78a7ae89eef..ca8cee270d3d 100644 --- a/lib/gro/gro_vxlan_udp4.c +++ b/lib/gro/gro_vxlan_udp4.c @@ -259,8 +259,8 @@ update_vxlan_header(struct gro_vxlan_udp4_item *item) /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + - pkt->outer_l2_len); + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); /* Update the outer UDP header. */ -- 2.39.2