ソースを参照

qcacld-3.0: Add support for WDS repeater feature

Enable source port learning for SAP to add AST entry for the
remote stations with next hop. The SAP should use 4-address
frame format for the remote destinations.

Add support to handle data packets for WDS destination.

Change-Id: I6002e6dd9c9bb2c7b2e4f85bf06156dbb7feebee
CRs-Fixed: 2997812
Subrat Dash 3 年 前
コミット
19e3d0b415

+ 11 - 0
Kbuild

@@ -511,6 +511,10 @@ ifeq ($(CONFIG_WLAN_FEATURE_MCC_QUOTA), y)
 HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_mcc_quota.o
 endif
 
+ifeq ($(CONFIG_FEATURE_WDS), y)
+HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_wds.o
+endif
+
 $(call add-wlan-objs,hdd,$(HDD_OBJS))
 
 ###### OSIF_SYNC ########
@@ -1955,6 +1959,11 @@ WMI_OBJS += $(WMI_OBJ_DIR)/wmi_unified_11be_tlv.o
 WMI_OBJS += $(WMI_OBJ_DIR)/wmi_unified_11be_api.o
 endif
 
+ifeq ($(CONFIG_FEATURE_WDS), y)
+WMI_OBJS += $(WMI_OBJ_DIR)/wmi_unified_wds_api.o
+WMI_OBJS += $(WMI_OBJ_DIR)/wmi_unified_wds_tlv.o
+endif
+
 $(call add-wlan-objs,wmi,$(WMI_OBJS))
 
 ########### FWLOG ###########
@@ -4324,6 +4333,8 @@ endif
 cppflags-$(CONFIG_FEATURE_WDS) += -DFEATURE_WDS
 cppflags-$(CONFIG_FEATURE_MEC) += -DFEATURE_MEC
 cppflags-$(CONFIG_FEATURE_MCL_REPEATER) += -DFEATURE_MCL_REPEATER
+cppflags-$(CONFIG_WDS_CONV_TARGET_IF_OPS_ENABLE) += -DWDS_CONV_TARGET_IF_OPS_ENABLE
+cppflags-$(CONFIG_BYPASS_WDS_OL_OPS) += -DBYPASS_OL_OPS
 
 ccflags-$(CONFIG_IPA_WDI3_TX_TWO_PIPES) += -DIPA_WDI3_TX_TWO_PIPES
 

+ 17 - 0
components/fw_offload/core/inc/wlan_fw_offload_main.h

@@ -463,4 +463,21 @@ QDF_STATUS fwol_set_sap_sho(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 QDF_STATUS fwol_configure_hw_assist(struct wlan_objmgr_pdev *pdev,
 				    bool disable_hw_assist);
 
+/**
+ * fwol_set_sap_wds_config() - API to configure WDS mode on SAP vdev
+ * @psoc: pointer to the psoc object
+ * @vdev_id: vdev id
+ *
+ * Return: QDF_STATUS
+ */
+#ifdef FEATURE_WDS
+QDF_STATUS
+fwol_set_sap_wds_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id);
+#else
+static inline QDF_STATUS
+fwol_set_sap_wds_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 #endif

+ 22 - 0
components/fw_offload/core/src/wlan_fw_offload_main.c

@@ -857,3 +857,25 @@ QDF_STATUS fwol_configure_hw_assist(struct wlan_objmgr_pdev *pdev,
 
 	return status;
 }
+
+#ifdef FEATURE_WDS
+QDF_STATUS
+fwol_set_sap_wds_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
+{
+	QDF_STATUS status;
+	struct vdev_set_params vdev_param;
+
+	if (!wlan_mlme_get_wds_mode(psoc))
+		return QDF_STATUS_SUCCESS;
+
+	vdev_param.vdev_id = vdev_id;
+	vdev_param.param_id = WMI_VDEV_PARAM_WDS;
+	vdev_param.param_value = true;
+
+	status = tgt_fwol_vdev_param_send(psoc, vdev_param);
+	if (QDF_IS_STATUS_ERROR(status))
+		fwol_err("WMI_VDEV_PARAM_WDS failed %d", status);
+
+	return status;
+}
+#endif

