lkml.org 
[lkml]   [2009]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] macb: RLE and BNA handling
Erik Waling wrote:
> > > @@ -527,18 +529,31 @@ static int macb_poll(struct napi_struct
> > > dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
> > > (unsigned long)status, budget);
> > >
> > > - if (!(status & MACB_BIT(REC))) {
> > > + if (status & MACB_BIT(REC)) {
> > > + work_done = macb_rx(bp, budget);
> > > + if (work_done < budget)
> > > + netif_rx_complete(dev, napi);
> > > + } else if (status & MACB_BIT(BNA)) {
> > > + /* No slots available in RX ring. Mark all slots
> > > + * as unused.
> > > + */
> > > + int i;
> > > +
> > > + dev_warn(&bp->pdev->dev,
> > > + "No free RX buffers. Marking all as unused.\n");
> > > +
> > > + for (i = 0; i < RX_RING_SIZE; i++)
> > > + bp->rx_ring[i].addr &= ~MACB_BIT(RX_USED);
> > > +
> > > + wmb();
> > > + netif_rx_complete(dev, napi);
> >
> > I'm not sure if nuking all the buffers that were received successfully
> > is the right thing to do here...?
> >
>
> This was the only solution I could think of since all slots are marked
> as used and we are not able to assemble a complete frame. Do you think
> there is a better solution?

No, I guess that might be a good fallback solution if we really can't
seem to make any progress...

However, I'm wondering if there might be a different bug in the code
above: Suppose that we receive lots of frames, start processing them,
but exhaust our budget so that we return before we had a chance to look
at all of them.

Then, when the network layer calls us again, we will only continue
processing the buffers if the REC bit was set in the mean time, which
it might not be if there was a brief pause in the flow of packets. If
this happens, we'll simply display a warning and call
netif_rx_complete() with potentially lots of unprocessed packets in the
RX ring...

So I'm wondering if the right thing to do is to just call macb_rx()
regardless of the state of the REC bit. If it exhausts the budget, and
the BNA bit is set, we could flush the ring in order to sort of relieve
the pressure a bit...

Btw, I suspect you'll need to update rx_tail when you do that, or it
might not point to where the next used buffer will be.

Haavard


\
 
 \ /
  Last update: 2009-01-14 13:07    [W:1.739 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site