hsr_slave.h 982 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright 2011-2014 Autronica Fire and Security AS
  3. *
  4. * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
  5. *
  6. * include file for HSR and PRP.
  7. */
  8. #ifndef __HSR_SLAVE_H
  9. #define __HSR_SLAVE_H
  10. #include <linux/skbuff.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/rtnetlink.h>
  13. #include "hsr_main.h"
  14. int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
  15. enum hsr_port_type pt, struct netlink_ext_ack *extack);
  16. void hsr_del_port(struct hsr_port *port);
  17. bool hsr_port_exists(const struct net_device *dev);
  18. static inline struct hsr_port *hsr_port_get_rtnl(const struct net_device *dev)
  19. {
  20. ASSERT_RTNL();
  21. return hsr_port_exists(dev) ?
  22. rtnl_dereference(dev->rx_handler_data) : NULL;
  23. }
  24. static inline struct hsr_port *hsr_port_get_rcu(const struct net_device *dev)
  25. {
  26. return hsr_port_exists(dev) ?
  27. rcu_dereference(dev->rx_handler_data) : NULL;
  28. }
  29. bool hsr_invalid_dan_ingress_frame(__be16 protocol);
  30. #endif /* __HSR_SLAVE_H */