Use rte_pktmbuf_mtod_offset. Change was automatically generated by cocci/mtod-offset.cocci.
Signed-off-by: Stephen Hemminger <step...@networkplumber.org> --- 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