On Mon, Jul 31, 2006 at 08:36:58PM +0200, Patrick McHardy wrote:
>
> [NETFILTER]: Get rid of HW checksum invalidation
>
> Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
It all looks great except for the csum update function.
> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index 5d29d5e..a7c42c8 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -222,6 +222,29 @@ copy_skb:
> }
> EXPORT_SYMBOL(skb_make_writable);
>
> +u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval, u_int16_t csum)
> +{
> + u_int32_t diff[] = { oldval, newval };
> +
> + return csum_fold(csum_partial((char *)diff, sizeof(diff),
> + csum ^ 0xFFFF));
> +}
> +EXPORT_SYMBOL(nf_csum_update);
> +
> +u_int16_t nf_proto_csum_update(struct sk_buff *skb,
> + u_int32_t oldval, u_int32_t newval,
> + u_int16_t csum, int pseudohdr)
> +{
> + if (skb->ip_summed != CHECKSUM_PARTIAL) {
> + csum = nf_csum_update(oldval, newval, csum);
> + if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
Shouldn't that be !pseudohdr?
> + skb->csum = nf_csum_update(oldval, newval, skb->csum);
^^^^^^^^^
This is a 32-bit quantity so nf_csum_update should eat a 32-bit quantity
as well. Also, this checksum is not inverted so you need
skb->csum = ~nf_csum_update(oldval, newval, ~skb->csum);
Of course nf_csum_update will need ~csum instead of csum^0xffff.
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html