From: Shay Agroskin <shayagr@amazon.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<davem@davemloft.net>, <lorenzo.bianconi@redhat.com>,
<brouer@redhat.com>, <echaudro@redhat.com>, <sameehj@amazon.com>,
<kuba@kernel.org>, <john.fastabend@gmail.com>,
<daniel@iogearbox.net>, <ast@kernel.org>
Subject: Re: [PATCH v2 net-next 3/9] net: mvneta: update mb bit before passing the xdp buffer to eBPF layer
Date: Sun, 6 Sep 2020 10:33:16 +0300 [thread overview]
Message-ID: <pj41zly2lnpdfn.fsf@u68c7b5b1d2d758.ant.amazon.com> (raw)
In-Reply-To: <25198d8424778abe9ee3fe25bba542143201b030.1599165031.git.lorenzo@kernel.org>
Lorenzo Bianconi <lorenzo@kernel.org> writes:
> Update multi-buffer bit (mb) in xdp_buff to notify XDP/eBPF
> layer and
> XDP remote drivers if this is a "non-linear" XDP buffer. Access
> skb_shared_info only if xdp_buff mb is set
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> drivers/net/ethernet/marvell/mvneta.c | 37
> +++++++++++++++------------
> 1 file changed, 21 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c
> b/drivers/net/ethernet/marvell/mvneta.c
> index 832bbb8b05c8..4f745a2b702a 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2027,11 +2027,11 @@ mvneta_xdp_put_buff(struct mvneta_port
> *pp, struct mvneta_rx_queue *rxq,
> struct xdp_buff *xdp, int sync_len, bool napi)
> {
> struct skb_shared_info *sinfo =
> xdp_get_shared_info_from_buff(xdp);
> - int i;
> + int i, num_frames = xdp->mb ? sinfo->nr_frags : 0;
>
> page_pool_put_page(rxq->page_pool,
> virt_to_head_page(xdp->data),
> sync_len, napi);
> - for (i = 0; i < sinfo->nr_frags; i++)
> + for (i = 0; i < num_frames; i++)
> page_pool_put_full_page(rxq->page_pool,
> skb_frag_page(&sinfo->frags[i]),
> napi);
> }
> ...
> @@ -2175,6 +2175,7 @@ mvneta_run_xdp(struct mvneta_port *pp,
> struct mvneta_rx_queue *rxq,
>
> len = xdp->data_end - xdp->data_hard_start -
> pp->rx_offset_correction;
> data_len = xdp->data_end - xdp->data;
> - sinfo = xdp_get_shared_info_from_buff(xdp);
> - sinfo->nr_frags = 0;
> + xdp->mb = 0;
>
> *size = rx_desc->data_size - len;
> rx_desc->buf_phys_addr = 0;
> @@ -2269,7 +2267,7 @@ mvneta_swbm_add_rx_fragment(struct
> mvneta_port *pp,
> struct mvneta_rx_desc *rx_desc,
> struct mvneta_rx_queue *rxq,
> struct xdp_buff *xdp, int *size,
> - struct page *page)
> + int *nfrags, struct page *page)
> {
> struct skb_shared_info *sinfo =
> xdp_get_shared_info_from_buff(xdp);
> struct net_device *dev = pp->dev;
> @@ -2288,13 +2286,18 @@ mvneta_swbm_add_rx_fragment(struct
> mvneta_port *pp,
> rx_desc->buf_phys_addr,
> len, dma_dir);
>
> - if (data_len > 0 && sinfo->nr_frags < MAX_SKB_FRAGS) {
> - skb_frag_t *frag = &sinfo->frags[sinfo->nr_frags];
> + if (data_len > 0 && *nfrags < MAX_SKB_FRAGS) {
> + skb_frag_t *frag = &sinfo->frags[*nfrags];
>
> skb_frag_off_set(frag, pp->rx_offset_correction);
> skb_frag_size_set(frag, data_len);
> __skb_frag_set_page(frag, page);
> - sinfo->nr_frags++;
> + *nfrags = *nfrags + 1;
nit, why do you use nfrags variable instead of sinfo->nr_frags (as
it was before this patch) ?
You doesn't seem to use the nfrags variable in the
caller function and you update nr_frags as well.
If it's used in a different patch (haven't
reviewed it all yet), maybe move it to that patch
? (sorry in advance if I missed the logic here)
> +
> + if (rx_desc->status & MVNETA_RXD_LAST_DESC) {
> + sinfo->nr_frags = *nfrags;
> + xdp->mb = true;
> + }
>
> rx_desc->buf_phys_addr = 0;
> ...
next prev parent reply other threads:[~2020-09-06 7:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 20:58 [PATCH v2 net-next 0/9] mvneta: introduce XDP multi-buffer support Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 1/9] xdp: introduce mb in xdp_buff/xdp_frame Lorenzo Bianconi
2020-09-04 1:07 ` Alexei Starovoitov
2020-09-04 7:19 ` Jesper Dangaard Brouer
2020-09-04 15:15 ` David Ahern
2020-09-04 15:59 ` Jesper Dangaard Brouer
2020-09-04 16:30 ` David Ahern
2020-09-07 18:02 ` Jesper Dangaard Brouer
2020-09-08 1:22 ` David Ahern
2020-09-03 20:58 ` [PATCH v2 net-next 2/9] xdp: initialize xdp_buff mb bit to 0 in all XDP drivers Lorenzo Bianconi
2020-09-04 7:35 ` Jesper Dangaard Brouer
2020-09-04 7:54 ` Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 3/9] net: mvneta: update mb bit before passing the xdp buffer to eBPF layer Lorenzo Bianconi
2020-09-06 7:33 ` Shay Agroskin [this message]
2020-09-06 9:05 ` Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 4/9] xdp: add multi-buff support to xdp_return_{buff/frame} Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 5/9] net: mvneta: add multi buffer support to XDP_TX Lorenzo Bianconi
2020-09-06 7:20 ` Shay Agroskin
2020-09-06 8:43 ` Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 6/9] bpf: helpers: add bpf_xdp_adjust_mb_header helper Lorenzo Bianconi
2020-09-04 1:09 ` Alexei Starovoitov
2020-09-04 8:07 ` Lorenzo Bianconi
2020-09-04 1:13 ` Alexei Starovoitov
2020-09-04 7:50 ` Lorenzo Bianconi
2020-09-04 13:52 ` Jesper Dangaard Brouer
2020-09-04 14:27 ` Lorenzo Bianconi
2020-09-04 6:47 ` John Fastabend
2020-09-04 9:45 ` Lorenzo Bianconi
2020-09-04 15:23 ` John Fastabend
2020-09-06 13:36 ` Lorenzo Bianconi
2020-09-08 19:57 ` John Fastabend
2020-09-08 21:31 ` Lorenzo Bianconi
2020-09-09 20:51 ` Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 7/9] bpf: helpers: add multibuffer support Lorenzo Bianconi
2020-09-03 21:24 ` Maciej Fijalkowski
2020-09-04 9:47 ` Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 8/9] samples/bpf: add bpf program that uses xdp mb helpers Lorenzo Bianconi
2020-09-03 20:58 ` [PATCH v2 net-next 9/9] net: mvneta: enable jumbo frames for XDP Lorenzo Bianconi
2020-09-04 1:08 ` [PATCH v2 net-next 0/9] mvneta: introduce XDP multi-buffer support Alexei Starovoitov
2020-09-04 7:40 ` Lorenzo Bianconi
2020-09-04 5:41 ` John Fastabend
2020-09-04 7:39 ` Lorenzo Bianconi
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=pj41zly2lnpdfn.fsf@u68c7b5b1d2d758.ant.amazon.com \
--to=shayagr@amazon.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=echaudro@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sameehj@amazon.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