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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 C187DC10F0E for ; Tue, 9 Apr 2019 09:20:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B19020818 for ; Tue, 9 Apr 2019 09:20:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="Kzm6Cdld" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfDIJUE (ORCPT ); Tue, 9 Apr 2019 05:20:04 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36778 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbfDIJUD (ORCPT ); Tue, 9 Apr 2019 05:20:03 -0400 Received: by mail-wr1-f66.google.com with SMTP id y13so19887897wrd.3 for ; Tue, 09 Apr 2019 02:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=S1fmlTBObwCywrgR5aP173Pv826IqW+Si8pKOEBFxkY=; b=Kzm6Cdldtah4WOYl4gNYksHOedbWAZZ9ls+k7BdNwLVaslom8hM42v6TlzaLd4MPAO VvhpRZXZkXWQaX+U7moXlzha7W158uIb0YlD7UHZUe7Wa8BWB7tYMqZSV1aiPaaw6a3J /Q+UUBWCfx2a+bX8RMVU2rqCASvumxuVTEZmE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=S1fmlTBObwCywrgR5aP173Pv826IqW+Si8pKOEBFxkY=; b=Ti1ZfvGE71Ec9/YGs3WYM0AbbwWlRf7gHEcnnay1FXNLWNbs3WjOncKBaIboS1Ffge mx7xCX5ZkxFuY7ucSCxJqVs5Ds6kq8p8Q0uSkIDBPO/4NnTZV9tnu9c1B6sX6b6Vrs7I H5GCGOfy/2Zt6njcj9ZLNmkA5qt62HqLz0sde9DLpYbguViDovB9tvlJWYLn7CwPOwV7 gV78Q7OgTq9cVuc1+eN4a4gWmT9GH47ImGEAva7I4nMFCL3a7q8pYjIENZukg2D24YLO 4WdJhfKGCK18W0JmqGy3q1yXT+VrQd7v7j5OxTgORemi81Rbd5ohwsz+wq0nuL25glbp HOsg== X-Gm-Message-State: APjAAAWkAQH1UPCj2QsDPC+GX7f3600onr/++pKowi4yS4tUMDxu5cFe gjQo55Qs9QEQA0qbIejZhn3GOA== X-Google-Smtp-Source: APXvYqyXGPUBUPJ15TCrTg9yk5meMf3wD3+oHH1RBvMrX/g0tnfNzJyrO0NfuJxio62wfurlTsK5zA== X-Received: by 2002:a5d:538d:: with SMTP id d13mr22683617wrv.45.1554801602046; Tue, 09 Apr 2019 02:20:02 -0700 (PDT) Received: from [192.168.0.107] (84-238-136-197.ip.btc-net.bg. [84.238.136.197]) by smtp.gmail.com with ESMTPSA id y127sm14600257wmg.29.2019.04.09.02.20.00 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 02:20:01 -0700 (PDT) Subject: Re: [PATCH] net:bridge:bridge mtu auto tuning does not always work To: Huang Rui , davem@davemloft.net Cc: lirongqing@baidu.com, netdev@vger.kernel.org, Roopa Prabhu References: <20190409073642.12953-1-huangruiPPP@gmail.com> From: Nikolay Aleksandrov Message-ID: <6e2e9992-2830-2842-ab17-e053309b6049@cumulusnetworks.com> Date: Tue, 9 Apr 2019 12:20:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190409073642.12953-1-huangruiPPP@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 09/04/2019 10:36, Huang Rui wrote: > If someone setup a bridge and add a port(for example: eth0) > into the bridge, but configure the bridge's mtu which is equal > to eth0's mtu, the auto tuning flag will not be set true. But > the meaning of the auto tuning flag is that it will be set true > if a user configure bridge's mtu. > > 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 2b67f2a..ba410d7 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) { > Nacked-by: Nikolay Aleksandrov No, it is not. If the user specified the MTU then auto-tuning is disabled on purpose because that is what the user desired as MTU. We've had so many MTU issues over the years, it's hard to get it right and the auto-min/max policies work only for some cases, to workaround that we disable the auto policy when the user explicitly specifies the MTU[1]. Also please CC bridge maintainers when sending bridge patches. Thanks, Nik [1] This has been the behaviour since: commit 804b854d374e Author: Nikolay Aleksandrov Date: Fri Mar 30 13:46:19 2018 +0300 net: bridge: disable bridge MTU auto tuning if it was set manually As Roopa noted today the biggest source of problems when configuring bridge and ports is that the bridge MTU keeps changing automatically on port events (add/del/changemtu). That leads to inconsistent behaviour and network config software needs to chase the MTU and fix it on each such event. Let's improve on that situation and allow for the user to set any MTU within ETH_MIN/MAX limits, but once manually configured it is the user's responsibility to keep it correct afterwards. In case the MTU isn't manually set - the behaviour reverts to the previous and the bridge follows the minimum MTU. Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller