[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1333099431.19659.15.camel@edumazet-laptop>
Date: Fri, 30 Mar 2012 11:23:51 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Mike Sinkovsky <msink@...monline.ru>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] Ethernet driver for the WIZnet W5100 chip
Le vendredi 30 mars 2012 à 13:00 +0600, Mike Sinkovsky a écrit :
> Tested and used in production with Blackfin BF531 embedded processor.
>
> Signed-off-by: Mike Sinkovsky <msink@...monline.ru>
> ---
> +
> +static int w5100_start_tx(struct sk_buff *skb, struct net_device *ndev)
> +{
> + struct w5100_priv *priv = netdev_priv(ndev);
> + u16 offset;
> +
> + if (w5100_read16(priv, W5100_S0_TX_FSR) < skb->len) {
There is a race here.
Interrupt came come right here before you set the stop_queue()
> + netif_stop_queue(ndev);
So Here I suggest adding a test again
if (w5100_read16(priv, W5100_S0_TX_FSR) >= skb->len)
netif_wake_queue(ndev);
else
return NETDEV_TX_BUSY;
> + return NETDEV_TX_BUSY;
> + }
> +
> + offset = w5100_read16(priv, W5100_S0_TX_WR);
> + w5100_writebuf(priv, offset, skb->data, skb->len);
> + w5100_write16(priv, W5100_S0_TX_WR, offset + skb->len);
> + w5100_command(priv, S0_CR_SEND);
> + ndev->stats.tx_bytes += skb->len;
> + ndev->stats.tx_packets++;
> + dev_kfree_skb(skb);
> +
> + return NETDEV_TX_OK;
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists