netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net:bridge:always disable auto-tuning when the user specified MTU
@ 2019-04-10  2:32 Huang Rui
  2019-04-10  2:39 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Huang Rui @ 2019-04-10  2:32 UTC (permalink / raw)
  To: davem
  Cc: ast, daniel, jakub.kicinski, hawk, john.fastabend, kafai,
	songliubraving, yhs, jiri, ecree, idosch, petrm,
	alexander.h.duyck, amritha.nambiar, lirongqing, netdev,
	linux-kernel, xdp-newbies, bpf, roopa, nikolay, bridge,
	huangruiPPP

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 <huangruiPPP@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-16  7:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-10  2:32 [PATCH] net:bridge:always disable auto-tuning when the user specified MTU Huang Rui
2019-04-10  2:39 ` Stephen Hemminger
2019-04-10 10:34   ` Petr Machata
2019-04-10 11:05     ` Nikolay Aleksandrov
2019-04-16  7:19       ` 黄睿

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).