From: Leon Romanovsky <leon@kernel.org>
To: Yonatan Nachum <ynachum@amazon.com>
Cc: jgg@nvidia.com, linux-rdma@vger.kernel.org, mrgolin@amazon.com,
sleybo@amazon.com, matua@amazon.com, gal.pressman@linux.dev,
Daniel Kranzdorf <dkkranzd@amazon.com>
Subject: Re: [PATCH for-next v2] RDMA/efa: Validate SQ depth based on WQE size
Date: Mon, 18 May 2026 15:00:50 +0300 [thread overview]
Message-ID: <20260518120050.GQ33515@unreal> (raw)
In-Reply-To: <20260517175216.614494-1-ynachum@amazon.com>
On Sun, May 17, 2026 at 05:52:16PM +0000, Yonatan Nachum wrote:
> Change the SQ depth validation to take into account the SQ WQE size.
> This is needed since when using 128-byte WQE the max SQ depth is cut in
> half. On create QP command, userspace provides SQ ring size which is SQ
> depth X WQE size so we can calculate the requested WQE size in the
> kernel.
>
> Fixes: 40909f664d27 ("RDMA/efa: Add EFA verbs implementation")
> Reviewed-by: Daniel Kranzdorf <dkkranzd@amazon.com>
> Reviewed-by: Michael Margolin <mrgolin@amazon.com>
> Signed-off-by: Yonatan Nachum <ynachum@amazon.com>
> ---
> Changelog:
> v2:
> * Add fixes line.
> v1: https://lore.kernel.org/all/20260507112110.869212-1-ynachum@amazon.com/
>
> drivers/infiniband/hw/efa/efa_verbs.c | 39 ++++++++++++++++++---------
> 1 file changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> index 395290ab0584..9a6cbb70581b 100644
> --- a/drivers/infiniband/hw/efa/efa_verbs.c
> +++ b/drivers/infiniband/hw/efa/efa_verbs.c
> @@ -597,14 +597,27 @@ static int qp_mmap_entries_setup(struct efa_qp *qp,
> return -ENOMEM;
> }
>
> +static int efa_calc_sq_wqe_size(u32 sq_ring_size, u32 max_send_wr)
> +{
> + return max_send_wr == 0 ? 0 : sq_ring_size / max_send_wr;
> +}
> +
> +static u32 efa_calc_sq_max_depth(struct efa_dev *dev, u32 sq_wqe_size)
> +{
> + return sq_wqe_size == 0 ? 0 :
> + rounddown_pow_of_two(dev->dev_attr.max_llq_size / sq_wqe_size);
> +}
Please review sashiko's findings:
https://sashiko.dev/#/patchset/20260517175216.614494-1-ynachum@amazon.com
It appears that a valid input can trigger rounddown_pow_of_two(0).
Thanks
prev parent reply other threads:[~2026-05-18 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 17:52 [PATCH for-next v2] RDMA/efa: Validate SQ depth based on WQE size Yonatan Nachum
2026-05-18 12:00 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260518120050.GQ33515@unreal \
--to=leon@kernel.org \
--cc=dkkranzd@amazon.com \
--cc=gal.pressman@linux.dev \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=matua@amazon.com \
--cc=mrgolin@amazon.com \
--cc=sleybo@amazon.com \
--cc=ynachum@amazon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox