drivers: net: use NETDEV_TX_OK instead of NETDEV_TX_LOCKED
authorFlorian Westphal <fw@strlen.de>
Sun, 24 Apr 2016 19:38:12 +0000 (21:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Apr 2016 19:53:05 +0000 (15:53 -0400)
These drivers already call netif_stop_queue() so we should not be called
unless tx space is available.  Just free the skb and return TX_OK.

Followup patch will remove NETDEV_TX_LOCKED from the kernel.

Cc: linux-parisc@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/7990.c
drivers/net/ethernet/amd/a2065.c
drivers/net/ethernet/dec/tulip/de4x5.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/hdlcdrv.c

index 66d0b73c39c03ba2a050c70e49f6cba4498f47c1..8e75755715318968ff21cad7c8635fef69bbc77c 100644 (file)
@@ -543,11 +543,13 @@ int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
        static int outs;
        unsigned long flags;
 
-       if (!TX_BUFFS_AVAIL)
-               return NETDEV_TX_LOCKED;
-
        netif_stop_queue(dev);
 
+       if (!TX_BUFFS_AVAIL) {
+               dev_consume_skb_any(skb);
+               return NETDEV_TX_OK;
+       }
+
        skblen = skb->len;
 
 #ifdef DEBUG_DRIVER
index 56139184b8019c132428654a5af6a4bd4018de14..2a18d34d2610d660d3062dd733137c8950b18b1f 100644 (file)
@@ -547,10 +547,8 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
 
        local_irq_save(flags);
 
-       if (!lance_tx_buffs_avail(lp)) {
-               local_irq_restore(flags);
-               return NETDEV_TX_LOCKED;
-       }
+       if (!lance_tx_buffs_avail(lp))
+               goto out_free;
 
 #ifdef DEBUG
        /* dump the packet */
@@ -573,6 +571,7 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,
 
        /* Kick the lance: transmit now */
        ll->rdp = LE_C0_INEA | LE_C0_TDMD;
+ out_free:
        dev_kfree_skb(skb);
 
        local_irq_restore(flags);
index 3acde3b9b767c4c025b57130c0e497e62b6cd46c..d88fbab378aaa5a71310c8de8db82cb2a6a9e6f8 100644 (file)
@@ -1465,7 +1465,7 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
 
     netif_stop_queue(dev);
     if (!lp->tx_enable)                   /* Cannot send for now */
-       return NETDEV_TX_LOCKED;
+               goto tx_err;
 
     /*
     ** Clean out the TX ring asynchronously to interrupts - sometimes the
@@ -1478,7 +1478,7 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
 
     /* Test if cache is already locked - requeue skb if so */
     if (test_and_set_bit(0, (void *)&lp->cache.lock) && !lp->interrupt)
-       return NETDEV_TX_LOCKED;
+               goto tx_err;
 
     /* Transmit descriptor ring full or stale skb */
     if (netif_queue_stopped(dev) || (u_long) lp->tx_skb[lp->tx_new] > 1) {
@@ -1519,6 +1519,9 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev)
     lp->cache.lock = 0;
 
     return NETDEV_TX_OK;
+tx_err:
+       dev_kfree_skb_any(skb);
+       return NETDEV_TX_OK;
 }
 
 /*
index 72c9f1f352b4ec686a073b48f8df52d6245f771f..eb6663866c9f5795e3089d67514a4eb5e8ed698f 100644 (file)
@@ -780,8 +780,10 @@ static int baycom_send_packet(struct sk_buff *skb, struct net_device *dev)
                dev_kfree_skb(skb);
                return NETDEV_TX_OK;
        }
-       if (bc->skb)
-               return NETDEV_TX_LOCKED;
+       if (bc->skb) {
+               dev_kfree_skb(skb);
+               return NETDEV_TX_OK;
+       }
        /* strip KISS byte */
        if (skb->len >= HDLCDRV_MAXFLEN+1 || skb->len < 3) {
                dev_kfree_skb(skb);
index 49fe59b180a8619f554d5852202df933fee54871..4bad0b894e9c9fccbe89ae0427a01a4d07f226e4 100644 (file)
@@ -412,8 +412,10 @@ static netdev_tx_t hdlcdrv_send_packet(struct sk_buff *skb,
                dev_kfree_skb(skb);
                return NETDEV_TX_OK;
        }
-       if (sm->skb)
-               return NETDEV_TX_LOCKED;
+       if (sm->skb) {
+               dev_kfree_skb(skb);
+               return NETDEV_TX_OK;
+       }
        netif_stop_queue(dev);
        sm->skb = skb;
        return NETDEV_TX_OK;