qcacmn: Add API to read mgmt Rx REO snapshots

Add APIs to read management rx-reordering snapshots.

CRs-Fixed: 2955865
Change-Id: I1f36705607b0bae92d422d85223f825ed0b96ef9
This commit is contained in:
Edayilliam Jayadev
2021-05-17 21:07:45 +05:30
committed by Madan Koyyalamudi
parent c775b5586a
commit ff18a53051
9 changed files with 368 additions and 9 deletions

View File

@@ -24,8 +24,17 @@
#include <qdf_types.h>
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_mgmt_txrx_rx_reo_utils_api.h>
#ifdef WLAN_MGMT_RX_REO_SUPPORT
#define MGMT_RX_REO_SNAPSHOT_READ_RETRY_LIMIT (5)
#define REO_SNAPSHOT_GET_VALID(l) (1)
#define REO_SNAPSHOT_GET_MGMT_PKT_CTR(l) (1)
#define REO_SNAPSHOT_GET_REDUNDANT_MGMT_PKT_CTR(h) (1)
#define REO_SNAPSHOT_IS_CONSISTENT(c, rc) (1)
#define REO_SNAPSHOT_GET_GLOBAL_TIMESTAMP(l, h) (1)
/**
* target_if_mgmt_rx_reo_register_event_handlers() - Register management
* rx-reordering related event handlers.
@@ -45,6 +54,17 @@ target_if_mgmt_rx_reo_register_event_handlers(struct wlan_objmgr_psoc *psoc);
*/
QDF_STATUS
target_if_mgmt_rx_reo_unregister_event_handlers(struct wlan_objmgr_psoc *psoc);
/**
* target_if_mgmt_rx_reo_tx_ops_register() - Register management rx-reordring
* txops
* @mgmt_txrx_tx_ops: Pointer to mgmt_txrx module's txops
*
* Return: QDF_STATUS
*/
QDF_STATUS
target_if_mgmt_rx_reo_tx_ops_register(
struct wlan_lmac_if_mgmt_txrx_tx_ops *mgmt_txrx_tx_ops);
#else
/**
* target_if_mgmt_rx_reo_register_event_handlers() - Register management
@@ -71,5 +91,19 @@ target_if_mgmt_rx_reo_unregister_event_handlers(struct wlan_objmgr_psoc *psoc)
{
return QDF_STATUS_SUCCESS;
}
/**
* target_if_mgmt_rx_reo_tx_ops_register() - Register management rx-reordring
* txops
* @mgmt_txrx_tx_ops: Pointer to mgmt_txrx module's txops
*
* Return: QDF_STATUS
*/
static inline QDF_STATUS
target_if_mgmt_rx_reo_tx_ops_register(
struct wlan_lmac_if_mgmt_txrx_tx_ops *mgmt_txrx_tx_ops)
{
return QDF_STATUS_SUCCESS;
}
#endif /* WLAN_MGMT_RX_REO_SUPPORT */
#endif /* _TARGET_IF_MGMT_TXRX_RX_REO_H_ */

View File

@@ -77,6 +77,7 @@ QDF_STATUS
target_if_mgmt_txrx_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
{
struct wlan_lmac_if_mgmt_txrx_tx_ops *mgmt_txrx_tx_ops;
QDF_STATUS status;
if (!tx_ops) {
mgmt_txrx_err("txops is NULL");
@@ -89,5 +90,11 @@ target_if_mgmt_txrx_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops)
mgmt_txrx_tx_ops->unreg_ev_handler =
target_if_mgmt_txrx_unregister_event_handler;
status = target_if_mgmt_rx_reo_tx_ops_register(mgmt_txrx_tx_ops);
if (QDF_IS_STATUS_ERROR(status)) {
mgmt_txrx_err("Failed to register mgmt Rx REO tx ops");
return QDF_STATUS_E_FAILURE;
}
return QDF_STATUS_SUCCESS;
}

View File

