qcacld-3.0: Check pmf status while processing mgmt packets

Add pmf status checks while processing management packets
in packet capture component.

Change-Id: I04e1f7eb33573a3f77f53f9ffbdf0781041be100
CRs-Fixed: 2633851
This commit is contained in:
Dundi Raviteja 2020-03-02 12:00:16 +05:30 • committed by nshrivas
commit b3134da83d
10 changed files with 118 additions and 10 deletions

View file

@ -95,9 +95,11 @@ struct pkt_capture_vdev_priv {
* struct pkt_psoc_priv - Private object to be stored in psoc
* @psoc: pointer to psoc object
* @cfg_param: INI config params for packet capture
* @cb_obj: struct contaning callback pointers
*/
struct pkt_psoc_priv {
struct wlan_objmgr_psoc *psoc;
struct pkt_capture_cfg cfg_param;
struct pkt_capture_callbacks cb_obj;
};
#endif /* End of _WLAN_PKT_CAPTURE_PRIV_STRUCT_H_ */

View file

@ -177,20 +177,47 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev,
uint8_t status)
{
struct mon_rx_status txrx_status = {0};
struct pkt_psoc_priv *psoc_priv;
struct wlan_objmgr_vdev *vdev;
struct wlan_objmgr_psoc *psoc;
uint16_t channel_flags = 0;
tpSirMacFrameCtl pfc = (tpSirMacFrameCtl) (qdf_nbuf_data(nbuf));
struct ieee80211_frame *wh;
uint8_t mgt_type;
uint8_t mgt_type, vdev_id;
int rmf_enabled;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc)
return QDF_STATUS_E_FAILURE;
psoc_priv = pkt_capture_psoc_get_priv(psoc);
if (!psoc_priv) {
pkt_capture_err("psoc priv is NULL");
return QDF_STATUS_E_FAILURE;
}
wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);
vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(pdev,
wh->i_addr2,
WLAN_PKT_CAPTURE_ID);
if (!vdev) {
pkt_capture_err("vdev is NULL");
return QDF_STATUS_E_FAILURE;
}
vdev_id = wlan_vdev_get_id(vdev);
wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID);
rmf_enabled = psoc_priv->cb_obj.get_rmf_status(vdev_id);
if (rmf_enabled < 0) {
pkt_capture_err("unable to get rmf status");
return QDF_STATUS_E_FAILURE;
}
mgt_type = (wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
if (mgt_type == IEEE80211_FC0_TYPE_MGT &&
if (rmf_enabled &&
(mgt_type == IEEE80211_FC0_TYPE_MGT) &&
(pfc->subType == SIR_MAC_MGMT_DISASSOC ||
pfc->subType == SIR_MAC_MGMT_DEAUTH ||
pfc->subType == SIR_MAC_MGMT_ACTION)) {
@ -203,7 +230,7 @@ pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev,
orig_hdr = (uint8_t *)qdf_nbuf_data(nbuf);
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
status = mlme_get_peer_mic_len(psoc, pdev_id,
wh->i_addr2,
wh->i_addr1,
&mic_len,
&hdr_len);
if (QDF_IS_STATUS_ERROR(status)) {

View file

@ -58,4 +58,12 @@ struct mgmt_offload_event_params {
uint8_t *buf;
uint8_t tx_retry_cnt;
};
/**
* struct pkt_capture_callbacks - callbacks to non-converged driver
* @get_rmf_status: callback to get rmf status
*/
struct pkt_capture_callbacks {
int (*get_rmf_status)(uint8_t vdev_id);
};
#endif /* _WLAN_PKT_CAPTURE_PUBLIC_STRUCTS_H_ */

View file

@ -263,6 +263,17 @@ void ucfg_pkt_capture_tx_completion_process(
* Return: None
*/
void ucfg_pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev);
/**
* ucfg_pkt_capture_register_callbacks - ucfg API to register WMA callbacks
* @psoc - pointer to psoc object
* @cb_obj - Pointer to packet capture callback structure
*
* Return: status of operation
*/
int
ucfg_pkt_capture_register_wma_callbacks(struct wlan_objmgr_psoc *psoc,
struct pkt_capture_callbacks *cb_obj);
#else
static inline
QDF_STATUS ucfg_pkt_capture_init(void)

View file

@ -339,3 +339,19 @@ void ucfg_pkt_capture_record_channel(struct wlan_objmgr_vdev *vdev)
{
pkt_capture_record_channel(vdev);
}
int
ucfg_pkt_capture_register_wma_callbacks(struct wlan_objmgr_psoc *psoc,
struct pkt_capture_callbacks *cb_obj)
{
struct pkt_psoc_priv *psoc_priv = pkt_capture_psoc_get_priv(psoc);
if (!psoc_priv) {
pkt_capture_err("psoc priv is NULL");
return -EINVAL;
}
psoc_priv->cb_obj.get_rmf_status = cb_obj->get_rmf_status;
return 0;
}

View file

@ -178,6 +178,10 @@ QDF_STATUS wma_get_connection_info(uint8_t vdev_id,
QDF_STATUS wma_ndi_update_connection_info(uint8_t vdev_id,
struct nan_datapath_channel_info *ndp_chan_info);
#ifdef WLAN_FEATURE_PKT_CAPTURE
int wma_get_rmf_status(uint8_t vdev_id);
#endif
bool wma_is_vdev_up(uint8_t vdev_id);
void *wma_get_beacon_buffer_by_vdev_id(uint8_t vdev_id, uint32_t *buffer_size);

View file

@ -2792,9 +2792,12 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
WLAN_MGMT_NB_ID);
}
ucfg_pkt_capture_mgmt_tx(wma_handle->pdev,
tx_frame, wma_handle->interfaces[vdev_id].mhz,
mgmt_param.tx_param.preamble_type);
if (ucfg_pkt_capture_get_pktcap_mode(psoc)) {
ucfg_pkt_capture_mgmt_tx(wma_handle->pdev,
tx_frame,
wma_handle->interfaces[vdev_id].mhz,
mgmt_param.tx_param.preamble_type);
}
status = wlan_mgmt_txrx_mgmt_frame_tx(peer, wma_handle->mac_context,
(qdf_nbuf_t)tx_frame, NULL,

View file

@ -106,6 +106,10 @@
#include <target_if_direct_buf_rx_api.h>
#endif
#ifdef WLAN_FEATURE_PKT_CAPTURE
#include "wlan_pkt_capture_ucfg_api.h"
#endif
#define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */
#define WMI_TLV_HEADROOM 128
@ -2844,6 +2848,23 @@ static void wma_register_nan_callbacks(tp_wma_handle wma_handle)
}
#endif
#ifdef WLAN_FEATURE_PKT_CAPTURE
static void
wma_register_pkt_capture_callbacks(tp_wma_handle wma_handle)
{
struct pkt_capture_callbacks cb_obj = {0};
cb_obj.get_rmf_status = wma_get_rmf_status;
ucfg_pkt_capture_register_wma_callbacks(wma_handle->psoc, &cb_obj);
}
#else
static inline void
wma_register_pkt_capture_callbacks(tp_wma_handle wma_handle)
{
}
#endif
/**
* wma_open() - Allocate wma context and initialize it.
* @cds_context: cds context
@ -3373,6 +3394,7 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
wma_vdev_get_beacon_interval);
wma_cbacks.wma_get_connection_info = wma_get_connection_info;
wma_register_nan_callbacks(wma_handle);
wma_register_pkt_capture_callbacks(wma_handle);
qdf_status = policy_mgr_register_wma_cb(wma_handle->psoc, &wma_cbacks);
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
WMA_LOGE("Failed to register wma cb with Policy Manager");

View file

@ -2683,8 +2683,8 @@ int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
}
cmpl_params = param_buf->fixed_param;
if (ucfg_pkt_capture_get_pktcap_mode(wma_handle->psoc) &
PKT_CAPTURE_MODE_MGMT_ONLY) {
if ((ucfg_pkt_capture_get_pktcap_mode(wma_handle->psoc) &
PKT_CAPTURE_MODE_MGMT_ONLY) && param_buf->mgmt_hdr) {
struct mgmt_offload_event_params params = {0};
wma_extract_mgmt_offload_event_params(
@ -2758,8 +2758,8 @@ int wma_mgmt_tx_bundle_completion_handler(void *handle, uint8_t *buf,
}
for (i = 0; i < num_reports; i++) {
if (ucfg_pkt_capture_get_pktcap_mode(wma_handle->psoc) &
PKT_CAPTURE_MODE_MGMT_ONLY) {
if ((ucfg_pkt_capture_get_pktcap_mode(wma_handle->psoc) &
PKT_CAPTURE_MODE_MGMT_ONLY) && param_buf->mgmt_hdr) {
struct mgmt_offload_event_params params = {0};
wma_extract_mgmt_offload_event_params(

View file

@ -3601,6 +3601,21 @@ struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id)
return &wma->interfaces[vdev_id];
}
#ifdef WLAN_FEATURE_PKT_CAPTURE
int wma_get_rmf_status(uint8_t vdev_id)
{
struct wma_txrx_node *iface;
iface = wma_get_interface_by_vdev_id(vdev_id);
if (!iface) {
WMA_LOGE("Unable to get wma interface");
return -EINVAL;
}
return iface->rmfEnabled;
}
#endif
/**
* wma_update_intf_hw_mode_params() - Update WMA params
* @vdev_id: VDEV id whose params needs to be updated