DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: perform SW IP checksum for GRO packets
@ 2022-05-11  1:37 Wenwu Ma
  2022-05-11  7:27 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Wenwu Ma @ 2022-05-11  1:37 UTC (permalink / raw)
  To: xiaoyun.li, aman.deep.singh, yuying.zhang, dev
  Cc: jiayu.hu, yinan.wang, xingguang.he, Wenwu Ma

The GRO library doesn't re-calculate checksums for
merged packets. If users want the merged packets to
have correct IP checksums, they should select HW IP
checksum calculation for the port which the merged
packets are transmitted to. But if the port doesn't
support HW IP checksum, users may perform a SW IP
checksum. This patch add the code about it.

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
 app/test-pmd/csumonly.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 8b6665d6f3..76ce58f6d0 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -824,6 +824,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 	void **gro_ctx;
 	uint16_t gro_pkts_num;
 	uint8_t gro_enable;
+	struct rte_ipv4_hdr *ipv4_hdr;
 #endif
 	uint16_t nb_rx;
 	uint16_t nb_tx;
@@ -1098,6 +1099,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 				fs->gro_times = 0;
 			}
 		}
+
+		for (i = 0; i < nb_rx; i++) {
+			if ((pkts_burst[i]->ol_flags & RTE_MBUF_F_TX_IPV4) &&
+				(tx_offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) == 0) {
+				ipv4_hdr = rte_pktmbuf_mtod_offset(pkts_burst[i],
+							struct rte_ipv4_hdr *,
+							pkts_burst[i]->l2_len);
+				ipv4_hdr->hdr_checksum = 0;
+				ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr);
+			}
+		}
 	}
 #endif
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-19  8:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  1:37 [PATCH] app/testpmd: perform SW IP checksum for GRO packets Wenwu Ma
2022-05-11  7:27 ` David Marchand
2022-05-11  9:00   ` Ma, WenwuX
2022-05-11  9:35 ` [PATCH v2] app/testpmd: perform SW IP checksum for GRO/GSO packets Wenwu Ma
2022-05-12  1:07 ` [PATCH v3] " Wenwu Ma
2022-05-12  1:33   ` Hu, Jiayu
2022-05-17  2:56   ` Ling, WeiX
2022-05-17 16:02   ` Zhang, Yuying
2022-05-19  8:23     ` Andrew Rybchenko

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git