@@ -22,6 +22,8 @@
#include <wlan_objmgr_psoc_obj.h>
#include <qdf_status.h>
#include <target_if.h>
#include <wlan_mgmt_txrx_rx_reo_public_structs.h>
#include <target_if_mgmt_txrx_rx_reo.h>
QDF_STATUS
target_if_mgmt_rx_reo_register_event_handlers(struct wlan_objmgr_psoc *psoc)
@@ -30,7 +32,7 @@ target_if_mgmt_rx_reo_register_event_handlers(struct wlan_objmgr_psoc *psoc)
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
mgmt_txrx_err("Invalid WMI handle");
mgmt_rx_reo_err("Invalid WMI handle");
return QDF_STATUS_E_INVAL;
}
@@ -46,7 +48,7 @@ target_if_mgmt_rx_reo_unregister_event_handlers(struct wlan_objmgr_psoc *psoc)
wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
if (!wmi_handle) {
mgmt_txrx_err("Invalid WMI handle");
mgmt_rx_reo_err("Invalid WMI handle");
return QDF_STATUS_E_INVAL;
}
@@ -54,3 +56,113 @@ target_if_mgmt_rx_reo_unregister_event_handlers(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_SUCCESS;
}
/**
* target_if_mgmt_rx_reo_read_snapshot() - Read management rx-reorder snapshot
* @snapshot_address: Snapshot address
* @id: Snapshot ID
* @snapshot_value: Pointer to snapshot value
*
* Read management rx-reorder snapshots from target.
*
* Return: QDF_STATUS
*/
static QDF_STATUS
target_if_mgmt_rx_reo_read_snapshot(
struct mgmt_rx_reo_snapshot *snapshot_address,
enum mgmt_rx_reo_snapshot_id id,
struct mgmt_rx_reo_snapshot_params *snapshot_value)
{
bool snapshot_valid;
uint16_t mgmt_pkt_ctr;
uint16_t redundant_mgmt_pkt_ctr;
uint32_t global_timestamp;
uint32_t mgmt_rx_reo_snapshot_low;
uint32_t mgmt_rx_reo_snapshot_high;
uint8_t retry_count;
QDF_STATUS status;
if (!snapshot_address) {
mgmt_rx_reo_err("Mgmt Rx REO snapshot address null");
return QDF_STATUS_E_INVAL;
}
if (!snapshot_value) {
mgmt_rx_reo_err("Mgmt Rx REO snapshot null");
return QDF_STATUS_E_INVAL;
}
switch (id) {
case MGMT_RX_REO_SNAPSHOT_MAC_HW:
case MGMT_RX_REO_SNAPSHOT_FW_CONSUMED:
case MGMT_RX_REO_SNAPSHOT_FW_FORWADED:
retry_count = 0;
for (; retry_count < MGMT_RX_REO_SNAPSHOT_READ_RETRY_LIMIT;
retry_count++) {
mgmt_rx_reo_snapshot_low =
snapshot_address->mgmt_rx_reo_snapshot_low;
mgmt_rx_reo_snapshot_high =
snapshot_address->mgmt_rx_reo_snapshot_high;
snapshot_valid = REO_SNAPSHOT_GET_VALID(
mgmt_rx_reo_snapshot_low);
if (!snapshot_valid) {
mgmt_rx_reo_debug("Invalid REO snapshot value");
snapshot_value->valid = false;
return QDF_STATUS_SUCCESS;
}
global_timestamp = REO_SNAPSHOT_GET_GLOBAL_TIMESTAMP(
mgmt_rx_reo_snapshot_low,
mgmt_rx_reo_snapshot_high);
mgmt_pkt_ctr = REO_SNAPSHOT_GET_MGMT_PKT_CTR(
mgmt_rx_reo_snapshot_low);
redundant_mgmt_pkt_ctr =
REO_SNAPSHOT_GET_REDUNDANT_MGMT_PKT_CTR(
mgmt_rx_reo_snapshot_high);
if (REO_SNAPSHOT_IS_CONSISTENT(
mgmt_pkt_ctr, redundant_mgmt_pkt_ctr))
break;
mgmt_rx_reo_info("Inconsistent snapshot value low=0x%x high=0x%x",
mgmt_rx_reo_snapshot_low,
mgmt_rx_reo_snapshot_high);
}
if (retry_count == MGMT_RX_REO_SNAPSHOT_READ_RETRY_LIMIT) {
mgmt_rx_reo_debug("Read retry limit reached");
snapshot_value->valid = false;
return QDF_STATUS_SUCCESS;
}
snapshot_value->valid = true;
snapshot_value->mgmt_pkt_ctr = mgmt_pkt_ctr;
snapshot_value->global_timestamp = global_timestamp;
status = QDF_STATUS_SUCCESS;
break;
default:
mgmt_rx_reo_err("Invalid snapshot id %d", id);
status = QDF_STATUS_E_INVAL;
break;
}
return status;
}
QDF_STATUS
target_if_mgmt_rx_reo_tx_ops_register(
struct wlan_lmac_if_mgmt_txrx_tx_ops *mgmt_txrx_tx_ops)
{
struct wlan_lmac_if_mgmt_rx_reo_tx_ops *mgmt_rx_reo_tx_ops;
if (!mgmt_txrx_tx_ops) {
mgmt_rx_reo_err("mgmt_txrx txops NULL");
return QDF_STATUS_E_FAILURE;
}
mgmt_rx_reo_tx_ops = &mgmt_txrx_tx_ops->mgmt_rx_reo_tx_ops;
mgmt_rx_reo_tx_ops->read_mgmt_rx_reo_snapshot =
target_if_mgmt_rx_reo_read_snapshot;
return QDF_STATUS_SUCCESS;
}

