blob: edc4612bb0091a955c8e93266fbe5ffa938e8d8b [file] [log] [blame]
Murali Karicheri0e7623b2019-04-05 13:31:34 -04001/* SPDX-License-Identifier: GPL-2.0 */
Arvid Brodin81ba6af2014-07-04 23:35:24 +02002/* Copyright 2011-2014 Autronica Fire and Security AS
3 *
Arvid Brodin81ba6af2014-07-04 23:35:24 +02004 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
Murali Karicheri8f4c0e02020-07-22 10:40:16 -04005 *
6 * include file for HSR and PRP.
Arvid Brodin81ba6af2014-07-04 23:35:24 +02007 */
8
9#ifndef __HSR_SLAVE_H
10#define __HSR_SLAVE_H
11
12#include <linux/skbuff.h>
13#include <linux/netdevice.h>
Arvid Brodinc5a75912014-07-04 23:38:05 +020014#include <linux/rtnetlink.h>
Arvid Brodin51f3c602014-07-04 23:37:27 +020015#include "hsr_main.h"
Arvid Brodin81ba6af2014-07-04 23:35:24 +020016
Arvid Brodinc5a75912014-07-04 23:38:05 +020017int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
Taehee Yoo13eeb5f2020-02-28 18:01:35 +000018 enum hsr_port_type pt, struct netlink_ext_ack *extack);
Arvid Brodinc5a75912014-07-04 23:38:05 +020019void hsr_del_port(struct hsr_port *port);
Arvid Brodinf266a682014-07-04 23:41:03 +020020bool hsr_port_exists(const struct net_device *dev);
Arvid Brodinc5a75912014-07-04 23:38:05 +020021
22static inline struct hsr_port *hsr_port_get_rtnl(const struct net_device *dev)
23{
24 ASSERT_RTNL();
25 return hsr_port_exists(dev) ?
26 rtnl_dereference(dev->rx_handler_data) : NULL;
27}
28
29static inline struct hsr_port *hsr_port_get_rcu(const struct net_device *dev)
30{
31 return hsr_port_exists(dev) ?
32 rcu_dereference(dev->rx_handler_data) : NULL;
33}
34
Murali Karicheri451d8122020-07-22 10:40:21 -040035bool hsr_invalid_dan_ingress_frame(__be16 protocol);
36
Arvid Brodin81ba6af2014-07-04 23:35:24 +020037#endif /* __HSR_SLAVE_H */