qca-wifi: Protocol tag support in lite rx monitor
Add protocol tagging support in lite rx monitor mode. Change-Id: If95f43cade89d2a980dd6868f40fe7f5413bf019 CRs-Fixed: 2448531
This commit is contained in:
@@ -27,6 +27,10 @@
|
||||
#define RX_ENH_CB_BUF_RESERVATION 256
|
||||
#define RX_ENH_CB_BUF_ALIGNMENT 4
|
||||
|
||||
#define RX_ENH_CAPTURE_TRAILER_LEN 8
|
||||
#define RX_ENH_CAPTURE_MODE_MASK 0x0F
|
||||
#define RX_ENH_CAPTURE_TRAILER_ENABLE_MASK 0x10
|
||||
|
||||
/**
|
||||
* struct cdp_rx_indication_mpdu_info - Rx MPDU info
|
||||
* @ppdu_id: PPDU Id
|
||||
|
@@ -103,6 +103,173 @@ dp_rx_populate_cdp_indication_mpdu_info(
|
||||
cdp_mpdu_info->per_chain_rssi[i] = ppdu_info->rx_status.rssi[i];
|
||||
}
|
||||
|
||||
#ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
|
||||
/*
|
||||
* dp_rx_mon_enh_capture_set_protocol_tag() - Tags the actual nbuf with
|
||||
* cached data read from TLV
|
||||
* @pdev: pdev structure
|
||||
* @ppdu_info: ppdu info structure from monitor status ring
|
||||
* @user_id: user ID on which the PPDU is received
|
||||
* @nbuf: packet buffer on which metadata have to be updated
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void
|
||||
dp_rx_mon_enh_capture_set_protocol_tag(struct dp_pdev *pdev,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
uint32_t user_id,
|
||||
qdf_nbuf_t nbuf)
|
||||
{
|
||||
uint32_t cce_metadata = 0;
|
||||
uint16_t protocol_tag = 0;
|
||||
|
||||
/**
|
||||
* Since skb->cb is memset to 0, we can skip setting protocol tag to 0
|
||||
* in all the error paths.
|
||||
*/
|
||||
|
||||
cce_metadata = ppdu_info->rx_msdu_info[user_id].cce_metadata;
|
||||
|
||||
/**
|
||||
* Received CCE metadata should be
|
||||
* within the valid limits
|
||||
*/
|
||||
if (qdf_unlikely((cce_metadata < RX_PROTOCOL_TAG_START_OFFSET) ||
|
||||
(cce_metadata >= (RX_PROTOCOL_TAG_START_OFFSET
|
||||
+ RX_PROTOCOL_TAG_MAX))))
|
||||
return;
|
||||
|
||||
/**
|
||||
* The CCE metadata received is just the
|
||||
* packet_type + RX_PROTOCOL_TAG_START_OFFSET
|
||||
*/
|
||||
cce_metadata -= RX_PROTOCOL_TAG_START_OFFSET;
|
||||
|
||||
/**
|
||||
* Update the QDF packet with the user specified tag/metadata
|
||||
* by looking up tag value for received protocol type.
|
||||
*/
|
||||
protocol_tag = pdev->rx_proto_tag_map[cce_metadata].tag;
|
||||
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW,
|
||||
"%s: Setting ProtoID:%d Tag %u", __func__,
|
||||
cce_metadata, protocol_tag);
|
||||
qdf_nbuf_set_rx_protocol_tag(nbuf, protocol_tag);
|
||||
}
|
||||
|
||||
/*
|
||||
* dp_rx_mon_enh_capture_tag_protocol_type() - Support protocol tagging
|
||||
* for packets captured in enhanced capture mode
|
||||
* @pdev: pdev structure
|
||||
* @ppdu_info: ppdu info structure from monitor status ring
|
||||
* @user_id: user ID on which the PPDU is received
|
||||
* @nbuf: packet buffer on which tag should be updated
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void
|
||||
dp_rx_mon_enh_capture_tag_protocol_type(struct dp_pdev *pdev,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
uint32_t user_id, qdf_nbuf_t nbuf)
|
||||
{
|
||||
/**
|
||||
* Since skb->cb is memset to 0, we can skip setting protocol tag to 0
|
||||
* in all the error paths.
|
||||
*/
|
||||
if (!pdev->is_rx_protocol_tagging_enabled)
|
||||
return;
|
||||
|
||||
/**
|
||||
* It is assumed that we have already received RX Header/ MSDU
|
||||
* Start TLV for this MSDU.
|
||||
*/
|
||||
dp_rx_mon_enh_capture_set_protocol_tag(pdev, ppdu_info,
|
||||
user_id, nbuf);
|
||||
|
||||
/* Reset MSDU tag variables on completion of every MSDU tag */
|
||||
ppdu_info->rx_msdu_info[user_id].cce_metadata = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* dp_rx_mon_enh_capture_set_protocol_tag_in_trailer - update msdu trailer
|
||||
* with protocol tag
|
||||
* @nbuf: packet buffer on which metadata have to be updated
|
||||
* @trailer: pointer to rx monitor-lite trailer
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
static inline
|
||||
void dp_rx_mon_enh_capture_set_protocol_tag_in_trailer(qdf_nbuf_t nbuf,
|
||||
void *trailer)
|
||||
{
|
||||
uint16_t protocol_tag = qdf_nbuf_get_rx_protocol_tag(nbuf);
|
||||
struct dp_rx_mon_enh_trailer_data *nbuf_trailer =
|
||||
(struct dp_rx_mon_enh_trailer_data *)trailer;
|
||||
|
||||
if (protocol_tag != 0)
|
||||
nbuf_trailer->protocol_tag = protocol_tag;
|
||||
}
|
||||
|
||||
#else
|
||||
static void
|
||||
dp_rx_mon_enh_capture_tag_protocol_type(struct dp_pdev *pdev,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
uint32_t user_id, qdf_nbuf_t nbuf)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
dp_rx_mon_enh_capture_set_protocol_tag(struct dp_pdev *pdev,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
uint32_t user_id, qdf_nbuf_t nbuf)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void dp_rx_mon_enh_capture_set_protocol_tag_in_trailer(qdf_nbuf_t nbuf,
|
||||
void *trailer)
|
||||
{
|
||||
}
|
||||
#endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
|
||||
|
||||
/*
|
||||
* dp_rx_mon_enh_capture_update_trailer() - Update trailer with custom data
|
||||
* @pdev: pdev structure
|
||||
* @nbuf: packet buffer on which metadata have to be updated
|
||||
*
|
||||
* Return: return number of bytes updated in the tail
|
||||
*/
|
||||
static inline
|
||||
uint16_t dp_rx_mon_enh_capture_update_trailer(struct dp_pdev *pdev,
|
||||
qdf_nbuf_t nbuf)
|
||||
{
|
||||
uint64_t trailer;
|
||||
uint8_t *dest;
|
||||
struct dp_rx_mon_enh_trailer_data *nbuf_trailer =
|
||||
(struct dp_rx_mon_enh_trailer_data *)&trailer;
|
||||
|
||||
if (qdf_unlikely(qdf_nbuf_len(nbuf) < sizeof(trailer)))
|
||||
return 0;
|
||||
|
||||
trailer = RX_MON_CAP_ENH_TRAILER;
|
||||
|
||||
dp_rx_mon_enh_capture_set_protocol_tag_in_trailer(nbuf, nbuf_trailer);
|
||||
|
||||
/**
|
||||
* Overwrite last 8 bytes of data with trailer. This is ok since we
|
||||
* do not care about the data in this debug mode.
|
||||
*/
|
||||
qdf_nbuf_trim_tail(nbuf, sizeof(trailer));
|
||||
dest = qdf_nbuf_put_tail(nbuf, sizeof(trailer));
|
||||
if (qdf_likely(dest)) {
|
||||
qdf_mem_copy(dest, &trailer, sizeof(trailer));
|
||||
} else {
|
||||
dp_err("Unable to add tail room");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sizeof(trailer);
|
||||
}
|
||||
|
||||
/*
|
||||
* dp_rx_handle_enh_capture() - Deliver Rx enhanced capture data
|
||||
* @pdev: pdev ctx
|
||||
@@ -129,6 +296,7 @@ dp_rx_handle_enh_capture(struct dp_soc *soc, struct dp_pdev *pdev,
|
||||
dp_rx_free_msdu_list(msdu_list);
|
||||
mpdu_ind = &pdev->mpdu_ind[user];
|
||||
mpdu_info = &mpdu_ind->mpdu_info;
|
||||
pdev->is_mpdu_hdr[user] = true;
|
||||
|
||||
dp_rx_populate_cdp_indication_mpdu_info(
|
||||
pdev, &pdev->ppdu_info, mpdu_info, user);
|
||||
@@ -148,7 +316,6 @@ dp_rx_handle_enh_capture(struct dp_soc *soc, struct dp_pdev *pdev,
|
||||
}
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* dp_rx_mon_enh_capture_process() - Rx enhanced capture mode
|
||||
* processing.
|
||||
@@ -157,7 +324,6 @@ dp_rx_handle_enh_capture(struct dp_soc *soc, struct dp_pdev *pdev,
|
||||
* @status_nbuf: monitor status ring buffer
|
||||
* @ppdu_info: ppdu info structure from monitor status ring
|
||||
* @nbuf_used: nbuf need a clone
|
||||
* @rx_enh_capture_mode: Rx enhanced capture mode
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
@@ -165,8 +331,7 @@ void
|
||||
dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
qdf_nbuf_t status_nbuf,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
bool *nbuf_used,
|
||||
uint32_t rx_enh_capture_mode)
|
||||
bool *nbuf_used)
|
||||
{
|
||||
qdf_nbuf_t nbuf;
|
||||
struct msdu_list *msdu_list;
|
||||
@@ -174,14 +339,14 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
struct dp_soc *soc;
|
||||
qdf_nbuf_t mpdu_head;
|
||||
|
||||
if (rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_DISABLED)
|
||||
if (pdev->rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_DISABLED)
|
||||
return;
|
||||
|
||||
user_id = ppdu_info->user_id;
|
||||
|
||||
if ((tlv_status == HAL_TLV_STATUS_HEADER) && (
|
||||
(rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU_MSDU) ||
|
||||
((rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU) &&
|
||||
(pdev->rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU_MSDU) ||
|
||||
((pdev->rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU) &&
|
||||
pdev->is_mpdu_hdr[user_id]))) {
|
||||
|
||||
if (*nbuf_used) {
|
||||
@@ -194,9 +359,10 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
if (!nbuf)
|
||||
return;
|
||||
|
||||
/* Truncate 4 bytes containing PPDU ID */
|
||||
dp_nbuf_set_data_and_len(nbuf, ppdu_info->data,
|
||||
ppdu_info->hdr_len
|
||||
- 4);
|
||||
ppdu_info->hdr_len - 4);
|
||||
|
||||
if (pdev->is_mpdu_hdr[user_id]) {
|
||||
soc = pdev->soc;
|
||||
mpdu_head = qdf_nbuf_alloc(soc->osdev,
|
||||
@@ -239,6 +405,44 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
}
|
||||
pdev->is_mpdu_hdr[user_id] = true;
|
||||
}
|
||||
|
||||
/* Tag the MSDU/MPDU if a cce_metadata is valid */
|
||||
if ((tlv_status == HAL_TLV_STATUS_MSDU_END) &&
|
||||
(pdev->rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU_MSDU)) {
|
||||
/**
|
||||
* Proceed only if this is a data frame.
|
||||
* We could also rx probes, etc.
|
||||
*/
|
||||
if (!(ppdu_info->nac_info.fc_valid &&
|
||||
(IEEE80211_FC0_TYPE_DATA ==
|
||||
(ppdu_info->nac_info.frame_control &
|
||||
IEEE80211_FC0_TYPE_MASK))))
|
||||
return;
|
||||
|
||||
msdu_list = &pdev->msdu_list[user_id];
|
||||
qdf_assert_always(msdu_list->head);
|
||||
|
||||
/**
|
||||
* Directly move the last MSDU and fetch the same.
|
||||
* The earlier MSDUs should already be tagged as the
|
||||
* packets are tagged at the end of every RX
|
||||
* MSDU.
|
||||
*/
|
||||
nbuf = msdu_list->tail;
|
||||
|
||||
/**
|
||||
* Set the protocol tag value from CCE metadata.
|
||||
*/
|
||||
dp_rx_mon_enh_capture_tag_protocol_type(pdev, ppdu_info,
|
||||
user_id, nbuf);
|
||||
|
||||
if (!pdev->is_rx_enh_capture_trailer_enabled)
|
||||
return;
|
||||
/**
|
||||
* Update necessary information in trailer (for debug purpose)
|
||||
*/
|
||||
dp_rx_mon_enh_capture_update_trailer(pdev, nbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -249,20 +453,33 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
* Return: 0 for success. nonzero for failure.
|
||||
*/
|
||||
QDF_STATUS
|
||||
dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, int val)
|
||||
dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint8_t val)
|
||||
{
|
||||
struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
|
||||
uint8_t rx_cap_mode = (val & RX_ENH_CAPTURE_MODE_MASK);
|
||||
bool is_mpdu_hdr = false;
|
||||
uint8_t user_id;
|
||||
|
||||
if (pdev->mcopy_mode || (val < CDP_RX_ENH_CAPTURE_DISABLED) ||
|
||||
(val > CDP_RX_ENH_CAPTURE_MPDU_MSDU)) {
|
||||
dp_err("Invalid mode");
|
||||
if (pdev->mcopy_mode || (rx_cap_mode < CDP_RX_ENH_CAPTURE_DISABLED) ||
|
||||
(rx_cap_mode > CDP_RX_ENH_CAPTURE_MPDU_MSDU)) {
|
||||
dp_err("Invalid mode: %d", rx_cap_mode);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
if (pdev->rx_enh_capture_mode)
|
||||
dp_reset_monitor_mode(pdev_handle);
|
||||
|
||||
pdev->rx_enh_capture_mode = val;
|
||||
pdev->rx_enh_capture_mode = rx_cap_mode;
|
||||
|
||||
if (rx_cap_mode != CDP_RX_ENH_CAPTURE_DISABLED)
|
||||
is_mpdu_hdr = true;
|
||||
|
||||
for (user_id = 0; user_id < MAX_MU_USERS; user_id++)
|
||||
pdev->is_mpdu_hdr[user_id] = is_mpdu_hdr;
|
||||
|
||||
/* Use a bit from val to enable MSDU trailer for internal debug use */
|
||||
pdev->is_rx_enh_capture_trailer_enabled =
|
||||
(val & RX_ENH_CAPTURE_TRAILER_ENABLE_MASK) ? true : false;
|
||||
return dp_pdev_configure_monitor_rings(pdev);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WLAN_RX_PKT_CAPTURE_ENH */
|
||||
|
@@ -55,7 +55,6 @@ dp_rx_handle_enh_capture(struct dp_soc *soc, struct dp_pdev *pdev,
|
||||
* @status_nbuf: monitor status ring buffer
|
||||
* @ppdu_info: ppdu info structure from monitor status ring
|
||||
* @nbuf_used: nbuf need a clone
|
||||
* @rx_enh_capture_mode: Rx enhanced capture mode
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
@@ -63,8 +62,7 @@ void
|
||||
dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
qdf_nbuf_t status_nbuf,
|
||||
struct hal_rx_ppdu_info *ppdu_info,
|
||||
bool *nbuf_used,
|
||||
uint32_t rx_enh_capture_mode);
|
||||
bool *nbuf_used);
|
||||
|
||||
/*
|
||||
* dp_config_enh_rx_capture()- API to enable/disable enhanced rx capture
|
||||
@@ -74,6 +72,6 @@ dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
|
||||
* Return: 0 for success. nonzero for failure.
|
||||
*/
|
||||
QDF_STATUS
|
||||
dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, int val);
|
||||
#endif
|
||||
#endif
|
||||
dp_config_enh_rx_capture(struct cdp_pdev *pdev_handle, uint8_t val);
|
||||
#endif /* WLAN_RX_PKT_CAPTURE_ENH */
|
||||
#endif /* _DP_RX_MON_FEATURE_H_ */
|
||||
|
Reference in New Issue
Block a user