qca_multi_link.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. /**
  35. * qca_multi_link_needs_enq - rptr return status
  36. * @QCA_MULTI_LINK_ALLOW_VAP_ENQ: Allow the packet to be enqueued
  37. * @QCA_MULTI_LINK_SKIP_VAP_ENQ: SKIP the enqueue
  38. */
  39. typedef enum qca_multi_link_needs_enq {
  40. QCA_MULTI_LINK_ALLOW_VAP_ENQ = 0,
  41. QCA_MULTI_LINK_SKIP_VAP_ENQ,
  42. } qca_multi_link_needs_enq_t;
  43. /**
  44. * enum qca_multi_link_status - rptr return status
  45. * @qca_multi_link_PKT_ALLOW: Allow the packet to be received or transmitted
  46. * @qca_multi_link_PKT_DROP: Drop the packet
  47. * @qca_multi_link_PKT_CONSUMED: The packet is consumed in the repeater processing
  48. */
  49. typedef enum qca_multi_link_status {
  50. QCA_MULTI_LINK_PKT_NONE = 0,
  51. QCA_MULTI_LINK_PKT_ALLOW,
  52. QCA_MULTI_LINK_PKT_DROP,
  53. QCA_MULTI_LINK_PKT_CONSUMED
  54. } qca_multi_link_status_t;
  55. /**
  56. * struct qca_multi_link_statistics - rptr drop statistics
  57. */
  58. typedef struct qca_multi_link_statistics {
  59. uint32_t ap_rx_sec_sta_null;
  60. uint32_t sta_rx_sec_sta_mcast_no_fdb;
  61. uint32_t sta_rx_sec_sta_mcast_dup_pkts;
  62. uint32_t sta_rx_sec_sta_mcast_drop_sec;
  63. uint32_t sta_rx_sec_sta_mcast_drop;
  64. uint32_t sta_rx_sec_sta_ucast_src_eth;
  65. uint32_t sta_rx_sec_sta_ucast_src_dif_band;
  66. uint32_t sta_rx_sec_sta_ucast_no_ap;
  67. uint32_t sta_rx_pri_sta_mcast_no_fdb;
  68. uint32_t sta_rx_pri_sta_mcast_drop;
  69. uint32_t sta_tx_sec_sta_alwys_prim;
  70. uint32_t sta_tx_sec_sta_mcast_no_fdb;
  71. uint32_t sta_tx_sec_sta_src_eth;
  72. uint32_t sta_tx_sec_sta_mcast_drop_sec;
  73. uint32_t sta_tx_sec_sta_drop_dif_band;
  74. uint32_t sta_tx_pri_sta_drop_no_fdb;
  75. uint32_t sta_tx_pri_sta_drop_dif_band;
  76. } qca_ml_global_stats_t;
  77. /**
  78. * struct qca_multi_link_radio_list_node - rptr list node
  79. * @node: linked list node
  80. * @wiphy: wiphy pointer
  81. * @no_backhaul: is no_backhaul radio
  82. * @is_fast_lane: is fast_lane radio
  83. * @sta_dev: radio's station net device
  84. */
  85. typedef struct qca_multi_link_radio_list_node {
  86. qdf_list_node_t node;
  87. struct wiphy *wiphy;
  88. bool no_backhaul;
  89. bool is_fast_lane;
  90. struct net_device *sta_dev;
  91. } qca_multi_link_radio_node_t;
  92. /**
  93. * struct qca_multi_link_parameters - rptr list node
  94. * @rptr_processing_enable: repeater is enabled
  95. * @loop_detected: is loop detected
  96. * @always_primary: is always primary flag enabled
  97. * @force_client_mcast_traffic: is force client mcast flag enabled
  98. * @drop_secondary_mcast: is drop secondary mcast flag enabled
  99. * @primary_wiphy: primary radio pointer
  100. * @total_stavaps_up: total number of backhauls
  101. * @radio_list: list of radio participating in repeater
  102. */
  103. typedef struct qca_multi_link_parameters {
  104. bool rptr_processing_enable;
  105. bool loop_detected;
  106. bool always_primary;
  107. bool force_client_mcast_traffic;
  108. bool drop_secondary_mcast;
  109. struct wiphy *primary_wiphy;
  110. uint8_t total_stavaps_up;
  111. qdf_list_t radio_list;
  112. qdf_spinlock_t radio_lock;
  113. qca_ml_global_stats_t qca_ml_stats;
  114. } qca_multi_link_parameters_t;
  115. void qca_multi_link_deinit_module(void);
  116. void qca_multi_link_init_module(void);
  117. uint8_t qca_multi_link_get_num_sta(void);
  118. void qca_multi_link_append_num_sta(bool inc_or_dec);
  119. bool qca_multi_link_is_dbdc_processing_reqd(struct net_device *net_dev);
  120. void qca_multi_link_set_drop_sec_mcast(bool val);
  121. void qca_multi_link_set_force_client_mcast(bool val);
  122. void qca_multi_link_set_always_primary(bool val);
  123. void qca_multi_link_set_dbdc_enable(bool val);
  124. struct wiphy *qca_multi_link_get_primary_radio(void);
  125. void qca_multi_link_set_primary_radio(struct wiphy *primary_wiphy);
  126. bool qca_multi_link_remove_radio(struct wiphy *wiphy);
  127. bool qca_multi_link_add_radio(struct wiphy *wiphy);
  128. bool qca_multi_link_remove_fastlane_radio(struct wiphy *fl_wiphy);
  129. bool qca_multi_link_add_fastlane_radio(struct wiphy *fl_wiphy);
  130. bool qca_multi_link_remove_no_backhaul_radio(struct wiphy *no_bl_wiphy);
  131. bool qca_multi_link_add_no_backhaul_radio(struct wiphy *no_bl_wiphy);
  132. bool qca_multi_link_remove_station_vap(struct wiphy *wiphy);
  133. bool qca_multi_link_add_station_vap(struct wiphy *wiphy,
  134. struct net_device *sta_dev);
  135. bool qca_multi_link_ap_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  136. bool qca_multi_link_sta_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  137. bool qca_multi_link_sta_tx(struct net_device *net_dev, qdf_nbuf_t nbuf);
  138. #endif