[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080325224554.GA32429@electric-eye.fr.zoreil.com>
Date: Tue, 25 Mar 2008 23:45:54 +0100
From: Francois Romieu <romieu@...zoreil.com>
To: Florian Fainelli <florian.fainelli@...ecomint.eu>
Cc: Johannes Berg <johannes@...solutions.net>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Jeff Garzik <jeff@...zik.org>, Felix Fietkau <nbd@...nwrt.org>
Subject: Re: [PATCH] Add support the Korina (IDT RC32434) Ethernet MAC
Florian Fainelli <florian.fainelli@...ecomint.eu> :
> Le mercredi 19 mars 2008, Francois Romieu a ?crit?:
[...]
> > If the allocation fails, the driver will have to handle a shorter
> > than expected ring (it is probably ok, I have not checked it). You
> > may consider initializing the link field for each descriptor if
> > possible. See epic_init_ring() for some inspiration.
>
> That is why I use the i variable such that if a break in the loop happens,
> the ring and last/first decscriptors are properly set.
I was more worried that rx_next_done (in korina_rx) does not seem to
know that the descriptor ring can actually be shorter than expected.
static void korina_alloc_ring(struct net_device *dev)
{
[...]
for (i = 0; i < KORINA_NUM_RDS; i++) {
struct sk_buff *skb = lp->rx_skb[i];
skb = dev_alloc_skb(KORINA_RBSIZE + 2);
if (!skb)
break;
[...]
lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
[...]
static int korina_rx(struct net_device *dev, int limit)
{
[...]
rd->control = DMA_COUNT(KORINA_RBSIZE) |
DMA_DESC_COD | DMA_DESC_IOD;
lp->rd_ring[(lp->rx_next_done - 1) &
KORINA_RDS_MASK].control &= ~DMA_DESC_COD;
lp->rx_next_done = (lp->rx_next_done + 1) & KORINA_RDS_MASK;
-> Sooner than later, rx_next_done will force the code through a
descriptor ring entry where rd->link is not set while the
hardware has already returned to the start of the ring.
--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists