* [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup @ 2019-06-21 3:50 Vasanthakumar Thiagarajan 2019-06-24 7:38 ` Kalle Valo 2019-06-24 10:57 ` Kalle Valo 0 siblings, 2 replies; 4+ messages in thread From: Vasanthakumar Thiagarajan @ 2019-06-21 3:50 UTC (permalink / raw) To: ath11k 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). Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> --- 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(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c index c4770bb..0e09d07 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -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; } diff --git a/drivers/net/wireless/ath/ath11k/hal.c b/drivers/net/wireless/ath/ath11k/hal.c index b7b9b9c..26a8eda 100644 --- a/drivers/net/wireless/ath/ath11k/hal.c +++ b/drivers/net/wireless/ath/ath11k/hal.c @@ -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) diff --git a/drivers/net/wireless/ath/ath11k/hal.h b/drivers/net/wireless/ath/ath11k/hal.h index 6649dd2..71d3884 100644 --- a/drivers/net/wireless/ath/ath11k/hal.h +++ b/drivers/net/wireless/ath/ath11k/hal.h @@ -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); -- 1.9.1 _______________________________________________ ath11k mailing list ath11k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath11k ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup 2019-06-21 3:50 [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup Vasanthakumar Thiagarajan @ 2019-06-24 7:38 ` Kalle Valo 2019-06-24 8:07 ` Vasanthakumar Thiagarajan 2019-06-24 10:57 ` Kalle Valo 1 sibling, 1 reply; 4+ messages in thread From: Kalle Valo @ 2019-06-24 7:38 UTC (permalink / raw) To: Vasanthakumar Thiagarajan; +Cc: ath11k Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote: > 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). > > Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org> 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: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending-ath11k&id=c23d1428eb9c1bfeb1167d8770e58e55e1217170 -- https://patchwork.kernel.org/patch/11008423/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list ath11k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath11k ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup 2019-06-24 7:38 ` Kalle Valo @ 2019-06-24 8:07 ` Vasanthakumar Thiagarajan 0 siblings, 0 replies; 4+ messages in thread From: Vasanthakumar Thiagarajan @ 2019-06-24 8:07 UTC (permalink / raw) To: Kalle Valo; +Cc: ath11k On 2019-06-24 13:08, Kalle Valo wrote: > Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote: > >> 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). >> >> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> >> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> > > 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: > > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending-ath11k&id=c23d1428eb9c1bfeb1167d8770e58e55e1217170 Looks good, thanks. Vasanth _______________________________________________ ath11k mailing list ath11k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath11k ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup 2019-06-21 3:50 [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup Vasanthakumar Thiagarajan 2019-06-24 7:38 ` Kalle Valo @ 2019-06-24 10:57 ` Kalle Valo 1 sibling, 0 replies; 4+ messages in thread From: Kalle Valo @ 2019-06-24 10:57 UTC (permalink / raw) To: Vasanthakumar Thiagarajan; +Cc: ath11k Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> wrote: > 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). > > Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Patch applied to ath11k-bringup branch of ath.git, thanks. ec3e7d5d47a5 ath11k/dp: Cleanup type casting in WBM link descriptor setup -- https://patchwork.kernel.org/patch/11008423/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list ath11k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath11k ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-24 10:57 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-21 3:50 [PATCH] ath11k/dp: Cleanup type casting in WBM link descriptor setup Vasanthakumar Thiagarajan 2019-06-24 7:38 ` Kalle Valo 2019-06-24 8:07 ` Vasanthakumar Thiagarajan 2019-06-24 10:57 ` Kalle Valo
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.