qcacmn: Add support for PHY logging for pktlog

The user can add phy logging to be enabled in user space
by using '-ephy' option, which will let the host know about
this corresponding event and will send the event information
to the firmware.

Change-Id: Ibb4888101a80a765d196264403ce7912d1a6e9aa
This commit is contained in:
Ramanathan Choodamani 2020-04-08 17:34:30 -07:00 committed by nshrivas
parent 8186e7d0cf
commit 40ef96ef99
2 changed files with 70 additions and 12 deletions

View File

@ -6265,21 +6265,48 @@ typedef struct _wmi_host_dcs_im_tgt_stats {
uint32_t reg_rxclr_ext80_cnt;
} wmi_host_dcs_im_tgt_stats_t;
#ifndef BIT
#define BIT(n) (1 << (n))
#endif
/**
* Enum for pktlog req
*/
enum {
WMI_HOST_PKTLOG_EVENT_RX_BIT,
WMI_HOST_PKTLOG_EVENT_TX_BIT,
WMI_HOST_PKTLOG_EVENT_RCF_BIT,
WMI_HOST_PKTLOG_EVENT_RCU_BIT,
WMI_HOST_PKTLOG_EVENT_DBG_PRINT_BIT,
WMI_HOST_PKTLOG_EVENT_SMART_ANTENNA_BIT,
WMI_HOST_PKTLOG_EVENT_H_INFO_BIT,
WMI_HOST_PKTLOG_EVENT_STEERING_BIT,
WMI_HOST_PKTLOG_EVENT_TX_DATA_CAPTURE_BIT,
WMI_HOST_PKTLOG_EVENT_PHY_LOGGING_BIT,
};
typedef enum {
WMI_HOST_PKTLOG_EVENT_RX = 0x1,
WMI_HOST_PKTLOG_EVENT_TX = 0x2,
WMI_HOST_PKTLOG_EVENT_RCF = 0x4, /* Rate Control Find */
WMI_HOST_PKTLOG_EVENT_RCU = 0x8, /* Rate Control Update */
WMI_HOST_PKTLOG_EVENT_DBG_PRINT = 0x10, /* DEBUG prints */
WMI_HOST_PKTLOG_EVENT_RX = BIT(WMI_HOST_PKTLOG_EVENT_RX_BIT),
WMI_HOST_PKTLOG_EVENT_TX = BIT(WMI_HOST_PKTLOG_EVENT_TX_BIT),
WMI_HOST_PKTLOG_EVENT_RCF =
BIT(WMI_HOST_PKTLOG_EVENT_RCF_BIT), /* Rate Control Find */
WMI_HOST_PKTLOG_EVENT_RCU =
BIT(WMI_HOST_PKTLOG_EVENT_RCU_BIT), /* Rate Control Update */
WMI_HOST_PKTLOG_EVENT_DBG_PRINT =
BIT(WMI_HOST_PKTLOG_EVENT_DBG_PRINT_BIT), /* DEBUG prints */
/* To support Smart Antenna */
WMI_HOST_PKTLOG_EVENT_SMART_ANTENNA = 0x20,
WMI_HOST_PKTLOG_EVENT_H_INFO = 0x40,
WMI_HOST_PKTLOG_EVENT_STEERING = 0x80,
WMI_HOST_PKTLOG_EVENT_SMART_ANTENNA =
BIT(WMI_HOST_PKTLOG_EVENT_SMART_ANTENNA_BIT),
WMI_HOST_PKTLOG_EVENT_H_INFO =
BIT(WMI_HOST_PKTLOG_EVENT_H_INFO_BIT),
WMI_HOST_PKTLOG_EVENT_STEERING =
BIT(WMI_HOST_PKTLOG_EVENT_STEERING_BIT),
/* To support Tx data Capture */
WMI_HOST_PKTLOG_EVENT_TX_DATA_CAPTURE = 0x100,
WMI_HOST_PKTLOG_EVENT_TX_DATA_CAPTURE =
BIT(WMI_HOST_PKTLOG_EVENT_TX_DATA_CAPTURE_BIT),
/* To support PHY logging */
WMI_HOST_PKTLOG_EVENT_PHY_LOGGING =
BIT(WMI_HOST_PKTLOG_EVENT_PHY_LOGGING_BIT),
} WMI_HOST_PKTLOG_EVENT;
/**

View File

@ -494,6 +494,26 @@ static const uint32_t vdev_param_tlv[] = {
};
#endif
/**
* Populate the pktlog event tlv array, where
* the values are the FW WMI events, which host
* uses to communicate with FW for pktlog
*/
static const uint32_t pktlog_event_tlv[] = {
[WMI_HOST_PKTLOG_EVENT_RX_BIT] = WMI_PKTLOG_EVENT_RX,
[WMI_HOST_PKTLOG_EVENT_TX_BIT] = WMI_PKTLOG_EVENT_TX,
[WMI_HOST_PKTLOG_EVENT_RCF_BIT] = WMI_PKTLOG_EVENT_RCF,
[WMI_HOST_PKTLOG_EVENT_RCU_BIT] = WMI_PKTLOG_EVENT_RCU,
[WMI_HOST_PKTLOG_EVENT_DBG_PRINT_BIT] = 0,
[WMI_HOST_PKTLOG_EVENT_SMART_ANTENNA_BIT] =
WMI_PKTLOG_EVENT_SMART_ANTENNA,
[WMI_HOST_PKTLOG_EVENT_H_INFO_BIT] = 0,
[WMI_HOST_PKTLOG_EVENT_STEERING_BIT] = 0,
[WMI_HOST_PKTLOG_EVENT_TX_DATA_CAPTURE_BIT] = 0,
[WMI_HOST_PKTLOG_EVENT_PHY_LOGGING_BIT] = WMI_PKTLOG_EVENT_PHY,
};
/**
* convert_host_pdev_id_to_target_pdev_id() - Convert pdev_id from
* host to target defines.
@ -2207,7 +2227,7 @@ static QDF_STATUS send_peer_based_pktlog_cmd(wmi_unified_t wmi_handle,
static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle,
WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id)
{
int32_t ret;
int32_t ret, idx, max_idx;
wmi_pdev_pktlog_enable_cmd_fixed_param *cmd;
wmi_buf_t buf;
uint16_t len = sizeof(wmi_pdev_pktlog_enable_cmd_fixed_param);
@ -2221,7 +2241,12 @@ static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle,
WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_pdev_pktlog_enable_cmd_fixed_param));
cmd->evlist = PKTLOG_EVENT;
max_idx = sizeof(pktlog_event_tlv) / (sizeof(pktlog_event_tlv[0]));
cmd->evlist = 0;
for (idx = 0; idx < max_idx; idx++) {
if (PKTLOG_EVENT & (1 << idx))
cmd->evlist |= pktlog_event_tlv[idx];
}
cmd->pdev_id = mac_id;
wmi_mtrace(WMI_PDEV_PKTLOG_ENABLE_CMDID, cmd->pdev_id, 0);
ret = wmi_unified_cmd_send(wmi_handle, buf, len,
@ -5740,10 +5765,12 @@ static QDF_STATUS send_pktlog_wmi_send_cmd_tlv(wmi_unified_t wmi_handle,
wmi_pdev_pktlog_disable_cmd_fixed_param *disable_cmd;
int len = 0;
wmi_buf_t buf;
int32_t idx, max_idx;
PKTLOG_EVENT = pktlog_event;
CMD_ID = cmd_id;
max_idx = sizeof(pktlog_event_tlv) / (sizeof(pktlog_event_tlv[0]));
switch (CMD_ID) {
case WMI_PDEV_PKTLOG_ENABLE_CMDID:
len = sizeof(*cmd);
@ -5757,7 +5784,11 @@ static QDF_STATUS send_pktlog_wmi_send_cmd_tlv(wmi_unified_t wmi_handle,
WMITLV_TAG_STRUC_wmi_pdev_pktlog_enable_cmd_fixed_param,
WMITLV_GET_STRUCT_TLVLEN
(wmi_pdev_pktlog_enable_cmd_fixed_param));
cmd->evlist = PKTLOG_EVENT;
cmd->evlist = 0;
for (idx = 0; idx < max_idx; idx++) {
if (PKTLOG_EVENT & (1 << idx))
cmd->evlist |= pktlog_event_tlv[idx];
}
cmd->enable = user_triggered ? WMI_PKTLOG_ENABLE_FORCE
: WMI_PKTLOG_ENABLE_AUTO;
cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(