All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	netdev@vger.kernel.org, davem@davemloft.net, bpf@vger.kernel.org,
	ilias.apalodimas@linaro.org, brouer@redhat.com,
	echaudro@redhat.com, sameehj@amazon.com
Subject: Re: [PATCH 2/6] net: mvneta: move skb build after descriptors processing
Date: Thu, 16 Jul 2020 21:12:51 +0200	[thread overview]
Message-ID: <20200716191251.GH2174@localhost.localdomain> (raw)
In-Reply-To: <20200715125844.567e5795@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

[-- Attachment #1: Type: text/plain, Size: 1902 bytes --]

> On Thu,  9 Jul 2020 17:57:19 +0200 Lorenzo Bianconi wrote:
> > +		frag->bv_offset = pp->rx_offset_correction;
> > +		skb_frag_size_set(frag, data_len);
> > +		frag->bv_page = page;
> > +		sinfo->nr_frags++;
> 
> nit: please use the skb_frag_* helpers, in case we have to rename those
>      fields again. You should also consider adding a helper for the
>      operation of appending a frag, I bet most drivers will needs this.

Hi Jakub,

thx for the review. Ack, I will fix them in v2.

> 
> > +static struct sk_buff *
> > +mvneta_swbm_build_skb(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
> > +		      struct xdp_buff *xdp, u32 desc_status)
> > +{
> > +	struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
> > +	int i, num_frags = sinfo->nr_frags;
> > +	skb_frag_t frags[MAX_SKB_FRAGS];
> > +	struct sk_buff *skb;
> > +
> > +	memcpy(frags, sinfo->frags, sizeof(skb_frag_t) * num_frags);
> > +
> > +	skb = build_skb(xdp->data_hard_start, PAGE_SIZE);
> > +	if (!skb)
> > +		return ERR_PTR(-ENOMEM);
> > +
> > +	page_pool_release_page(rxq->page_pool, virt_to_page(xdp->data));
> > +
> > +	skb_reserve(skb, xdp->data - xdp->data_hard_start);
> > +	skb_put(skb, xdp->data_end - xdp->data);
> > +	mvneta_rx_csum(pp, desc_status, skb);
> > +
> > +	for (i = 0; i < num_frags; i++) {
> > +		skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
> > +				frags[i].bv_page, frags[i].bv_offset,
> > +				skb_frag_size(&frags[i]), PAGE_SIZE);
> > +		page_pool_release_page(rxq->page_pool, frags[i].bv_page);
> > +	}
> > +
> > +	return skb;
> > +}
> 
> Here as well - is the plan to turn more of this function into common
> code later on? Looks like most of this is not really driver specific.

I agree. What about adding it when other drivers will add multi-buff support?
(here we have even page_pool dependency)

Regards,
Lorenzo

> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2020-07-16 19:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 15:57 [PATCH 0/6] rework mvneta napi_poll loop for XDP multi-buffers Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 1/6] xdp: introduce xdp_get_shared_info_from_{buff,frame} utility routines Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 2/6] net: mvneta: move skb build after descriptors processing Lorenzo Bianconi
2020-07-15 19:58   ` Jakub Kicinski
2020-07-16 19:12     ` Lorenzo Bianconi [this message]
2020-07-16 19:44       ` Jakub Kicinski
2020-07-16 20:09         ` Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 3/6] net: mvneta: move mvneta_run_xdp " Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 4/6] net: mvneta: drop all fragments in XDP_DROP Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 5/6] net: mvneta: get rid of skb in mvneta_rx_queue Lorenzo Bianconi
2020-07-09 15:57 ` [PATCH 6/6] net: mvneta: move rxq->left_size on the stack 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=20200716191251.GH2174@localhost.localdomain \
    --to=lorenzo.bianconi@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=echaudro@redhat.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kuba@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.