Commit 6bbc088d authored by David S. Miller's avatar David S. Miller

Merge branch 'bridge-mrp'

Horatiu Vultur says:

====================
bridge: mrp: Fix br_mrp_port_switchdev_set_state

Based on the discussion here[1], there was a problem with the function
br_mrp_port_switchdev_set_state. The problem was that it was called
both with BR_STATE* and BR_MRP_PORT_STATE* types. This patch series
fixes this issue and removes SWITCHDEV_ATTR_ID_MRP_PORT_STAT because
is not used anymore.

[1] https://www.spinics.net/lists/netdev/msg714816.html
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3aa6bce9 059d2a10
...@@ -42,7 +42,6 @@ enum switchdev_attr_id { ...@@ -42,7 +42,6 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED, SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
SWITCHDEV_ATTR_ID_BRIDGE_MROUTER, SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,
#if IS_ENABLED(CONFIG_BRIDGE_MRP) #if IS_ENABLED(CONFIG_BRIDGE_MRP)
SWITCHDEV_ATTR_ID_MRP_PORT_STATE,
SWITCHDEV_ATTR_ID_MRP_PORT_ROLE, SWITCHDEV_ATTR_ID_MRP_PORT_ROLE,
#endif #endif
}; };
...@@ -62,7 +61,6 @@ struct switchdev_attr { ...@@ -62,7 +61,6 @@ struct switchdev_attr {
u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */ u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */
bool mc_disabled; /* MC_DISABLED */ bool mc_disabled; /* MC_DISABLED */
#if IS_ENABLED(CONFIG_BRIDGE_MRP) #if IS_ENABLED(CONFIG_BRIDGE_MRP)
u8 mrp_port_state; /* MRP_PORT_STATE */
u8 mrp_port_role; /* MRP_PORT_ROLE */ u8 mrp_port_role; /* MRP_PORT_ROLE */
#endif #endif
} u; } u;
......
...@@ -557,19 +557,22 @@ int br_mrp_del(struct net_bridge *br, struct br_mrp_instance *instance) ...@@ -557,19 +557,22 @@ int br_mrp_del(struct net_bridge *br, struct br_mrp_instance *instance)
int br_mrp_set_port_state(struct net_bridge_port *p, int br_mrp_set_port_state(struct net_bridge_port *p,
enum br_mrp_port_state_type state) enum br_mrp_port_state_type state)
{ {
u32 port_state;
if (!p || !(p->flags & BR_MRP_AWARE)) if (!p || !(p->flags & BR_MRP_AWARE))
return -EINVAL; return -EINVAL;
spin_lock_bh(&p->br->lock); spin_lock_bh(&p->br->lock);
if (state == BR_MRP_PORT_STATE_FORWARDING) if (state == BR_MRP_PORT_STATE_FORWARDING)
p->state = BR_STATE_FORWARDING; port_state = BR_STATE_FORWARDING;
else else
p->state = BR_STATE_BLOCKING; port_state = BR_STATE_BLOCKING;
p->state = port_state;
spin_unlock_bh(&p->br->lock); spin_unlock_bh(&p->br->lock);
br_mrp_port_switchdev_set_state(p, state); br_mrp_port_switchdev_set_state(p, port_state);
return 0; return 0;
} }
......
...@@ -169,13 +169,12 @@ int br_mrp_switchdev_send_in_test(struct net_bridge *br, struct br_mrp *mrp, ...@@ -169,13 +169,12 @@ int br_mrp_switchdev_send_in_test(struct net_bridge *br, struct br_mrp *mrp,
return err; return err;
} }
int br_mrp_port_switchdev_set_state(struct net_bridge_port *p, int br_mrp_port_switchdev_set_state(struct net_bridge_port *p, u32 state)
enum br_mrp_port_state_type state)
{ {
struct switchdev_attr attr = { struct switchdev_attr attr = {
.orig_dev = p->dev, .orig_dev = p->dev,
.id = SWITCHDEV_ATTR_ID_MRP_PORT_STATE, .id = SWITCHDEV_ATTR_ID_PORT_STP_STATE,
.u.mrp_port_state = state, .u.stp_state = state,
}; };
int err; int err;
......
...@@ -72,8 +72,7 @@ int br_mrp_switchdev_set_ring_state(struct net_bridge *br, struct br_mrp *mrp, ...@@ -72,8 +72,7 @@ int br_mrp_switchdev_set_ring_state(struct net_bridge *br, struct br_mrp *mrp,
int br_mrp_switchdev_send_ring_test(struct net_bridge *br, struct br_mrp *mrp, int br_mrp_switchdev_send_ring_test(struct net_bridge *br, struct br_mrp *mrp,
u32 interval, u8 max_miss, u32 period, u32 interval, u8 max_miss, u32 period,
bool monitor); bool monitor);
int br_mrp_port_switchdev_set_state(struct net_bridge_port *p, int br_mrp_port_switchdev_set_state(struct net_bridge_port *p, u32 state);
enum br_mrp_port_state_type state);
int br_mrp_port_switchdev_set_role(struct net_bridge_port *p, int br_mrp_port_switchdev_set_role(struct net_bridge_port *p,
enum br_mrp_port_role_type role); enum br_mrp_port_role_type role);
int br_mrp_switchdev_set_in_role(struct net_bridge *br, struct br_mrp *mrp, int br_mrp_switchdev_set_in_role(struct net_bridge *br, struct br_mrp *mrp,
......
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