bridge: mrp: Add br_mrp_in_port_open function
authorHoratiu Vultur <horatiu.vultur@microchip.com>
Tue, 14 Jul 2020 07:34:52 +0000 (09:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Jul 2020 20:46:42 +0000 (13:46 -0700)
This function notifies the userspace when the node lost the continuity
of MRP_InTest frames.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_mrp_netlink.c
net/bridge/br_private_mrp.h

index acce300c0cc29e39e407a8295a232ed9a3dccbbc..4bf7aaeb2915260351740147c13f578f0aa72c05 100644 (file)
@@ -389,3 +389,25 @@ int br_mrp_ring_port_open(struct net_device *dev, u8 loc)
 out:
        return err;
 }
+
+int br_mrp_in_port_open(struct net_device *dev, u8 loc)
+{
+       struct net_bridge_port *p;
+       int err = 0;
+
+       p = br_port_get_rcu(dev);
+       if (!p) {
+               err = -EINVAL;
+               goto out;
+       }
+
+       if (loc)
+               p->flags |= BR_MRP_LOST_IN_CONT;
+       else
+               p->flags &= ~BR_MRP_LOST_IN_CONT;
+
+       br_ifinfo_notify(RTM_NEWLINK, NULL, p);
+
+out:
+       return err;
+}
index e93c8f9d4df58ca7ad0dce48091ba80f326bcbc6..23da2f956ad0e9469249cefa85d1a1aedd199bf9 100644 (file)
@@ -75,5 +75,6 @@ int br_mrp_port_switchdev_set_role(struct net_bridge_port *p,
 
 /* br_mrp_netlink.c  */
 int br_mrp_ring_port_open(struct net_device *dev, u8 loc);
+int br_mrp_in_port_open(struct net_device *dev, u8 loc);
 
 #endif /* _BR_PRIVATE_MRP_H */