hsr_prp_slave.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Copyright 2011-2014 Autronica Fire and Security AS
  2. *
  3. * This program is free software; you can redistribute it and/or modify it
  4. * under the terms of the GNU General Public License as published by the Free
  5. * Software Foundation; either version 2 of the License, or (at your option)
  6. * any later version.
  7. *
  8. * Author(s):
  9. * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
  10. */
  11. #ifndef __HSR_PRP_SLAVE_H
  12. #define __HSR_PRP_SLAVE_H
  13. #include <linux/skbuff.h>
  14. #include <linux/netdevice.h>
  15. #include <linux/rtnetlink.h>
  16. #include "hsr_prp_main.h"
  17. int hsr_prp_add_port(struct hsr_prp_priv *priv, struct net_device *dev,
  18. enum hsr_prp_port_type pt);
  19. void hsr_prp_del_port(struct hsr_prp_port *port);
  20. bool hsr_prp_port_exists(const struct net_device *dev);
  21. static inline struct hsr_prp_port
  22. *hsr_prp_port_get_rtnl(const struct net_device *dev)
  23. {
  24. ASSERT_RTNL();
  25. return hsr_prp_port_exists(dev) ?
  26. rtnl_dereference(dev->rx_handler_data) : NULL;
  27. }
  28. static inline struct hsr_prp_port
  29. *hsr_prp_port_get_rcu(const struct net_device *dev)
  30. {
  31. return hsr_prp_port_exists(dev) ?
  32. rcu_dereference(dev->rx_handler_data) : NULL;
  33. }
  34. #endif /* __HSR_PRP_SLAVE_H */