All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: hadi@cyberus.ca
Cc: netdev@oss.sgi.com
Subject: Re: reminder to netdriver authors
Date: Sun, 04 Jul 2004 11:05:21 -0400	[thread overview]
Message-ID: <40E81CB1.5070403@pobox.com> (raw)
In-Reply-To: <1088910801.1041.818.camel@jzny.localdomain>

jamal wrote:
> 1) When you have no space in your DMA 
> 
> Do NOT stash the packet in your ring
> a) netif_stop_queue()
> b) return 1
> 
> A _lot_ of drivers dont follow this rule. A good driver to copy
> from if you are into cutnpaste is the e1000.
> If you stash the packet in your ring then return 1 you are in deep 
> doodoo friend. 
> 
> 2) return a 0 only when you have succesfully put things on DMA.
> Returning 0 always is not a BadThing. Most drivers do this.
> It is a little less efficient at the top layer for each batch of packets
> sent to the driver and you end up stopping the netif at this point.
> 
> 3) In case of error probably return a 1 and dont try anything funny
> with the skb. Dont put on your DMA or try to free it or muck with it in
> any way. You probably should whine if you have too many errors in
> sequence. 
> 
> Someone with more time than myself can audit the drivers - I have seen
> these issues.

FWIW some of this is related to my own lack of knowledge, long long ago, 
and mistakes made long ago get cut-n-pasted into the present.

I will edit this email, and add it to 
Documentation/networking/netdevices.txt.

Please (to all) consider netdevices.txt as a general text describing how 
to (or how not to) write net drivers.  Any patches -- or even random 
comments you would like me to turn into patches -- are accepted.  Share 
the knowledge!

	Jeff

      reply	other threads:[~2004-07-04 15:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-04  3:13 reminder to netdriver authors jamal
2004-07-04 15:05 ` Jeff Garzik [this message]

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=40E81CB1.5070403@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=hadi@cyberus.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.