All of lore.kernel.org
 help / color / mirror / Atom feed
* UDP checksum calculation
       [not found] <7784F3C775469047B0E8C3B494DB28BEB1B126@EXC-MBX03.tsn.tno.nl>
@ 2017-06-28  8:46 ` Panneman, J.J. (Jeffrey)
  2017-06-28  9:18   ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Panneman, J.J. (Jeffrey) @ 2017-06-28  8:46 UTC (permalink / raw)
  To: xdp-newbies

Hi All,

I posted this question in the Cillium Slack too, but I figured posting it here might help other people too.
I checked out the Cillium source(from what I see makes use of the provided tc-helpers: https://github.com/cilium/cilium/blob/master/bpf/lib/csum.h), but is there an appropriate way to do checksum (re)calculation for UDP with XDP ? Since it does not really like long loops that much and the payload possibly being quite long. I don't really see a way to loop over the payload to recalculate the checksum, would anyone perhaps have a code snippet for this ?

Kind regards,

Jeffrey
This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: UDP checksum calculation
  2017-06-28  8:46 ` UDP checksum calculation Panneman, J.J. (Jeffrey)
@ 2017-06-28  9:18   ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2017-06-28  9:18 UTC (permalink / raw)
  To: Panneman, J.J. (Jeffrey); +Cc: xdp-newbies

On 06/28/2017 10:46 AM, Panneman, J.J. (Jeffrey) wrote:
> Hi All,
>
> I posted this question in the Cillium Slack too, but I figured posting it here might help other people too.
> I checked out the Cillium source(from what I see makes use of the provided tc-helpers: https://github.com/cilium/cilium/blob/master/bpf/lib/csum.h), but is there an appropriate way to do checksum (re)calculation for UDP with XDP ? Since it does not really like long loops that much and the payload possibly being quite long. I don't really see a way to loop over the payload to recalculate the checksum, would anyone perhaps have a code snippet for this ?

Depends on the use-case, are you rewriting also UDP payload
in XDP? If not, why is [1] not sufficient resp. a variant of
that which calcs the diff? csum_diff() could be an option, but
why not doing it in BPF itself?

   [1] http://lingrok.org/xref/linux-net-next/tools/testing/selftests/bpf/test_xdp.c#141

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-28  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <7784F3C775469047B0E8C3B494DB28BEB1B126@EXC-MBX03.tsn.tno.nl>
2017-06-28  8:46 ` UDP checksum calculation Panneman, J.J. (Jeffrey)
2017-06-28  9:18   ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.