net/mlx4_en: optimizes get_fixed_ipv6_csum()
authorEric Dumazet <edumazet@google.com>
Thu, 19 Apr 2018 15:49:29 +0000 (08:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 May 2018 15:59:19 +0000 (11:59 -0400)
commit2d943adf860302a4c7bfee498e64ded9fe7d9dba
treec41bf16890c1891a6f5b4db0b1fb5a8945f0c0d7
parenta8d7d124941973d3de9f388ead826a40929d8707
net/mlx4_en: optimizes get_fixed_ipv6_csum()

While trying to support CHECKSUM_COMPLETE for IPV6 fragments,
I had to experiments various hacks in get_fixed_ipv6_csum().
I must admit I could not find how to implement this :/

However, get_fixed_ipv6_csum() does a lot of redundant operations,
calling csum_partial() twice.

First csum_partial() computes the checksum of saddr and daddr,
put in @csum_pseudo_hdr. Undone later in the second csum_partial()
computed on whole ipv6 header.

Then nexthdr is added once, added a second time, then substracted.

payload_len is added once, then substracted.

Really all this can be reduced to two add_csum(), to add back 6 bytes
that were removed by mlx4 when providing hw_checksum in RX descriptor.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>
Cc: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_rx.c