Kaynağa Gözat

qcacld-3.0: Add support to deliver ald events to son

Add support for the following event
MLME_EVENT_ASSOC_DISASSOC
MLME_EVENT_ACS_COMPLETE
MLME_EVENT_CAC_STATUS
MLME_EVENT_CLIENT_ASSOCIATED

Change-Id: I2d3cadce47d501d6afff6ec101b6342a45c0b01f
anikkuma 3 yıl önce
ebeveyn
işleme
41b0bacd30

+ 4 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -90,6 +91,7 @@
 
 #include "wlan_hdd_twt.h"
 #include "wlan_cm_roam_ucfg_api.h"
+#include "wlan_hdd_son.h"
 
 /* These are needed to recognize WPA and RSN suite types */
 #define HDD_WPA_OUI_SIZE 4
@@ -1158,6 +1160,8 @@ QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter,
 		    (wlan_mlme_get_wds_mode(hdd_ctx->psoc) ==
 		    WLAN_WDS_MODE_REPEATER))
 			hdd_config_wds_repeater_mode(adapter, peer_mac);
+
+		hdd_son_deliver_peer_authorize_event(adapter, peer_mac);
 	}
 	return QDF_STATUS_SUCCESS;
 }

+ 14 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -106,6 +106,7 @@
 #ifdef WLAN_FEATURE_11BE_MLO
 #include <wlan_mlo_mgr_ap.h>
 #endif
+#include "wlan_hdd_son.h"
 
 #define ACS_SCAN_EXPIRY_TIMEOUT_S 4
 
@@ -2218,6 +2219,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		} else {
 			hdd_debug("Sent CAC end (interrupted) to user space");
 		}
+		hdd_son_deliver_cac_status_event(adapter, true);
 		break;
 	case eSAP_DFS_CAC_END:
 		wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
@@ -2235,6 +2237,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		} else {
 			hdd_debug("Sent CAC end to user space");
 		}
+		hdd_son_deliver_cac_status_event(adapter, false);
 		break;
 	case eSAP_DFS_RADAR_DETECT:
 	{
@@ -2261,6 +2264,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		} else {
 			hdd_debug("Sent radar detected to user space");
 		}
+		hdd_son_deliver_cac_status_event(adapter, true);
 		break;
 	}
 	case eSAP_DFS_RADAR_DETECT_DURING_PRE_CAC:
@@ -2273,6 +2277,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				wlan_hdd_sap_pre_cac_failure,
 				(void *)adapter);
 		qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
+		hdd_son_deliver_cac_status_event(adapter, true);
 		break;
 	case eSAP_DFS_PRE_CAC_END:
 		hdd_debug("pre cac end notification received:%d",
@@ -2557,6 +2562,10 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		}
 
 		hdd_green_ap_add_sta(hdd_ctx);
+		hdd_son_deliver_assoc_disassoc_event(adapter,
+						     event->staMac,
+						     event->status,
+						     ALD_ASSOC_EVENT);
 		break;
 
 	case eSAP_STA_DISASSOC_EVENT:
@@ -2720,7 +2729,10 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 			hdd_bus_bw_compute_reset_prev_txrx_stats(adapter);
 			hdd_bus_bw_compute_timer_try_stop(hdd_ctx);
 		}
-
+		hdd_son_deliver_assoc_disassoc_event(adapter,
+						     disassoc_comp->staMac,
+						     disassoc_comp->reason_code,
+						     ALD_DISASSOC_EVENT);
 		hdd_green_ap_del_sta(hdd_ctx);
 		break;
 
@@ -2834,6 +2846,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		return hdd_handle_acs_scan_event(sap_event, adapter);
 
 	case eSAP_ACS_CHANNEL_SELECTED:
+		hdd_son_deliver_acs_complete_event(adapter);
 		ap_ctx->sap_config.acs_cfg.pri_ch_freq =
 			sap_event->sapevt.sap_ch_selected.pri_ch_freq;
 		ap_ctx->sap_config.acs_cfg.ht_sec_ch_freq =

