diff options
author | Bogdan Hamciuc <bogdan.hamciuc@freescale.com> | 2012-05-25 16:08:07 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-04-18 21:44:22 (GMT) |
commit | 980a27082fe7c51625b07541437b62503ce4f4b8 (patch) | |
tree | d43c80f21e831fe4a4ab69ab86523129817e7421 /net | |
parent | e6966c11a2b71c0031d9160dac94d1375fef7cb8 (diff) | |
download | linux-fsl-qoriq-980a27082fe7c51625b07541437b62503ce4f4b8.tar.xz |
netpoll: Add support for hardware checksumming on egress
Netpoll used to compute its own csum; but if the device supports, we
should let it do the checksum itself.
Note: we owe the upstream community some documentation about why and how
we configure FMan for checksumming on egress. It is apparently not clear
to them and so a reason for not having this patch upstream yet.
Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Change-Id: Ie2c8210e1d1e7f5be60bcb9610042009548e06bd
Reviewed-on: http://git.am.freescale.net:8181/1539
Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com>
Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/netpoll.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 3151acf..33436d3 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -400,13 +400,19 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len) udph->source = htons(np->local_port); udph->dest = htons(np->remote_port); udph->len = htons(udp_len); - udph->check = 0; - udph->check = csum_tcpudp_magic(np->local_ip, + + /* Only querying the IPv4 csumming capabilities */ + if (np->dev->features & NETIF_F_IP_CSUM) + skb->ip_summed = CHECKSUM_PARTIAL; + else { + skb->ip_summed = CHECKSUM_NONE; + udph->check = csum_tcpudp_magic(np->local_ip, np->remote_ip, udp_len, IPPROTO_UDP, csum_partial(udph, udp_len, 0)); - if (udph->check == 0) - udph->check = CSUM_MANGLED_0; + if (udph->check == 0) + udph->check = CSUM_MANGLED_0; + } skb_push(skb, sizeof(*iph)); skb_reset_network_header(skb); |