]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: sonic: return NETDEV_TX_OK if failed to map buffer
authorMao Wenan <maowenan@huawei.com>
Thu, 5 Sep 2019 01:57:12 +0000 (09:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 6 Sep 2019 13:04:57 +0000 (15:04 +0200)
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 <maowenan@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/natsemi/sonic.c

index d0a01e8f000aee71413425d94efc921856a062f7..18fd62fbfb6497b0f10dfd0751a02426d41cb4fd 100644 (file)
@@ -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);
                dev_kfree_skb(skb);
-               return NETDEV_TX_BUSY;
+               return NETDEV_TX_OK;
        }
 
        sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0);       /* clear status */