Re: [PATCH 1/1] net: tun: add XDP metadata support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > >> +		metasize = metasize > 0 ? metasize : 0;
> > > 
> > > Why is this part needed?
> > 
> > When an xdp_buff was initialized withouth metadata support (meta_valid
> > argument of xdp_prepare_buff is false), then data_meta == data + 1.
> > So this check makes sure that metadata was supported for the given xdp_buff
> > and metasize is not -1 (data - data_meta).
> > 
> > But you have a good point here: Because we have control over the
> > initialization of xdp_buff in the tun_build_skb function (first code path),
> > we know, that metadata is always supported for that buffer and metasize
> > is never < 0. So this check is redundant and I'll remove it.
> > 
> > But in the tun_xdp_one function (second code path), I'd prefer to keep that
> > check, as the xdp_buff is externally passed to tun_sendmsg and the tun driver
> > should probably not make assumptions about the metadata support of buffers
> > created by other drivers (e.g. vhost_net).
> > 
> > Thank you for taking a look, I hope things are more clear now.
> 
> Please use min()
> 

Err.. max.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux