Subject: Re: [PATCH v3] can: Add driver for esd CAN-USB/2 device

From: Oliver Neukum <[email-masked]>
Date: Fri, 28 May 2010 17:26:00 +0200

Am Freitag, 28. Mai 2010 16:19:33 schrieb Matthias Fuchs:
> On Wednesday 26 May 2010 15:47, Oliver Neukum wrote:
> > Am Mittwoch, 26. Mai 2010 11:14:03 schrieb Matthias Fuchs:
> > > +       netdev->trans_start = jiffies;
> > > +
> > > +       /* Slow down tx path */
> > > +       if (atomic_read(&priv->active_tx_jobs) >= MAX_TX_URBS)
> > > +               netif_stop_queue(netdev);
> > 
> > Where is the queue started again?
> > 
> > 	Regards
> > 		Oliver
> 
> This is done in the ack-patch for sent messages:
> 
> static void esd_usb2_tx_done_msg(struct esd_usb2_net_priv *priv,
> 				 struct esd_usb2_msg *msg)
> {
> ...
> 	atomic_dec(&priv->active_tx_jobs);
> 
> 	netif_wake_queue(netdev);
> }

Oh, I see. I am afraid this is a race. You have no guarantee that
esd_usb2_tx_done_msg() runs after you stop the queue. If you do
it that way you must stop the queue before you submit the URB
due to which you want to stop it (and do the error handling)

	Regards
		Oliver