netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to do TCP tx checksums
@ 2015-11-17  0:20 Ben Greear
  2015-11-17  5:02 ` Tom Herbert
  0 siblings, 1 reply; 10+ messages in thread
From: Ben Greear @ 2015-11-17  0:20 UTC (permalink / raw)
  To: netdev

Hello!

I'm hacking on (my already hacked) pktgen, trying to get it to send TCP frames.

And, having issues getting checksums to work properly.

I'm trying this:
	struct iphdr *iph = ip_hdr(skb);
	struct net_device *odev = pkt_dev->odev;

	if (pkt_dev->flags & F_TCP) {
		if (odev->features & NETIF_F_V4_CSUM) {
			skb->ip_summed = CHECKSUM_PARTIAL;
		} else {
			skb->ip_summed = CHECKSUM_NONE;
		}
		skb->csum = 0;
		__tcp_v4_send_check(skb, iph->saddr, iph->daddr);

I added an export so I could call that __tcp_v4_send_check method
w/out having to put a fake socket struct on the stack.

But, the receiving NIC reports 100% checksum failure, so obviously
I'm not doing it correct.

Any suggestions on what I might be doing wrong or the proper method(s)
to call?

Thanks,
Ben


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

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

end of thread, other threads:[~2015-11-17 21:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17  0:20 How to do TCP tx checksums Ben Greear
2015-11-17  5:02 ` Tom Herbert
2015-11-17  5:47   ` Eric Dumazet
2015-11-17 17:19   ` Ben Greear
2015-11-17 17:44   ` Ben Greear
2015-11-17 18:26     ` Eric Dumazet
2015-11-17 18:32       ` Ben Greear
2015-11-17 19:40         ` Daniel Borkmann
2015-11-17 19:28       ` David Miller
2015-11-17 21:22   ` Ben Greear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).