qcacmn: Extract msdu end TLV information at once during Rx fast path

Rather than extracting msdu end pkt tlv information per field basis
during fast data path, extract msdu end pkt tlv information at once
and store in local structure.

Change-Id: I0877ba4f824d480cc0851c72090f010852d0d203
This commit is contained in:
syed touqeer pasha
2019-12-31 15:45:55 +05:30
committed by nshrivas
parent fc4ac73e9b
commit 6997a37a1e
13 changed files with 179 additions and 26 deletions

View File

@@ -401,9 +401,9 @@ static bool
dp_rx_intrabss_fwd(struct dp_soc *soc,
struct dp_peer *ta_peer,
uint8_t *rx_tlv_hdr,
qdf_nbuf_t nbuf)
qdf_nbuf_t nbuf,
struct hal_rx_msdu_metadata msdu_metadata)
{
uint16_t da_idx;
uint16_t len;
uint8_t is_frag;
struct dp_peer *da_peer;
@@ -420,9 +420,8 @@ dp_rx_intrabss_fwd(struct dp_soc *soc,
*/
if ((qdf_nbuf_is_da_valid(nbuf) && !qdf_nbuf_is_da_mcbc(nbuf))) {
da_idx = hal_rx_msdu_end_da_idx_get(soc->hal_soc, rx_tlv_hdr);
ast_entry = soc->ast_table[da_idx];
ast_entry = soc->ast_table[msdu_metadata.da_idx];
if (!ast_entry)
return false;
@@ -1526,15 +1525,14 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc,
static inline bool is_sa_da_idx_valid(struct dp_soc *soc,
uint8_t *rx_tlv_hdr,
qdf_nbuf_t nbuf)
qdf_nbuf_t nbuf,
struct hal_rx_msdu_metadata msdu_info)
{
if ((qdf_nbuf_is_sa_valid(nbuf) &&
(hal_rx_msdu_end_sa_idx_get(soc->hal_soc, rx_tlv_hdr) >
wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))) ||
(msdu_info.sa_idx > wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))) ||
(!qdf_nbuf_is_da_mcbc(nbuf) &&
qdf_nbuf_is_da_valid(nbuf) &&
(hal_rx_msdu_end_da_idx_get(soc->hal_soc, rx_tlv_hdr) >
wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))))
(msdu_info.da_idx > wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx))))
return false;
return true;
@@ -1766,7 +1764,6 @@ uint32_t dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
union dp_rx_desc_list_elem_t *tail[MAX_PDEV_CNT];
uint32_t num_pending;
uint32_t rx_bufs_used = 0, rx_buf_cookie;
uint32_t l2_hdr_offset = 0;
uint16_t msdu_len = 0;
uint16_t peer_id;
uint8_t vdev_id;
@@ -1799,6 +1796,7 @@ uint32_t dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
uint32_t num_entries_avail = 0;
uint32_t rx_ol_pkt_cnt = 0;
uint32_t num_entries = 0;
struct hal_rx_msdu_metadata msdu_metadata;
DP_HIST_INIT();
@@ -2144,6 +2142,7 @@ done:
* This is the most likely case, we receive 802.3 pkts
* decapsulated by HW, here we need to set the pkt length.
*/
hal_rx_msdu_metadata_get(hal_soc, rx_tlv_hdr, &msdu_metadata);
if (qdf_unlikely(qdf_nbuf_is_frag(nbuf))) {
bool is_mcbc, is_sa_vld, is_da_vld;
@@ -2179,17 +2178,16 @@ done:
continue;
}
} else {
l2_hdr_offset =
hal_rx_msdu_end_l3_hdr_padding_get(soc->hal_soc,
rx_tlv_hdr);
msdu_len = QDF_NBUF_CB_RX_PKT_LEN(nbuf);
pkt_len = msdu_len + l2_hdr_offset + RX_PKT_TLVS_LEN;
pkt_len = msdu_len +
msdu_metadata.l3_hdr_pad +
RX_PKT_TLVS_LEN;
qdf_nbuf_set_pktlen(nbuf, pkt_len);
qdf_nbuf_pull_head(nbuf,
RX_PKT_TLVS_LEN +
l2_hdr_offset);
msdu_metadata.l3_hdr_pad);
}
/*
@@ -2278,7 +2276,8 @@ done:
* Drop the packet if sa_idx and da_idx OOB or
* sa_sw_peerid is 0
*/
if (!is_sa_da_idx_valid(soc, rx_tlv_hdr, nbuf)) {
if (!is_sa_da_idx_valid(soc, rx_tlv_hdr, nbuf,
msdu_metadata)) {
qdf_nbuf_free(nbuf);
nbuf = next;
DP_STATS_INC(soc, rx.err.invalid_sa_da_idx, 1);
@@ -2287,15 +2286,19 @@ done:
}
/* WDS Source Port Learning */
if (qdf_likely(vdev->wds_enabled))
dp_rx_wds_srcport_learn(soc, rx_tlv_hdr,
peer, nbuf);
dp_rx_wds_srcport_learn(soc,
rx_tlv_hdr,
peer,
nbuf,
msdu_metadata);
/* Intrabss-fwd */
if (dp_rx_check_ap_bridge(vdev))
if (dp_rx_intrabss_fwd(soc,
peer,
rx_tlv_hdr,
nbuf)) {
nbuf,
msdu_metadata)) {
nbuf = next;
dp_peer_unref_del_find_by_id(peer);
tid_stats->intrabss_cnt++;

View File

@@ -786,7 +786,8 @@ static inline void
dp_rx_wds_srcport_learn(struct dp_soc *soc,
uint8_t *rx_tlv_hdr,
struct dp_peer *ta_peer,
qdf_nbuf_t nbuf)
qdf_nbuf_t nbuf,
struct hal_rx_msdu_metadata msdu_metadata)
{
}
#endif

