ath11k/dp: Cleanup type casting in WBM link descriptor setup
PATCH 1/1 ath11k/dp: Cleanup type casting in WBM link descriptor setup
Change the type of virtual address of struct hal_wbm_idle_scatter_list from u32 * to struct hal_wbm_link_desc *. This also makes the pointer arithmetic simpler. This also fixes a bug in pointer arithmetic on scatter buffer address. Scatter buffer address was incremented by HAL_LINK_DESC_SIZE instead of sizeof(hal_wbm_link_desc).
--- drivers/net/wireless/ath/ath11k/dp.c | 21 +++++++++------------ drivers/net/wireless/ath/ath11k/hal.c | 17 ++++++++--------- drivers/net/wireless/ath/ath11k/hal.h | 5 +++-- 3 files changed, 20 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +9 -12
@@ -338,12 +338,13 @@ static int ath11k_dp_scatter_idle_link_desc_setup(struct ath11k_base *ab,struct hal_wbm_idle_scatter_list *slist = dp->scatter_list;u32 n_entries_per_buf;int num_scatter_buf, scatter_idx; -u32 *scatter_buf; +struct hal_wbm_link_desc *scatter_buf;int align_bytes, n_entries;dma_addr_t paddr;int rem_entries;int i;int ret =0 ; +u32 end_offset; n_entries_per_buf =HAL_WBM_IDLE_SCATTER_BUF_SIZE /ath11k_hal_srng_get_entrysize (HAL_WBM_IDLE_LINK );
@@ -373,15 +374,12 @@ static int ath11k_dp_scatter_idle_link_desc_setup(struct ath11k_base *ab,HAL_LINK_DESC_SIZE ; paddr = link_desc_banks[i].paddr;while (n_entries) { -ath11k_hal_set_link_desc_addr ( - (struct buffer_addr *)scatter_buf, i, - paddr); +ath11k_hal_set_link_desc_addr (scatter_buf, i, paddr); n_entries--; paddr +=HAL_LINK_DESC_SIZE ;if (rem_entries) { rem_entries--; - scatter_buf = (u32 *)((u8 *)scatter_buf + -HAL_LINK_DESC_SIZE ); + scatter_buf++;continue ; }
@@ -391,10 +389,10 @@ static int ath11k_dp_scatter_idle_link_desc_setup(struct ath11k_base *ab, } } + end_offset = (scatter_buf - slist[scatter_idx].vaddr) * +sizeof (struct hal_wbm_link_desc );ath11k_hal_setup_link_idle_list (ab, slist, num_scatter_buf, - n_link_desc, - (u8 *)scatter_buf - - (u8 *)slist[scatter_idx].vaddr); + n_link_desc, end_offset);return 0 ;
@@ -577,9 +575,8 @@ int ath11k_dp_link_desc_setup(struct ath11k_base *ab, paddr = link_desc_banks[i].paddr;while (n_entries && (desc =ath11k_hal_srng_src_get_next_entry (ab, srng))) { -ath11k_hal_set_link_desc_addr ( - (struct buffer_addr *)desc, i, - paddr); +ath11k_hal_set_link_desc_addr ((struct hal_wbm_link_desc *)desc, i, + paddr); n_entries--; paddr +=HAL_LINK_DESC_SIZE ; }
drivers/net/wireless/ath/ath11k/hal.c +8 -9
@@ -689,16 +689,15 @@ u32 ath11k_hal_ce_dst_status_get_length(void *buf)return len; } -void ath11k_hal_set_link_desc_addr (void *buf,u32 cookie,dma_addr_t paddr) +void ath11k_hal_set_link_desc_addr (struct hal_wbm_link_desc *desc,u32 cookie, +dma_addr_t paddr) { -struct buffer_addr *desc = (struct buffer_addr *)buf; - - desc->info0 =FIELD_PREP (BUFFER_ADDR_INFO0_ADDR , - (paddr &HAL_ADDR_LSB_REG_MASK )); - desc->info1 =FIELD_PREP (BUFFER_ADDR_INFO1_ADDR , - ((u64 )paddr >>HAL_ADDR_MSB_REG_SHIFT )) | -FIELD_PREP (BUFFER_ADDR_INFO1_RET_BUF_MGR ,1 ) | -FIELD_PREP (BUFFER_ADDR_INFO1_SW_COOKIE , cookie); + desc->buf_addr_info.info0 =FIELD_PREP (BUFFER_ADDR_INFO0_ADDR , + (paddr &HAL_ADDR_LSB_REG_MASK )); + desc->buf_addr_info.info1 =FIELD_PREP (BUFFER_ADDR_INFO1_ADDR , + ((u64 )paddr >>HAL_ADDR_MSB_REG_SHIFT )) | +FIELD_PREP (BUFFER_ADDR_INFO1_RET_BUF_MGR ,1 ) | +FIELD_PREP (BUFFER_ADDR_INFO1_SW_COOKIE , cookie); }u32 *ath11k_hal_srng_dst_peek (struct ath11k_base *ab,struct hal_srng *srng)
drivers/net/wireless/ath/ath11k/hal.h +3 -2
@@ -445,7 +445,7 @@ enum hal_reo_cmd_status {struct hal_wbm_idle_scatter_list {dma_addr_t paddr; -u32 *vaddr; +struct hal_wbm_link_desc *vaddr; };struct hal_srng_params {
@@ -875,7 +875,8 @@ dma_addr_t ath11k_hal_srng_get_tp_addr(struct ath11k_base *ab, struct hal_srng *srng);dma_addr_t ath11k_hal_srng_get_hp_addr (struct ath11k_base *ab,struct hal_srng *srng); -void ath11k_hal_set_link_desc_addr (void *buf,u32 cookie,dma_addr_t paddr); +void ath11k_hal_set_link_desc_addr (struct hal_wbm_link_desc *desc,u32 cookie, +dma_addr_t paddr);u32 ath11k_hal_ce_get_desc_size (enum hal_ce_desc type);void ath11k_hal_ce_src_set_desc (void *buf,dma_addr_t paddr,u32 len,u32 id,u8 byte_swap_data);
Signature · 7 lines
1.9.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 8 lines · Vasanthakumar Thiagarajan
Change the type of virtual address of struct
hal_wbm_idle_scatter_listfrom u32 * to structhal_wbm_link_desc*. This also makes the pointer arithmetic simpler. This also fixes a bug in pointer arithmetic on scatter buffer address. Scatter buffer address was incremented byHAL_LINK_DESC_SIZEinstead ofsizeof(hal_wbm_link_desc).Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
This had conflicts:
Applying: ath11k/dp: Cleanup type casting in WBM link descriptor setup Using index info to reconstruct a base tree...
M drivers/net/wireless/ath/ath11k/dp.c M drivers/net/wireless/ath/ath11k/hal.c M drivers/net/wireless/ath/ath11k/hal.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath11k/hal.h
Auto-merging drivers/net/wireless/ath/ath11k/hal.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath11k/hal.c Auto-merging drivers/net/wireless/ath/ath11k/dp.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath11k/dp.c Recorded preimage for 'drivers/net/wireless/ath/ath11k/dp.c' Recorded preimage for 'drivers/net/wireless/ath/ath11k/hal.c'
error: Failed to merge in the changes.
Patch failed at 0001 ath11k/dp: Cleanup type casting in WBM link descriptor setup
Please double check my resolution:
Signature · 9 lines
https://patchwork.kernel.org/patch/11008423/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 30 lines · Kalle Valo
Quoted 8 lines · Vasanthakumar Thiagarajan
Change the type of virtual address of struct
hal_wbm_idle_scatter_listfrom u32 * to structhal_wbm_link_desc*. This also makes the pointer arithmetic simpler. This also fixes a bug in pointer arithmetic on scatter buffer address. Scatter buffer address was incremented byHAL_LINK_DESC_SIZEinstead ofsizeof(hal_wbm_link_desc).Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>This had conflicts:
Applying: ath11k/dp: Cleanup type casting in WBM link descriptor setup Using index info to reconstruct a base tree...
M drivers/net/wireless/ath/ath11k/dp.c M drivers/net/wireless/ath/ath11k/hal.c M drivers/net/wireless/ath/ath11k/hal.hFalling back to patching base and 3-way merge...
Auto-mergingdrivers/net/wireless/ath/ath11k/hal.h
Auto-mergingdrivers/net/wireless/ath/ath11k/hal.c
CONFLICT (content): Merge conflict indrivers/net/wireless/ath/ath11k/hal.cAuto-mergingdrivers/net/wireless/ath/ath11k/dp.c
CONFLICT (content): Merge conflict indrivers/net/wireless/ath/ath11k/dp.cRecorded preimage for 'drivers/net/wireless/ath/ath11k/dp.c' Recorded preimage for 'drivers/net/wireless/ath/ath11k/hal.c'
error: Failed to merge in the changes.
Patch failed at 0001 ath11k/dp: Cleanup type casting in WBM link descriptor setup
Quoted 3 lines
Please double check my resolution:
Looks good, thanks.
Vasanth
_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
Quoted 8 lines · Vasanthakumar Thiagarajan
Change the type of virtual address of struct
hal_wbm_idle_scatter_listfrom u32 * to structhal_wbm_link_desc*. This also makes the pointer arithmetic simpler. This also fixes a bug in pointer arithmetic on scatter buffer address. Scatter buffer address was incremented byHAL_LINK_DESC_SIZEinstead ofsizeof(hal_wbm_link_desc).Signed-off-by Vasanthakumar Thiagarajan <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath11k-bringup branch of ath.git, thanks.
ec3e7d5d47a5 ath11k/dp: Cleanup type casting in WBM link descriptor setup
Signature · 9 lines
https://patchwork.kernel.org/patch/11008423/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k