Commit 26a17b7b authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

sc92031: start transmit return value bugfix

Any negative return value from start_xmit is interpreted as NETDEV_TX_LOCK
which is not what this driver wants. It should return 0 (NETDEV_TX_OK)
when it consumes a packet.

Also, use skb_padto() as the generic way to pad small frames.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 9c28eaea
...@@ -947,16 +947,16 @@ static struct net_device_stats *sc92031_get_stats(struct net_device *dev) ...@@ -947,16 +947,16 @@ static struct net_device_stats *sc92031_get_stats(struct net_device *dev)
static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
int err = 0;
struct sc92031_priv *priv = netdev_priv(dev); struct sc92031_priv *priv = netdev_priv(dev);
void __iomem *port_base = priv->port_base; void __iomem *port_base = priv->port_base;
unsigned len; unsigned len;
unsigned entry; unsigned entry;
u32 tx_status; u32 tx_status;
if (skb_padto(skb, ETH_ZLEN))
return NETDEV_TX_OK;
if (unlikely(skb->len > TX_BUF_SIZE)) { if (unlikely(skb->len > TX_BUF_SIZE)) {
err = -EMSGSIZE;
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
goto out; goto out;
} }
...@@ -964,7 +964,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -964,7 +964,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
spin_lock(&priv->lock); spin_lock(&priv->lock);
if (unlikely(!netif_carrier_ok(dev))) { if (unlikely(!netif_carrier_ok(dev))) {
err = -ENOLINK;
dev->stats.tx_dropped++; dev->stats.tx_dropped++;
goto out_unlock; goto out_unlock;
} }
...@@ -976,11 +975,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -976,11 +975,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
len = skb->len; len = skb->len;
if (unlikely(len < ETH_ZLEN)) {
memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
0, ETH_ZLEN - len);
len = ETH_ZLEN;
}
wmb(); wmb();
...@@ -1007,7 +1001,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1007,7 +1001,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
out: out:
dev_kfree_skb(skb); dev_kfree_skb(skb);
return err; return NETDEV_TX_OK;
} }
static int sc92031_open(struct net_device *dev) static int sc92031_open(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment