blob: a4aa87433275506d39bc3f345757522505e36376 [file] [log] [blame]
From 7426b0a6558af06af2996bbef149225e5ecd2da0 Mon Sep 17 00:00:00 2001
From: Mao Wenan <>
Date: Thu, 5 Sep 2019 09:57:12 +0800
Subject: [PATCH] net: sonic: return NETDEV_TX_OK if failed to map buffer
commit 6e1cdedcf0362fed3aedfe051d46bd7ee2a85fe1 upstream.
NETDEV_TX_BUSY really should only be used by drivers that call
netif_tx_stop_queue() at the wrong moment. If dma_map_single() is
failed to map tx DMA buffer, it might trigger an infinite loop.
This patch use NETDEV_TX_OK instead of NETDEV_TX_BUSY, and change
printk to pr_err_ratelimited.
Fixes: d9fb9f384292 ("*sonic/natsemi/ns83829: Move the National Semi-conductor drivers")
Signed-off-by: Mao Wenan <>
Signed-off-by: David S. Miller <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c
index d0a01e8f000a..18fd62fbfb64 100644
--- a/drivers/net/ethernet/natsemi/sonic.c
+++ b/drivers/net/ethernet/natsemi/sonic.c
@@ -232,9 +232,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
if (!laddr) {
- printk(KERN_ERR "%s: failed to map tx DMA buffer.\n", dev->name);
+ pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name);
- return NETDEV_TX_BUSY;
+ return NETDEV_TX_OK;
sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */