From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lennart Schulte Subject: SG off on domU middle node drops packets Date: Tue, 26 May 2015 10:55:52 +0300 Message-ID: <55642708.9040302@aalto.fi> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org 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 diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index d8c1076..f5e403b 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -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;