diff options
author | Stanislav Fomichev <sdf@google.com> | 2023-11-27 11:03:14 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-11-29 14:59:40 -0800 |
commit | 11614723af26e7c32fcb704d8f30fdf60c1122dc (patch) | |
tree | e1040027e771206bc1b17ebc626bf8d5e1a58574 /net/xdp/xsk.c | |
parent | ce59f9686e0eca19431571c7403394a6c36371e2 (diff) |
xsk: Add option to calculate TX checksum in SW
For XDP_COPY mode, add a UMEM option XDP_UMEM_TX_SW_CSUM
to call skb_checksum_help in transmit path. Might be useful
to debugging issues with real hardware. I also use this mode
in the selftests.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/20231127190319.1190813-9-sdf@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/xdp/xsk.c')
-rw-r--r-- | net/xdp/xsk.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index d66ba9d6154f..281d49b4fca4 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -744,6 +744,12 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs, skb->csum_start = hr + meta->request.csum_start; skb->csum_offset = meta->request.csum_offset; skb->ip_summed = CHECKSUM_PARTIAL; + + if (unlikely(xs->pool->tx_sw_csum)) { + err = skb_checksum_help(skb); + if (err) + goto free_err; + } } } } |