RE: [PATCH net-next v20 07/13] rtase: Implement a function to receive packets
From: Justin Lai
Date: Mon Jun 17 2024 - 02:46:02 EST
> On Fri, 7 Jun 2024 16:43:15 +0800 Justin Lai wrote:
> > +static int rx_handler(struct rtase_ring *ring, int budget) {
> > + const struct rtase_private *tp = ring->ivec->tp;
> > + union rtase_rx_desc *desc_base = ring->desc;
> > + u32 pkt_size, cur_rx, delta, entry, status;
> > + struct net_device *dev = tp->dev;
> > + union rtase_rx_desc *desc;
> > + struct sk_buff *skb;
> > + int workdone = 0;
> > +
> > + cur_rx = ring->cur_idx;
> > + entry = cur_rx % RTASE_NUM_DESC;
> > + desc = &desc_base[entry];
> > +
> > + do {
> > + /* make sure discriptor has been updated */
> > + rmb();
>
> Barriers are between things. What is this barrier between?
At the end of this do while loop, it fetches the next descriptor. This
barrier is mainly used between fetching the next descriptor and using
the next descriptor, to ensure that the content of the next descriptor is
completely fetched before using it.
>
> > + status = le32_to_cpu(desc->desc_status.opts1);
> > +
> > + if (status & RTASE_DESC_OWN)
> > + break;