Subject: RE: [PATCH net-next v29 07/13] rtase: Implement a function to receive packets

From: Larry Chiu <[email-masked]>
Date: Tue, 3 Sep 2024 02:51:43 +0000

> -----Original Message-----
> From: Jakub Kicinski <[email-masked]>
> Sent: Tuesday, September 3, 2024 10:04 AM
> To: Justin Lai <[email-masked]>
> Cc: [email-masked]; [email-masked]; [email-masked];
> [email-masked]; [email-masked]; [email-masked];
> [email-masked]; [email-masked]; [email-masked];
> [email-masked]; Ping-Ke Shih <[email-masked]>; Larry Chiu
> <[email-masked]>
> Subject: Re: [PATCH net-next v29 07/13] rtase: Implement a function to
> receive packets
> 
> 
> External mail.
> 
> 
> 
> On Thu, 29 Aug 2024 11:48:26 +0800 Justin Lai wrote:
> > +             skb->dev = dev;
> 
> no need to assign skb->dev = dev; eth_type_trans() will do it for you

Thanks, we will remove it.

> 
> > +             skb_put(skb, pkt_size);
> > +             skb_mark_for_recycle(skb);
> > +             skb->protocol = eth_type_trans(skb, dev);
> > +
> > +             if (skb->pkt_type == PACKET_MULTICAST)
> > +                     tp->stats.multicast++;
> > +
> > +             rtase_rx_vlan_skb(desc, skb);
> > +             rtase_rx_skb(ring, skb);
> > +
> > +             dev_sw_netstats_rx_add(dev, pkt_size);
> > +
> > +skip_process_pkt:
> > +             workdone++;
> > +             cur_rx++;
> > +             entry = cur_rx % RTASE_NUM_DESC;
> > +             desc = ring->desc + sizeof(union rtase_rx_desc) * entry;
> > +     } while (workdone != budget);
> 
> The check needs to be at the start of the function.
> NAPI can be called with budget of 0 to limit the processing
> to just Tx cleanup. In that case no packet should be received.

OK, we will use a for loop instead.