Commit 701b943e authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

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: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4792e6d1
...@@ -10,7 +10,6 @@ driver as they did not build properly at the time. ...@@ -10,7 +10,6 @@ driver as they did not build properly at the time.
TODO: TODO:
- Look at reducing the number of spinlocks - Look at reducing the number of spinlocks
- Simplify code in nic_rx_pkts(), when determining multicast_pkts_rcvd - Simplify code in nic_rx_pkts(), when determining multicast_pkts_rcvd
- In et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packet with kfree_skb().
- Reduce the number of split lines by careful consideration of variable names etc. - Reduce the number of split lines by careful consideration of variable names etc.
Please send patches to: Please send patches to:
......
...@@ -4212,7 +4212,6 @@ static void et131x_multicast(struct net_device *netdev) ...@@ -4212,7 +4212,6 @@ static void et131x_multicast(struct net_device *netdev)
/* et131x_tx - The handler to tx a packet on the device */ /* 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) 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 et131x_adapter *adapter = netdev_priv(netdev);
struct tx_ring *tx_ring = &adapter->tx_ring; 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) ...@@ -4224,43 +4223,23 @@ static netdev_tx_t et131x_tx(struct sk_buff *skb, struct net_device *netdev)
netdev->trans_start = jiffies; netdev->trans_start = jiffies;
/* TCB is not available */ /* TCB is not available */
if (tx_ring->used >= NUM_TCB) { if (tx_ring->used >= NUM_TCB)
/* NOTE: If there's an error on send, no need to queue the goto drop_err;
* 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) || if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) ||
!netif_carrier_ok(netdev)) { !netif_carrier_ok(netdev))
dev_kfree_skb_any(skb); goto drop_err;
skb = NULL;
adapter->netdev->stats.tx_dropped++; if (send_packet(skb, adapter))
} else { goto drop_err;
status = send_packet(skb, adapter);
if (status != 0 && status != -ENOMEM) { return NETDEV_TX_OK;
/* On any other error, make netif think we're
* OK and drop the packet drop_err:
*/
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
skb = NULL; skb = NULL;
adapter->netdev->stats.tx_dropped++; adapter->netdev->stats.tx_dropped++;
} return NETDEV_TX_OK;
}
}
/* 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;
} }
/* et131x_tx_timeout - Timeout handler /* et131x_tx_timeout - Timeout handler
......
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