From c0396e72ea0cbbf3d498dc5473d2232bac8af0d1 Mon Sep 17 00:00:00 2001 From: Tallapragada Kalyan Date: Tue, 3 Nov 2020 12:37:52 +0530 Subject: [PATCH] qcacmn: use qdf_nbuf_headlen API to get the length in TX path currently qdf_nbuf_len is being used to get the length of the tx pkt, but this API also interprets the nbuf CB field to adjust the length if extra_frags are present. The concept of extra_frags is applicable only for legacy drivers but in lithium as cb is not reset in the driver the qdf_nbuf_len API is mis-calculating the length if extra_frag field in cb is set by any network stack protocol. To avoid this qdf_nbuf_headlen API is used to get the length of the TX pkt. Change-Id: Ie1e0b4b2168daf93ae77f4c995f5c3476a27b433 --- dp/wifi3.0/dp_tx.c | 37 +++++++++++++++---------------------- dp/wifi3.0/dp_tx.h | 8 ++++++-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 189a531ed5..c22c428fea 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -917,6 +917,7 @@ struct dp_tx_desc_s *dp_tx_prepare_desc_single(struct dp_vdev *vdev, tx_desc->pdev = pdev; tx_desc->msdu_ext_desc = NULL; tx_desc->pkt_offset = 0; + tx_desc->length = qdf_nbuf_headlen(nbuf); dp_tx_trace_pkt(nbuf, tx_desc->id, vdev->vdev_id); @@ -984,6 +985,7 @@ struct dp_tx_desc_s *dp_tx_prepare_desc_single(struct dp_vdev *vdev, tx_desc->pkt_offset = align_pad + htt_hdr_size; tx_desc->flags |= DP_TX_DESC_FLAG_TO_FW; is_exception = 1; + tx_desc->length -= tx_desc->pkt_offset; } #if !TQM_BYPASS_WAR @@ -1070,6 +1072,13 @@ static struct dp_tx_desc_s *dp_tx_prepare_desc(struct dp_vdev *vdev, tx_desc->msdu_ext_desc = msdu_ext_desc; tx_desc->flags |= DP_TX_DESC_FLAG_FRAG; + tx_desc->dma_addr = msdu_ext_desc->paddr; + + if (msdu_ext_desc->flags & DP_TX_EXT_DESC_FLAG_METADATA_VALID) + tx_desc->length = HAL_TX_EXT_DESC_WITH_META_DATA; + else + tx_desc->length = HAL_TX_EXTENSION_DESC_LEN_BYTES; + return tx_desc; failure: dp_tx_desc_release(tx_desc, desc_pool_id); @@ -1340,7 +1349,6 @@ dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev, struct cdp_tx_exception_metadata *tx_exc_metadata, struct dp_tx_msdu_info_s *msdu_info) { - uint8_t type; void *hal_tx_desc; uint32_t *hal_tx_desc_cached; int coalesce = 0; @@ -1372,27 +1380,9 @@ dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev, hal_tx_desc_cached = (void *) cached_desc; - if (tx_desc->flags & DP_TX_DESC_FLAG_FRAG) { - type = HAL_TX_BUF_TYPE_EXT_DESC; - tx_desc->dma_addr = tx_desc->msdu_ext_desc->paddr; - - if (tx_desc->msdu_ext_desc->flags & - DP_TX_EXT_DESC_FLAG_METADATA_VALID) - tx_desc->length = HAL_TX_EXT_DESC_WITH_META_DATA; - else - tx_desc->length = HAL_TX_EXTENSION_DESC_LEN_BYTES; - } else { - tx_desc->length = qdf_nbuf_len(tx_desc->nbuf) - - tx_desc->pkt_offset; - type = HAL_TX_BUF_TYPE_BUFFER; - tx_desc->dma_addr = qdf_nbuf_mapped_paddr_get(tx_desc->nbuf); - } - - qdf_assert_always(tx_desc->dma_addr); - hal_tx_desc_set_buf_addr(soc->hal_soc, hal_tx_desc_cached, tx_desc->dma_addr, bm_id, tx_desc->id, - type); + (tx_desc->flags & DP_TX_DESC_FLAG_FRAG)); hal_tx_desc_set_lmac_id(soc->hal_soc, hal_tx_desc_cached, vdev->lmac_id); hal_tx_desc_set_search_type(soc->hal_soc, hal_tx_desc_cached, @@ -1437,8 +1427,10 @@ dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev, tx_desc->timestamp = qdf_ktime_to_ms(qdf_ktime_real_get()); dp_verbose_debug("length:%d , type = %d, dma_addr %llx, offset %d desc id %u", - tx_desc->length, type, (uint64_t)tx_desc->dma_addr, - tx_desc->pkt_offset, tx_desc->id); + tx_desc->length, + (tx_desc->flags & DP_TX_DESC_FLAG_FRAG), + (uint64_t)tx_desc->dma_addr, tx_desc->pkt_offset, + tx_desc->id); hal_ring_hdl = dp_tx_get_hal_ring_hdl(soc, ring_id); @@ -2036,6 +2028,7 @@ dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf, goto release_desc; } + tx_desc->dma_addr = qdf_nbuf_mapped_paddr_get(tx_desc->nbuf); /* Enqueue the Tx MSDU descriptor to HW for transmit */ status = dp_tx_hw_enqueue(soc, vdev, tx_desc, htt_tcl_metadata, tx_exc_metadata, msdu_info); diff --git a/dp/wifi3.0/dp_tx.h b/dp/wifi3.0/dp_tx.h index 49f9b4db90..b230f78406 100644 --- a/dp/wifi3.0/dp_tx.h +++ b/dp/wifi3.0/dp_tx.h @@ -27,9 +27,13 @@ #define DP_TX_MAX_NUM_FRAGS 6 -#define DP_TX_DESC_FLAG_SIMPLE 0x1 +/* + * DP_TX_DESC_FLAG_FRAG flags should always be defined to 0x1 + * please do not change this flag's definition + */ +#define DP_TX_DESC_FLAG_FRAG 0x1 #define DP_TX_DESC_FLAG_TO_FW 0x2 -#define DP_TX_DESC_FLAG_FRAG 0x4 +#define DP_TX_DESC_FLAG_SIMPLE 0x4 #define DP_TX_DESC_FLAG_RAW 0x8 #define DP_TX_DESC_FLAG_MESH 0x10 #define DP_TX_DESC_FLAG_QUEUED_TX 0x20