Murali Karicheri | 0e7623b | 2019-04-05 13:31:34 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Arvid Brodin | 81ba6af | 2014-07-04 23:35:24 +0200 | [diff] [blame] | 2 | /* Copyright 2011-2014 Autronica Fire and Security AS |
| 3 | * |
Arvid Brodin | 81ba6af | 2014-07-04 23:35:24 +0200 | [diff] [blame] | 4 | * 2011-2014 Arvid Brodin, arvid.brodin@alten.se |
Murali Karicheri | 8f4c0e0 | 2020-07-22 10:40:16 -0400 | [diff] [blame] | 5 | * |
| 6 | * include file for HSR and PRP. |
Arvid Brodin | 81ba6af | 2014-07-04 23:35:24 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef __HSR_SLAVE_H |
| 10 | #define __HSR_SLAVE_H |
| 11 | |
| 12 | #include <linux/skbuff.h> |
| 13 | #include <linux/netdevice.h> |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 14 | #include <linux/rtnetlink.h> |
Arvid Brodin | 51f3c60 | 2014-07-04 23:37:27 +0200 | [diff] [blame] | 15 | #include "hsr_main.h" |
Arvid Brodin | 81ba6af | 2014-07-04 23:35:24 +0200 | [diff] [blame] | 16 | |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 17 | int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev, |
Taehee Yoo | 13eeb5f | 2020-02-28 18:01:35 +0000 | [diff] [blame] | 18 | enum hsr_port_type pt, struct netlink_ext_ack *extack); |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 19 | void hsr_del_port(struct hsr_port *port); |
Arvid Brodin | f266a68 | 2014-07-04 23:41:03 +0200 | [diff] [blame] | 20 | bool hsr_port_exists(const struct net_device *dev); |
Arvid Brodin | c5a7591 | 2014-07-04 23:38:05 +0200 | [diff] [blame] | 21 | |
| 22 | static 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 | |
| 29 | static 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 Karicheri | 451d812 | 2020-07-22 10:40:21 -0400 | [diff] [blame] | 35 | bool hsr_invalid_dan_ingress_frame(__be16 protocol); |
| 36 | |
Arvid Brodin | 81ba6af | 2014-07-04 23:35:24 +0200 | [diff] [blame] | 37 | #endif /* __HSR_SLAVE_H */ |