Browse Source

qcacmn: implement target_if APIs for MLO

Implement target_if APIs for MLO.

Change-Id: I29c6ea51e29f4ea200e3f47960168dfa9a8c42cc
CRs-Fixed: 3036844
Yu Wang 3 năm trước cách đây
mục cha
commit
a9ed2d6a47

+ 20 - 0
target_if/core/src/target_if_main.c

@@ -102,6 +102,10 @@
 
 #include "wmi_unified_api.h"
 
+#ifdef WLAN_FEATURE_11BE_MLO
+#include <target_if_mlo_mgr.h>
+#endif
+
 static struct target_if_ctx *g_target_if_ctx;
 
 struct target_if_ctx *target_if_get_ctx()
@@ -498,6 +502,20 @@ void target_if_mgmt_txrx_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 }
 #endif /* WLAN_MGMT_RX_REO_SUPPORT */
 
+#ifdef WLAN_FEATURE_11BE_MLO
+static QDF_STATUS
+target_if_mlo_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+	return target_if_mlo_register_tx_ops(tx_ops);
+}
+#else
+static QDF_STATUS
+target_if_mlo_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 static
 QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -548,6 +566,8 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 
 	target_if_mgmt_txrx_register_tx_ops(tx_ops);
 
+	target_if_mlo_tx_ops_register(tx_ops);
+
 	/* Converged UMAC components to register their TX-ops here */
 	return QDF_STATUS_SUCCESS;
 }

+ 85 - 0
target_if/mlo_mgr/inc/target_if_mlo_mgr.h

@@ -0,0 +1,85 @@
+/*
+ * 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
+ * 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: target_if_mlo_mgr.h
+ *
+ * This header file provide declarations required for Rx and Tx events from
+ * firmware
+ */
+
+#ifndef __TARGET_IF_MLO_MGR_H__
+#define __TARGET_IF_MLO_MGR_H__
+
+#include <target_if.h>
+#include <wlan_lmac_if_def.h>
+
+/**
+ * target_if_mlo_get_rx_ops() - get rx ops
+ * @tx_ops: pointer to target_if tx ops
+ *
+ * API to retrieve the MLO rx ops from the psoc context
+ *
+ * Return: pointer to rx ops
+ */
+static inline struct wlan_lmac_if_mlo_rx_ops *
+target_if_mlo_get_rx_ops(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_lmac_if_rx_ops *rx_ops;
+
+	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
+	if (!rx_ops) {
+		target_if_err("rx_ops is NULL");
+		return NULL;
+	}
+
+	return &rx_ops->mlo_rx_ops;
+}
+
+/**
+ * target_if_mlo_get_tx_ops() - get tx ops
+ * @tx_ops: pointer to target_if tx ops
+ *
+ * API to retrieve the MLO tx ops from the psoc context
+ *
+ * Return: pointer to tx ops
+ */
+static inline struct wlan_lmac_if_mlo_tx_ops *
+target_if_mlo_get_tx_ops(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_lmac_if_tx_ops *tx_ops;
+
+	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
+	if (!tx_ops) {
+		target_if_err("tx_ops is NULL");
+		return NULL;
+	}
+
+	return &tx_ops->mlo_ops;
+}
+
+/**
+ * target_if_mlo_register_tx_ops() - lmac handler to register mlo tx ops
+ *  callback functions
+ * @tx_ops: wlan_lmac_if_tx_ops object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+target_if_mlo_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
+
+#endif /* __TARGET_IF_MLO_MGR_H__ */
+

+ 207 - 0
target_if/mlo_mgr/src/target_if_mlo_mgr.c

