[PATCH 1/2] ucc_geth: Move freeing of TX packets to NAPI context.

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Fri Mar 27 03:55:02 EST 2009


Eric Dumazet <dada1 at cosmosbay.com> wrote on 26/03/2009 15:15:25:
> 
> Joakim Tjernlund a écrit :
> > Also set NAPI weight to 64 as this is a common value.
> > This will make the system alot more responsive while
> > ping flooding the ucc_geth ethernet interaface.
> > 
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
> > ---
> >  drivers/net/ucc_geth.c |   32 ++++++++++++--------------------
> >  drivers/net/ucc_geth.h |    1 -
> >  2 files changed, 12 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> > index 097aed8..7fc91aa 100644
> > --- a/drivers/net/ucc_geth.c
> > +++ b/drivers/net/ucc_geth.c
> > @@ -3214,7 +3214,7 @@ static int ucc_geth_tx(struct net_device *dev, 
u8 txQ)
> >        dev->stats.tx_packets++;
> > 
> >        /* Free the sk buffer associated with this TxBD */
> > -      dev_kfree_skb_irq(ugeth->
> > +      dev_kfree_skb(ugeth->
> >                tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]]);
> >        ugeth->tx_skbuff[txQ][ugeth->skb_dirtytx[txQ]] = NULL;
> >        ugeth->skb_dirtytx[txQ] =
> > @@ -3248,9 +3248,16 @@ static int ucc_geth_poll(struct napi_struct 
*napi, int budget)
> 
> >     for (i = 0; i < ug_info->numQueuesRx; i++)
> >        howmany += ucc_geth_rx(ugeth, i, budget - howmany);
> 
> Not related to your patch, but seeing above code, I can understand
> you might have a problem in flood situation : Only first queue(s) are
> depleted, and last one cannot be because howmany >= budget.
> 
> This driver might have to remember last queue it handled at previous
> call ucc_geth_poll(), so that all rxqueues have same probability to be 
scanned.
> 
> j = ug->lastslot;
> for (i = 0; ug_info->numQueuesRx; i++) {
>    if (++j >= ug_info->numQueuesRx)
>       j = 0;
>    howmany += ucc_geth_rx(ugeth, j, budget - howmany);
>    if (howmany >= budget)
>       break;
> }
> ug->lastslot = j;

yes, or scan the RX queues in prio order. However ATM there is only
one queue so it won't be a problem until one extends the driver with
several queues.

Thanks,
        Jocke



More information about the Linuxppc-dev mailing list