netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ravinandan.arakali@neterion.com
Cc: shemminger@osdl.org, netdev@vger.kernel.org,
	Steve.Whitaker@neterion.com, Mike.Doyle@neterion.com,
	Andrew.LaCroix@neterion.com, Ananda.Raju@neterion.com,
	dave.fenton@neterion.com, leonid.grossman@neterion.com
Subject: Re: H/W requirements for NETIF_F_HW_CSUM
Date: Wed, 26 Jul 2006 14:07:38 -0700 (PDT)	[thread overview]
Message-ID: <20060726.140738.39464304.davem@davemloft.net> (raw)
In-Reply-To: <006b01c6b0ea$82ed3f60$4510100a@pc.s2io.com>

From: "Ravinandan Arakali" <ravinandan.arakali@neterion.com>
Date: Wed, 26 Jul 2006 12:34:28 -0700

> "You CANNOT use NETIF_F_HW_CSUM, when your hardware does not provide the 
> checksum value.  You must use NETIF_F_IP_CSUM.  Your use of 
> NETIF_F_HW_CSUM + CHECKSUM_UNNECESSARY is flat out incorrect."

NETIF_F_HW_CSUM means, on transmit, that you can handle being given a
skb with ip_summed set to CHECKSUM_HW.

When you see CHECKSUM_HW on transmit, this means that skb->csum holds
the offset into the packet where you should place the computed
checksum.  Actually you are given two packet offsets, defined as
follows:

	csum_start_off = (u32) (skb->h.raw - skb->data);
	csum_stuff_off = (u32) ((skb->h.raw + skb->csum) - skb->data);

The first value is where you should start calculating the two's
complement checksum, and the second value is the offset into the
packet where you should place the 16-bit checksum after you have
folded it.

The thing I think you are misunderstanding is that in order to support
NETIF_F_HW_CSUM you must be able to compute the two's complement over
_ARBITRARY_ portions of the packet and be able to place the 16-bit
checkum you compute at _ARBITRARY_ locations in the packet.

Therefore, saying things like "our card can only handle IPV4 and IPV6"
have no sense when discussing CHECKSUM_HW.  The algorithm of
CHECKSUM_HW on transmit is generic, the protocol in use doesn't
matter, it does a generic two's complement checksum over some section
of the packet data.  This allows to handle arbitrary protocols that
make use of two's complement checksums, not just "ipv4 and ipv6".

On receive, if you want to set CHECKSUM_HW, the card must compute the
two's complement checksum over the entire packet data and place it
in skb->csum.


      reply	other threads:[~2006-07-26 21:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 17:28 H/W requirements for NETIF_F_HW_CSUM Ravinandan Arakali
2006-07-26 19:16 ` Stephen Hemminger
2006-07-26 19:34   ` Ravinandan Arakali
2006-07-26 21:07     ` David Miller [this message]

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=20060726.140738.39464304.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Ananda.Raju@neterion.com \
    --cc=Andrew.LaCroix@neterion.com \
    --cc=Mike.Doyle@neterion.com \
    --cc=Steve.Whitaker@neterion.com \
    --cc=dave.fenton@neterion.com \
    --cc=leonid.grossman@neterion.com \
    --cc=netdev@vger.kernel.org \
    --cc=ravinandan.arakali@neterion.com \
    --cc=shemminger@osdl.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;
as well as URLs for NNTP newsgroup(s).