Netdev List
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: "Li,Rongqing" <lirongqing@baidu.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: 答复: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments
Date: Fri, 13 Jul 2018 12:19:32 +0300	[thread overview]
Message-ID: <6b2d6c0c-5100-dd8e-66f4-2849979faa4c@cumulusnetworks.com> (raw)
In-Reply-To: <2AD939572F25A448A3AE3CAEA61328C23785704D@BC-MAIL-M28.internal.baidu.com>

On 13/07/18 12:11, Li,Rongqing wrote:
> 
> 
>> -----邮件原件-----
>> 发件人: Nikolay Aleksandrov [mailto:nikolay@cumulusnetworks.com]
>> 发送时间: 2018年7月13日 16:01
>> 收件人: Li,Rongqing <lirongqing@baidu.com>; netdev@vger.kernel.org
>> 主题: Re: [PATCH][net-next] bridge: clean up mtu_set_by_user setting to
>> false and comments
>>
>> On 13/07/18 09:47, Li RongQing wrote:
>>> Once mtu_set_by_user is set to true, br_mtu_auto_adjust will not run,
>>> and no chance to clear mtu_set_by_user.
>>>
>> ^^
>> This was by design, there is no error here and no "cleanup" is needed.
>> If you read the ndo_change_mtu() call you'll see the comment:
>> /* this flag will be cleared if the MTU was automatically adjusted */
>>
> But after this comment, mtu_set_by_user is set to true, and br_mtu_auto_adjust
>  will not truly be run, how to set mtu_set_by_user to false?

It will be run if the mtu_set_by_user is set to "false".

> 
> 230     /* this flag will be cleared if the MTU was automatically adjusted */
> 231     br->mtu_set_by_user = true;
> 
> And the line 457  is useless, since it run only if it is false?

dev_set_mtu() calls ndo_change_mtu() which makes mtu_set_by_user = true but that is
not really _true_ since this is an automatic MTU adjustment so we need to revert the
value to false so the automatic adjustment will continue to work.
But if you go ahead and set the MTU yourself manually, then mtu_set_by_user will be
equal to true and will stay that way, thus disabling the auto adjust behaviour.

This is used to differentiate when auto adjust is used and when user has set the MTU.
As I already said everything is working as expected and you should not remove this code.

> 
> 445 void br_mtu_auto_adjust(struct net_bridge *br)
> 446 {
> 447     ASSERT_RTNL();
> 448 
> 449     /* if the bridge MTU was manually configured don't mess with it */
> 450     if (br->mtu_set_by_user)
> 451         return;
> 452 
> 453     /* change to the minimum MTU and clear the flag which was set by
> 454      * the bridge ndo_change_mtu callback
> 455      */
> 456     dev_set_mtu(br->dev, br_mtu_min(br));
> 457     br->mtu_set_by_user = false;
> 458 }
> 
> 
> -R
> 

  reply	other threads:[~2018-07-13  9:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13  6:47 [PATCH][net-next] bridge: clean up mtu_set_by_user setting to false and comments Li RongQing
2018-07-13  8:00 ` Nikolay Aleksandrov
2018-07-13  9:11   ` 答复: " Li,Rongqing
2018-07-13  9:19     ` Nikolay Aleksandrov [this message]
2018-07-13 10:56       ` 答复: " Li,Rongqing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b2d6c0c-5100-dd8e-66f4-2849979faa4c@cumulusnetworks.com \
    --to=nikolay@cumulusnetworks.com \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox