summaryrefslogtreecommitdiffstats
path: root/drivers/staging/et131x/et131x.c
diff options
context:
space:
mode:
authorMark Einon <mark.einon@gmail.com>2014-09-11 22:59:40 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 16:02:12 -0700
commit701b943e5cbcbaeb9d86947d9822f41755b1fe49 (patch)
tree91998cac618979e94f839a0136cc67a46d075f6d /drivers/staging/et131x/et131x.c
parent4792e6d136dc4a340cef1c713a3eb50bd0550764 (diff)
staging: et131x: In et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packet
Memory allocation errors do not denote NETDEV_TX_BUSY, simply drop the packet silently with kfree_skb() and return NETDEV_TX_OK. Also remove this item from the TODO list. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/et131x/et131x.c')
-rw-r--r--drivers/staging/et131x/et131x.c51
1 files changed, 15 insertions, 36 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 0314920824a..c1ba51af320 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -4212,7 +4212,6 @@ static void et131x_multicast(struct net_device *netdev)
/* et131x_tx - The handler to tx a packet on the device */
static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev)
{
- int status = 0;
struct et131x_adapter *adapter = netdev_priv(netdev);
struct tx_ring *tx_ring = &adapter->tx_ring;
@@ -4224,43 +4223,23 @@ static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev)
netdev->trans_start = jiffies;
/* TCB is not available */
- if (tx_ring->used >= NUM_TCB) {
- /* NOTE: If there's an error on send, no need to queue the
- * packet under Linux; if we just send an error up to the
- * netif layer, it will resend the skb to us.
- */
- status = -ENOMEM;
- } else {
- /* We need to see if the link is up; if it's not, make the
- * netif layer think we're good and drop the packet
- */
- if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) ||
- !netif_carrier_ok(netdev)) {
- dev_kfree_skb_any(skb);
- skb = NULL;
+ if (tx_ring->used >= NUM_TCB)
+ goto drop_err;
- adapter->netdev->stats.tx_dropped++;
- } else {
- status = send_packet(skb, adapter);
- if (status != 0 && status != -ENOMEM) {
- /* On any other error, make netif think we're
- * OK and drop the packet
- */
- dev_kfree_skb_any(skb);
- skb = NULL;
- adapter->netdev->stats.tx_dropped++;
- }
- }
- }
+ if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) ||
+ !netif_carrier_ok(netdev))
+ goto drop_err;
- /* Check status and manage the netif queue if necessary */
- if (status != 0) {
- if (status == -ENOMEM)
- status = NETDEV_TX_BUSY;
- else
- status = NETDEV_TX_OK;
- }
- return status;
+ if (send_packet(skb, adapter))
+ goto drop_err;
+
+ return NETDEV_TX_OK;
+
+drop_err:
+ dev_kfree_skb_any(skb);
+ skb = NULL;
+ adapter->netdev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
}
/* et131x_tx_timeout - Timeout handler