Re: [PATCH bpf-next v2 2/6] net: tun: enable transfer of XDP metadata to skb

From
Marcus Wichelmann <hidden>
Date
2025-02-19 15:15:34
Also in
bpf, linux-kselftest, lkml
Reply to
Willem de Bruijn, 2025-02-19
Am 19.02.25 um 16:06 schrieb Willem de Bruijn:
Marcus Wichelmann wrote:
quoted
Am 18.02.25 um 02:47 schrieb Willem de Bruijn:
quoted
[...]
This is pointer comparison, which is tricky wrt type. It likely is
ptrdiff_t and thus signed. But may want to use max_t(long int, ..) to
make this explicit.
Ah, I see, good point.

So like that?

	metasize = max_t(long int, xdp->data - xdp->data_meta, 0);
	if (metasize)
		skb_metadata_set(skb, metasize);
Or just this? Also ensures the test uses signed int.

     int metasize;

     ...


     metasize = xdp->data - xdp->data_meta;
     if (metasize > 0)
             skb_metadata_set(skb, metasize);
Well, yeah, just keep it simple I guess. ;) Will do that.

I'll send a V3 patch series with the change.

Thanks!

Marcus
Thread (16 messages) 16 messages, 3 authors, last reply 2025-02-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help