summaryrefslogtreecommitdiff
path: root/net/bridge/br_mrp_netlink.c
diff options
context:
space:
mode:
authorHoratiu Vultur <horatiu.vultur@microchip.com>2020-04-26 16:22:05 +0300
committerDavid S. Miller <davem@davemloft.net>2020-04-27 21:40:25 +0300
commit9a9f26e8f7ea300e8efffcae036dbef239be433a (patch)
tree894587a79fb7d95c0aa53d936dc317eee5c002ae /net/bridge/br_mrp_netlink.c
parentfadd409136f0f21192d80816edd9529f27d88c17 (diff)
downloadlinux-9a9f26e8f7ea300e8efffcae036dbef239be433a.tar.xz
bridge: mrp: Connect MRP API with the switchdev API
Implement the MRP API. In case the HW can't generate MRP Test frames then the SW will try to generate the frames. In case that also the SW will fail in generating the frames then a error is return to the userspace. The userspace is responsible to generate all the other MRP frames regardless if the test frames are generated by HW or SW. The forwarding/termination of MRP frames is happening in the kernel and is done by the MRP instance. The userspace application doesn't do the forwarding. Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_mrp_netlink.c')
-rw-r--r--net/bridge/br_mrp_netlink.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/net/bridge/br_mrp_netlink.c b/net/bridge/br_mrp_netlink.c
new file mode 100644
index 000000000000..b982db14bbf4
--- /dev/null
+++ b/net/bridge/br_mrp_netlink.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <net/genetlink.h>
+
+#include <uapi/linux/mrp_bridge.h>
+#include "br_private.h"
+#include "br_private_mrp.h"
+
+int br_mrp_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_CONT;
+ else
+ p->flags &= ~BR_MRP_LOST_CONT;
+
+ br_ifinfo_notify(RTM_NEWLINK, NULL, p);
+
+out:
+ return err;
+}