Skip to contentSkip to conversation

SG off on domU middle node drops packets

PATCH Lennart Schulte 2 participants 2 messages May 26, 2015 – Jun 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,
I use a Xen domU with vanilla Linux 3.19 kernel as a middle node. SG is switched off via ethtool. I get random packet drops for about 7% of small packets (pings, TCP ACKs/SYNs/little payload). From the code in Linux 4.0 it seems that the behavior should be the same.

I posted on Xen-users before with more information:
http://lists.xen.org/archives/html/xen-users/2015-05/msg00170.html

I narrowed down the issue, and the below patch seems to work. Any comments are highly welcome.

Thanks,
Lennart

drivers/net/xen-netfront.c +0 -1
index d8c1076..f5e403b 100644
@@ -611,11 +611,19 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
        spin_lock_irqsave(&queue->tx_lock, flags);
 
        if (unlikely(!netif_carrier_ok(dev) ||
-                    (slots > 1 && !xennet_can_sg(dev)) ||
                     netif_needs_gso(dev, skb, netif_skb_features(skb)))) {
spin_unlock_irqrestore(&queue->tx_lock, flags);
                goto drop;
        }

+ if (unlikely(slots > 1 && !xennet_can_sg(dev))) {
+ if (skb_linearize(skb)) {
+ spin_unlock_irqrestore(&queue->tx_lock, flags);
+ goto drop;

+               }
+               data = skb->data;
+               offset = offset_in_page(data);
+               len = skb_headlen(skb);

+ }

        i = queue->tx.req_prod_pvt;
#1 lore raw
Quoted 5 lines · Lennart Schulte

Hi,
I use a Xen domU with vanilla Linux 3.19 kernel as a middle node. SG is switched off via ethtool. I get random packet drops for about 7% of small packets (pings, TCP ACKs/SYNs/little payload).
From the code in Linux 4.0 it seems that the behavior should be the same.

Why would you turn this option off?

Quoted 23 lines

I posted on Xen-users before with more information:
http://lists.xen.org/archives/html/xen-users/2015-05/msg00170.html

I narrowed down the issue, and the below patch seems to work. Any comments are highly welcome.

Thanks,
Lennart

drivers/net/xen-netfront.c +0 -1
index d8c1076..f5e403b 100644
@@ -611,11 +611,19 @@ static int xennet_start_xmit(struct sk_buff *skb,
 struct net_device *dev)
        spin_lock_irqsave(&queue->tx_lock, flags);
 
        if (unlikely(!netif_carrier_ok(dev) ||
-                    (slots > 1 && !xennet_can_sg(dev)) ||
                     netif_needs_gso(dev, skb, netif_skb_features(skb)))) {
 spin_unlock_irqrestore(&queue->tx_lock, flags);
                goto drop;

drivers/net/xen-netfront.c static int xennet_start_xmit(struct sk_buff *skb, · line 627

Quoted 10 lines
drivers/net/xen-netfront.c +9 -0
        }
+       if (unlikely(slots > 1 && !xennet_can_sg(dev))) {
+               if (skb_linearize(skb)) {
+ spin_unlock_irqrestore(&queue->tx_lock, flags);
+                       goto drop;
+               }
+               data = skb->data;
+               offset = offset_in_page(data);
+               len = skb_headlen(skb);
+       }

Looks ok, can you send a proper patch to devel and xen-devel, please?

David