aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sc92031.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-04-02 13:11:11 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-16 20:41:35 -0400
commit26a17b7bbb36a8552d531bc1ad08472fb5aa3007 (patch)
tree3a1041cb4661f313fbba5e276f3d0eeef36d28d4 /drivers/net/sc92031.c
parent9c28eaea90aef8db20004d29f924ad3059d9704e (diff)
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: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sc92031.c')
-rw-r--r--drivers/net/sc92031.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index af0422da6f99..841bfa745301 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -947,16 +947,16 @@ static struct net_device_stats *sc92031_get_stats(struct net_device *dev)
947 947
948static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) 948static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
949{ 949{
950 int err = 0;
951 struct sc92031_priv *priv = netdev_priv(dev); 950 struct sc92031_priv *priv = netdev_priv(dev);
952 void __iomem *port_base = priv->port_base; 951 void __iomem *port_base = priv->port_base;
953
954 unsigned len; 952 unsigned len;
955 unsigned entry; 953 unsigned entry;
956 u32 tx_status; 954 u32 tx_status;
957 955
956 if (skb_padto(skb, ETH_ZLEN))
957 return NETDEV_TX_OK;
958
958 if (unlikely(skb->len > TX_BUF_SIZE)) { 959 if (unlikely(skb->len > TX_BUF_SIZE)) {
959 err = -EMSGSIZE;
960 dev->stats.tx_dropped++; 960 dev->stats.tx_dropped++;
961 goto out; 961 goto out;
962 } 962 }
@@ -964,7 +964,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
964 spin_lock(&priv->lock); 964 spin_lock(&priv->lock);
965 965
966 if (unlikely(!netif_carrier_ok(dev))) { 966 if (unlikely(!netif_carrier_ok(dev))) {
967 err = -ENOLINK;
968 dev->stats.tx_dropped++; 967 dev->stats.tx_dropped++;
969 goto out_unlock; 968 goto out_unlock;
970 } 969 }
@@ -976,11 +975,6 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
976 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE); 975 skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
977 976
978 len = skb->len; 977 len = skb->len;
979 if (unlikely(len < ETH_ZLEN)) {
980 memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
981 0, ETH_ZLEN - len);
982 len = ETH_ZLEN;
983 }
984 978
985 wmb(); 979 wmb();
986 980
@@ -1007,7 +1001,7 @@ out_unlock:
1007out: 1001out:
1008 dev_kfree_skb(skb); 1002 dev_kfree_skb(skb);
1009 1003
1010 return err; 1004 return NETDEV_TX_OK;
1011} 1005}
1012 1006
1013static int sc92031_open(struct net_device *dev) 1007static int sc92031_open(struct net_device *dev)