View File

@@ -26,7 +26,7 @@
#include <qdf_timer.h>
#include <qdf_lock.h>
#include <qdf_nbuf.h>
#include <wlan_mgmt_txrx_utils_api.h>
#include <wlan_mgmt_txrx_rx_reo_utils_api.h>
#include <wlan_mgmt_txrx_rx_reo_public_structs.h>
/**
@@ -61,8 +61,6 @@ struct mgmt_rx_reo_list_entry {
uint32_t insertion_timestamp;
};
struct mgmt_rx_reo_snapshot;
/*
* struct mgmt_rx_reo_pdev_info - Pdev information required by the Management
* Rx REO module
@@ -74,7 +72,7 @@ struct mgmt_rx_reo_snapshot;
* to the Host by FW
*/
struct mgmt_rx_reo_pdev_info {
struct mgmt_rx_reo_snapshot_simplified host_or_fw_consumed_snapshot;
struct mgmt_rx_reo_snapshot_params host_or_fw_consumed_snapshot;
struct mgmt_rx_reo_snapshot *mac_hw_snapshot;
struct mgmt_rx_reo_snapshot *fw_consumed_snapshot;
struct mgmt_rx_reo_snapshot *fw_forwarded_snapshot;

View File

@@ -21,11 +21,26 @@
#ifndef _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H
#define _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H
#ifdef WLAN_MGMT_RX_REO_SUPPORT
/*
* enum mgmt_rx_reo_snapshot_id - Represents the management rx-reorder
* snapshot identifier.
* @MGMT_RX_REO_SNAPSHOT_MAC_HW: MAC HW snapshot
* @MGMT_RX_REO_SNAPSHOT_FW_CONSUMED: FW consumed snapshot
* @MGMT_RX_REO_SNAPSHOT_FW_FORWADED: FW forwarded snapshot
* @MGMT_RX_REO_SNAPSHOT_MAX: Max number of snapshots
* @MGMT_RX_REO_SNAPSHOT_INVALID: Invalid snapshot
*/
enum mgmt_rx_reo_snapshot_id {
MGMT_RX_REO_SNAPSHOT_MAC_HW = 0,
MGMT_RX_REO_SNAPSHOT_FW_CONSUMED,
MGMT_RX_REO_SNAPSHOT_FW_FORWADED,
MGMT_RX_REO_SNAPSHOT_MAX,
MGMT_RX_REO_SNAPSHOT_INVALID,
};
/*
* struct mgmt_rx_reo_snapshot_simplified - Represents the simplified version of
* struct mgmt_rx_reo_snapshot_params - Represents the simplified version of
* Management Rx Frame snapshot for Host use. Note that this is different from
* the structure shared between the Host and FW/HW
* @valid: Whether this snapshot is valid
@@ -34,11 +49,20 @@
* @global_timestamp: Global timestamp.This is taken from a clock which is
* common across all the HW links
*/
struct mgmt_rx_reo_snapshot_simplified {
struct mgmt_rx_reo_snapshot_params {
bool valid;
uint16_t mgmt_pkt_ctr;
uint32_t global_timestamp;
};
/*
* struct mgmt_rx_reo_snapshot - Represents the management rx-reorder snapshot
* @mgmt_rx_reo_snapshot_low: Lower 32 bits of the reo snapshot
* @mgmt_rx_reo_snapshot_high: Higher 32 bits of the reo snapshot
*/
struct mgmt_rx_reo_snapshot {
uint32_t mgmt_rx_reo_snapshot_low;
uint32_t mgmt_rx_reo_snapshot_high;
};
#endif /* WLAN_MGMT_RX_REO_SUPPORT */
#endif /* _WLAN_MGMT_TXRX_RX_REO_PUBLIC_STRUCTS_H */

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2021, The Linux Foundation. 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_mgmt_txrx_rx_reo_tgt_api.h
* This file contains mgmt rx re-ordering tgt layer related APIs
*/
#ifndef _WLAN_MGMT_TXRX_RX_REO_TGT_API_H
#define _WLAN_MGMT_TXRX_RX_REO_TGT_API_H
#include <wlan_objmgr_pdev_obj.h>
#include <qdf_types.h>
#include <wlan_mgmt_txrx_rx_reo_public_structs.h>
#include <wlan_mgmt_txrx_rx_reo_utils_api.h>
#ifdef WLAN_MGMT_RX_REO_SUPPORT
/**
* tgt_mgmt_rx_reo_read_snapshot() - Read management rx-reorder snapshot
* @pdev: Pointer to pdev object
* @address: Snapshot address
* @id: Snapshot ID
* @value: Pointer to the snapshot value where the snapshot
* should be written
*
* Read management rx-reorder snapshots from target.
*
* Return: QDF_STATUS
*/
QDF_STATUS
tgt_mgmt_rx_reo_read_snapshot(struct wlan_objmgr_pdev *pdev,
struct mgmt_rx_reo_snapshot *address,
enum mgmt_rx_reo_snapshot_id id,
struct mgmt_rx_reo_snapshot_params *value);
#endif /* WLAN_MGMT_RX_REO_SUPPORT */
#endif /* _WLAN_MGMT_TXRX_RX_REO_TGT_API_H */

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2021, The Linux Foundation. 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.
*/
#ifndef _WLAN_MGMT_TXRX_RX_REO_UTILS_API_H_
#define _WLAN_MGMT_TXRX_RX_REO_UTILS_API_H_
/**
* DOC: wlan_mgmt_txrx_rx_reo_utils_api.h
*
* management rx-reorder public APIs and structures
* for umac converged components.
*
*/
#include <wlan_mgmt_txrx_utils_api.h>
#ifdef WLAN_MGMT_RX_REO_SUPPORT
#define mgmt_rx_reo_alert mgmt_txrx_alert
#define mgmt_rx_reo_err mgmt_txrx_err
#define mgmt_rx_reo_warn mgmt_txrx_warn
#define mgmt_rx_reo_notice mgmt_txrx_notice
#define mgmt_rx_reo_info mgmt_txrx_info
#define mgmt_rx_reo_debug mgmt_txrx_debug
#endif /* WLAN_MGMT_RX_REO_SUPPORT*/
#endif /* _WLAN_MGMT_TXRX_RX_REO_UTILS_API_H_ */

View File

@@ -0,0 +1,79 @@
/*
* Copyright (c) 2021, The Linux Foundation. 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_mgmt_txrx_rx_re_tgt_api.c
* This file contains mgmt rx re-ordering tgt layer related function
* definitions
*/
#include <wlan_mgmt_txrx_rx_reo_tgt_api.h>
#include <wlan_lmac_if_def.h>
/**
* wlan_pdev_get_mgmt_rx_reo_txops() - Get management rx-reorder txops from pdev
* @pdev: Pointer to pdev object
*
* Read management rx-reorder snapshots from target.
*
* Return: Pointer to management rx-reorder txops
*/
static struct wlan_lmac_if_mgmt_rx_reo_tx_ops *
wlan_pdev_get_mgmt_rx_reo_txops(struct wlan_objmgr_pdev *pdev)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_lmac_if_tx_ops *tx_ops;
if (!pdev) {
mgmt_rx_reo_err("pdev is NULL");
return NULL;
}
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
mgmt_rx_reo_err("psoc is NULL");
return NULL;
}
tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
if (!tx_ops) {
mgmt_rx_reo_err("tx_ops is NULL");
return NULL;
}
return &tx_ops->mgmt_txrx_tx_ops.mgmt_rx_reo_tx_ops;
}
QDF_STATUS
tgt_mgmt_rx_reo_read_snapshot(struct wlan_objmgr_pdev *pdev,
struct mgmt_rx_reo_snapshot *address,
enum mgmt_rx_reo_snapshot_id id,
struct mgmt_rx_reo_snapshot_params *value)
{
struct wlan_lmac_if_mgmt_rx_reo_tx_ops *mgmt_rx_reo_txops;
mgmt_rx_reo_txops = wlan_pdev_get_mgmt_rx_reo_txops(pdev);
if (!mgmt_rx_reo_txops) {
mgmt_rx_reo_err("mgmt rx reo txops is NULL");
return QDF_STATUS_E_INVAL;
}
if (!mgmt_rx_reo_txops->read_mgmt_rx_reo_snapshot) {
mgmt_rx_reo_err("mgmt rx reo read snapshot txops is NULL");
return QDF_STATUS_E_NULL_VALUE;
}
return mgmt_rx_reo_txops->read_mgmt_rx_reo_snapshot(address, id, value);
}

