[dpdk-dev] [PATCH RFC 10/11] testpmd: modify source address to validate checksum calculation

Olivier Matz olivier.matz at 6wind.com
Fri May 9 16:50:37 CEST 2014


Always modify the source address of the packet in order to validate
the calculation of the checksums (L3 or L4). This was already done
for IPv4 software checksum, add it for IPv4 hw checksum and IPv6.

Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
---
 app/test-pmd/csumonly.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 9caad8f..e93d75f 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -310,6 +310,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 
 			if (tx_ol_flags & PKT_TX_IP_CKSUM) {
 				/* HW checksum */
+				ipv4_hdr->src_addr--;
 				ol_flags |= PKT_TX_IP_CKSUM;
 			}
 			else {
@@ -373,6 +374,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 					unsigned char *) + l2_len);
 			l3_len = sizeof(struct ipv6_hdr) ;
 			l4_proto = ipv6_hdr->proto;
+			ipv6_hdr->src_addr[3]--;
 
 			if (l4_proto == IPPROTO_UDP) {
 				udp_hdr = (struct udp_hdr*) (rte_pktmbuf_mtod(mb,
-- 
1.9.2



More information about the dev mailing list