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 785EB42DEC; Thu, 6 Jul 2023 19:59:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B46A642FF4; Thu, 6 Jul 2023 19:59:44 +0200 (CEST) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id 0B1BA40A79 for ; Thu, 6 Jul 2023 19:59:42 +0200 (CEST) Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-262d33fa37cso605958a91.3 for ; Thu, 06 Jul 2023 10:59:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688666382; x=1691258382; 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=uKIPVSHQOjG/aLU05G8kD/J+dkw9l+RFxXIKhjNDK+w=; b=SIV2QO3Hnp6uE7wEEXqBMzoN3TKVocVggJthHpNK+AdJsPAFs1w+cWYOjDh1vxbko6 T+4DmITnZ1NixppPXG43emXVNwvDHLRtJ7kdVpHxf1JWRtvkiIPQS4c06r1kA8dpxRDR h7bO4kApv94OuiC01Gv8/GE6rMFuDcH65tuj9cZrhcx2Y4nDrckML8bYUP90nrFtHNq8 dkuCaHYNr0X7qT1KIfVfUTSJ+KTEHDPz/XVKOtvMCza9QLuhgWE8DS37eTuD4ZHgEcGt W5mV1ss3sOI3nzOgpcsygVw5lexx8gvm2m5eFKDMMYGOEfcidDw426RcIOqzYLJMtPVY Eo6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688666382; x=1691258382; 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=uKIPVSHQOjG/aLU05G8kD/J+dkw9l+RFxXIKhjNDK+w=; b=GR4jMQvAQ4tZb8REcn5+CbwKzhHX2PABhkv5OQr9dKfADgQFV3TDTjGhzu4E9W1FXi uw4nZMMdHoGutaLrG+lbu67Jq3krMsuouV8I38Q7oIVxxLpZ2VxMpoNB0OqxYu+fYwf+ bD4rjRiiSAzR4O9vJBAtIy6qjSj3XzuHS6TrsS+rT5AJtkWt7RdmnmoLNl5zlod8WwRq 5KDpZKMQ5+Z7SzFBgZrdoQ7eJBlsWggZvfLtu35pqyfB+9YydE8TUeCOzEBpeka6Aa47 j7FuOBcoNmS3w0LGTV8CC4bGM7jNru4a55piC/bBbRdhxVZEx9POzia/JjUt3rp3CZFf cmsA== X-Gm-Message-State: ABy/qLZYi+EX9Hr4uS9sZS7Tpv0zcLCjNnzCm0DiHyaxoDarRjruJ9+O bprbO5SxcOQJmRYT7xrNgJasE7fMxUMG2Grz6zY= X-Google-Smtp-Source: APBJJlGxzB8EBoc/yV8aQShCSDYZFeYJnm4hzkXktRw/mGobv23HpkCDFS2omAUNRpbO0Rkmy7a8Vw== X-Received: by 2002:a17:90b:1110:b0:263:72c5:9ac6 with SMTP id gi16-20020a17090b111000b0026372c59ac6mr1988145pjb.11.1688666381664; Thu, 06 Jul 2023 10:59:41 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id nh8-20020a17090b364800b00256bbfbabcfsm76464pjb.48.2023.07.06.10.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 10:59:41 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jiayu Hu Subject: [PATCH v3 01/14] gro: use rte_pktmbuf_mtod_offset Date: Thu, 6 Jul 2023 10:59:25 -0700 Message-Id: <20230706175938.62721-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230706175938.62721-1-stephen@networkplumber.org> References: <20230505174813.133894-1-stephen@networkplumber.org> <20230706175938.62721-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_tcp.h | 2 +- lib/gro/gro_tcp4.c | 2 +- lib/gro/gro_udp4.c | 4 ++-- lib/gro/gro_vxlan_tcp4.c | 4 ++-- lib/gro/gro_vxlan_udp4.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/gro/gro_tcp.h b/lib/gro/gro_tcp.h index d926c4b8cc71..2c825413c261 100644 --- a/lib/gro/gro_tcp.h +++ b/lib/gro/gro_tcp.h @@ -150,7 +150,7 @@ check_seq_option(struct gro_tcp_item *item, struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (char *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = rte_pktmbuf_mtod_offset(pkt_orig, char *, l2_offset + pkt_orig->l2_len); tcph_orig = (struct rte_tcp_hdr *)(iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 6645de592b63..f8cd92950c63 100644 --- a/lib/gro/gro_tcp4.c +++ b/lib/gro/gro_tcp4.c @@ -223,7 +223,7 @@ update_header(struct gro_tcp_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 *) + + 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_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 6ab700192261..2752650389a4 100644 --- a/lib/gro/gro_vxlan_tcp4.c +++ b/lib/gro/gro_vxlan_tcp4.c @@ -263,8 +263,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