qca_multi_link.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (c) 2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __qca_multi_link_H_
  17. #define __qca_multi_link_H_
  18. #include <qdf_nbuf.h>
  19. #include <qdf_module.h>
  20. #include <qdf_list.h>
  21. #include <qdf_util.h>
  22. #include <qdf_lock.h>
  23. #include <linux/netdevice.h>
  24. #include <linux/etherdevice.h>
  25. #include <linux/version.h>
  26. #include <linux/wireless.h>
  27. #include <net/cfg80211.h>
  28. #include <br_private.h>
  29. #include <ieee80211.h>
  30. #include <ieee80211_defines.h>
  31. #include <qca_multi_link_tbl.h>
  32. #include "if_upperproto.h"
  33. #define QCA_MULTI_LINK_RADIO_LIST_SIZE 6
  34. typedef void (*qca_multi_link_set_loop_detection_fn_t)(void *context, bool val);
  35. /**
  36. * qca_multi_link_needs_enq - rptr return status
  37. * @QCA_MULTI_LINK_ALLOW_VAP_ENQ: Allow the packet to be enqueued
  38. * @QCA_MULTI_LINK_SKIP_VAP_ENQ: SKIP the enqueue
  39. */
  40. typedef enum qca_multi_link_needs_enq {
  41. QCA_MULTI_LINK_ALLOW_VAP_ENQ = 0,
  42. QCA_MULTI_LINK_SKIP_VAP_ENQ,
  43. } qca_multi_link_needs_enq_t;
  44. /**
  45. * enum qca_multi_link_status - rptr return status
  46. * @qca_multi_link_PKT_ALLOW: Allow the packet to be received or transmitted
  47. * @qca_multi_link_PKT_DROP: Drop the packet
  48. * @qca_multi_link_PKT_CONSUMED: The packet is consumed in the repeater processing
  49. */
  50. typedef enum qca_multi_link_status {
  51. QCA_MULTI_LINK_PKT_NONE = 0,
  52. QCA_MULTI_LINK_PKT_ALLOW,
  53. QCA_MULTI_LINK_PKT_DROP,
  54. QCA_MULTI_LINK_PKT_CONSUMED
  55. } qca_multi_link_status_t;
  56. /**
  57. * struct qca_multi_link_statistics - rptr drop statistics
  58. */
  59. typedef struct qca_multi_link_statistics {
  60. uint32_t ap_rx_sec_sta_null;
  61. uint32_t sta_rx_sec_sta_mcast_no_fdb;
  62. uint32_t sta_rx_sec_sta_mcast_dup_pkts;
  63. uint32_t sta_rx_sec_sta_mcast_drop_sec;
  64. uint32_t sta_rx_sec_sta_mcast_drop;
  65. uint32_t sta_rx_sec_sta_ucast_src_eth;
  66. uint32_t sta_rx_sec_sta_ucast_src_dif_band;
  67. uint32_t sta_rx_sec_sta_ucast_no_ap;
  68. uint32_t sta_rx_pri_sta_mcast_no_fdb;
  69. uint32_t sta_rx_pri_sta_mcast_drop;
  70. uint32_t sta_tx_sec_sta_alwys_prim;
  71. uint32_t sta_tx_sec_sta_mcast_no_fdb;
  72. uint32_t sta_tx_sec_sta_src_eth;
  73. uint32_t sta_tx_sec_sta_mcast_drop_sec;
  74. uint32_t sta_tx_sec_sta_drop_dif_band;
  75. uint32_t sta_tx_pri_sta_drop_no_fdb;
  76. uint32_t sta_tx_pri_sta_drop_dif_band;
  77. } qca_ml_global_stats_t;
  78. /**
  79. * struct qca_multi_link_radio_list_node - rptr list node
  80. * @node: linked list node
  81. * @wiphy: wiphy pointer
  82. * @no_backhaul: is no_backhaul radio
  83. * @is_fast_lane: is fast_lane radio
  84. * @sta_dev: radio's station net device
  85. */
  86. typedef struct qca_multi_link_radio_list_node {
  87. qdf_list_node_t node;
  88. struct wiphy *wiphy;
  89. bool no_backhaul;
  90. bool is_fast_lane;
  91. struct net_device *sta_dev;
  92. } qca_multi_link_radio_node_t;
  93. /**
  94. * struct qca_multi_link_parameters - rptr list node
  95. * @rptr_processing_enable: repeater is enabled
  96. * @loop_detected: is loop detected
  97. * @always_primary: is always primary flag enabled
  98. * @force_client_mcast_traffic: is force client mcast flag enabled
  99. * @drop_secondary_mcast: is drop secondary mcast flag enabled
  100. * @primary_wiphy: primary radio pointer
  101. * @total_stavaps_up: total number of backhauls
  102. * @radio_list: list of radio participating in repeater
  103. */
  104. typedef struct qca_multi_link_parameters {
  105. bool rptr_processing_enable;
  106. bool loop_detected;
  107. bool always_primary;
  108. bool force_client_mcast_traffic;
  109. bool drop_secondary_mcast;
  110. struct wiphy *primary_wiphy;
  111. uint8_t total_stavaps_up;
  112. qdf_list_t radio_list;
  113. qdf_spinlock_t radio_lock;
  114. qca_ml_global_stats_t qca_ml_stats;
  115. qca_multi_link_set_loop_detection_fn_t qca_ml_set_loop_detection;
  116. void *qca_ml_loop_detection_context;
  117. } qca_multi_link_parameters_t;
  118. void qca_multi_link_deinit_module(void);
  119. void qca_multi_link_init_module(void);
  120. uint8_t qca_multi_link_get_num_sta(void);
  121. void qca_multi_link_append_num_sta(bool inc_or_dec);
  122. bool qca_multi_link_is_dbdc_processing_reqd(struct net_device *net_dev);
  123. void qca_multi_link_set_drop_sec_mcast(bool val);
  124. void qca_multi_link_set_force_client_mcast(bool val);
  125. void qca_multi_link_set_always_primary(bool val);
  126. void qca_multi_link_set_dbdc_enable(bool val);
  127. struct wiphy *qca_multi_link_get_primary_radio(void);
  128. void qca_multi_link_set_primary_radio(struct wiphy *primary_wiphy);
  129. bool qca_multi_link_remove_radio(struct wiphy *wiphy);
  130. bool qca_multi_link_add_radio(struct wiphy *wiphy);
  131. bool qca_multi_link_remove_fastlane_radio(struct wiphy *fl_wiphy);
  132. bool qca_multi_link_add_fastlane_radio(struct wiphy *fl_wiphy);
  133. bool qca_multi_link_remove_no_backhaul_radio(struct wiphy *no_bl_wiphy);
  134. bool qca_multi_link_add_no_backhaul_radio(struct wiphy *no_bl_wiphy);
  135. bool qca_multi_link_remove_station_vap(struct wiphy *wiphy);
  136. bool qca_multi_link_add_station_vap(struct wiphy *wiphy,
  137. struct net_device *sta_dev);
  138. bool qca_multi_link_ap_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  139. bool qca_multi_link_sta_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  140. bool qca_multi_link_sta_tx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  141. void qca_multi_link_set_dbdc_loop_detection_cb(qca_multi_link_set_loop_detection_fn_t qca_ml_cb,
  142. void *ctx);
  143. #endif