hsr_prp_slave.h 948 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. #ifndef __HSR_PRP_SLAVE_H
  7. #define __HSR_PRP_SLAVE_H
  8. #include <linux/skbuff.h>
  9. #include <linux/netdevice.h>
  10. #include <linux/rtnetlink.h>
  11. #include "hsr_prp_main.h"
  12. int hsr_prp_add_port(struct hsr_prp_priv *hsr, struct net_device *dev,
  13. enum hsr_prp_port_type pt);
  14. void hsr_prp_del_port(struct hsr_prp_port *port);
  15. bool hsr_prp_port_exists(const struct net_device *dev);
  16. static inline
  17. struct hsr_prp_port *hsr_prp_port_get_rtnl(const struct net_device *dev)
  18. {
  19. ASSERT_RTNL();
  20. return hsr_prp_port_exists(dev) ?
  21. rtnl_dereference(dev->rx_handler_data) :
  22. NULL;
  23. }
  24. static inline
  25. struct hsr_prp_port *hsr_prp_port_get_rcu(const struct net_device *dev)
  26. {
  27. return hsr_prp_port_exists(dev) ?
  28. rcu_dereference(dev->rx_handler_data) :
  29. NULL;
  30. }
  31. #endif /* __HSR_PRP_SLAVE_H */