All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: "Feldman, Scott" <scott.feldman@intel.com>
Cc: raghavendra.koushik@wipro.com, leonid.grossman@s2io.com,
	netdev@oss.sgi.com, shemminger@osdl.org, hch@infradead.org,
	ravinandan.arakali@s2io.com, raghavendra.koushik@s2io.com
Subject: Re: Submission #3  for S2io 10GbE driver
Date: Tue, 02 Mar 2004 16:21:02 -0500	[thread overview]
Message-ID: <4044FABE.9070408@pobox.com> (raw)
In-Reply-To: <C6F5CF431189FA4CBAEC9E7DD5441E0102CBDECB@orsmsx402.jf.intel.com>

Feldman, Scott wrote:
>>This is incorrect, and definitely an issue that needs to be addressed.
>>
>>As I said, the model is, the driver calls netif_stop_queue() after 
>>queueing a packet, when it knows there is no more room for a full 
>>packet.  The tg3 driver does it like this:
>>	
>>	...queue an skb to hardware...
>>         if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))
>>                 netif_stop_queue(dev);
>>
>>Therefore you guarantee the queue is stopped until you are 
>>100% certain that another skb (up to MAX_SKB_FRAGS + "main frag"
>>fragments) may be queued to hardware.
>>
>>You do -not- want to figure out "after the fact" that you 
>>cannot queue the skb you were just passed.
> 
> 
> But tg3 checks this case also and returns 1:
> 
>         /* This is a hard error, log it. */
>         if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags +
> 1))) {
>                 netif_stop_queue(dev);
>                 ...
>                 return 1;
>         }
> 
> Does this code path happen?

You snipped the important

                 printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue 
awake!\n",
                        dev->name);

It's a BUG because it should never happen.

tg3 needs to kfree the skb too, leading to my comment "some existing 
drivers get this wrong too".  Requeueing the skb only occurs in -some- 
packet schedulers, not all.  So drivers cannot depend on the net stack 
doing what you want in all cases.  Conditional correct behavior or 
leak..  :/

	Jeff

  reply	other threads:[~2004-03-02 21:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02 21:16 Submission #3 for S2io 10GbE driver Feldman, Scott
2004-03-02 21:21 ` Jeff Garzik [this message]
2004-03-02 21:33   ` Ben Greear
2004-03-02 21:38     ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2004-03-02 21:47 Feldman, Scott
2004-03-02 22:21 ` Ben Greear
2004-03-02 13:46 raghavendra.koushik
2004-03-02 18:47 ` Jeff Garzik
2004-03-01 13:05 raghavendra.koushik
2004-03-01 15:24 ` Leonid Grossman
2004-03-01  6:21 raghavendra.koushik
2004-03-01  6:53 ` Jeff Garzik
2004-02-17  0:11 Submission " Christoph Hellwig
2004-02-28 15:08 ` Submission #3 " Leonid Grossman
2004-02-28 20:21   ` Jeff Garzik
2004-03-12 21:55     ` ravinandan arakali
2004-03-13  2:30       ` 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=4044FABE.9070408@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=hch@infradead.org \
    --cc=leonid.grossman@s2io.com \
    --cc=netdev@oss.sgi.com \
    --cc=raghavendra.koushik@s2io.com \
    --cc=raghavendra.koushik@wipro.com \
    --cc=ravinandan.arakali@s2io.com \
    --cc=scott.feldman@intel.com \
    --cc=shemminger@osdl.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 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.