Просмотр исходного кода

qca-wifi: Add loop detection set and query API

Add loop detection set and query API

Change-Id: I55287762c435067af39af0f29b3c2245da499a5f
syed touqeer pasha 4 лет назад
Родитель
Сommit
3173bb1ac4
2 измененных файлов с 38 добавлено и 0 удалено
  1. 6 0
      qca_multi_link/inc/qca_multi_link.h
  2. 32 0
      qca_multi_link/src/qca_multi_link.c

+ 6 - 0
qca_multi_link/inc/qca_multi_link.h

@@ -37,6 +37,8 @@
 
 #define QCA_MULTI_LINK_RADIO_LIST_SIZE 6
 
+typedef void (*qca_multi_link_set_loop_detection_fn_t)(void *context, bool val);
+
 /**
  * qca_multi_link_needs_enq - rptr return status
  * @QCA_MULTI_LINK_ALLOW_VAP_ENQ: Allow the packet to be enqueued
@@ -121,6 +123,8 @@ typedef struct qca_multi_link_parameters {
 	qdf_list_t radio_list;
 	qdf_spinlock_t radio_lock;
 	qca_ml_global_stats_t qca_ml_stats;
+	qca_multi_link_set_loop_detection_fn_t qca_ml_set_loop_detection;
+	void *qca_ml_loop_detection_context;
 } qca_multi_link_parameters_t;
 
 void qca_multi_link_deinit_module(void);
@@ -146,4 +150,6 @@ bool qca_multi_link_add_station_vap(struct wiphy *wiphy,
 bool qca_multi_link_ap_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
 bool qca_multi_link_sta_rx(struct net_device *net_dev, qdf_nbuf_t nbuf);
 bool qca_multi_link_sta_tx(struct net_device *net_dev, qdf_nbuf_t nbuf);
+void qca_multi_link_set_dbdc_loop_detection_cb(qca_multi_link_set_loop_detection_fn_t qca_ml_cb,
+			void *ctx);
 #endif

+ 32 - 0
qca_multi_link/src/qca_multi_link.c

@@ -243,6 +243,8 @@ void qca_multi_link_deinit_module(void)
 	qca_multi_link_cfg.primary_wiphy = NULL;
 	qdf_list_destroy(&qca_multi_link_cfg.radio_list);
 	is_initialized = false;
+	qca_multi_link_cfg.qca_ml_set_loop_detection = NULL;
+	qca_multi_link_cfg.qca_ml_loop_detection_context = NULL;
 	qdf_spinlock_destroy(&qca_multi_link_cfg.radio_lock);
 
 	QDF_TRACE(QDF_MODULE_ID_RPTR, QDF_TRACE_LEVEL_INFO,
@@ -265,6 +267,8 @@ void qca_multi_link_init_module(void)
 	qca_multi_link_cfg.total_stavaps_up = 0;
 	qca_multi_link_cfg.loop_detected = 0;
 	qca_multi_link_cfg.primary_wiphy = NULL;
+	qca_multi_link_cfg.qca_ml_set_loop_detection = NULL;
+	qca_multi_link_cfg.qca_ml_loop_detection_context = NULL;
 	qdf_list_create(&qca_multi_link_cfg.radio_list, QCA_MULTI_LINK_RADIO_LIST_SIZE);
 	qdf_spinlock_create(&qca_multi_link_cfg.radio_lock);
 
@@ -889,6 +893,11 @@ static qca_multi_link_status_t qca_multi_link_secondary_sta_rx(struct net_device
 				if (qca_ml_entry.qal_fdb_is_local
 					&& (qca_ml_entry.qal_fdb_ieee80211_ptr->iftype == NL80211_IFTYPE_STATION)) {
 					qca_multi_link_cfg.loop_detected = true;
+					if (qca_multi_link_cfg.qca_ml_set_loop_detection) {
+						qca_multi_link_cfg.qca_ml_set_loop_detection(
+							qca_multi_link_cfg.qca_ml_loop_detection_context,
+							true);
+					}
 					QDF_TRACE(QDF_MODULE_ID_RPTR, QDF_TRACE_LEVEL_INFO, FL("\n****Wifi Rptr Loop Detected****\n"));
 				}
 			}
@@ -1071,6 +1080,11 @@ static qca_multi_link_status_t qca_multi_link_primary_sta_rx(struct net_device *
 				== NL80211_IFTYPE_STATION)) {
 			if (!qca_multi_link_cfg.loop_detected) {
 				qca_multi_link_cfg.loop_detected = true;
+				if (qca_multi_link_cfg.qca_ml_set_loop_detection) {
+					qca_multi_link_cfg.qca_ml_set_loop_detection(
+							qca_multi_link_cfg.qca_ml_loop_detection_context,
+							true);
+				}
 				QDF_TRACE(QDF_MODULE_ID_RPTR, QDF_TRACE_LEVEL_INFO,
 						FL("\n****Wifi Rptr Loop Detected****\n"));
 			}
@@ -1393,3 +1407,21 @@ end:
 }
 
 qdf_export_symbol(qca_multi_link_sta_tx);
+
+/**
+ * qca_multi_link_set_dbdc_loop_detection_cb() - set the dbdc loop detection callback
+ * @qca_ml_cb: Callback function to be called during multi link loop detection.
+ */
+void qca_multi_link_set_dbdc_loop_detection_cb(
+		qca_multi_link_set_loop_detection_fn_t qca_ml_cb,
+		void *ctx)
+{
+	qca_multi_link_cfg.qca_ml_set_loop_detection = qca_ml_cb;
+	qca_multi_link_cfg.qca_ml_loop_detection_context = ctx;
+
+	QDF_TRACE(QDF_MODULE_ID_RPTR, QDF_TRACE_LEVEL_DEBUG,
+		FL("\nSetting DBDC Loop detection ctx:%p\n"), ctx);
+}
+
+qdf_export_symbol(qca_multi_link_set_dbdc_loop_detection_cb);
+