On Tue, 11 Apr 2017 18:43:47 +0200, Daniel Borkmann wrote: > cls_bpf has a couple of helpers like bpf_l3_csum_replace(), > bpf_l4_csum_replace() > bpf_csum_diff(), bpf_csum_update(), where we (cilium at least) use checksum > diffs extensively. You can then also leave the option to the user to feed > pre-computed diffs from a map, etc, or, to just not care at all when not > necessary. Pushing this via return code seems a bit odd, perhaps a xdp->csum > member could be populated before calling into the program and the resulting > xdp->csum processed further upon exit.
+1 on exposing xdp->csum. I think having the csum complete available in the eBPF program (rather than diff) may be useful for apps doing encap to a csumed tunnel (e.g. UDP). If the header is pre-calculated in the map, having csum complete makes calculating the outer csum extremely easy, right?
