switch.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef __DSA_SWITCH_H
  3. #define __DSA_SWITCH_H
  4. #include <net/dsa.h>
  5. struct netlink_ext_ack;
  6. enum {
  7. DSA_NOTIFIER_AGEING_TIME,
  8. DSA_NOTIFIER_BRIDGE_JOIN,
  9. DSA_NOTIFIER_BRIDGE_LEAVE,
  10. DSA_NOTIFIER_FDB_ADD,
  11. DSA_NOTIFIER_FDB_DEL,
  12. DSA_NOTIFIER_HOST_FDB_ADD,
  13. DSA_NOTIFIER_HOST_FDB_DEL,
  14. DSA_NOTIFIER_LAG_FDB_ADD,
  15. DSA_NOTIFIER_LAG_FDB_DEL,
  16. DSA_NOTIFIER_LAG_CHANGE,
  17. DSA_NOTIFIER_LAG_JOIN,
  18. DSA_NOTIFIER_LAG_LEAVE,
  19. DSA_NOTIFIER_MDB_ADD,
  20. DSA_NOTIFIER_MDB_DEL,
  21. DSA_NOTIFIER_HOST_MDB_ADD,
  22. DSA_NOTIFIER_HOST_MDB_DEL,
  23. DSA_NOTIFIER_VLAN_ADD,
  24. DSA_NOTIFIER_VLAN_DEL,
  25. DSA_NOTIFIER_HOST_VLAN_ADD,
  26. DSA_NOTIFIER_HOST_VLAN_DEL,
  27. DSA_NOTIFIER_MTU,
  28. DSA_NOTIFIER_TAG_PROTO,
  29. DSA_NOTIFIER_TAG_PROTO_CONNECT,
  30. DSA_NOTIFIER_TAG_PROTO_DISCONNECT,
  31. DSA_NOTIFIER_TAG_8021Q_VLAN_ADD,
  32. DSA_NOTIFIER_TAG_8021Q_VLAN_DEL,
  33. DSA_NOTIFIER_CONDUIT_STATE_CHANGE,
  34. };
  35. /* DSA_NOTIFIER_AGEING_TIME */
  36. struct dsa_notifier_ageing_time_info {
  37. unsigned int ageing_time;
  38. };
  39. /* DSA_NOTIFIER_BRIDGE_* */
  40. struct dsa_notifier_bridge_info {
  41. const struct dsa_port *dp;
  42. struct dsa_bridge bridge;
  43. bool tx_fwd_offload;
  44. struct netlink_ext_ack *extack;
  45. };
  46. /* DSA_NOTIFIER_FDB_* */
  47. struct dsa_notifier_fdb_info {
  48. const struct dsa_port *dp;
  49. const unsigned char *addr;
  50. u16 vid;
  51. struct dsa_db db;
  52. };
  53. /* DSA_NOTIFIER_LAG_FDB_* */
  54. struct dsa_notifier_lag_fdb_info {
  55. struct dsa_lag *lag;
  56. const unsigned char *addr;
  57. u16 vid;
  58. struct dsa_db db;
  59. };
  60. /* DSA_NOTIFIER_MDB_* */
  61. struct dsa_notifier_mdb_info {
  62. const struct dsa_port *dp;
  63. const struct switchdev_obj_port_mdb *mdb;
  64. struct dsa_db db;
  65. };
  66. /* DSA_NOTIFIER_LAG_* */
  67. struct dsa_notifier_lag_info {
  68. const struct dsa_port *dp;
  69. struct dsa_lag lag;
  70. struct netdev_lag_upper_info *info;
  71. struct netlink_ext_ack *extack;
  72. };
  73. /* DSA_NOTIFIER_VLAN_* */
  74. struct dsa_notifier_vlan_info {
  75. const struct dsa_port *dp;
  76. const struct switchdev_obj_port_vlan *vlan;
  77. struct netlink_ext_ack *extack;
  78. };
  79. /* DSA_NOTIFIER_MTU */
  80. struct dsa_notifier_mtu_info {
  81. const struct dsa_port *dp;
  82. int mtu;
  83. };
  84. /* DSA_NOTIFIER_TAG_PROTO_* */
  85. struct dsa_notifier_tag_proto_info {
  86. const struct dsa_device_ops *tag_ops;
  87. };
  88. /* DSA_NOTIFIER_TAG_8021Q_VLAN_* */
  89. struct dsa_notifier_tag_8021q_vlan_info {
  90. const struct dsa_port *dp;
  91. u16 vid;
  92. };
  93. /* DSA_NOTIFIER_CONDUIT_STATE_CHANGE */
  94. struct dsa_notifier_conduit_state_info {
  95. const struct net_device *conduit;
  96. bool operational;
  97. };
  98. struct dsa_vlan *dsa_vlan_find(struct list_head *vlan_list,
  99. const struct switchdev_obj_port_vlan *vlan);
  100. int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v);
  101. int dsa_broadcast(unsigned long e, void *v);
  102. int dsa_switch_register_notifier(struct dsa_switch *ds);
  103. void dsa_switch_unregister_notifier(struct dsa_switch *ds);
  104. #endif