Skip to content

Commit f7fb92a

Browse files
committed
Merge branch 'bridge-mrp-Update-MRP_PORT_ROLE'
Horatiu Vultur says: ==================== bridge: mrp: Update MRP_PORT_ROLE This patch series does the following: - fixes the enum br_mrp_port_role_type. It removes the port role none(0x2) because this is in conflict with the standard. The standard defines the interconnect port role as value 0x2. - adds checks regarding current defined port roles: primary(0x0) and secondary(0x1). v2: - add the validation code when setting the port role. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 26ac10b + 7882c89 commit f7fb92a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/uapi/linux/mrp_bridge.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ enum br_mrp_port_state_type {
3636
enum br_mrp_port_role_type {
3737
BR_MRP_PORT_ROLE_PRIMARY,
3838
BR_MRP_PORT_ROLE_SECONDARY,
39-
BR_MRP_PORT_ROLE_NONE,
4039
};
4140

4241
enum br_mrp_tlv_header_type {

net/bridge/br_mrp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,16 @@ int br_mrp_set_port_role(struct net_bridge_port *p,
411411
if (!mrp)
412412
return -EINVAL;
413413

414-
if (role == BR_MRP_PORT_ROLE_PRIMARY)
414+
switch (role) {
415+
case BR_MRP_PORT_ROLE_PRIMARY:
415416
rcu_assign_pointer(mrp->p_port, p);
416-
else
417+
break;
418+
case BR_MRP_PORT_ROLE_SECONDARY:
417419
rcu_assign_pointer(mrp->s_port, p);
420+
break;
421+
default:
422+
return -EINVAL;
423+
}
418424

419425
br_mrp_port_switchdev_set_role(p, role);
420426

0 commit comments

Comments
 (0)