From 02ed94801adf8c170a77c1158c836b18bd7dea48 Mon Sep 17 00:00:00 2001 From: Prathyusha Guduri Date: Tue, 17 Apr 2018 19:06:30 +0530 Subject: [PATCH] qcacmn: Add support in DP for enabling multiqueue support Enable multiqueue on VAP with 4 Tx and Rx queues in lithium. In Rx path set the rx queue of skb based on the reo ring id on which it is received. In Tx path use the queue_mapping of skb to map to the hardware Tx ring on which it has to be transmitted. Change-Id: I103a21e91d1ed5c0e1d8441863d4fcd273b7bed9 --- dp/wifi3.0/dp_rx.c | 2 ++ dp/wifi3.0/dp_rx.h | 19 +++++++++++++++++++ dp/wifi3.0/dp_rx_err.c | 3 +++ dp/wifi3.0/dp_tx.c | 33 +++++++++++++++++---------------- dp/wifi3.0/dp_tx_desc.h | 14 ++++++++++++++ 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index a78099bff0b4..0ab25256d7b2 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -1560,6 +1560,8 @@ done: dp_rx_cksum_offload(nbuf, rx_tlv_hdr); + dp_set_rx_queue(nbuf, ring_id); + /* * HW structures call this L3 header padding -- * even though this is actually the offset from diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h index f27e83a823f6..f1c9d556f193 100644 --- a/dp/wifi3.0/dp_rx.h +++ b/dp/wifi3.0/dp_rx.h @@ -136,6 +136,25 @@ static inline uint32_t dp_rx_rotr(uint32_t val, int bits) return (val >> bits) | (val << (32 - bits)); } +/* + * dp_set_rx_queue() - set queue_mapping in skb + * @nbuf: skb + * @queue_id: rx queue_id + * + * Return: void + */ +#ifdef QCA_OL_RX_MULTIQ_SUPPORT +static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id) +{ + qdf_nbuf_record_rx_queue(nbuf, queue_id); + return; +} +#else +static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id) +{ +} +#endif + /* *dp_rx_xswap() - swap the bits left *@val: unsigned integer input value diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c index 3feb290b1e18..c3a5edaf9068 100644 --- a/dp/wifi3.0/dp_rx_err.c +++ b/dp/wifi3.0/dp_rx_err.c @@ -1130,6 +1130,9 @@ done: */ hal_rx_wbm_err_info_get_from_tlv(rx_tlv_hdr, &wbm_err_info); + /* Set queue_mapping in nbuf to 0 */ + dp_set_rx_queue(nbuf, 0); + next = nbuf->next; if (wbm_err_info.wbm_err_src == HAL_RX_WBM_ERR_SRC_REO) { if (wbm_err_info.reo_psh_rsn diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 2df6f96fedc7..c7fbe794ce54 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -30,22 +30,7 @@ #include "if_meta_hdr.h" #endif -#ifdef TX_PER_PDEV_DESC_POOL -#ifdef QCA_LL_TX_FLOW_CONTROL_V2 -#define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id) -#else /* QCA_LL_TX_FLOW_CONTROL_V2 */ -#define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->pdev->pdev_id) -#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ - #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id) -#else - #ifdef TX_PER_VDEV_DESC_POOL - #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id) - #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id) - #else - #define DP_TX_GET_DESC_POOL_ID(vdev) qdf_get_cpu() - #define DP_TX_GET_RING_ID(vdev) vdev->pdev->soc->tx_ring_map[qdf_get_cpu()] - #endif /* TX_PER_VDEV_DESC_POOL */ -#endif /* TX_PER_PDEV_DESC_POOL */ +#define DP_TX_QUEUE_MASK 0x3 /* TODO Add support in TSO */ #define DP_DESC_NUM_FRAG(x) 0 @@ -88,6 +73,21 @@ static const uint8_t sec_type_map[MAX_CDP_SEC_TYPE] = { * * Return: None */ +#ifdef QCA_OL_TX_MULTIQ_SUPPORT +static inline void dp_tx_get_queue(struct dp_vdev *vdev, + qdf_nbuf_t nbuf, struct dp_tx_queue *queue) +{ + uint16_t queue_offset = qdf_nbuf_get_queue_mapping(nbuf) & DP_TX_QUEUE_MASK; + queue->desc_pool_id = queue_offset; + queue->ring_id = vdev->pdev->soc->tx_ring_map[queue_offset]; + + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, + "%s, pool_id:%d ring_id: %d", + __func__, queue->desc_pool_id, queue->ring_id); + + return; +} +#else /* QCA_OL_TX_MULTIQ_SUPPORT */ static inline void dp_tx_get_queue(struct dp_vdev *vdev, qdf_nbuf_t nbuf, struct dp_tx_queue *queue) { @@ -101,6 +101,7 @@ static inline void dp_tx_get_queue(struct dp_vdev *vdev, return; } +#endif #if defined(FEATURE_TSO) /** diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h index ed8a1710ad5d..294e52463f17 100644 --- a/dp/wifi3.0/dp_tx_desc.h +++ b/dp/wifi3.0/dp_tx_desc.h @@ -23,6 +23,20 @@ #include "dp_tx.h" #include "dp_internal.h" +#ifdef TX_PER_PDEV_DESC_POOL +#ifdef QCA_LL_TX_FLOW_CONTROL_V2 +#define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id) +#else /* QCA_LL_TX_FLOW_CONTROL_V2 */ +#define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->pdev->pdev_id) +#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ + #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id) +#else + #ifdef TX_PER_VDEV_DESC_POOL + #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id) + #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id) + #endif /* TX_PER_VDEV_DESC_POOL */ +#endif /* TX_PER_PDEV_DESC_POOL */ + /** * 21 bits cookie * 2 bits pool id 0 ~ 3,