public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] netpoll: Add support for hardware checksumming on egress
Date: Tue, 12 Jun 2012 14:43:20 +0200	[thread overview]
Message-ID: <1339505000.22704.132.camel@edumazet-glaptop> (raw)
In-Reply-To: <1339496765-3093-2-git-send-email-bogdan.hamciuc@freescale.com>

On Tue, 2012-06-12 at 13:26 +0300, Bogdan Hamciuc wrote:
> Netpoll used to compute its own csum; but if the device supports, we
> should let it do the checksum itself.
> 
> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com>
> ---
>  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 9a08068..f5d00b4 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -385,13 +385,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);

Hi Bogdan

I cant see how this can possibly work ?

Which NIC was able to send a good UDP frame after this patch ?

  reply	other threads:[~2012-06-12 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 10:26 [PATCH] netpoll: Fix skb tail pointer in netpoll_send_udp() Bogdan Hamciuc
2012-06-12 10:26 ` [PATCH] netpoll: Add support for hardware checksumming on egress Bogdan Hamciuc
2012-06-12 12:43   ` Eric Dumazet [this message]
2012-06-12 12:22 ` [PATCH] netpoll: Fix skb tail pointer in netpoll_send_udp() Eric Dumazet
2012-06-12 13:15   ` Eric Dumazet
2012-06-12 13:34     ` Eric Dumazet
2012-06-12 15:08       ` Hamciuc Bogdan-BHAMCIU1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339505000.22704.132.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=bogdan.hamciuc@freescale.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox