Skip to content

Commit

Permalink
net: Move main gso loop out of dev_hard_start_xmit() into helper.
Browse files Browse the repository at this point in the history
There is a slight policy change happening here as well.

The previous code would drop the entire rest of the GSO skb if any of
them got, for example, a congestion notification.

That makes no sense, anything NET_XMIT_MASK and below is something
like congestion or policing.  And in the congestion case it doesn't
even mean the packet was actually dropped.

Just continue until dev_xmit_complete() evaluates to false.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Sep 2, 2014
1 parent 2ea2551 commit 7f2e870
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,34 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev,
return rc;
}

static struct sk_buff *xmit_list(struct sk_buff *first, struct net_device *dev,
struct netdev_queue *txq, int *ret)
{
struct sk_buff *skb = first;
int rc = NETDEV_TX_OK;

while (skb) {
struct sk_buff *next = skb->next;

skb->next = NULL;
rc = xmit_one(skb, dev, txq);
if (unlikely(!dev_xmit_complete(rc))) {
skb->next = next;
goto out;
}

skb = next;
if (netif_xmit_stopped(txq) && skb) {
rc = NETDEV_TX_BUSY;
break;
}
}

out:
*ret = rc;
return skb;
}

int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
struct netdev_queue *txq)
{
Expand Down Expand Up @@ -2681,25 +2709,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
}

gso:
do {
struct sk_buff *nskb = skb->next;

skb->next = nskb->next;
nskb->next = NULL;

rc = xmit_one(nskb, dev, txq);
if (unlikely(rc != NETDEV_TX_OK)) {
if (rc & ~NETDEV_TX_MASK)
goto out_kfree_gso_skb;
nskb->next = skb->next;
skb->next = nskb;
return rc;
}
if (unlikely(netif_xmit_stopped(txq) && skb->next))
return NETDEV_TX_BUSY;
} while (skb->next);

out_kfree_gso_skb:
skb->next = xmit_list(skb->next, dev, txq, &rc);
if (likely(skb->next == NULL)) {
skb->destructor = DEV_GSO_CB(skb)->destructor;
consume_skb(skb);
Expand Down

0 comments on commit 7f2e870

Please sign in to comment.