Subject: Re: [PATCH 2/6]: powerpc/cell spidernet low watermark patch.

From: Arnd Bergmann <[email-masked]>
Date: Sat, 19 Aug 2006 01:09:13 +0200

On Saturday 19 August 2006 00:21, Linas Vepstas wrote:
> +       /* Measure the length of the queue. */
> +       while (descr != card->tx_chain.head) {
> +               status = descr->dmac_cmd_status & SPIDER_NET_DESCR_NOT_IN_USE;
> +               if (status == SPIDER_NET_DESCR_NOT_IN_USE)
> +                       break;
> +               descr = descr->next;
> +               cnt++;
> +       }
> +       if (cnt == 0)
> +               return;
> +
> +       /* Set low-watermark 3/4th's of the way into the queue. */
> +       descr = card->tx_chain.tail;
> +       cnt = (cnt*3)/4;
> +       for (i=0;i<cnt; i++)
> +               descr = descr->next;

I wonder if calling this frequently results in a significant processing
overhead in the CPU. Does the spider_net_set_low_watermark function
show up in your profiles?

A more efficient implementation might be to mark one descriptor that
is at a fixed offset from the TX queue tail, so we only need to do

card->low_watermark->next->dmac_cmd_status |= SPIDER_NET_DESCR_TXDESFLG;
mb();
card->low_watermark->dmac_cmd_status &= ~SPIDER_NET_DESCR_TXDESFLG;
card->low_watermark = card->low_watermark->next;

when we queue another frame for TX.

	Arnd <><