+ 63 - 0
core/hdd/src/wlan_hdd_son.c

@@ -1538,3 +1538,66 @@ void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
 	ucfg_son_register_deliver_smps_cb(hdd_ctx->psoc,
 					  hdd_son_deliver_smps);
 }
+
+int hdd_son_deliver_acs_complete_event(struct hdd_adapter *adapter)
+{
+	int ret;
+
+	ret = os_if_son_deliver_ald_event(adapter, NULL,
+					  MLME_EVENT_ACS_COMPLETE, NULL);
+	return ret;
+}
+
+int hdd_son_deliver_cac_status_event(struct hdd_adapter *adapter,
+				     bool radar_detected)
+{
+	int ret;
+
+	ret = os_if_son_deliver_ald_event(adapter, NULL,
+					  MLME_EVENT_CAC_STATUS,
+					  &radar_detected);
+	return ret;
+}
+
+int hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter *adapter,
+					 struct qdf_mac_addr sta_mac,
+					 uint32_t reason_code,
+					 enum assoc_disassoc_event flag)
+{
+	int ret;
+	struct son_ald_assoc_event_info info;
+
+	qdf_mem_zero(&info, sizeof(info));
+	memcpy(info.macaddr, &sta_mac.bytes, QDF_MAC_ADDR_SIZE);
+	info.flag = flag;
+	info.reason = reason_code;
+	ret = os_if_son_deliver_ald_event(adapter, NULL,
+					  MLME_EVENT_ASSOC_DISASSOC, &info);
+	return ret;
+}
+
+void hdd_son_deliver_peer_authorize_event(struct hdd_adapter *adapter,
+					  uint8_t *peer_mac)
+{
+	struct wlan_objmgr_peer *peer;
+	int ret;
+
+	if (adapter->device_mode != QDF_SAP_MODE) {
+		osif_err("Non SAP vdev");
+		return;
+	}
+	peer = wlan_objmgr_get_peer_by_mac(psoc, peer_mac, WLAN_UMAC_COMP_SON);
+	if (!peer) {
+		osif_err("No peer object for sta" QDF_FULL_MAC_FMT,
+			 QDF_FULL_MAC_REF(peer_mac));
+		return;
+	}
+
+	ret = os_if_son_deliver_ald_event(adapter, peer,
+					  MLME_EVENT_CLIENT_ASSOCIATED, NULL);
+	if (ret)
+		osif_err("ALD ASSOCIATED Event failed for" QDF_FULL_MAC_FMT,
+			 QDF_FULL_MAC_REF(peer_mac));
+
+	wlan_objmgr_peer_release_ref(peer, WLAN_UMAC_COMP_SON);
+}

+ 83 - 0
core/hdd/src/wlan_hdd_son.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -24,6 +25,16 @@
 #include <qdf_types.h>
 #include <wlan_hdd_main.h>
 
+/*
+ * Determines type of event sent for MLME_EVENT_ASSOC_DISASSOC
+ * @ALD_ASSOC_EVENT: event name to send assoc event
+ * @ALD_DISASSOC_EVENT: event name to send disassoc event
+ */
+enum assoc_disassoc_event {
+	ALD_ASSOC_EVENT,
+	ALD_DISASSOC_EVENT,
+};
+
 #ifdef WLAN_FEATURE_SON
 
 /**
@@ -33,10 +44,82 @@
  * Return: void
  */
 void hdd_son_register_callbacks(struct hdd_context *hdd_ctx);
