net: fix network drivers ndo_start_xmit() return values
authorPatrick McHardy <kaber@trash.net>
Mon, 15 Jun 2009 23:33:24 +0000 (23:33 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Jun 2009 11:31:16 +0000 (04:31 -0700)
Fix up remaining drivers returning a magic or an errno value from their
ndo_start_xmit() functions that were missed in the first pass:

- isdn_net: missed conversion
- bpqether: missed conversion: skb is freed, so return NETDEV_TX_OK
- hp100: intention appears to be to resubmit skb once resources are
  available, but due to no queue handling it is dropped for now.
- lapbether: skb is freed, so return NETDEV_TX_OK

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/i4l/isdn_net.c
drivers/net/hamradio/bpqether.c
drivers/net/hp100.c
drivers/net/wan/lapbether.c

index 34d54e7281fd13aabf5b72cbf4a471a6e433ddb8..de4aad076ebc98767d1df746f5b3d43d09a31786 100644 (file)
@@ -1300,7 +1300,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                netif_stop_queue(ndev);
                }
        }
-       return 1;
+       return NETDEV_TX_BUSY;
 }
 
 /*
index 5105548ad50c6ad0ccb73efaea382066b0af255b..abcd19a8bff98cb997371174f0f41aeb40173159 100644 (file)
@@ -260,7 +260,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
         */
        if (!netif_running(dev)) {
                kfree_skb(skb);
-               return -ENODEV;
+               return NETDEV_TX_OK;
        }
 
        skb_pull(skb, 1);
index 8feda9fe8297d738a77449b85a64259fb58c95dc..1d3429a415e6b646f90b49e9aad317ab1a3b0271 100644 (file)
@@ -1495,13 +1495,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
        hp100_outw(0x4210, TRACE);
        printk("hp100: %s: start_xmit_bm\n", dev->name);
 #endif
-
-       if (skb == NULL) {
-               return 0;
-       }
-
        if (skb->len <= 0)
-               return 0;
+               goto drop;
 
        if (lp->chip == HP100_CHIPID_SHASTA && skb_padto(skb, ETH_ZLEN))
                return 0;
@@ -1514,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
 #endif
                /* not waited long enough since last tx? */
                if (time_before(jiffies, dev->trans_start + HZ))
-                       return -EAGAIN;
+                       goto drop;
 
                if (hp100_check_lan(dev))
-                       return -EIO;
+                       goto drop;
 
                if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
                        /* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1551,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
                }
 
                dev->trans_start = jiffies;
-               return -EAGAIN;
+               goto drop;
        }
 
        /*
@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)
        dev->trans_start = jiffies;
 
        return 0;
+
+drop:
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
 }
 
 
@@ -1648,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
        hp100_outw(0x4212, TRACE);
        printk("hp100: %s: start_xmit\n", dev->name);
 #endif
-
-       if (skb == NULL) {
-               return 0;
-       }
-
        if (skb->len <= 0)
-               return 0;
+               goto drop;
 
        if (hp100_check_lan(dev))
-               return -EIO;
+               goto drop;
 
        /* If there is not enough free memory on the card... */
        i = hp100_inl(TX_MEM_FREE) & 0x7fffffff;
@@ -1671,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        printk("hp100: %s: trans_start timing problem\n",
                               dev->name);
 #endif
-                       return -EAGAIN;
+                       goto drop;
                }
                if (lp->lan_type == HP100_LAN_100 && lp->hub_status < 0) {
                        /* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1705,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        }
                }
                dev->trans_start = jiffies;
-               return -EAGAIN;
+               goto drop;
        }
 
        for (i = 0; i < 6000 && (hp100_inb(OPTION_MSW) & HP100_TX_CMD); i++) {
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
 #endif
 
        return 0;
+
+drop:
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
+
 }
 
 
index 2dd78d20eb05fedde9e7bea0ca2a228e1fb2b4d1..aff4f6bdf3d5b2275cccb5b166d4994938820ec5 100644 (file)
@@ -149,46 +149,40 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)
  */
 static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       int err = -ENODEV;
+       int err;
 
        /*
         * Just to be *really* sure not to send anything if the interface
         * is down, the ethernet device may have gone.
         */
-       if (!netif_running(dev)) {
+       if (!netif_running(dev))
                goto drop;
-       }
 
        switch (skb->data[0]) {
        case 0x00:
-               err = 0;
                break;
        case 0x01:
                if ((err = lapb_connect_request(dev)) != LAPB_OK)
                        printk(KERN_ERR "lapbeth: lapb_connect_request "
                               "error: %d\n", err);
-               goto drop_ok;
+               goto drop;
        case 0x02:
                if ((err = lapb_disconnect_request(dev)) != LAPB_OK)
                        printk(KERN_ERR "lapbeth: lapb_disconnect_request "
                               "err: %d\n", err);
                /* Fall thru */
        default:
-               goto drop_ok;
+               goto drop;
        }
 
        skb_pull(skb, 1);
 
        if ((err = lapb_data_request(dev, skb)) != LAPB_OK) {
                printk(KERN_ERR "lapbeth: lapb_data_request error - %d\n", err);
-               err = -ENOMEM;
                goto drop;
        }
-       err = 0;
 out:
-       return err;
-drop_ok:
-       err = 0;
+       return NETDEV_TX_OK;
 drop:
        kfree_skb(skb);
        goto out;