From c39a68da37376a34b067c036b3c6a15a0583b77b Mon Sep 17 00:00:00 2001 From: Debasis Das Date: Mon, 28 Jan 2019 17:02:06 +0530 Subject: [PATCH] qcacmn: Support for 8021p pcp to tid mapping Add HAL and DP support to configure 8021p PCP to TID mapping tables into Hardware. Change-Id: I8a54970c8c4ef56f3c487b6e648c4411b3abde0e --- dp/wifi3.0/dp_main.c | 135 ++++++++++++++++++++++++++++- dp/wifi3.0/dp_types.h | 18 +++- hal/wifi3.0/hal_generic_api.h | 87 ++++++++++++++++++- hal/wifi3.0/hal_internal.h | 5 ++ hal/wifi3.0/hal_tx.h | 46 +++++++++- hal/wifi3.0/qca6018/hal_6018.c | 6 +- hal/wifi3.0/qca6290/hal_6290.c | 6 +- hal/wifi3.0/qca6390/hal_6390.c | 6 +- hal/wifi3.0/qca8074v1/hal_8074v1.c | 6 +- hal/wifi3.0/qca8074v2/hal_8074v2.c | 4 + 10 files changed, 310 insertions(+), 9 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index d33320e006..29ba1f4aa4 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -158,6 +158,22 @@ static uint8_t default_dscp_tid_map[DSCP_TID_MAP_MAX] = { 7, 7, 7, 7, 7, 7, 7, 7, }; +/** + * default_pcp_tid_map - Default PCP-TID mapping + * + * PCP TID + * 000 0 + * 001 1 + * 010 2 + * 011 3 + * 100 4 + * 101 5 + * 110 6 + * 111 7 + */ +static uint8_t default_pcp_tid_map[PCP_TID_MAP_MAX] = { + 0, 1, 2, 3, 4, 5, 6, 7, +}; /* * struct dp_rate_debug * @@ -3015,6 +3031,25 @@ dp_dscp_tid_map_setup(struct dp_pdev *pdev) } } +/** + * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps + * @pdev - DP_PDEV handle + * + * Return: void + */ +static inline void +dp_pcp_tid_map_setup(struct dp_pdev *pdev) +{ + struct dp_soc *soc = pdev->soc; + + if (!soc) + return; + + qdf_mem_copy(soc->pcp_tid_map, default_pcp_tid_map, + sizeof(default_pcp_tid_map)); + hal_tx_set_pcp_tid_map_default(soc->hal_soc, default_pcp_tid_map); +} + #ifdef IPA_OFFLOAD /** * dp_setup_ipa_rx_refill_buf_ring - Setup second Rx refill buffer ring @@ -3192,7 +3227,6 @@ void dp_iterate_update_peer_list(void *pdev_hdl) { } #endif - /* * dp_pdev_attach_wifi3() - attach txrx pdev * @ctrl_pdev: Opaque PDEV object @@ -3389,6 +3423,7 @@ static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, dp_local_peer_id_pool_init(pdev); dp_dscp_tid_map_setup(pdev); + dp_pcp_tid_map_setup(pdev); /* Rx monitor mode specific init */ if (dp_rx_pdev_mon_attach(pdev)) { @@ -4378,6 +4413,7 @@ static void dp_soc_set_nss_cfg_wifi3(struct cdp_soc_t *cdp_soc, int config) QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, FL("nss-wifi<0> nss config is enabled")); } + /* * dp_vdev_attach_wifi3() - attach txrx vdev * @txrx_pdev: Datapath PDEV handle @@ -9528,6 +9564,97 @@ static uint32_t dp_tx_flow_ctrl_configure_pdev(void *pdev_handle, } #endif +/** + * dp_set_pdev_pcp_tid_map_wifi3(): update pcp tid map in pdev + * @vdev: DP_PDEV handle + * @pcp: pcp value + * @tid: tid value passed by the user + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS dp_set_pdev_pcp_tid_map_wifi3(struct cdp_pdev *pdev_handle, + uint8_t pcp, uint8_t tid) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + struct dp_soc *soc = pdev->soc; + + soc->pcp_tid_map[pcp] = tid; + + hal_tx_update_pcp_tid_map(soc->hal_soc, pcp, tid); + return QDF_STATUS_SUCCESS; +} + +/** + * dp_set_pdev_tidmap_prty_wifi3(): update tidmap priority in pdev + * @vdev: DP_PDEV handle + * @prio: tidmap priority value passed by the user + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS dp_set_pdev_tidmap_prty_wifi3(struct cdp_pdev *pdev_handle, + uint8_t prio) +{ + struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; + struct dp_soc *soc = pdev->soc; + + soc->tidmap_prty = prio; + + hal_tx_set_tidmap_prty(soc->hal_soc, prio); + return QDF_STATUS_SUCCESS; +} + +/** + * dp_set_vdev_pcp_tid_map_wifi3(): update pcp tid map in vdev + * @vdev: DP_VDEV handle + * @pcp: pcp value + * @tid: tid value passed by the user + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS dp_set_vdev_pcp_tid_map_wifi3(struct cdp_vdev *vdev_handle, + uint8_t pcp, uint8_t tid) +{ + struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; + + vdev->pcp_tid_map[pcp] = tid; + + return QDF_STATUS_SUCCESS; +} + +/** + * dp_set_vdev_tidmap_tbl_id_wifi3(): update tidmapi tbl id in vdev + * @vdev: DP_VDEV handle + * @mapid: map_id value passed by the user + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS dp_set_vdev_tidmap_tbl_id_wifi3(struct cdp_vdev *vdev_handle, + uint8_t mapid) +{ + struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; + + vdev->tidmap_tbl_id = mapid; + + return QDF_STATUS_SUCCESS; +} + +/** + * dp_set_vdev_tidmap_prty_wifi3(): update tidmap priority in vdev + * @vdev: DP_VDEV handle + * @prio: tidmap priority value passed by the user + * + * Return: QDF_STATUS_SUCCESS on success + */ +static QDF_STATUS dp_set_vdev_tidmap_prty_wifi3(struct cdp_vdev *vdev_handle, + uint8_t prio) +{ + struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; + + vdev->tidmap_prty = prio; + + return QDF_STATUS_SUCCESS; +} + static struct cdp_cmn_ops dp_ops_cmn = { .txrx_soc_attach_target = dp_soc_attach_target_wifi3, .txrx_vdev_attach = dp_vdev_attach_wifi3, @@ -9616,6 +9743,12 @@ static struct cdp_cmn_ops dp_ops_cmn = { .get_rate_stats_ctx = dp_soc_get_rate_stats_ctx, .txrx_peer_flush_rate_stats = dp_peer_flush_rate_stats, .txrx_flush_rate_stats_request = dp_flush_rate_stats_req, + + .set_pdev_pcp_tid_map = dp_set_pdev_pcp_tid_map_wifi3, + .set_pdev_tidmap_prty = dp_set_pdev_tidmap_prty_wifi3, + .set_vdev_pcp_tid_map = dp_set_vdev_pcp_tid_map_wifi3, + .set_vdev_tidmap_prty = dp_set_vdev_tidmap_prty_wifi3, + .set_vdev_tidmap_tbl_id = dp_set_vdev_tidmap_tbl_id_wifi3, }; static struct cdp_ctrl_ops dp_ops_ctrl = { diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index c529362370..5c0ae5a0b1 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -88,11 +88,11 @@ #define DEFAULT_HW_PEER_ID 0xffff #define MAX_TX_HW_QUEUES MAX_TCL_DATA_RINGS - - /* Maximum retries for Delba per tid per peer */ #define DP_MAX_DELBA_RETRY 3 +#define PCP_TID_MAP_MAX 8 + #ifndef REMOVE_PKT_LOG enum rx_pktlog_mode { DP_RX_PKTLOG_DISABLED = 0, @@ -1024,6 +1024,11 @@ struct dp_soc { struct cdp_soc_rate_stats_ctx *rate_stats_ctx; /* rdk rate statistics control flag */ bool wlanstats_enabled; + + /* 8021p PCP-TID map values */ + uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; + /* TID map priority value */ + uint8_t tidmap_prty; }; #ifdef IPA_OFFLOAD @@ -1568,6 +1573,15 @@ struct dp_vdev { /* Capture timestamp of previous rx packet delivered */ uint64_t prev_rx_deliver_tstamp; + + /* 8021p PCP-TID mapping table ID */ + uint8_t tidmap_tbl_id; + + /* 8021p PCP-TID map values */ + uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; + + /* TIDmap priority */ + uint8_t tidmap_prty; }; diff --git a/hal/wifi3.0/hal_generic_api.h b/hal/wifi3.0/hal_generic_api.h index cc84ba3391..33b0634a53 100644 --- a/hal/wifi3.0/hal_generic_api.h +++ b/hal/wifi3.0/hal_generic_api.h @@ -1919,7 +1919,6 @@ static inline void hal_rx_dump_mpdu_start_tlv_generic(void *mpdustart, mpdu_info->mpdu_qos_control_field, mpdu_info->mpdu_ht_control_field); } -#endif /** * hal_tx_desc_set_search_type - Set the search type value @@ -1968,3 +1967,89 @@ static void hal_tx_desc_set_search_index_generic(void *desc, { } #endif + +/** + * hal_tx_set_pcp_tid_map_generic() - Configure default PCP to TID map table + * @soc: HAL SoC context + * @map: PCP-TID mapping table + * + * PCP are mapped to 8 TID values using TID values programmed + * in one set of mapping registers PCP_TID_MAP_<0 to 6> + * The mapping register has TID mapping for 8 PCP values + * + * Return: none + */ +static void hal_tx_set_pcp_tid_map_generic(void *hal_soc, uint8_t *map) +{ + uint32_t addr, value; + + struct hal_soc *soc = (struct hal_soc *)hal_soc; + + addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR( + SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET); + + value = (map[0] | + (map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) | + (map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) | + (map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) | + (map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) | + (map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) | + (map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) | + (map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT)); + + HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK)); +} + +/** + * hal_tx_update_pcp_tid_generic() - Update the pcp tid map table with + * value received from user-space + * @soc: HAL SoC context + * @pcp: pcp value + * @tid : tid value + * + * Return: void + */ +static +void hal_tx_update_pcp_tid_generic(void *hal_soc, uint8_t pcp, uint8_t tid) +{ + uint32_t addr, value, regval; + + struct hal_soc *soc = (struct hal_soc *)hal_soc; + + addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR( + SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET); + + value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp); + + /* Read back previous PCP TID config and update + * with new config. + */ + regval = HAL_REG_READ(soc, addr); + regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp)); + regval |= value; + + HAL_REG_WRITE(soc, addr, + (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK)); +} + +/** + * hal_tx_update_tidmap_prty_generic() - Update the tid map priority + * @soc: HAL SoC context + * @val: priority value + * + * Return: void + */ +static +void hal_tx_update_tidmap_prty_generic(void *hal_soc, uint8_t value) +{ + uint32_t addr; + + struct hal_soc *soc = (struct hal_soc *)hal_soc; + + addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR( + SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET); + + HAL_REG_WRITE(soc, addr, + (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK)); +} +#endif /* _HAL_GENERIC_API_H_ */ diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h index ff9bcd5bdd..0c2b4dad3a 100644 --- a/hal/wifi3.0/hal_internal.h +++ b/hal/wifi3.0/hal_internal.h @@ -343,6 +343,11 @@ struct hal_hw_txrx_ops { void *wbm_er_info); void (*hal_rx_dump_mpdu_start_tlv)(void *mpdustart, uint8_t dbg_level); + + void (*hal_tx_set_pcp_tid_map)(void *hal_soc, uint8_t *map); + void (*hal_tx_update_pcp_tid_map)(void *hal_soc, uint8_t pcp, + uint8_t id); + void (*hal_tx_set_tidmap_prty)(void *hal_soc, uint8_t prio); }; /** diff --git a/hal/wifi3.0/hal_tx.h b/hal/wifi3.0/hal_tx.h index aa424821f0..d9725d46fd 100644 --- a/hal/wifi3.0/hal_tx.h +++ b/hal/wifi3.0/hal_tx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -85,6 +85,8 @@ do { \ #define HAL_TX_EXT_DESC_WITH_META_DATA \ (HTT_META_HEADER_LEN_BYTES + HAL_TX_EXTENSION_DESC_LEN_BYTES) +#define HAL_TX_NUM_PCP_PER_REGISTER 8 + /* Length of WBM release ring without the status words */ #define HAL_TX_COMPLETION_DESC_BASE_LEN 12 @@ -990,4 +992,46 @@ static inline void hal_tx_desc_set_buf_addr(void *desc, dma_addr_t paddr, desc_id, type); } + +/** + * hal_tx_set_pcp_tid_map_default() - Configure default PCP to TID map table + * + * @soc: HAL SoC context + * @map: PCP-TID mapping table + * + * Return: void + */ +static inline void hal_tx_set_pcp_tid_map_default(struct hal_soc *hal_soc, + uint8_t *map) +{ + hal_soc->ops->hal_tx_set_pcp_tid_map(hal_soc, map); +} + +/** + * hal_tx_update_pcp_tid_map() - Update PCP to TID map table + * + * @soc: HAL SoC context + * @pcp: pcp value + * @tid: tid no + * + * Return: void + */ +static inline void hal_tx_update_pcp_tid_map(struct hal_soc *hal_soc, + uint8_t pcp, uint8_t tid) +{ + hal_soc->ops->hal_tx_update_pcp_tid_map(hal_soc, tid, tid); +} + +/** + * hal_tx_set_tidmap_prty() - Configure TIDmap priority + * + * @soc: HAL SoC context + * @val: priority value + * + * Return: void + */ +static inline void hal_tx_set_tidmap_prty(struct hal_soc *hal_soc, uint8_t val) +{ + hal_soc->ops->hal_tx_set_tidmap_prty(hal_soc, val); +} #endif /* HAL_TX_H */ diff --git a/hal/wifi3.0/qca6018/hal_6018.c b/hal/wifi3.0/qca6018/hal_6018.c index af7e9a3b26..37a010f508 100644 --- a/hal/wifi3.0/qca6018/hal_6018.c +++ b/hal/wifi3.0/qca6018/hal_6018.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -139,6 +139,10 @@ struct hal_hw_txrx_ops qca6018_hal_hw_txrx_ops = { hal_rx_status_get_tlv_info_generic, hal_rx_wbm_err_info_get_generic, hal_rx_dump_mpdu_start_tlv_generic, + + hal_tx_set_pcp_tid_map_generic, + hal_tx_update_pcp_tid_generic, + hal_tx_update_tidmap_prty_generic, }; struct hal_hw_srng_config hw_srng_table_6018[] = { diff --git a/hal/wifi3.0/qca6290/hal_6290.c b/hal/wifi3.0/qca6290/hal_6290.c index 94039c5409..709ef2f026 100644 --- a/hal/wifi3.0/qca6290/hal_6290.c +++ b/hal/wifi3.0/qca6290/hal_6290.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -144,6 +144,10 @@ struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = { hal_rx_status_get_tlv_info_generic, hal_rx_wbm_err_info_get_generic, hal_rx_dump_mpdu_start_tlv_generic, + + hal_tx_set_pcp_tid_map_generic, + hal_tx_update_pcp_tid_generic, + hal_tx_update_tidmap_prty_generic, }; struct hal_hw_srng_config hw_srng_table_6290[] = { diff --git a/hal/wifi3.0/qca6390/hal_6390.c b/hal/wifi3.0/qca6390/hal_6390.c index 6f4295e4f8..0b7a919897 100644 --- a/hal/wifi3.0/qca6390/hal_6390.c +++ b/hal/wifi3.0/qca6390/hal_6390.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -144,6 +144,10 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = { hal_rx_status_get_tlv_info_generic, hal_rx_wbm_err_info_get_generic, hal_rx_dump_mpdu_start_tlv_generic, + + hal_tx_set_pcp_tid_map_generic, + hal_tx_update_pcp_tid_generic, + hal_tx_update_tidmap_prty_generic, }; struct hal_hw_srng_config hw_srng_table_6390[] = { diff --git a/hal/wifi3.0/qca8074v1/hal_8074v1.c b/hal/wifi3.0/qca8074v1/hal_8074v1.c index 5059d69997..e8367517b3 100644 --- a/hal/wifi3.0/qca8074v1/hal_8074v1.c +++ b/hal/wifi3.0/qca8074v1/hal_8074v1.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -140,6 +140,10 @@ struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = { hal_rx_status_get_tlv_info_generic, hal_rx_wbm_err_info_get_generic, hal_rx_dump_mpdu_start_tlv_generic, + + hal_tx_set_pcp_tid_map_generic, + hal_tx_update_pcp_tid_generic, + hal_tx_update_tidmap_prty_generic, }; struct hal_hw_srng_config hw_srng_table_8074[] = { diff --git a/hal/wifi3.0/qca8074v2/hal_8074v2.c b/hal/wifi3.0/qca8074v2/hal_8074v2.c index 2539b26b2a..536fd05c60 100644 --- a/hal/wifi3.0/qca8074v2/hal_8074v2.c +++ b/hal/wifi3.0/qca8074v2/hal_8074v2.c @@ -140,6 +140,10 @@ struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = { hal_rx_status_get_tlv_info_generic, hal_rx_wbm_err_info_get_generic, hal_rx_dump_mpdu_start_tlv_generic, + + hal_tx_set_pcp_tid_map_generic, + hal_tx_update_pcp_tid_generic, + hal_tx_update_tidmap_prty_generic, }; struct hal_hw_srng_config hw_srng_table_8074v2[] = {