Merge branch 'for-linus' into for-next
[linux-block.git] / net / hsr / hsr_slave.h
CommitLineData
0e7623bd 1/* SPDX-License-Identifier: GPL-2.0 */
81ba6afd
AB
2/* Copyright 2011-2014 Autronica Fire and Security AS
3 *
81ba6afd 4 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
8f4c0e01
MK
5 *
6 * include file for HSR and PRP.
81ba6afd
AB
7 */
8
9#ifndef __HSR_SLAVE_H
10#define __HSR_SLAVE_H
11
12#include <linux/skbuff.h>
13#include <linux/netdevice.h>
c5a75911 14#include <linux/rtnetlink.h>
51f3c605 15#include "hsr_main.h"
81ba6afd 16
c5a75911 17int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
13eeb5fe 18 enum hsr_port_type pt, struct netlink_ext_ack *extack);
c5a75911 19void hsr_del_port(struct hsr_port *port);
f266a683 20bool hsr_port_exists(const struct net_device *dev);
c5a75911
AB
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
451d8123
MK
35bool hsr_invalid_dan_ingress_frame(__be16 protocol);
36
81ba6afd 37#endif /* __HSR_SLAVE_H */