Commit 3e427a33 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by David S. Miller

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 43b25ee7
...@@ -640,10 +640,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, ...@@ -640,10 +640,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
if (unlikely(skb->len > MAX_PKT_SIZE)) { if (unlikely(skb->len > MAX_PKT_SIZE)) {
if (net_ratelimit()) if (net_ratelimit())
netdev_dbg(netdev, "tx packet too big\n"); netdev_dbg(netdev, "tx packet too big\n");
goto drop;
netdev->stats.tx_dropped++;
kfree_skb(skb);
return NETDEV_TX_OK;
} }
map = dma_map_single(priv->dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE); 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, ...@@ -651,10 +648,7 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
/* drop packet */ /* drop packet */
if (net_ratelimit()) if (net_ratelimit())
netdev_err(netdev, "map socket buffer failed\n"); netdev_err(netdev, "map socket buffer failed\n");
goto drop;
netdev->stats.tx_dropped++;
kfree_skb(skb);
return NETDEV_TX_OK;
} }
txdes = ftgmac100_current_txdes(priv); txdes = ftgmac100_current_txdes(priv);
...@@ -693,6 +687,13 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb, ...@@ -693,6 +687,13 @@ static int ftgmac100_hard_start_xmit(struct sk_buff *skb,
ftgmac100_txdma_normal_prio_start_polling(priv); 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; return NETDEV_TX_OK;
} }
......
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