Re: [PATCH net-next v2 1/2] net/smc: make wr buffer count configurable

Halil Pasic
2025-09-09T10:19:02Z

On Tue, 9 Sep 2025 11:00:50 +0800
Dust Li <dust.li@linux.alibaba.com> wrote:

> On 2025-09-09 00:01:49, Halil Pasic wrote:
> >Think SMC_WR_BUF_CNT_SEND := SMC_WR_BUF_CNT used in send context and
> >SMC_WR_BUF_CNT_RECV := 3 * SMC_WR_BUF_CNT used in recv context. Those
> >get replaced with lgr->pref_send_wr and lgr->max_recv_wr respective.

Yes it is just in the commit message, I messed up the search and replace
in the commit message. :(

> ^ ^
> better to use the same prefix
>
> I personally prefer max_send_wr/max_recv_wr.
>

Will go back to that then for v3

> >
> >While at it let us also remove a confusing comment that is either not
> >about the context in which it resides (describing
> >qp_attr.cap.pref_send_wr and qp_attr.cap.max_recv_wr) or not applicable
> ^
> I haven't found pref_send_wr in qp_attr.cap
>

Again search and replace. Sorry!

[..]
> >+
> >+ Please be aware that all the buffers need to be allocated as a physically
> >+ continuous array in which each element is a single buffer and has the size
> >+ of SMC_WR_BUF_SIZE (48) bytes. If the allocation fails we give up much
> >+ like before having this control.
> >+ this control.
>
> The final 'this control' looks unwanted.

You are right

[..]
> >
> >@@ -741,50 +742,51 @@ int smc_wr_alloc_lgr_mem(struct smc_link_group *lgr)
> > int smc_wr_alloc_link_mem(struct smc_link *link)
> > {
> > /* allocate link related memory */
> >- link->wr_tx_bufs = kcalloc(SMC_WR_BUF_CNT, SMC_WR_BUF_SIZE, GFP_KERNEL);
> >+ link->wr_tx_bufs = kcalloc(link->lgr->pref_send_wr,
> >+ SMC_WR_BUF_SIZE, GFP_KERNEL);
> > if (!link->wr_tx_bufs)
> > goto no_mem;
> >- link->wr_rx_bufs = kcalloc(SMC_WR_BUF_CNT * 3, link->wr_rx_buflen,
> >+ link->wr_rx_bufs = kcalloc(link->lgr->pref_recv_wr, SMC_WR_BUF_SIZE,
> > GFP_KERNEL);

I will have to do some digging, let's assume for now that it is my
mistake. Unfortunately I won't be able to revisit this before next
Wednesday.

Thank you for your review!

Regards,
Halil