sch_cbq: validate TCA_CBQ_WRROPT to avoid crash
[linux-2.6-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
AB
4 * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
5 */
6
7#ifndef __HSR_SLAVE_H
8#define __HSR_SLAVE_H
9
10#include <linux/skbuff.h>
11#include <linux/netdevice.h>
c5a75911 12#include <linux/rtnetlink.h>
51f3c605 13#include "hsr_main.h"
81ba6afd 14
c5a75911
AB
15int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
16 enum hsr_port_type pt);
17void hsr_del_port(struct hsr_port *port);
f266a683 18bool hsr_port_exists(const struct net_device *dev);
c5a75911
AB
19
20static inline struct hsr_port *hsr_port_get_rtnl(const struct net_device *dev)
21{
22 ASSERT_RTNL();
23 return hsr_port_exists(dev) ?
24 rtnl_dereference(dev->rx_handler_data) : NULL;
25}
26
27static inline struct hsr_port *hsr_port_get_rcu(const struct net_device *dev)
28{
29 return hsr_port_exists(dev) ?
30 rcu_dereference(dev->rx_handler_data) : NULL;
31}
32
81ba6afd 33#endif /* __HSR_SLAVE_H */