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

From: Jakub Kicinski
Date: Mon Sep 02 2024 - 22:04:34 EST


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

> + 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.