hsr_slave.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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_SLAVE_H
  12. #define __HSR_SLAVE_H
  13. #include <linux/skbuff.h>
  14. #include <linux/netdevice.h>
  15. #include <linux/rtnetlink.h>
  16. #include "hsr_main.h"
  17. int hsr_add_port(struct hsr_priv *hsr, struct net_device *dev,
  18. enum hsr_port_type pt);
  19. void hsr_del_port(struct hsr_port *port);
  20. bool hsr_port_exists(const struct net_device *dev);
  21. static inline struct hsr_port *hsr_port_get_rtnl(const struct net_device *dev)
  22. {
  23. ASSERT_RTNL();
  24. return hsr_port_exists(dev) ?
  25. rtnl_dereference(dev->rx_handler_data) : NULL;
  26. }
  27. static 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. #endif /* __HSR_SLAVE_H */