blob: edc4612bb0091a955c8e93266fbe5ffa938e8d8b [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0 */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/* Copyright 2011-2014 Autronica Fire and Security AS
3 *
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
Olivier Deprez157378f2022-04-04 15:47:50 +02005 *
6 * include file for HSR and PRP.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007 */
8
9#ifndef __HSR_SLAVE_H
10#define __HSR_SLAVE_H
11
12#include <linux/skbuff.h>
13#include <linux/netdevice.h>
14#include <linux/rtnetlink.h>
15#include "hsr_main.h"
16
17int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
Olivier Deprez157378f2022-04-04 15:47:50 +020018 enum hsr_port_type pt, struct netlink_ext_ack *extack);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000019void hsr_del_port(struct hsr_port *port);
20bool hsr_port_exists(const struct net_device *dev);
21
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
Olivier Deprez157378f2022-04-04 15:47:50 +020035bool hsr_invalid_dan_ingress_frame(__be16 protocol);
36
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000037#endif /* __HSR_SLAVE_H */