[PATCH 03/50] wifi: ath12k: add ce.c
Karthikeyan Periyasamy (QUIC)
quic_periyasa at quicinc.com
Tue Oct 4 04:08:00 PDT 2022
> -----Original Message-----
> From: Ping-Ke Shih <pkshih at realtek.com>
> Sent: Tuesday, September 13, 2022 9:58 AM
> To: Kalle Valo <kvalo at kernel.org>; linux-wireless at vger.kernel.org
> Cc: ath12k at lists.infradead.org
> Subject: RE: [PATCH 03/50] wifi: ath12k: add ce.c
>
> WARNING: This email originated from outside of Qualcomm. Please be wary
> of any links or attachments, and do not enable macros.
>
> > -----Original Message-----
> > From: Kalle Valo <kvalo at kernel.org>
> > Sent: Saturday, August 13, 2022 12:09 AM
> > To: linux-wireless at vger.kernel.org
> > Cc: ath12k at lists.infradead.org
> > Subject: [PATCH 03/50] wifi: ath12k: add ce.c
> >
> > From: Kalle Valo <quic_kvalo at 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 at quicinc.com>
> > ---
> > drivers/net/wireless/ath/ath12k/ce.c | 971
> > +++++++++++++++++++++++++++++++++++
> > 1 file changed, 971 insertions(+)
> >
> > diff --git a/drivers/net/wireless/ath/ath12k/ce.c
> > b/drivers/net/wireless/ath/ath12k/ce.c
> > new file mode 100644
> > index 000000000000..5694eef37232
> > --- /dev/null
> > +++ b/drivers/net/wireless/ath/ath12k/ce.c
>
> [...]
>
> > +
> > +static int ath12k_ce_rx_buf_enqueue_pipe(struct ath12k_ce_pipe *pipe,
> > + struct sk_buff *skb, dma_addr_t
> > +paddr) {
> > + struct ath12k_base *ab = pipe->ab;
> > + struct ath12k_ce_ring *ring = pipe->dest_ring;
> > + struct hal_srng *srng;
> > + unsigned int write_index;
> > + unsigned int nentries_mask = ring->nentries_mask;
> > + struct hal_ce_srng_dest_desc *desc;
> > + int ret;
> > +
>
> [...]
>
> > +
> > + ring->skb[write_index] = skb;
> > + write_index = CE_RING_IDX_INCR(nentries_mask, write_index);
> > + ring->write_index = write_index;
> > +
> > + pipe->rx_buf_needed--;
> > +
> > + ret = 0;
>
> nit.
> I think '= 0' can be initializer like other functions.
>
> > +exit:
> > + ath12k_hal_srng_access_end(ab, srng);
> > +
> > + spin_unlock_bh(&srng->lock);
> > +
> > + return ret;
> > +}
> > +
> > +static int ath12k_ce_rx_post_pipe(struct ath12k_ce_pipe *pipe) {
>
> [...]
>
> > +
> > + ATH12K_SKB_RXCB(skb)->paddr = paddr;
> > +
> > + ret = ath12k_ce_rx_buf_enqueue_pipe(pipe, skb, paddr);
> > +
>
> nit.
> this blank line can be removed.
>
Sure will address in the next version of the patch
> > + if (ret) {
> > + ath12k_warn(ab, "failed to enqueue rx buf: %d\n", ret);
> > + dma_unmap_single(ab->dev, paddr,
> > + skb->len + skb_tailroom(skb),
> > + DMA_FROM_DEVICE);
> > + dev_kfree_skb_any(skb);
> > + goto exit;
> > + }
> > + }
> > +
> > +exit:
> > + spin_unlock_bh(&ab->ce.ce_lock);
> > + return ret;
> > +}
> > +
>
> [...]
>
> > +
> > +int ath12k_ce_send(struct ath12k_base *ab, struct sk_buff *skb, u8
> pipe_id,
> > + u16 transfer_id)
> > +{
>
> [...]
>
> > +
> > + ath12k_hal_srng_access_end(ab, srng);
> > +
> > + spin_unlock_bh(&srng->lock);
> > +
> > + spin_unlock_bh(&ab->ce.ce_lock);
>
> Two unlock are duplicate of err_unlock. I think they can be merged to a single
> copy to reduce maintain effort. If my opinion is accepted, maybe rename
> err_unlock to out_unlock because it becomes a normal flow.
>
Sure will address in the next version of the patch
> > +
> > + return 0;
> > +
> > +err_unlock:
> > + spin_unlock_bh(&srng->lock);
> > +
> > + spin_unlock_bh(&ab->ce.ce_lock);
> > +
> > + return ret;
> > +}
> > +
>
> These opinions are not very important. Just for reference.
>
> Ping-Ke
Thanks
Karthikeyan
More information about the ath12k
mailing list