Re: [PATCH v11 bpf-next 17/18] net: xdp: introduce bpf_xdp_adjust_data helper

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

 



> Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxx> writes:
> 
> >> Lorenzo Bianconi <lorenzo@xxxxxxxxxx> writes:
> >> 
> > [...]
> >> > + *	Description
> >> > + *		For XDP frames split over multiple buffers, the
> >> > + *		*xdp_md*\ **->data** and*xdp_md *\ **->data_end** pointers
> >> > + *		will point to the start and end of the first fragment only.
> >> > + *		This helper can be used to access subsequent fragments by
> >> > + *		moving the data pointers. To use, an XDP program can call
> >> > + *		this helper with the byte offset of the packet payload that
> >> > + *		it wants to access; the helper will move *xdp_md*\ **->data**
> >> > + *		and *xdp_md *\ **->data_end** so they point to the requested
> >> > + *		payload offset and to the end of the fragment containing this
> >> > + *		byte offset, and return the byte offset of the start of the
> >> > + *		fragment.
> >> 
> >> This comment is wrong now :)
> >
> > actually we are still returning the byte offset of the start of the fragment
> > (base_offset).
> 
> Hmm, right, I was looking at the 'return 0':
> 
> > +BPF_CALL_2(bpf_xdp_adjust_data, struct xdp_buff *, xdp, u32, offset)
> > +{
> > +	struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
> > +	u32 base_offset = xdp->mb.headlen;
> > +	int i;
> > +
> > +	if (!xdp_buff_is_mb(xdp) || offset > sinfo->xdp_frags_size)
> > +		return -EINVAL;
> > +
> > +	if (offset < xdp->mb.headlen) {
> > +		/* linear area */
> > +		xdp->data = xdp->data_hard_start + xdp->mb.headroom;
> > +		xdp->data_end = xdp->data + xdp->mb.headlen;
> > +		return 0;
> > +	}
> 
> But I guess that's an offset; but that means the helper is not doing
> what it says it's doing if it's within the first fragment. That should
> probably be made consistent... :)

ack, right. I will fix it in v12, thanks.

Regards,
Lorenzo

> 
> -Toke
> 

Attachment: signature.asc
Description: PGP signature


[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