diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-04-10 04:15:18 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-10 23:03:57 +0300 |
commit | 3e427a3363edbc8416c36815c2f7de4621739273 (patch) | |
tree | a15a723bb56967a33aa0353158f205ed1e03e358 /drivers/net/ethernet/faraday/ftgmac100.c | |
parent | 43b25ee712f72ec3ad03285413b5515619744eeb (diff) | |
download | linux-3e427a3363edbc8416c36815c2f7de4621739273.tar.xz |
ftgmac100: Factor tx packet dropping path
Use a simple goto to a drop path at the tail of the function,
it will be used in a few more cases soon
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/faraday/ftgmac100.c')
-rw-r--r-- | drivers/net/ethernet/faraday/ftgmac100.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 18b021709286..c8162d21c142 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -640,10 +640,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, if (unlikely(skb->len > MAX_PKT_SIZE)) { if (net_ratelimit()) netdev_dbg(netdev, "tx packet too big\n"); - - netdev->stats.tx_dropped++; - kfree_skb(skb); - return NETDEV_TX_OK; + goto drop; } map = dma_map_single(priv->dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE); @@ -651,10 +648,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, /* drop packet */ if (net_ratelimit()) netdev_err(netdev, "map socket buffer failed\n"); - - netdev->stats.tx_dropped++; - kfree_skb(skb); - return NETDEV_TX_OK; + goto drop; } txdes = ftgmac100_current_txdes(priv); @@ -694,6 +688,13 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, ftgmac100_txdma_normal_prio_start_polling(priv); return NETDEV_TX_OK; + + drop: + /* Drop the packet */ + dev_kfree_skb_any(skb); + netdev->stats.tx_dropped++; + + return NETDEV_TX_OK; } static void ftgmac100_free_buffers(struct ftgmac100 *priv) |