+ 4 - 0
components/fw_offload/dispatcher/src/wlan_fwol_ucfg_api.c

@@ -1225,6 +1225,10 @@ QDF_STATUS ucfg_fwol_configure_vdev_params(struct wlan_objmgr_psoc *psoc,
 		status = fwol_set_sap_sho(psoc, vdev_id, value);
 		if (QDF_IS_STATUS_ERROR(status))
 			return status;
+
+		status = fwol_set_sap_wds_config(psoc, vdev_id);
+		if (QDF_IS_STATUS_ERROR(status))
+			return status;
 	}
 
 	return status;

+ 13 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -108,6 +108,7 @@
 #endif
 #include "wlan_hdd_son.h"
 #include "wlan_hdd_mcc_quota.h"
+#include "wlan_hdd_wds.h"
 
 #define ACS_SCAN_EXPIRY_TIMEOUT_S 4
 
@@ -1935,6 +1936,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 	uint8_t *mld;
 #endif
 	bool notify_new_sta = true;
+	struct wlan_objmgr_vdev *vdev;
 
 	dev = context;
 	if (!dev) {
@@ -2144,6 +2146,17 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		if (!wlan_reg_is_6ghz_chan_freq(ap_ctx->operating_chan_freq))
 			wlan_reg_set_ap_pwr_and_update_chan_list(hdd_ctx->pdev,
 								 REG_INDOOR_AP);
+
+		/*
+		 * Enable wds source port learning on the dp vdev in AP mode
+		 * when WDS feature is enabled.
+		 */
+		vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_ID);
+		if (vdev) {
+			if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE)
+				hdd_wds_config_dp_repeater_mode(vdev);
+			hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
+		}
 		/*
 		 * set this event at the very end because once this events
 		 * get set, caller thread is waiting to do further processing.

+ 2 - 0
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -50,6 +50,7 @@
 #include "ol_defines.h"
 #include <wlan_hdd_sar_limits.h>
 #include "wlan_hdd_tsf.h"
+#include "wlan_hdd_wds.h"
 
 /* Preprocessor definitions and constants */
 #undef QCA_HDD_SAP_DUMP_SK_BUFF
@@ -614,6 +615,7 @@ static QDF_STATUS hdd_softap_validate_peer_state(struct hdd_adapter *adapter,
 		void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 		QDF_BUG(soc);
+		hdd_wds_replace_peer_mac(soc, adapter, mac_addr->bytes);
 		peer_state = cdp_peer_state_get(soc, adapter->vdev_id,
 						mac_addr->bytes);
 

+ 83 - 0
core/hdd/src/wlan_hdd_wds.c

@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2022 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: wlan_hdd_wds.c
+ *
+ * WLAN Host Device Driver file for wds (4 address frame header when
+ * SA and TA are different) support.
+ *
+ */
+
+/* Include Files */
+#include <cdp_txrx_ctrl.h>
+#include <wlan_hdd_main.h>
+#include "wlan_hdd_wds.h"
+
+void hdd_wds_config_dp_repeater_mode(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_pdev *pdev;
+	struct wlan_objmgr_psoc *psoc;
+	ol_txrx_soc_handle soc;
+	cdp_config_param_type vdev_param;
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	if (!pdev)
+		return;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc)
+		return;
+
+	if (!wlan_mlme_get_wds_mode(psoc))
+		return;
+
+	soc = wlan_psoc_get_dp_handle(psoc);
+
+	vdev_param.cdp_vdev_param_wds = true;
+	if (cdp_txrx_set_vdev_param(soc, vdev->vdev_objmgr.vdev_id,
+				    CDP_ENABLE_WDS,
+				    vdev_param))
+		hdd_debug("Failed to set WDS param on DP vdev");
+}
+
+void
+hdd_wds_replace_peer_mac(void *soc, struct hdd_adapter *adapter,
+			 uint8_t *mac_addr)
+{
+	struct cdp_ast_entry_info ast_entry_info = {0};
+	cdp_config_param_type val;
+	QDF_STATUS status;
+
+	if (!cdp_find_peer_exist(soc, OL_TXRX_PDEV_ID, mac_addr)) {
+		status = cdp_txrx_get_vdev_param(soc, adapter->vdev_id,
+						 CDP_ENABLE_WDS, &val);
+		if (!QDF_IS_STATUS_SUCCESS(status))
+			return;
+
+		if (!val.cdp_vdev_param_wds)
+			return;
+
+		if (!cdp_peer_get_ast_info_by_soc(soc,  mac_addr,
+						  &ast_entry_info))
+			return;
+
+		qdf_mem_copy(mac_addr, ast_entry_info.peer_mac_addr,
+			     QDF_MAC_ADDR_SIZE);
+	}
+}