@@ -0,0 +1,207 @@
+/*
+ * 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
+ * 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: target_if_mlo_mgr.c
+ *
+ * This file provide definition for APIs registered through lmac Tx Ops
+ */
+
+#include <wmi_unified_11be_api.h>
+#include <init_deinit_lmac.h>
+#include "target_if_mlo_mgr.h"
+
+/**
+ * target_if_mlo_link_set_active_resp_handler() - function to handle mlo link
+ *  set active response from firmware.
+ * @scn: scn handle
+ * @data: data buffer for event
+ * @datalen: data length
+ *
+ * Return: 0 on success, else error on failure
+ */
+static int
+target_if_mlo_link_set_active_resp_handler(ol_scn_t scn, uint8_t *data,
+					   uint32_t datalen)
+{
+	QDF_STATUS status;
+	struct wlan_objmgr_psoc *psoc;
+	struct wmi_unified *wmi_handle;
+	struct wlan_lmac_if_mlo_rx_ops *rx_ops;
+	struct mlo_link_set_active_resp resp;
+
+	if (!scn || !data) {
+		target_if_err("scn: 0x%pK, data: 0x%pK", scn, data);
+		return -EINVAL;
+	}
+
+	psoc = target_if_get_psoc_from_scn_hdl(scn);
+	if (!psoc) {
+		target_if_err("null psoc");
+		return -EINVAL;
+	}
+
+	rx_ops = target_if_mlo_get_rx_ops(psoc);
+	if (!rx_ops || !rx_ops->process_link_set_active_resp) {
+		target_if_err("callback not registered");
+		return -EINVAL;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return -EINVAL;
+	}
+
+	if (wmi_extract_mlo_link_set_active_resp(wmi_handle, data, &resp) !=
+	    QDF_STATUS_SUCCESS) {
+		target_if_err("Unable to extract mlo link set active resp");
+		return -EINVAL;
+	}
+
+	status = rx_ops->process_link_set_active_resp(psoc, &resp);
+
+	return qdf_status_to_os_return(status);
+}
+
+/**
+ * target_if_mlo_register_event_handler() - function to register handler for
+ *  mlo related wmi event from firmware.
+ * @psoc: psoc pointer
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+target_if_mlo_register_event_handler(struct wlan_objmgr_psoc *psoc)
+{
+	QDF_STATUS status;
+	struct wmi_unified *wmi_handle;
+
+	if (!psoc) {
+		target_if_err("PSOC is NULL!");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wmi_unified_register_event_handler(
+			wmi_handle,
+			wmi_mlo_link_set_active_resp_eventid,
+			target_if_mlo_link_set_active_resp_handler,
+			WMI_RX_WORK_CTX);
+	if (QDF_IS_STATUS_ERROR(status))
+		target_if_err("Failed to register mlo link set active resp cb");
+
+	return status;
+}
+
+/**
+ * target_if_mlo_unregister_event_handler() - function to unregister handler for
+ *  mlo related wmi event from firmware.
+ * @psoc: psoc pointer
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+target_if_mlo_unregister_event_handler(struct wlan_objmgr_psoc *psoc)
+{
+	struct wmi_unified *wmi_handle;
+
+	if (!psoc) {
+		target_if_err("PSOC is NULL!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wmi_unified_unregister_event_handler(wmi_handle,
+		wmi_mlo_link_set_active_resp_eventid);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * target_if_mlo_link_set_active() - Send WMI command for set mlo link active
+ * @psoc: psoc pointer
+ * @param: parameter for setting mlo link active
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+target_if_mlo_link_set_active(struct wlan_objmgr_psoc *psoc,
+			      struct mlo_link_set_active_param *param)
+{
+	QDF_STATUS ret;
+	struct wmi_unified *wmi_handle;
+
+	if (!psoc) {
+		target_if_err("null psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("null handle");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	ret = wmi_send_mlo_link_set_active_cmd(wmi_handle, param);
+	if (QDF_IS_STATUS_ERROR(ret))
+		target_if_err("wmi mlo link set active send failed: %d", ret);
+
+	return ret;
+}
+
+/**
+ * target_if_mlo_register_tx_ops() - lmac handler to register mlo tx ops
+ *  callback functions
+ * @tx_ops: wlan_lmac_if_tx_ops object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+target_if_mlo_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
+{
+	struct wlan_lmac_if_mlo_tx_ops *mlo_tx_ops;
+
+	if (!tx_ops) {
+		target_if_err("lmac tx ops is NULL!");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	mlo_tx_ops = &tx_ops->mlo_ops;
+	if (!mlo_tx_ops) {
+		target_if_err("lmac tx ops is NULL!");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	mlo_tx_ops->mlo_attach =
+		target_if_mlo_register_event_handler;
+	mlo_tx_ops->mlo_detach =
+		target_if_mlo_unregister_event_handler;
+	mlo_tx_ops->link_set_active = target_if_mlo_link_set_active;
+
+	return QDF_STATUS_SUCCESS;
+}
+

+ 36 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -83,6 +83,10 @@ struct dbr_module_config;
 #include <wlan_dcs_tgt_api.h>
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+#include "wlan_mlo_mgr_public_structs.h"
+#endif
+
 #ifdef QCA_SUPPORT_CP_STATS
 #include <wlan_cp_stats_public_structs.h>
 
@@ -1255,6 +1259,31 @@ struct wlan_lmac_if_son_rx_ops {
 				  void *wri);
 };
 
+#ifdef WLAN_FEATURE_11BE_MLO
+/**
+ * struct wlan_lmac_if_mlo_tx_ops - south bound tx function pointers for mlo
+ * @mlo_attach: function to register event handlers with FW
+ * @mlo_detach: function to de-register event handlers with FW
+ * @link_set_active: function to send mlo link set active command to FW
+ */
+struct wlan_lmac_if_mlo_tx_ops {
+	QDF_STATUS (*mlo_attach)(struct wlan_objmgr_psoc *psoc);
+	QDF_STATUS (*mlo_detach)(struct wlan_objmgr_psoc *psoc);
+	QDF_STATUS (*link_set_active)(struct wlan_objmgr_psoc *psoc,
+		struct mlo_link_set_active_param *param);
+};
+
+/**
+ * struct wlan_lmac_if_mlo_rx_ops - defines southbound rx callbacks for mlo
+ * @process_link_set_active_resp: function pointer to rx FW events
+ */
+struct wlan_lmac_if_mlo_rx_ops {
+	QDF_STATUS
+	(*process_link_set_active_resp)(struct wlan_objmgr_psoc *psoc,
+		struct mlo_link_set_active_resp *event);
+};
+#endif
+
 /**
  * struct wlan_lmac_if_tx_ops - south bound tx function pointers
  * @mgmt_txrx_tx_ops: mgmt txrx tx ops
@@ -1346,6 +1375,10 @@ struct wlan_lmac_if_tx_ops {
 #ifdef WLAN_FEATURE_GPIO_CFG
 	struct wlan_lmac_if_gpio_tx_ops gpio_ops;
 #endif
+
+#ifdef WLAN_FEATURE_11BE_MLO
+	struct wlan_lmac_if_mlo_tx_ops mlo_ops;
+#endif
 };
 
 /**
@@ -2072,6 +2105,9 @@ struct wlan_lmac_if_rx_ops {
 
 	struct wlan_lmac_if_ftm_rx_ops ftm_rx_ops;
 	struct wlan_lmac_if_son_rx_ops son_rx_ops;
+#ifdef WLAN_FEATURE_11BE_MLO
+	struct wlan_lmac_if_mlo_rx_ops mlo_rx_ops;
+#endif
 };
 
 /* Function pointer to call legacy tx_ops registration in OL/WMA.

+ 28 - 1
umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-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
@@ -77,6 +77,10 @@
 
 #include "wlan_mgmt_txrx_rx_reo_tgt_api.h"
 
+#ifdef WLAN_FEATURE_11BE_MLO
+#include "wlan_mlo_mgr_cmn.h"
+#endif
+
 /* Function pointer for OL/WMA specific UMAC tx_ops
  * registration.
  */
@@ -769,6 +773,27 @@ wlan_lmac_if_umac_ftm_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
 }
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+/**
+ * wlan_lmac_if_mlo_mgr_rx_ops_register() - API to register mlo mgr Rx Ops
+ * @rx_ops: pointer to lmac rx ops
+ *
+ * This API will be used to register function pointers for FW events
+ *
+ * Return: void
+ */
+static void
+wlan_lmac_if_mlo_mgr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
+{
+	/* register handler for received mlo related events */
+}
+#else
+static void
+wlan_lmac_if_mlo_mgr_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
+{
+}
+#endif /* WLAN_FEATURE_11BE_MLO */
+
 /**
  * wlan_lmac_if_umac_rx_ops_register() - UMAC rx handler register
  * @rx_ops: Pointer to rx_ops structure to be populated
@@ -832,6 +857,8 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops)
 	/* MLME rx_ops */
 	tgt_vdev_mgr_rx_ops_register(rx_ops);
 
+	wlan_lmac_if_mlo_mgr_rx_ops_register(rx_ops);
+
 	return QDF_STATUS_SUCCESS;
 }