> 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: signature.asc
Description: PGP signature

Reply via email to