+
+/**
+ * hdd_son_deliver_acs_complete_event() - send acs complete event to son
+ * @adapter: adapter object
+ *
+ * Return: 0 if event is sent successfully
+ */
+int hdd_son_deliver_acs_complete_event(struct hdd_adapter *adapter);
+
+/**
+ * hdd_son_deliver_cac_status_event() - send cac status to son
+ * @adapter: adapter object
+ * @radar_detected: true if radar is detected else false
+ *
+ * Return: 0 if event is sent successfully
+ */
+int hdd_son_deliver_cac_status_event(struct hdd_adapter *adapter,
+				     bool radar_detected);
+
+/**
+ * hdd_son_deliver_assoc_disassoc_event() - send sta assoc disassoc event
+ *						to son
+ * @adapter: adapter object
+ * @sta_mac: Mac address of the sta
+ * @reason_code: reason code
+ * @flag: determines the type of event sent(Assoc/disassoc)
+ *
+ * Return: 0 if event is sent successfully
+ */
+int hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter *adapter,
+					 struct qdf_mac_addr sta_mac,
+					 uint32_t reason_code,
+					 enum assoc_disassoc_event flag);
+/**
+ * hdd_son_deliver_peer_authorize_event() - Deliver peer auth event to SON
+ * @adapter: objmgr adapter
+ * @peer_mac: Peer mac address
+ *
+ * Return: Void
+ */
+void
+hdd_son_deliver_peer_authorize_event(struct hdd_adapter *adapter,
+				     uint8_t *peer_mac);
 #else
 
 static inline void hdd_son_register_callbacks(struct hdd_context *hdd_ctx)
 {
 }
+
+static inline int
+	hdd_son_deliver_acs_complete_event(struct hdd_adapter *adapter)
+{
+	return 0;
+}
+
+static inline int
+	hdd_son_deliver_cac_status_event(struct hdd_adapter *adapter,
+					 bool radar_detected)
+{
+	return 0;
+}
+
+static inline int
+	hdd_son_deliver_assoc_disassoc_event(struct hdd_adapter *adapter,
+					     struct qdf_mac_addr sta_mac,
+					     uint32_t reason_code,
+					     enum assoc_disassoc_event flag)
+{
+	return 0;
+}
+
+static inline void
+hdd_son_deliver_peer_authorize_event(struct hdd_adapter *adapter,
+				     uint8_t *peer_mac)
+{
+}
+
 #endif /* WLAN_FEATURE_SON */
 #endif

+ 14 - 0
os_if/son/inc/os_if_son.h

@@ -535,4 +535,18 @@ void os_if_son_deauth_peer_sta(struct wlan_objmgr_vdev *vdev,
 void os_if_son_modify_acl(struct wlan_objmgr_vdev *vdev,
 			  uint8_t *peer_mac,
 			  bool allow_auth);
+
+/**
+ * os_if_son_deliver_ald_event() - deliver ald events to son
+ * @adapter: adapter object
+ * @peer: peer object
+ * @event: Name of the event
+ * @event_data: event data
+ *
+ * Return: 0 on success
+ */
+int os_if_son_deliver_ald_event(struct hdd_adapter *adapter,
+				struct wlan_objmgr_peer *peer,
+				enum ieee80211_event_type event,
+				void *event_data);
 #endif

+ 33 - 0
os_if/son/src/os_if_son.c

@@ -1293,3 +1293,36 @@ QDF_STATUS os_if_son_pdev_ops(struct wlan_objmgr_pdev *pdev,
 }
 
 qdf_export_symbol(os_if_son_pdev_ops);
+
+int os_if_son_deliver_ald_event(struct hdd_adapter *adapter,
+				struct wlan_objmgr_peer *peer,
+				enum ieee80211_event_type event,
+				void *event_data)
+{
+	struct wlan_objmgr_vdev *vdev;
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_lmac_if_rx_ops *rx_ops;
+	int ret;
+
+	vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_SON_ID);
+	if (!vdev) {
+		osif_err("null vdev");
+		return -EINVAL;
+	}
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		osif_err("null posc");
+		hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_SON_ID);
+		return -EINVAL;
+	}
+	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
+	if (rx_ops && rx_ops->son_rx_ops.deliver_event)
+		ret = rx_ops->son_rx_ops.deliver_event(vdev, peer, event,
+							event_data);
+	else
+		ret = -EINVAL;
+	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_SON_ID);
+	return ret;
+}
+
+qdf_export_symbol(os_if_son_deliver_ald_event);