netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Florian Fainelli <florian.fainelli@telecomint.eu>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, Jeff Garzik <jeff@garzik.org>,
	Felix Fietkau <nbd@openwrt.org>
Subject: Re: [PATCH] Add support the Korina (IDT RC32434) Ethernet MAC
Date: Tue, 25 Mar 2008 23:45:54 +0100	[thread overview]
Message-ID: <20080325224554.GA32429@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <200803252155.56082.florian.fainelli@telecomint.eu>

Florian Fainelli <florian.fainelli@telecomint.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

  reply	other threads:[~2008-03-25 23:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 22:45 [PATCH] Add support the Korina (IDT RC32434) Ethernet MAC Florian Fainelli
2008-03-05 23:35 ` Johannes Berg
2008-03-07 10:07   ` Florian Fainelli
2008-03-07 10:45 ` Johannes Berg
2008-03-08 18:05   ` Florian Fainelli
2008-03-10 20:55     ` Florian Fainelli
2008-03-10 22:30     ` Francois Romieu
2008-03-13 10:55       ` Florian Fainelli
2008-03-17 22:31         ` Francois Romieu
2008-03-19 16:14           ` Florian Fainelli
2008-03-19 20:26             ` Francois Romieu
2008-03-19 21:17               ` Florian Fainelli
2008-03-19 21:55                 ` Francois Romieu
2008-03-25 20:55                   ` Florian Fainelli
2008-03-25 22:45                     ` Francois Romieu [this message]
2008-03-26  4:36             ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080325224554.GA32429@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=davem@davemloft.net \
    --cc=florian.fainelli@telecomint.eu \
    --cc=jeff@garzik.org \
    --cc=johannes@sipsolutions.net \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).