> -----Original Message----- > From: Ping-Ke Shih <pkshih@xxxxxxxxxxx> > Sent: Tuesday, September 13, 2022 9:58 AM > To: Kalle Valo <kvalo@xxxxxxxxxx>; linux-wireless@xxxxxxxxxxxxxxx > Cc: ath12k@xxxxxxxxxxxxxxxxxxx > 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@xxxxxxxxxx> > > Sent: Saturday, August 13, 2022 12:09 AM > > To: linux-wireless@xxxxxxxxxxxxxxx > > Cc: ath12k@xxxxxxxxxxxxxxxxxxx > > Subject: [PATCH 03/50] wifi: ath12k: add ce.c > > > > From: Kalle Valo <quic_kvalo@xxxxxxxxxxx> > > > > (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@xxxxxxxxxxx> > > --- > > 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