From: Jeff Garzik <jgarzik@pobox.com>
To: hadi@cyberus.ca
Cc: Andy Fleming <afleming@freescale.com>,
Kumar Gala <kumar.gala@freescale.com>,
netdev@oss.sgi.com, dwmw2@infradead.org
Subject: Re: [RFR] gianfar ethernet driver
Date: Wed, 07 Jul 2004 01:35:00 -0400 [thread overview]
Message-ID: <40EB8B84.7040301@pobox.com> (raw)
In-Reply-To: <1089171693.1037.87.camel@jzny.localdomain>
jamal wrote:
> On Tue, 2004-07-06 at 23:29, Jeff Garzik wrote:
>
>>On Tue, Jul 06, 2004 at 11:18:02PM -0400, jamal wrote:
>>
>>>You dont return a 1 anywhere.
>>
>>That OK in one model.
>
>
> True returning 0 this is not wrong; it
> results in an extra call in the layer above the driver.
> (I was trying to point that out in earlier email)
er, I'm confused now?
Every single ethernet driver returns zero, when it has queued a packet
to hardware :) That's the common case, I would hope it doesn't result
in additional work.
>>When you are not dealing with fragments, the most optimal model
>>eliminates the overflow case completely, so your ->hard_start_xmit looks
>>like
>>
>> lock
>> queue packet to DMA ring
>> if (DMA ring full)
>> netif_stop_queue()
>> unlock
>>
>> return 0
>>
>>If you can be sure -- by design -- that room is always available when
>>the queue is not stopped, then that's fine.
>>
>>With fragments, you cannot be sure of this, if you do not wish to
>>reserve MY_HW_MAX_FRAGMENTS slots on the DMA. Such a case would require
>>moving the "if no more descriptors" check up, and returning 1 when the
>>ring is empty.
>>
>>But ideally, you should write the driver where such a condition does not
>>occur at all.
>
>
> Ok, I overlooked fragments. I think it would be useful to capture this
> in the doc you were preping. BTW, why can you figure out the fragment
> count? If you can then the check for number of descriptors availabel
> could account for that.
In one design, you can say
queue packet
if (free descriptors < MAX_SKB_FRAGS)
netif_stop_queue()
return 0
That design wastes descriptors, but ensures you always have enough room
when ->hard_start_xmit is called, and thus ensures you never have to
return 1.
Another design, that attempts to use more descriptors, is
if (free descriptors < skb->frags)
netif_stop_queue()
return 1
queue packet
if (free descriptors == 0)
netif_stop_queue()
return 0
next prev parent reply other threads:[~2004-07-07 5:35 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <C681B01E-CEA9-11D8-931F-000393DBC2E8@freescale.com>
[not found] ` <89563A5C-CFAE-11D8-BA44-000393C30512@freescale.com>
2004-07-07 3:18 ` [RFR] gianfar ethernet driver jamal
2004-07-07 3:29 ` Jeff Garzik
2004-07-07 3:41 ` jamal
2004-07-07 5:35 ` Jeff Garzik [this message]
2004-07-07 18:29 ` jamal
[not found] ` <40EDC7A7.8060906@pobox.com>
2004-07-08 23:08 ` jamal
2004-07-21 19:51 ` Andy Fleming
2004-07-21 20:14 ` David Woodhouse
2004-08-02 22:19 ` Andy Fleming
2004-08-02 23:11 ` Jeff Garzik
2004-08-02 23:25 ` Andy Fleming
2004-08-04 23:02 ` Andy Fleming
2004-08-16 16:31 ` Kumar Gala
2004-08-22 21:03 ` Jeff Garzik
2004-07-07 5:27 ` Jeff Garzik
[not found] ` <D3458628-D05D-11D8-BA44-000393C30512@freescale.com>
2004-07-08 22:29 ` Jeff Garzik
[not found] ` <944A2374-D137-11D8-8835-000393C30512@freescale.com>
2004-07-09 1:32 ` jamal
2004-07-09 1:42 ` jamal
2004-07-26 22:06 ` Andy Fleming
2004-07-26 22:10 ` Jeff Garzik
2004-08-02 13:59 ` Kumar Gala
2004-08-02 14:09 ` Christoph Hellwig
2004-08-02 14:11 ` Kumar Gala
[not found] ` <2A724364-D53A-11D8-8835-000393C30512@freescale.com>
[not found] ` <40F4A6E5.4060000@pobox.com>
2004-07-19 23:29 ` Andy Fleming
2004-07-20 1:13 ` David Woodhouse
[not found] <8F52CF1D-C916-11D8-BB6A-000393DBC2E8@freescale.com>
2004-07-05 17:28 ` Jeff Garzik
2004-07-06 2:38 ` jamal
[not found] ` <20040708231131.GA20305@infradead.org>
2004-07-08 23:25 ` Jeff Garzik
2004-07-08 23:35 ` Christoph Hellwig
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=40EB8B84.7040301@pobox.com \
--to=jgarzik@pobox.com \
--cc=afleming@freescale.com \
--cc=dwmw2@infradead.org \
--cc=hadi@cyberus.ca \
--cc=kumar.gala@freescale.com \
--cc=netdev@oss.sgi.com \
/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).