BPF List
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	bpf@vger.kernel.org
Subject: Re: [PATCH net-next v1 1/2] net: introduce and use skb_frag_fill_page_desc()
Date: Wed, 10 May 2023 15:02:16 +0200	[thread overview]
Message-ID: <ZFuV2MEvcggfeRQS@corigine.com> (raw)
In-Reply-To: <e78bf687-8b3f-f40f-ac52-8c3ecf7ef40f@huawei.com>

On Wed, May 10, 2023 at 08:07:36PM +0800, Yunsheng Lin wrote:
> On 2023/5/10 16:40, Simon Horman wrote:
> > + XDP people and ML
> > 
> > On Tue, May 09, 2023 at 07:41:45PM +0800, Yunsheng Lin wrote:
> >> Most users use __skb_frag_set_page()/skb_frag_off_set()/
> >> skb_frag_size_set() to fill the page desc for a skb frag.
> >>
> >> Introduce skb_frag_fill_page_desc() to do that.
> >>
> >> net/bpf/test_run.c does not call skb_frag_off_set() to
> >> set the offset, "copy_from_user(page_address(page), ...)"
> >> suggest that it is assuming offset to be initialized as
> >> zero, so call skb_frag_fill_page_desc() with offset being
> >> zero for this case.
> > 
> > I think the question is, what is the value of bv_offset before this patch.
> 
> sinfo seems to be part of the 'data' kzalloced in
> bpf_test_init(), so bv_offset should be zero too.

Thanks, that sounds logical to me.

> > Lorenzo and Stanislav, do you have any insight here?
> > 
> >>
> >> Also, skb_frag_set_page() is not used anymore, so remove
> >> it.
> >>
> >> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> > 
> > ...
> > 
> >> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> >> index 738776ab8838..30be21c7d05f 100644
> >> --- a/include/linux/skbuff.h
> >> +++ b/include/linux/skbuff.h
> >> @@ -2411,6 +2411,15 @@ static inline unsigned int skb_pagelen(const struct sk_buff *skb)
> >>  	return skb_headlen(skb) + __skb_pagelen(skb);
> >>  }
> >>  
> >> +static inline void skb_frag_fill_page_desc(skb_frag_t *frag,
> >> +					   struct page *page,
> >> +					   int off, int size)
> >> +{
> >> +	frag->bv_page = page;
> >> +	frag->bv_offset = off;
> > 
> > Maybe it is slightly nicer to use skb_frag_off_set() here.
> 
> Yes, that is good idea.
> But we need to move the definition of skb_frag_off_set() before
> skb_frag_fill_page_desc in order to use it, I try to keep the
> patch simple for reviewing for now, so I perfer to not do it
> now if that is ok for you.

Sure, that is fine by me.

  reply	other threads:[~2023-05-10 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230509114146.20962-1-linyunsheng@huawei.com>
     [not found] ` <20230509114146.20962-2-linyunsheng@huawei.com>
2023-05-10  8:40   ` [PATCH net-next v1 1/2] net: introduce and use skb_frag_fill_page_desc() Simon Horman
2023-05-10 12:07     ` Yunsheng Lin
2023-05-10 13:02       ` Simon Horman [this message]
2023-05-10 14:27         ` Stanislav Fomichev
2023-05-10 14:46           ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFuV2MEvcggfeRQS@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=haoluo@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=lorenzo@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox