Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4440862yba; Tue, 9 Apr 2019 19:48:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmZBfyh72MVlpSkKve9hLG2jDkC5BfmWEWeeZ3+o208xQnP/H06qR/YUcwvrdiNUkAvFNE X-Received: by 2002:a63:88c3:: with SMTP id l186mr38935514pgd.148.1554864521666; Tue, 09 Apr 2019 19:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554864521; cv=none; d=google.com; s=arc-20160816; b=A41TbRM8B8numBE2WPVtAQO01KzV90TKYKmVpzMx7Nex4XReipoh4FlHqGss2D5RbF 24PTW/HAutMrHUwsnZzEDPBSYcHzdEhX4029PKbwwe18f7geHsNosrmAALTKY0hAMg/W YCV6YreZvL3H9bEJGmdCyp7Xy4kIkeKttnC7oqsSVW1Fwz7gdmo6SDpRwii076jOrZgy N/VRGrD/wDjqo3Xe5nU0dteD5QuYm7ppFuOJ1XL3BxAn+VQn4Lgk6K6e/wLyE2BGHX6U FOeUt3yuqmgWWVp9xVf+cBHtA2BMLHkaxN+bFbKEZUfB9DlRMb+3/g0QNTylWALlT3V1 0I2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=DSm60fsRvigZ9rO9v9GaStHi5ZcMD+nYH04YGyKBRU0=; b=sG3TV8HXgGZsRSxkV/H/ccCeWLKp0veXLl83t1lRfN1To0Qk2jGVRj459yqK8bDld/ ybRqgFYH1ccPlYRfE5xEMnmyW0aL4hyZMspoqBdqRkPdNjM6mlGi1/IcKkpYWosjDAl9 mqk7quCxnZePUBKYdP0vehJvFnUltFkAtK+ccNg/YwH4mAtL6UefqbU9NyfbqOibHCGG egBxbdJn0F3YD/XDbozwDR3R+PGY5aTY/E9M5MilKFyg/KP//jZQxJObO6uoFLLpHdfn 24PnE7vnDxsVX63ABSFD6mOmPYP5QT0zBVMvojLQwLZcuEoWaQv3ny57+/9dhs8VtBUI a4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fjESDrfL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q78si28830982pgq.321.2019.04.09.19.48.25; Tue, 09 Apr 2019 19:48:41 -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=@gmail.com header.s=20161025 header.b=fjESDrfL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbfDJCcP (ORCPT + 99 others); Tue, 9 Apr 2019 22:32:15 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35497 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726513AbfDJCcP (ORCPT ); Tue, 9 Apr 2019 22:32:15 -0400 Received: by mail-pl1-f193.google.com with SMTP id w24so418636plp.2; Tue, 09 Apr 2019 19:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=DSm60fsRvigZ9rO9v9GaStHi5ZcMD+nYH04YGyKBRU0=; b=fjESDrfL/POOG9UqFWuFRcxAKL0/LNLBZjmpbvCmJaBFkiRaJQuFHi/WWdPIBaUCBp oqBobw8ztH7yVJZw8kKSc7f8otXSgM7xKMVvvVKBLgcfshZHPzCJhkvQdTAFDFWREV/Q ToQOSvl+QbC//HEf2cj+u+Y3sk/KHJnc/mYYFVRrVtgX4n3B9Ox3RcnJWozk7nuIRKv4 PDSpX5SGQco+nZhdUaKo3UprRRoV+2O/fYO+uaEjIwaOUf52BgNsD6keJEquyTrOuelJ Uhl3r/3/n1MAk+p3uRja4ztVajwqKiqUH1a/+BrXb+VK8M6ruWlEwZH7XQL5Zt7lZRJC EHMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DSm60fsRvigZ9rO9v9GaStHi5ZcMD+nYH04YGyKBRU0=; b=SKftmbWwMzO8UjkZ5y8LOviXpfrhfAhzFD3OzlRud5Og9RxM5mV1nK0Ri2SeBcCwUv nzQaLqU/l8OzxJFB1QPJ2Wb32zln+a5eSFqZHgPUjdWxLR2YdbWFdsEFZ3jIWsW69sJZ KuWA+N+ghrBQYHzEewA5u+e/st7HdKJKFxe7/4q+RidymAlntZnFYQW7ijh+kFKOhjzu kraW4EXDV/TVEYyU4S2FHqVxfcJYZLNoAVcEVgQVpcDYM4CB2KhlAgkEucr0iX5XaTz4 VphJ6jog45ygeq1xCDATKZAMSmhTi8THmSwwWJkdZjSuyXUsAXBhbePrpTMaxQ473OZQ gRYw== X-Gm-Message-State: APjAAAVJFzWfCSKLLskTjBXo1uYeJZkgiRJeCqCoMe3Tt+5FCOXOLYLc tdx37yVqQrdWeO2D/vtEU78vz8I5b3A= X-Received: by 2002:a17:902:8643:: with SMTP id y3mr40171141plt.187.1554863534670; Tue, 09 Apr 2019 19:32:14 -0700 (PDT) Received: from shadowsocks.asia-east1-b.c.nth-highlander-219506.internal. (191.202.194.35.bc.googleusercontent.com. [35.194.202.191]) by smtp.gmail.com with ESMTPSA id u7sm36720689pgp.26.2019.04.09.19.32.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 19:32:13 -0700 (PDT) From: Huang Rui X-Google-Original-From: Huang Rui To: davem@davemloft.net Cc: ast@kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, jiri@mellanox.com, ecree@solarflare.com, idosch@mellanox.com, petrm@mellanox.com, alexander.h.duyck@intel.com, amritha.nambiar@intel.com, lirongqing@baidu.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xdp-newbies@vger.kernel.org, bpf@vger.kernel.org, roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com, bridge@lists.linux-foundation.org, huangruiPPP@gmail.com Subject: [PATCH] net:bridge:always disable auto-tuning when the user specified MTU Date: Wed, 10 Apr 2019 02:32:08 +0000 Message-Id: <20190410023208.25435-1-huangruiPPP@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For example. My purpose is to create a bridge br0 and join eth0 into br0. if we use this following way, the auto-tuning flag will not be disabled. If eth0's mtu is 1200 step 1.brctl addbr br0 step 2.brctl addif br0 eth0 step 3.ifconfig br0 mtu 1200 step 4.ifconfig eth0 mtu 1500 Result: br0's MTU: 1500, eth0's MTU: 1500 Expected: br0's MTU: 1200, eth0's MTU: 1500 I have specified br0's MTU, but auto-min policy works. So the MTU is not the result what we expected. As expected, if i have specified bridge's MTU, it will set the flag: BROPT_MTU_SET_BY_USER in net_bridge_opts disabled and auto-min/max policy will not work.But in this case, because the dev_set_mtu return early, the BROPT_MTU_SET_BY_USER flag will not be disabled and auto-min/max policy will still work. Signed-off-by: Huang Rui --- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 2b67f2aa59dd..ba410d76bb49 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -7670,8 +7670,12 @@ int dev_set_mtu_ext(struct net_device *dev, int new_mtu, { int err, orig_mtu; - if (new_mtu == dev->mtu) - return 0; + if (new_mtu == dev->mtu) { + if (dev->priv_flags & IFF_EBRIDGE) + return __dev_set_mtu(dev, new_mtu); + else + return 0; + } /* MTU must be positive, and in range */ if (new_mtu < 0 || new_mtu < dev->min_mtu) { -- 2.11.0