aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
authorSteven Hsieh <steven.hsieh@broadcom.com>2022-09-28 10:57:58 -0700
committerDavid S. Miller <davem@davemloft.net>2022-09-30 12:35:29 +0100
commitbd139381531987091d8c38e0d2c68faf1ad83668 (patch)
treed467cf7958d4b42be9eb50bc0ec5f269a27aab04 /net/bridge/br_if.c
parentnet: lan966x: Fix spelling mistake "tarffic" -> "traffic" (diff)
downloadlinux-dev-bd139381531987091d8c38e0d2c68faf1ad83668.tar.xz
linux-dev-bd139381531987091d8c38e0d2c68faf1ad83668.zip
net: bridge: assign path_cost for 2.5G and 5G link speed
As 2.5G, 5G ethernet ports are more common and affordable, these ports are being used in LAN bridge devices. STP port_cost() is missing path_cost assignment for these link speeds, causes highest cost 100 being used. This result in lower speed port being picked when there is loop between 5G and 1G ports. Original path_cost: 10G=2, 1G=4, 100m=19, 10m=100 Adjusted path_cost: 10G=2, 5G=3, 2.5G=4, 1G=5, 100m=19, 10m=100 speed greater than 10G = 1 Signed-off-by: Steven Hsieh <steven.hsieh@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index efbd93e92ce2..228fd5b20f10 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -40,12 +40,21 @@ static int port_cost(struct net_device *dev)
switch (ecmd.base.speed) {
case SPEED_10000:
return 2;
- case SPEED_1000:
+ case SPEED_5000:
+ return 3;
+ case SPEED_2500:
return 4;
+ case SPEED_1000:
+ return 5;
case SPEED_100:
return 19;
case SPEED_10:
return 100;
+ case SPEED_UNKNOWN:
+ return 100;
+ default:
+ if (ecmd.base.speed > SPEED_10000)
+ return 1;
}
}