View File

@@ -730,11 +730,12 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf,
uint8_t *rx_tlv_hdr, uint8_t pool_id,
struct dp_peer *peer)
{
uint32_t pkt_len, l2_hdr_offset;
uint32_t pkt_len;
uint16_t msdu_len;
struct dp_vdev *vdev;
uint8_t tid;
qdf_ether_header_t *eh;
struct hal_rx_msdu_metadata msdu_metadata;
qdf_nbuf_set_rx_chfrag_start(nbuf,
hal_rx_msdu_end_first_msdu_get(soc->hal_soc,
@@ -751,10 +752,9 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf,
hal_rx_msdu_end_sa_is_valid_get(soc->hal_soc,
rx_tlv_hdr));
l2_hdr_offset = hal_rx_msdu_end_l3_hdr_padding_get(soc->hal_soc,
rx_tlv_hdr);
hal_rx_msdu_metadata_get(soc->hal_soc, rx_tlv_hdr, &msdu_metadata);
msdu_len = hal_rx_msdu_start_msdu_len_get(rx_tlv_hdr);
pkt_len = msdu_len + l2_hdr_offset + RX_PKT_TLVS_LEN;
pkt_len = msdu_len + msdu_metadata.l3_hdr_pad + RX_PKT_TLVS_LEN;
if (qdf_likely(!qdf_nbuf_is_frag(nbuf))) {
if (dp_rx_check_pkt_len(soc, pkt_len))
@@ -819,7 +819,8 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf,
if (qdf_nbuf_is_frag(nbuf))
qdf_nbuf_pull_head(nbuf, RX_PKT_TLVS_LEN);
else
qdf_nbuf_pull_head(nbuf, (l2_hdr_offset + RX_PKT_TLVS_LEN));
qdf_nbuf_pull_head(nbuf, (msdu_metadata.l3_hdr_pad +
RX_PKT_TLVS_LEN));
dp_vdev_peer_stats_update_protocol_cnt(vdev, nbuf, NULL, 0, 1);
@@ -855,7 +856,8 @@ dp_rx_null_q_desc_handle(struct dp_soc *soc, qdf_nbuf_t nbuf,
/* WDS Source Port Learning */
if (qdf_likely(vdev->rx_decap_type == htt_cmn_pkt_type_ethernet &&
vdev->wds_enabled))
dp_rx_wds_srcport_learn(soc, rx_tlv_hdr, peer, nbuf);
dp_rx_wds_srcport_learn(soc, rx_tlv_hdr, peer, nbuf,
msdu_metadata);
if (hal_rx_is_unicast(soc->hal_soc, rx_tlv_hdr)) {
tid = hal_rx_tid_get(soc->hal_soc, rx_tlv_hdr);

View File

@@ -2316,4 +2316,27 @@ void hal_tx_update_tidmap_prty_generic(struct hal_soc *soc, uint8_t value)
(value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
}
/**
* hal_rx_msdu_packet_metadata_get(): API to get the
* msdu information from rx_msdu_end TLV
*
* @ buf: pointer to the start of RX PKT TLV headers
* @ hal_rx_msdu_metadata: pointer to the msdu info structure
*/
static void
hal_rx_msdu_packet_metadata_get_generic(uint8_t *buf,
void *pkt_msdu_metadata)
{
struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end;
struct hal_rx_msdu_metadata *msdu_metadata =
(struct hal_rx_msdu_metadata *)pkt_msdu_metadata;
msdu_metadata->l3_hdr_pad =
HAL_RX_MSDU_END_L3_HEADER_PADDING_GET(msdu_end);
msdu_metadata->sa_idx = HAL_RX_MSDU_END_SA_IDX_GET(msdu_end);
msdu_metadata->da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
msdu_metadata->sa_sw_peer_id =
HAL_RX_MSDU_END_SA_SW_PEER_ID_GET(msdu_end);
}
#endif /* _HAL_GENERIC_API_H_ */

View File

@@ -462,6 +462,8 @@ struct hal_hw_txrx_ops {
uint16_t (*hal_rx_get_rx_sequence)(uint8_t *buf);
void (*hal_rx_get_bb_info)(void *rx_tlv, void *ppdu_info_handle);
void (*hal_rx_get_rtt_info)(void *rx_tlv, void *ppdu_info_handle);
void (*hal_rx_msdu_packet_metadata_get)(uint8_t *buf,
void *msdu_pkt_metadata);
};
/**

View File

@@ -72,6 +72,22 @@ struct hal_wbm_err_desc_info {
reserved_2:3;
};
/**
* struct hal_rx_msdu_metadata:Structure to hold rx fast path information.
*
* @l3_hdr_pad: l3 header padding
* @reserved: Reserved bits
* @sa_sw_peer_id: sa sw peer id
* @sa_idx: sa index
* @da_idx: da index
*/
struct hal_rx_msdu_metadata {
uint32_t l3_hdr_pad:16,
sa_sw_peer_id:16;
uint32_t sa_idx:16,
da_idx:16;
};
/**
* enum hal_reo_error_code: Enum which encapsulates "reo_push_reason"
*
@@ -3425,4 +3441,22 @@ hal_rx_get_rtt_info(hal_soc_handle_t hal_soc_hdl,
if (hal_soc->ops->hal_rx_get_rtt_info)
hal_soc->ops->hal_rx_get_rtt_info(rx_tlv, ppdu_info);
}
/**
* hal_rx_msdu_metadata_get(): API to get the
* fast path information from rx_msdu_end TLV
*
* @ hal_soc_hdl: DP soc handle
* @ buf: pointer to the start of RX PKT TLV headers
* @ msdu_metadata: Structure to hold msdu end information
* Return: none
*/
static inline void
hal_rx_msdu_metadata_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf,
struct hal_rx_msdu_metadata *msdu_md)
{
struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
return hal_soc->ops->hal_rx_msdu_packet_metadata_get(buf, msdu_md);
}
#endif /* _HAL_RX_H */

View File

@@ -1079,6 +1079,8 @@ struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
hal_rx_get_rx_sequence_6290,
NULL,
NULL,
/* rx - msdu end fast path info fields */
hal_rx_msdu_packet_metadata_get_generic,
};
struct hal_hw_srng_config hw_srng_table_6290[] = {

View File

@@ -1075,6 +1075,8 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
hal_rx_get_rx_sequence_6390,
NULL,
NULL,
/* rx - msdu end fast path info fields */
hal_rx_msdu_packet_metadata_get_generic,
};
struct hal_hw_srng_config hw_srng_table_6390[] = {

View File

@@ -1291,6 +1291,30 @@ uint16_t hal_rx_get_rx_sequence_6490(uint8_t *buf)
return HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info);
}
/**
* hal_rx_msdu_packet_metadata_get_6490(): API to get the
* msdu information from rx_msdu_end TLV
*
* @ buf: pointer to the start of RX PKT TLV headers
* @ hal_rx_msdu_metadata: pointer to the msdu info structure
*/
static void
hal_rx_msdu_packet_metadata_get_6490(uint8_t *buf,
void *msdu_pkt_metadata)
{
struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end;
struct hal_rx_msdu_metadata *msdu_metadata =
(struct hal_rx_msdu_metadata *)msdu_pkt_metadata;
msdu_metadata->l3_hdr_pad =
HAL_RX_MSDU_END_L3_HEADER_PADDING_GET(msdu_end);
msdu_metadata->sa_idx = HAL_RX_MSDU_END_SA_IDX_GET(msdu_end);
msdu_metadata->da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
msdu_metadata->sa_sw_peer_id =
HAL_RX_MSDU_END_SA_SW_PEER_ID_GET(msdu_end);
}
/**
* hal_get_window_address_6490(): Function to get hp/tp address
* @hal_soc: Pointer to hal_soc
@@ -1394,6 +1418,8 @@ struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
hal_rx_get_rx_sequence_6490,
NULL,
NULL,
/* rx - msdu end fast path info fields */
hal_rx_msdu_packet_metadata_get_6490,
};
struct hal_hw_srng_config hw_srng_table_6490[] = {

View File

@@ -1284,6 +1284,30 @@ uint16_t hal_rx_get_rx_sequence_6750(uint8_t *buf)
return HAL_RX_MPDU_GET_SEQUENCE_NUMBER(rx_mpdu_info);
}
/**
* hal_rx_msdu_packet_metadata_get_6750(): API to get the
* msdu information from rx_msdu_end TLV
*
* @ buf: pointer to the start of RX PKT TLV headers
* @ hal_rx_msdu_metadata: pointer to the msdu info structure
*/
static void
hal_rx_msdu_packet_metadata_get_6750(uint8_t *buf,
void *msdu_pkt_metadata)
{
struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end;
struct hal_rx_msdu_metadata *msdu_metadata =
(struct hal_rx_msdu_metadata *)msdu_pkt_metadata;
msdu_metadata->l3_hdr_pad =
HAL_RX_MSDU_END_L3_HEADER_PADDING_GET(msdu_end);
msdu_metadata->sa_idx = HAL_RX_MSDU_END_SA_IDX_GET(msdu_end);
msdu_metadata->da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
msdu_metadata->sa_sw_peer_id =
HAL_RX_MSDU_END_SA_SW_PEER_ID_GET(msdu_end);
}
/**
* hal_get_window_address_6750(): Function to get hp/tp address
* @hal_soc: Pointer to hal_soc
@@ -1385,6 +1409,10 @@ struct hal_hw_txrx_ops qca6750_hal_hw_txrx_ops = {
NULL,
hal_rx_tlv_get_tcp_chksum_6750,
hal_rx_get_rx_sequence_6750,
NULL,
NULL,
/* rx - msdu end fast path info fields */
hal_rx_msdu_packet_metadata_get_6750,
};
struct hal_hw_srng_config hw_srng_table_6750[] = {

View File

@@ -1075,6 +1075,8 @@ struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
hal_rx_get_rx_sequence_8074v1,
NULL,
NULL,
/* rx - msdu fast path info fields */
hal_rx_msdu_packet_metadata_get_generic,
};
struct hal_hw_srng_config hw_srng_table_8074[] = {

View File

@@ -1080,6 +1080,8 @@ struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
NULL,
NULL,
#endif
/* rx - msdu fast path info fields */
hal_rx_msdu_packet_metadata_get_generic,
};
struct hal_hw_srng_config hw_srng_table_8074v2[] = {

View File

@@ -1343,6 +1343,30 @@ static inline void hal_write_window_register(struct hal_soc *hal_soc)
WINDOW_CONFIGURATION_VALUE_9000);
}
/**
* hal_rx_msdu_packet_metadata_get_9000(): API to get the
* msdu information from rx_msdu_end TLV
*
* @ buf: pointer to the start of RX PKT TLV headers
* @ hal_rx_msdu_metadata: pointer to the msdu info structure
*/
static void
hal_rx_msdu_packet_metadata_get_9000(uint8_t *buf,
void *msdu_pkt_metadata)
{
struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf;
struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end;
struct hal_rx_msdu_metadata *msdu_metadata =
(struct hal_rx_msdu_metadata *)msdu_pkt_metadata;
msdu_metadata->l3_hdr_pad =
HAL_RX_MSDU_END_L3_HEADER_PADDING_GET(msdu_end);
msdu_metadata->sa_idx = HAL_RX_MSDU_END_SA_IDX_GET(msdu_end);
msdu_metadata->da_idx = HAL_RX_MSDU_END_DA_IDX_GET(msdu_end);
msdu_metadata->sa_sw_peer_id =
HAL_RX_MSDU_END_SA_SW_PEER_ID_GET(msdu_end);
}
struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
/* init and setup */
@@ -1434,6 +1458,8 @@ struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
hal_rx_get_rx_sequence_9000,
NULL,
NULL,
/* rx - msdu fast path info fields */
hal_rx_msdu_packet_metadata_get_9000,
};
struct hal_hw_srng_config hw_srng_table_9000[] = {