All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yanze Zhang" <zhang.yanze@zte.com.cn>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma v10 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton
Date: Thu, 03 Dec 2026 13:20:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-247847@kernel.org> (raw)
In-Reply-To: <20261203124928.48716-5-zhang.yanze@zte.com.cn>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] RDMA/zrdma: zxdh_initialize_hw_rsrc() reserves two MR entries
  undocumented
- [Low] RDMA/zrdma: zrdma_verbs.h missing zrdma_type.h include for
  struct zxdh_sc_pd
- [Low] RDMA/zrdma: MAX_AH and MAX_SRQ in zrdma_verbs.h mismatch
  zrdma_hw.c pools
--

commit 5fe108987a433420b66283ff408fc8bd93f00adb
Author: Yanze Zhang <zhang.yanze@zte.com.cn>

RDMA/zrdma: Add hardware resource initialization and verbs skeleton

This commit adds hardware resource bitmap initialization in zrdma_hw.c and
a minimal verbs layer skeleton with device registration in zrdma_verbs.c
and zrdma_verbs.h.

> diff --git a/drivers/infiniband/hw/zrdma/zrdma_hw.c b/drivers/infiniband/hw/zrdma/zrdma_hw.c
> new file mode 100644
> index 0000000000000..ba0e5760b52ca
> --- /dev/null
> +++ b/drivers/infiniband/hw/zrdma/zrdma_hw.c
> @@ -0,0 +1,118 @@

[ ... ]

> +	/* The first entry of the pools that are already in use is
> +	 * reserved, so that a resource number of zero is not handed out.
> +	 * The pools of the completion queues, the shared receive queues,
> +	 * the user priorities and the 8K indices do not reserve an entry
> +	 * yet, they are not allocated from yet.
> +	 */
> +	set_bit(0, rf->allocated_mrs);
> +	set_bit(1, rf->allocated_mrs);
> +	set_bit(0, rf->allocated_pds);
> +	set_bit(0, rf->allocated_qps);
> +	set_bit(0, rf->allocated_ahs);
> +	set_bit(0, rf->allocated_mcgs);

[Severity: Low]
Why is bit 1 also reserved in rf->allocated_mrs here?

Both this comment and the commit message say only the first entry is
reserved, whereas MAX_MR is 0xfffe (ZXDH_MAX_MR - 2).  If index 1 is
intentionally reserved, the comment and commit message should explain why;
otherwise set_bit(1, rf->allocated_mrs) can be dropped.

[ ... ]

> diff --git a/drivers/infiniband/hw/zrdma/zrdma_verbs.h b/drivers/infiniband/hw/zrdma/zrdma_verbs.h
> new file mode 100644
> index 0000000000000..a435891ab7cf5
> --- /dev/null
> +++ b/drivers/infiniband/hw/zrdma/zrdma_verbs.h
> @@ -0,0 +1,119 @@

[ ... ]

> +#define MAX_SRQ 0x200
> +#define MAX_SRQ_WR 0x7fff
> +#define MAX_SRQ_SGE 0xf
> +#define LOCAL_CA_ACK_DELAY 16
> +#define HCA_CORE_CLOCK (1000 * 1000UL)
> +#define MAX_WQ_TYPE_RQ 0x3fff
> +#define MAX_AH 0x10000

[Severity: Low]
Should MAX_AH be 0xffff and MAX_SRQ match ZXDH_MAX_SRQ?

zxdh_initialize_hw_rsrc() allocates ZXDH_MAX_AH (0x10000) bits for
rf->allocated_ahs and reserves bit 0, leaving 0xffff usable AH entries,
unlike MAX_QP, MAX_PD, and MAX_MR which subtract their reserved entries.

Similarly, rf->allocated_srqs is sized to ZXDH_MAX_SRQ (0x2000), which is
16 times larger than MAX_SRQ (0x200).

[ ... ]

> +struct zxdh_ucontext {
> +	struct ib_ucontext ibucontext;
> +	struct zxdh_device *zdev;

[ ... ]

> +struct zxdh_pd {
> +	struct ib_pd ibpd;
> +	struct zxdh_sc_pd sc_pd;
> +};

[Severity: Low]
Does zrdma_verbs.h fail to compile if included standalone or before
zrdma_main.h?

struct zxdh_pd embeds struct zxdh_sc_pd by value, which is defined in
zrdma_type.h, but zrdma_verbs.h does not include zrdma_type.h.

It also uses struct zxdh_device *zdev without a forward declaration, and
defines generic unprefixed macros (such as CHIP_VERSION, MAX_QP, MAX_CQ,
MAX_MR, MAX_PD, MAX_AH, MAX_SRQ, TIMESTAMP_MASK, and MAX_MSG_SZ) that risk
namespace collisions.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203124928.48716-1-zhang.yanze@zte.com.cn?part=4

  reply	other threads:[~2026-12-03 13:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 12:49 [PATCH rdma v10 0/7] Add ZTE DingHai Ethernet Protocol Driver for RDMA Yanze Zhang
2026-12-03 12:49 ` [PATCH rdma v10 1/7] RDMA/zrdma: Add build infrastructure and module skeleton Yanze Zhang
2026-12-03 13:19   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 2/7] RDMA/zrdma: Add core data structures and ABI definitions Yanze Zhang
2026-12-03 13:21   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 3/7] RDMA/zrdma: Add internal headers and hardware register definitions Yanze Zhang
2026-12-03 13:17   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton Yanze Zhang
2026-12-03 13:20   ` sashiko-bot [this message]
2026-12-03 12:49 ` [PATCH rdma v10 5/7] RDMA/zrdma: Implement device and port query operations Yanze Zhang
2026-12-03 13:32   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 6/7] RDMA/zrdma: Add device probe and remove logic Yanze Zhang
2026-12-03 13:28   ` sashiko-bot
2026-12-03 12:49 ` [PATCH rdma v10 7/7] RDMA/zrdma: Implement context, PD, and mmap operations Yanze Zhang
2026-12-03 13:42   ` sashiko-bot
2026-12-03 20:06   ` Leon Romanovsky

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=sashiko-outbox-247847@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhang.yanze@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.