mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
net: Create xmit_one() helper for dev_hard_start_xmit()
Hopefully making the code a bit easier to read and digest. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
10b3ad8c21
commit
2ea2551375
1 changed files with 19 additions and 16 deletions
|
@ -2599,11 +2599,27 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(netif_skb_features);
|
EXPORT_SYMBOL(netif_skb_features);
|
||||||
|
|
||||||
|
static int xmit_one(struct sk_buff *skb, struct net_device *dev,
|
||||||
|
struct netdev_queue *txq)
|
||||||
|
{
|
||||||
|
unsigned int len;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!list_empty(&ptype_all))
|
||||||
|
dev_queue_xmit_nit(skb, dev);
|
||||||
|
|
||||||
|
len = skb->len;
|
||||||
|
trace_net_dev_start_xmit(skb, dev);
|
||||||
|
rc = netdev_start_xmit(skb, dev, txq);
|
||||||
|
trace_net_dev_xmit(skb, rc, dev, len);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
||||||
struct netdev_queue *txq)
|
struct netdev_queue *txq)
|
||||||
{
|
{
|
||||||
int rc = NETDEV_TX_OK;
|
int rc = NETDEV_TX_OK;
|
||||||
unsigned int skb_len;
|
|
||||||
|
|
||||||
if (likely(!skb->next)) {
|
if (likely(!skb->next)) {
|
||||||
netdev_features_t features;
|
netdev_features_t features;
|
||||||
|
@ -2661,14 +2677,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!list_empty(&ptype_all))
|
return xmit_one(skb, dev, txq);
|
||||||
dev_queue_xmit_nit(skb, dev);
|
|
||||||
|
|
||||||
skb_len = skb->len;
|
|
||||||
trace_net_dev_start_xmit(skb, dev);
|
|
||||||
rc = netdev_start_xmit(skb, dev, txq);
|
|
||||||
trace_net_dev_xmit(skb, rc, dev, skb_len);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gso:
|
gso:
|
||||||
|
@ -2678,13 +2687,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
|
||||||
skb->next = nskb->next;
|
skb->next = nskb->next;
|
||||||
nskb->next = NULL;
|
nskb->next = NULL;
|
||||||
|
|
||||||
if (!list_empty(&ptype_all))
|
rc = xmit_one(nskb, dev, txq);
|
||||||
dev_queue_xmit_nit(nskb, dev);
|
|
||||||
|
|
||||||
skb_len = nskb->len;
|
|
||||||
trace_net_dev_start_xmit(nskb, dev);
|
|
||||||
rc = netdev_start_xmit(nskb, dev, txq);
|
|
||||||
trace_net_dev_xmit(nskb, rc, dev, skb_len);
|
|
||||||
if (unlikely(rc != NETDEV_TX_OK)) {
|
if (unlikely(rc != NETDEV_TX_OK)) {
|
||||||
if (rc & ~NETDEV_TX_MASK)
|
if (rc & ~NETDEV_TX_MASK)
|
||||||
goto out_kfree_gso_skb;
|
goto out_kfree_gso_skb;
|
||||||
|
|
Loading…
Reference in a new issue