View File

@@ -53,6 +53,7 @@
#ifdef WLAN_IOT_SIM_SUPPORT
#include <wlan_iot_sim_public_structs.h>
#endif
#include <wlan_mgmt_txrx_rx_reo_public_structs.h>
/* Number of dev type: Direct attach and Offload */
#define MAX_DEV_TYPE 2
@@ -211,6 +212,20 @@ struct wlan_target_if_dcs_rx_ops {
};
#endif
#ifdef WLAN_MGMT_RX_REO_SUPPORT
/**
* struct wlan_lmac_if_mgmt_txrx_tx_ops - structure of tx function
* pointers for mgmt rx reo
* @read_mgmt_rx_reo_snapshot: Read rx-reorder snapshots
*/
struct wlan_lmac_if_mgmt_rx_reo_tx_ops {
QDF_STATUS (*read_mgmt_rx_reo_snapshot)
(struct mgmt_rx_reo_snapshot *address,
enum mgmt_rx_reo_snapshot_id id,
struct mgmt_rx_reo_snapshot_params *value);
};
#endif
/**
* struct wlan_lmac_if_mgmt_txrx_tx_ops - structure of tx function
* pointers for mgmt txrx component
@@ -221,6 +236,7 @@ struct wlan_target_if_dcs_rx_ops {
* pending mgmt frames cleanup
* @reg_ev_handler: function pointer to register event handlers
* @unreg_ev_handler: function pointer to unregister event handlers
* @mgmt_rx_reo_tx_ops: management rx-reorder txops
*/
struct wlan_lmac_if_mgmt_txrx_tx_ops {
QDF_STATUS (*mgmt_tx_send)(struct wlan_objmgr_vdev *vdev,
@@ -234,6 +250,9 @@ struct wlan_lmac_if_mgmt_txrx_tx_ops {
qdf_nbuf_t nbuf);
QDF_STATUS (*reg_ev_handler)(struct wlan_objmgr_psoc *psoc);
QDF_STATUS (*unreg_ev_handler)(struct wlan_objmgr_psoc *psoc);
#ifdef WLAN_MGMT_RX_REO_SUPPORT
struct wlan_lmac_if_mgmt_rx_reo_tx_ops mgmt_rx_reo_tx_ops;
#endif
};
/**