From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83258ECE587 for ; Tue, 1 Oct 2019 14:37:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B39220842 for ; Tue, 1 Oct 2019 14:37:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=akamai.com header.i=@akamai.com header.b="kz7f7apE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389108AbfJAOhC (ORCPT ); Tue, 1 Oct 2019 10:37:02 -0400 Received: from mx0b-00190b01.pphosted.com ([67.231.157.127]:57750 "EHLO mx0b-00190b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727143AbfJAOhB (ORCPT ); Tue, 1 Oct 2019 10:37:01 -0400 Received: from pps.filterd (m0122331.ppops.net [127.0.0.1]) by mx0b-00190b01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x91EasIZ002528; Tue, 1 Oct 2019 15:36:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=jan2016.eng; bh=nEy9c4lD3P2x/ZR8fS+JwUY4pdhFEVNThKY5qbNjg4c=; b=kz7f7apEJ1o5B+AOI6RBPQ0N7NcxSVVx7LfmuV4GMkwMoztbXpOAml9bxBF5KDIUyFzj rjxVDh15WiOV89awfCp14nvOVB6FSh3U5v8iC3oWW/+IynITh7GfWeFxBxREb6UHIFxi SIRJx4BSnpZmWUYQ6u9r0Fd4UG8FB66/C1hVmLHCRksPk1tO8Z3SX8xWfhbTA+00XxW9 bP9ZY53dJph9HWSO9MyA46f8fCchAZKR2ze8bmAduk6vCOLkP0nLX0nagdDfy/6gaBV5 vflpXexxKu47HQBNqgCsEculTRwwZ1nTKN7ngIqZ/ir1Zd31uIlJWXx4AsNEFQqcHEcc RA== Received: from prod-mail-ppoint3 (prod-mail-ppoint3.akamai.com [96.6.114.86] (may be forged)) by mx0b-00190b01.pphosted.com with ESMTP id 2v9vcudj5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Oct 2019 15:36:54 +0100 Received: from pps.filterd (prod-mail-ppoint3.akamai.com [127.0.0.1]) by prod-mail-ppoint3.akamai.com (8.16.0.27/8.16.0.27) with SMTP id x91EWDOT012300; Tue, 1 Oct 2019 10:36:53 -0400 Received: from prod-mail-relay14.akamai.com ([172.27.17.39]) by prod-mail-ppoint3.akamai.com with ESMTP id 2va2uycr1v-1; Tue, 01 Oct 2019 10:36:52 -0400 Received: from [0.0.0.0] (prod-ssh-gw02.sanmateo.corp.akamai.com [172.22.187.166]) by prod-mail-relay14.akamai.com (Postfix) with ESMTP id 40E6A80E97; Tue, 1 Oct 2019 14:36:50 +0000 (GMT) Subject: Re: [PATCH 2/2] udp: only do GSO if # of segs > 1 To: Alexander Duyck Cc: David Miller , Netdev , Eric Dumazet , Willem de Bruijn , "Duyck, Alexander H" References: <1569881518-21885-1-git-send-email-johunt@akamai.com> <1569881518-21885-2-git-send-email-johunt@akamai.com> From: Josh Hunt Message-ID: <5ba4beb7-2ad5-476a-403b-c37f6c761e08@akamai.com> Date: Tue, 1 Oct 2019 07:36:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-01_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910010131 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-01_07:2019-10-01,2019-10-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 spamscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1910010132 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 9/30/19 4:56 PM, Alexander Duyck wrote: > On Mon, Sep 30, 2019 at 3:13 PM Josh Hunt wrote: >> >> Prior to this change an application sending <= 1MSS worth of data and >> enabling UDP GSO would fail if the system had SW GSO enabled, but the >> same send would succeed if HW GSO offload is enabled. In addition to this >> inconsistency the error in the SW GSO case does not get back to the >> application if sending out of a real device so the user is unaware of this >> failure. >> >> With this change we only perform GSO if the # of segments is > 1 even >> if the application has enabled segmentation. I've also updated the >> relevant udpgso selftests. >> >> Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT") >> Signed-off-by: Josh Hunt >> --- >> net/ipv4/udp.c | 5 +++-- >> net/ipv6/udp.c | 5 +++-- >> tools/testing/selftests/net/udpgso.c | 16 ++++------------ >> 3 files changed, 10 insertions(+), 16 deletions(-) >> >> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c >> index be98d0b8f014..ac0baf947560 100644 >> --- a/net/ipv4/udp.c >> +++ b/net/ipv4/udp.c >> @@ -821,6 +821,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, >> int is_udplite = IS_UDPLITE(sk); >> int offset = skb_transport_offset(skb); >> int len = skb->len - offset; >> + int datalen = len - sizeof(*uh); >> __wsum csum = 0; >> >> /* >> @@ -832,7 +833,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, >> uh->len = htons(len); >> uh->check = 0; >> >> - if (cork->gso_size) { >> + if (cork->gso_size && datalen > cork->gso_size) { >> const int hlen = skb_network_header_len(skb) + >> sizeof(struct udphdr); >> > > So what about the datalen == cork->gso_size case? That would only > generate one segment wouldn't it? > > Shouldn't the test really be "datalen < cork->gso_size"? That should > be the only check you need since if gso_size is 0 this statement would > always fail anyway. > > Thanks. > > - Alex > Alex thanks for the review. The intent of the patch is to only use GSO when the # of segs > 1. The two cases you've mentioned are when the # of segs == 1. In those cases we don't want to set gso_size and treat this as a non-GSO case, skipping the if block. Let me know if I misunderstood your points or you'd like further clarification. Thanks! Josh