Re: [PATCH 19/50] wifi: ath12k: add hal.c

Jeff Johnson
2022-08-18T04:17:14Z

On 8/12/2022 9:09 AM, Kalle Valo wrote:
> From: Kalle Valo <quic_kvalo@quicinc.com>
>
> (Patches split into one patch per file for easier review, but the final
> commit will be one big patch. See the cover letter for more info.)
>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
> ---
> drivers/net/wireless/ath/ath12k/hal.c | 2179 +++++++++++++++++++++++++++++++++
> 1 file changed, 2179 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/ath/ath12k/hal.c

snip

> +static void ath12k_hal_srng_src_hw_init(struct ath12k_base *ab,
> + struct hal_srng *srng)
> +{

snip

> + /* interrupt setup */
> + /* NOTE: IPQ8074 v2 requires the interrupt timer threshold in the
> + * unit of 8 usecs instead of 1 usec (as required by v1).

why do we care about IPQ8074 when it isn't supported by this driver?
and where is the 8 us vs 1 us logic anyway?

> + */
> + val = u32_encode_bits(srng->intr_timer_thres_us,
> + HAL_TCL1_RING_CONSR_INT_SETUP_IX0_INTR_TMR_THOLD);

snip

> +static void ath12k_hal_srng_update_hp_tp_addr(struct ath12k_base *ab,
> + int shadow_cfg_idx,
> + enum hal_ring_type ring_type,
> + int ring_num)

inconsistent indentation?
snip

> +void ath12k_hal_srng_shadow_update_hp_tp(struct ath12k_base *ab,
> + struct hal_srng *srng)
> +{
> + lockdep_assert_held(&srng->lock);
> +
> + /* check whether the ring is emptry. Update the shadow

s/emptry/empty/

> + * HP only when then ring isn't' empty.
> + */
> + if (srng->ring_dir == HAL_SRNG_DIR_SRC &&
> + *srng->u.src_ring.tp_addr != srng->u.src_ring.hp)
> + ath12k_hal_srng_access_end(ab, srng);
> +}
> +

snip

> +void ath12k_hal_srng_deinit(struct ath12k_base *ab)
> +{
> + struct ath12k_hal *hal = &ab->hal;
> +
> + ath12k_hal_unregister_srng_lock_keys(ab);
> + ath12k_hal_free_cont_rdp(ab);
> + ath12k_hal_free_cont_wrp(ab);
> + kfree(hal->srng_config);

perhaps set hal->srng_config = NULL so that there isn't a dangling pointer?

snip