From patchwork Tue Oct 25 05:13:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Maxwell X-Patchwork-Id: 686325 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t31Xq0ffDz9t87 for ; Tue, 25 Oct 2016 16:14:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=R+hXmjJ/; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756790AbcJYFOF (ORCPT ); Tue, 25 Oct 2016 01:14:05 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36246 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754078AbcJYFOD (ORCPT ); Tue, 25 Oct 2016 01:14:03 -0400 Received: by mail-pf0-f194.google.com with SMTP id r16so18428720pfg.3; Mon, 24 Oct 2016 22:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vLMqSQcPygqBMj238VJdWlzHQTaRw4ydR2J7TJ/0bac=; b=R+hXmjJ/BkViM8zS5ILusJqqq7/ezPxnf/qiBVdDyS+W2IeNJUaCFSqewaN8R/medo tISlMJu2A8DINtKS9tXPbdILqKK0gaQVmfpohzWLBBBmaiRMvjgpa6Icl0rY25SYnpYa 9RPx8OrvXRbYMFRJLN9xmVLuXQxJMEBanJ9t+UZToNCIIindiAzZGi+7FBL9LfN8Qj/D bUYyAAsreeTNm6b7iV+ouUmmKJUkIj4TwNsSdoLT0Zr3gP0TlENZ6gMGDCkS8KaaYlHY 9i0tIfgaobxA1FnqlaC5+0+zt37frb4s9uS+K7E0NkvM0FaeEJ2FaTpRcdrMccQB8pKC sRIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vLMqSQcPygqBMj238VJdWlzHQTaRw4ydR2J7TJ/0bac=; b=NP9pTVAiYrvknHjbJzUVb9SCt+ECzaBukUAWX5o+ihp6ii5ZG+8g9JakMwhSp+mRaD dWy09DsVil9VUway7EJUv7RtDHqeexlxyPTCwKHOdAkbeopRgwOHfSWt75QAMlJhNMof 8c0X2IgpWeGyba+gKZvsKdl0knW2FMJPj9fcf7OiaB9w9i8p+GMla4ZYfCTPvtS0bHvg KGBZL3uaQqngfK8BnOnBCAn542HYrrQuEevUp0ZtKiUtAxJBcCKoMxlnUkFU+9dhQ5F8 hDFFFxtrJGeOagnQ05o/zJNh8Q61ca2Ar2CDK2aY5ggQpZUmw+tmAdQTVC5BUlAOF0W+ vDuw== X-Gm-Message-State: ABUngvd07AfG25iT68gjFlUDsREY5pGbO22xFwWWONRz+q2npGhvGQocSITzANpnZ3GuAQ== X-Received: by 10.99.123.90 with SMTP id k26mr13896774pgn.153.1477372442504; Mon, 24 Oct 2016 22:14:02 -0700 (PDT) Received: from dhcp-1-107.bne.redhat.com (110-175-8-199.static.tpgi.com.au. [110.175.8.199]) by smtp.gmail.com with ESMTPSA id e7sm4206329pfa.65.2016.10.24.22.13.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 22:14:01 -0700 (PDT) From: Jon Maxwell To: tlfalcon@linux.vnet.ibm.com Cc: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, davem@davemloft.net, tom@herbertland.com, jarod@redhat.com, hofrat@osadl.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, mleitner@redhat.com, jmaxwell@redhat.com, Jon Maxwell Subject: [PATCH net-next] ibmveth: calculate correct gso_size and set gso_type Date: Tue, 25 Oct 2016 16:13:41 +1100 Message-Id: <1477372421-11656-1-git-send-email-jmaxwell37@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We recently encountered a bug where a few customers using ibmveth on the same LPAR hit an issue where a TCP session hung when large receive was enabled. Closer analysis revealed that the session was stuck because the one side was advertising a zero window repeatedly. We narrowed this down to the fact the ibmveth driver did not set gso_size which is translated by TCP into the MSS later up the stack. The MSS is used to calculate the TCP window size and as that was abnormally large, it was calculating a zero window, even although the sockets receive buffer was completely empty. We were able to reproduce this and worked with IBM to fix this. Thanks Tom and Marcelo for all your help and review on this. The patch fixes both our internal reproduction tests and our customers tests. Signed-off-by: Jon Maxwell --- drivers/net/ethernet/ibm/ibmveth.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 29c05d0..3028c33 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c @@ -1182,6 +1182,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) int frames_processed = 0; unsigned long lpar_rc; struct iphdr *iph; + bool large_packet = 0; + u16 hdr_len = ETH_HLEN + sizeof(struct tcphdr); restart_poll: while (frames_processed < budget) { @@ -1236,10 +1238,27 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) iph->check = 0; iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); adapter->rx_large_packets++; + large_packet = 1; } } } + if (skb->len > netdev->mtu) { + iph = (struct iphdr *)skb->data; + if (be16_to_cpu(skb->protocol) == ETH_P_IP && iph->protocol == IPPROTO_TCP) { + hdr_len += sizeof(struct iphdr); + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; + skb_shinfo(skb)->gso_size = netdev->mtu - hdr_len; + } else if (be16_to_cpu(skb->protocol) == ETH_P_IPV6 && + iph->protocol == IPPROTO_TCP) { + hdr_len += sizeof(struct ipv6hdr); + skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; + skb_shinfo(skb)->gso_size = netdev->mtu - hdr_len; + } + if (!large_packet) + adapter->rx_large_packets++; + } + napi_gro_receive(napi, skb); /* send it up */ netdev->stats.rx_packets++;