Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4888819ybg; Mon, 21 Oct 2019 16:28:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqynd0UjmFNS45gr47m0QmTU3JAF5kdTXRvKmy1lQtHvGMzQD4N1N99MFi34QaAeqUCtdzCj X-Received: by 2002:a05:6402:3c5:: with SMTP id t5mr27179503edw.125.1571700532717; Mon, 21 Oct 2019 16:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571700532; cv=none; d=google.com; s=arc-20160816; b=v2nLKlmA3y/TuJXMW+C1oSwi3DbkPatEAn+zyQPo0TprjuQTBiBS/L8YJiidIh5HZD kcnmKrXRZ+mZvhb5aFLsz5zgk5Ek61FppBLC1NFPV+QTDbguVDQga7EPEEtzCnOqL8NU Kgam+f6Z876RXFCdxS06FvIavLHtDsH54/VzuwK56tXS5wUHpNm7MRUyVIRz/OD3QPC1 TBL98Dp5stJau8a2XA3tAkvImheRDrI7XSjkgkHLx5yAb8AGfaUAO7Myt4rLjgKSe1IJ ytbHqLJ68MMkvXTXi8mfocGfJ1XPExGL0JDFVKBi0IdEAEosYRdda2Qnhqpepu5kEKNn 1yfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WzXnfhMMbkyxsbipWZpmDaEvwrJstasCywDAINxmEVo=; b=EJ0Bq1OrnqkH2YqOPDGYSsluyNS4ZBp2v1BnGV990a4lQ+sr6jTfbH+HOIjZmt3wXd Va+9DZ5FbLHzsLnYtMamL5p5e6CJKRXB0u0DKZ7O76Wwce5Mrmb3auSuavoTJ4fWdPF5 NZZ3ESW2DCfJNR8JAVWBmRTRUbx8uMrPsbcjvPDvAZELqi0Rh/SGYflRZXUYmxgmSCNq MK/5SmPsivEaFZXo08rzPJ6i/II7fsu8WdRIUV7CRdgV6MOFnzxls7DrzAp6XvymVWrq hWfNaBb8bmdH77LHmxr/getxYv+0Mn54oYnNIHVq/9fmcd9f/QC6i1rh6k6TJReaYk5A JD5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=NgmGbovC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f31si4173573edf.75.2019.10.21.16.28.29; Mon, 21 Oct 2019 16:28:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=NgmGbovC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730217AbfJUX2B (ORCPT + 99 others); Mon, 21 Oct 2019 19:28:01 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42565 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727953AbfJUX2B (ORCPT ); Mon, 21 Oct 2019 19:28:01 -0400 Received: by mail-pg1-f196.google.com with SMTP id f14so8731954pgi.9 for ; Mon, 21 Oct 2019 16:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WzXnfhMMbkyxsbipWZpmDaEvwrJstasCywDAINxmEVo=; b=NgmGbovCPleH2RLmDw5JhoDuEPGz4MOoogHyBtIP6mJ9Dcy6+emNzKGSxU3oVjAx0u A6Thotqa3AC+oXLpkNPc/k8nDI7mEP0DpWfEe9Ug5PITZjO8pgOe6BrQ+HXu7Lna4CyS vxUGrbn74CCKn00pPxuQ+8n+UoCFiicvHSud8wUsy9BVNHvJzV/pJYDRBkhb9QlqjriB 0yBuHoBgdESlw55pEH5HDN4TnNcP6PEPc7Zm4zBmz+/mCm9G7uRFDDrbQIxhg6ek1+3Y rOVMVVFfOZa4CyAAMjflAmWWstpYjbWDxsE/u+E0FoZrJ7MkhAPIfM5NO2R14YoizbMq hhAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WzXnfhMMbkyxsbipWZpmDaEvwrJstasCywDAINxmEVo=; b=K5fI1CzWX0Y0OeQg+sINyw74tqdUh5xTyPyJHPEm7FZneJVNdshkXIRFtuJsVZS5xU xLn2EPz0e3q5NVOqhiDO2mg1wGL3h8AYRWksRwJKYgu3pAENlp6OiDuyQWscv2w5W/WX cTRKgir/fc1Iumcfgd67N4i1ZhPtnwhQgvFmvlm00GY699yCoczu284gGC9VJX4om1/2 CVUFvsv4Y6nuNhAXQgCgvVi8euYFgymFnVa+fksl8XUaS+eWFg1PVy3tbj2vYI0QDidG MCUGOpX9HXykYhLzUSE4ATobYAri0dch8JhO1p/AKd+cru04SoMQgrWJhVj11Aq6I5yz BRog== X-Gm-Message-State: APjAAAWMoKimnDfEI0+ZNGrd2LkAqH7xneM2JFCDjpvNe9VO2F1csANg JCWk8WdTDCEzjNfZlajVpBSaGg== X-Received: by 2002:a63:f743:: with SMTP id f3mr427772pgk.410.1571700478697; Mon, 21 Oct 2019 16:27:58 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id e17sm275837pgg.5.2019.10.21.16.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 16:27:58 -0700 (PDT) Date: Mon, 21 Oct 2019 16:27:51 -0700 From: Stephen Hemminger To: Yunsheng Lin Cc: , , , , , , , , Subject: Re: [PATCH RFC] net: vlan: reverse 4 bytes of vlan header when setting initial MTU Message-ID: <20191021162751.1ccb251e@hermes.lan> In-Reply-To: <1571660763-117936-1-git-send-email-linyunsheng@huawei.com> References: <1571660763-117936-1-git-send-email-linyunsheng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 21 Oct 2019 20:26:03 +0800 Yunsheng Lin wrote: > Currently the MTU of vlan netdevice is set to the same MTU > of the lower device, which requires the underlying device > to handle it as the comment has indicated: > > /* need 4 bytes for extra VLAN header info, > * hope the underlying device can handle it. > */ > new_dev->mtu = real_dev->mtu; > > Currently most of the physical netdevs seems to handle above > by reversing 2 * VLAN_HLEN for L2 packet len. > > But for vlan netdev over vxlan netdev case, the vxlan does not > seems to reverse the vlan header for vlan device, which may cause > performance degradation because vxlan may emit a packet that > exceed the MTU of the physical netdev, and cause the software > TSO to happen in ip_finish_output_gso(), software TSO call stack > as below: > > => ftrace_graph_call > => tcp_gso_segment > => tcp4_gso_segment > => inet_gso_segment > => skb_mac_gso_segment > => skb_udp_tunnel_segment > => udp4_ufo_fragment > => inet_gso_segment > => skb_mac_gso_segment > => __skb_gso_segment > => __ip_finish_output > => ip_output > => ip_local_out > => iptunnel_xmit > => udp_tunnel_xmit_skb > => vxlan_xmit_one > => vxlan_xmit > => dev_hard_start_xmit > => __dev_queue_xmit > => dev_queue_xmit > => vlan_dev_hard_start_xmit > => dev_hard_start_xmit > => __dev_queue_xmit > => dev_queue_xmit > => neigh_resolve_output > => ip_finish_output2 > => __ip_finish_output > => ip_output > => ip_local_out > => __ip_queue_xmit > => ip_queue_xmit > => __tcp_transmit_skb > => tcp_write_xmit > => __tcp_push_pending_frames > => tcp_push > => tcp_sendmsg_locked > => tcp_sendmsg > => inet_sendmsg > => sock_sendmsg > => sock_write_iter > => new_sync_write > => __vfs_write > => vfs_write > => ksys_write > => __arm64_sys_write > => el0_svc_common.constprop.0 > => el0_svc_handler > => el0_svc > > This patch set initial MTU of the vlan device to the MTU of the > lower device minus vlan header to handle the above case. > > Signed-off-by: Yunsheng Lin The MTU is visible to user space in many tools, and Linux (and BSD) have always treated VLAN header as not part of the MTU. You can't change that now.