Skip to content

Commit

Permalink
net: bridge: mrp: Update ring transitions.
Browse files Browse the repository at this point in the history
According to the standard IEC 62439-2, the number of transitions needs
to be counted for each transition 'between' ring state open and ring
state closed and not from open state to closed state.

Therefore fix this for both ring and interconnect ring.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Horatiu Vultur authored and David S. Miller committed Jun 4, 2021
1 parent ecb0605 commit fcb3463
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/bridge/br_mrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,7 @@ int br_mrp_set_ring_state(struct net_bridge *br,
if (!mrp)
return -EINVAL;

if (mrp->ring_state == BR_MRP_RING_STATE_CLOSED &&
state->ring_state != BR_MRP_RING_STATE_CLOSED)
if (mrp->ring_state != state->ring_state)
mrp->ring_transitions++;

mrp->ring_state = state->ring_state;
Expand Down Expand Up @@ -715,8 +714,7 @@ int br_mrp_set_in_state(struct net_bridge *br, struct br_mrp_in_state *state)
if (!mrp)
return -EINVAL;

if (mrp->in_state == BR_MRP_IN_STATE_CLOSED &&
state->in_state != BR_MRP_IN_STATE_CLOSED)
if (mrp->in_state != state->in_state)
mrp->in_transitions++;

mrp->in_state = state->in_state;
Expand Down

0 comments on commit fcb3463

Please sign in to comment.