+ 73 - 0
core/hdd/src/wlan_hdd_wds.h

@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2022 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC : wlan_hdd_wds.h
+ *
+ * WLAN Host Device Driver file for wds (4 address format in mac header when
+ * SA and TA are not same) support.
+ *
+ */
+
+#if !defined(WLAN_HDD_WDS_H)
+#define WLAN_HDD_WDS_H
+
+struct wlan_objmgr_vdev;
+struct hdd_adapter;
+
+#ifdef FEATURE_WDS
+/**
+ * hdd_wds_config_dp_repeater_mode - Function to enable wds on the AP vdev
+ * @vdev: object manager vdev context
+ *
+ * Set the wds_enabled flag for dp vdev. The wds source port learning
+ * is triggered when this flag is enabled and AST entry for the remote
+ * station(wds node) is added to the AST list.
+ *
+ * Return: None
+ */
+void hdd_wds_config_dp_repeater_mode(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * hdd_wds_replace_peer_mac() - Replace the mac address for the wds next hop
+ * @soc: SOC TXRX handle
+ * @adapter: the pointer to adapter
+ * @mac_addr: mac address of the peer or wds station
+ *
+ * The wds stations are reachable through a directly connected peer.
+ * Replace the destination address with the mac address of the next
+ * hop peer to reach the wds station, if the destination is not a
+ * directly connected peer.
+ *
+ * Return: None
+ */
+void hdd_wds_replace_peer_mac(void *soc, struct hdd_adapter *adapter,
+			      uint8_t *mac_addr);
+#else
+static inline
+void hdd_wds_config_dp_repeater_mode(struct wlan_objmgr_vdev *vdev)
+{
+}
+
+static inline
+void hdd_wds_replace_peer_mac(void *soc, struct hdd_adapter *adapter,
+			      uint8_t *mac_addr)
+{
+}
+#endif /* FEATURE_WDS*/
+#endif /* if !defined(WLAN_HDD_WDS_H)*/

+ 31 - 0
core/wma/src/wma_dev_if.c

@@ -3265,6 +3265,36 @@ fail:
 	return ret;
 }
 
+#ifdef FEATURE_WDS
+/*
+ * wma_cdp_cp_peer_del_response - handle peer delete response
+ * @psoc: psoc object pointer
+ * @mac_addr: Mac address of the peer
+ * @vdev_id: id of virtual device object
+ *
+ * when peer map v2 is enabled, cdp_peer_teardown() does not remove the AST from
+ * hash table. Call cdp_cp_peer_del_response() when peer delete response is
+ * received from fw to delete the AST entry from the AST hash.
+ *
+ * Return: None
+ */
+static void
+wma_cdp_cp_peer_del_response(struct wlan_objmgr_psoc *psoc,
+			     uint8_t *peer_mac, uint8_t vdev_id)
+{
+	ol_txrx_soc_handle soc_txrx_handle;
+
+	soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
+	cdp_cp_peer_del_response(soc_txrx_handle, vdev_id, peer_mac);
+}
+#else
+static void
+wma_cdp_cp_peer_del_response(struct wlan_objmgr_psoc *psoc,
+			     uint8_t *peer_mac, uint8_t vdev_id)
+{
+}
+#endif
+
 /**
  * wma_peer_delete_handler() - peer delete response handler
  * @handle: wma handle
@@ -3348,6 +3378,7 @@ int wma_peer_delete_handler(void *handle, uint8_t *cmd_param_info,
 		cm_free_join_req(req_msg->user_data);
 	}
 
+	wma_cdp_cp_peer_del_response(wma->psoc, macaddr, event->vdev_id);
 	qdf_mem_free(req_msg);
 
 	return status;