Commit 8f3359bd authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

bridge: make user modified path cost sticky

Keep a STP port path cost value if it was set by a user.
Don't replace it with the link-speed based path cost
whenever the link goes down and comes back up.
Reported-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f88c91dd
...@@ -67,7 +67,8 @@ void br_port_carrier_check(struct net_bridge_port *p) ...@@ -67,7 +67,8 @@ void br_port_carrier_check(struct net_bridge_port *p)
struct net_device *dev = p->dev; struct net_device *dev = p->dev;
struct net_bridge *br = p->br; struct net_bridge *br = p->br;
if (netif_running(dev) && netif_oper_up(dev)) if (!(p->flags & BR_ADMIN_COST) &&
netif_running(dev) && netif_oper_up(dev))
p->path_cost = port_cost(dev); p->path_cost = port_cost(dev);
if (!netif_running(br->dev)) if (!netif_running(br->dev))
......
...@@ -156,6 +156,7 @@ struct net_bridge_port ...@@ -156,6 +156,7 @@ struct net_bridge_port
#define BR_BPDU_GUARD 0x00000002 #define BR_BPDU_GUARD 0x00000002
#define BR_ROOT_BLOCK 0x00000004 #define BR_ROOT_BLOCK 0x00000004
#define BR_MULTICAST_FAST_LEAVE 0x00000008 #define BR_MULTICAST_FAST_LEAVE 0x00000008
#define BR_ADMIN_COST 0x00000010
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
u32 multicast_startup_queries_sent; u32 multicast_startup_queries_sent;
......
...@@ -288,6 +288,7 @@ int br_stp_set_path_cost(struct net_bridge_port *p, unsigned long path_cost) ...@@ -288,6 +288,7 @@ int br_stp_set_path_cost(struct net_bridge_port *p, unsigned long path_cost)
path_cost > BR_MAX_PATH_COST) path_cost > BR_MAX_PATH_COST)
return -ERANGE; return -ERANGE;
p->flags |= BR_ADMIN_COST;
p->path_cost = path_cost; p->path_cost = path_cost;
br_configuration_update(p->br); br_configuration_update(p->br);
br_port_state_selection(p->br); br_port_state_selection(p->br);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment