blob: 64b54952959207809ffa7632c989f49c88c73143 [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
5 */
6
7#ifndef __HSR_SLAVE_H
8#define __HSR_SLAVE_H
9
10#include <linux/skbuff.h>
11#include <linux/netdevice.h>
Arvid Brodinc5a75912014-07-04 23:38:05 +020012#include <linux/rtnetlink.h>
Arvid Brodin51f3c602014-07-04 23:37:27 +020013#include "hsr_main.h"
Arvid Brodin81ba6af2014-07-04 23:35:24 +020014
Arvid Brodinc5a75912014-07-04 23:38:05 +020015int 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);
Arvid Brodinf266a682014-07-04 23:41:03 +020018bool hsr_port_exists(const struct net_device *dev);
Arvid Brodinc5a75912014-07-04 23:38:05 +020019
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
Arvid Brodin81ba6af2014-07-04 23:35:24 +020033#endif /* __HSR_SLAVE_H */