hsr_framereg.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright 2011-2014 Autronica Fire and Security AS
  3. *
  4. * Author(s):
  5. * 2011-2014 Arvid Brodin, arvid.brodin@alten.se
  6. *
  7. * include file for HSR and PRP.
  8. */
  9. #ifndef __HSR_FRAMEREG_H
  10. #define __HSR_FRAMEREG_H
  11. #include "hsr_main.h"
  12. struct hsr_node;
  13. struct hsr_frame_info {
  14. struct sk_buff *skb_std;
  15. struct sk_buff *skb_hsr;
  16. struct sk_buff *skb_prp;
  17. struct hsr_port *port_rcv;
  18. struct hsr_node *node_src;
  19. u16 sequence_nr;
  20. bool is_supervision;
  21. bool is_proxy_supervision;
  22. bool is_vlan;
  23. bool is_local_dest;
  24. bool is_local_exclusive;
  25. bool is_from_san;
  26. };
  27. void hsr_del_self_node(struct hsr_priv *hsr);
  28. void hsr_del_nodes(struct list_head *node_db);
  29. struct hsr_node *hsr_get_node(struct hsr_port *port, struct list_head *node_db,
  30. struct sk_buff *skb, bool is_sup,
  31. enum hsr_port_type rx_port);
  32. void hsr_handle_sup_frame(struct hsr_frame_info *frame);
  33. bool hsr_addr_is_self(struct hsr_priv *hsr, unsigned char *addr);
  34. bool hsr_addr_is_redbox(struct hsr_priv *hsr, unsigned char *addr);
  35. void hsr_addr_subst_source(struct hsr_node *node, struct sk_buff *skb);
  36. void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,
  37. struct hsr_port *port);
  38. void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
  39. u16 sequence_nr);
  40. int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
  41. u16 sequence_nr);
  42. void hsr_prune_nodes(struct timer_list *t);
  43. void hsr_prune_proxy_nodes(struct timer_list *t);
  44. int hsr_create_self_node(struct hsr_priv *hsr,
  45. const unsigned char addr_a[ETH_ALEN],
  46. const unsigned char addr_b[ETH_ALEN]);
  47. void *hsr_get_next_node(struct hsr_priv *hsr, void *_pos,
  48. unsigned char addr[ETH_ALEN]);
  49. int hsr_get_node_data(struct hsr_priv *hsr,
  50. const unsigned char *addr,
  51. unsigned char addr_b[ETH_ALEN],
  52. unsigned int *addr_b_ifindex,
  53. int *if1_age,
  54. u16 *if1_seq,
  55. int *if2_age,
  56. u16 *if2_seq);
  57. void prp_handle_san_frame(bool san, enum hsr_port_type port,
  58. struct hsr_node *node);
  59. void prp_update_san_info(struct hsr_node *node, bool is_sup);
  60. bool hsr_is_node_in_db(struct list_head *node_db,
  61. const unsigned char addr[ETH_ALEN]);
  62. struct hsr_node {
  63. struct list_head mac_list;
  64. /* Protect R/W access to seq_out */
  65. spinlock_t seq_out_lock;
  66. unsigned char macaddress_A[ETH_ALEN];
  67. unsigned char macaddress_B[ETH_ALEN];
  68. /* Local slave through which AddrB frames are received from this node */
  69. enum hsr_port_type addr_B_port;
  70. unsigned long time_in[HSR_PT_PORTS];
  71. bool time_in_stale[HSR_PT_PORTS];
  72. unsigned long time_out[HSR_PT_PORTS];
  73. /* if the node is a SAN */
  74. bool san_a;
  75. bool san_b;
  76. u16 seq_out[HSR_PT_PORTS];
  77. bool removed;
  78. struct rcu_head rcu_head;
  79. };
  80. #endif /* __HSR_FRAMEREG_H */