Linux RDMA and InfiniBand development
 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 v8 3/7] RDMA/zrdma: Add internal headers and hardware register definitions
Date: Mon, 02 Nov 2026 09:00:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-193147@kernel.org> (raw)
In-Reply-To: <20261102082026.2645777-4-zhang.yanze@zte.com.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] RDMA/zrdma: unused declarations and intra-series churn in zrdma_main.h
--

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

RDMA/zrdma: Add internal headers and hardware register definitions

This commit adds internal header files (zrdma_hw.h and zrdma_main.h) and
updates zrdma_type.h to define structures, enums, and constants for the ZTE
DingHai RDMA driver.

> diff --git a/drivers/infiniband/hw/zrdma/zrdma_main.h b/drivers/infiniband/hw/zrdma/zrdma_main.h
> new file mode 100644
> index 0000000000000..31679b4eccb2c
> --- /dev/null
> +++ b/drivers/infiniband/hw/zrdma/zrdma_main.h
[ ... ]
> +#define PCI_SBDF_SAFE_LEN 64
> +#define ZXDH_RST_TIMEOUT_HZ 4
> +
> +#define ZXDH_RDMA_COMMON_FUNC_CAP 1
> +#define ZXDH_RDMA_COMM_FUNC BIT_ULL(24)
> +
> +extern struct list_head zxdh_handlers;
> +extern spinlock_t zxdh_handler_lock;
> +extern const struct ib_device_ops zxdh_dev_ops;
> +
> +struct zxdh_pci_f;
> +
> +struct zxdh_rdma_node {
> +	char name[IB_DEVICE_NAME_MAX];
> +	char sbdf[PCI_SBDF_SAFE_LEN];
> +	struct list_head list;
> +};
> +
> +enum zxdh_func_type {
> +	ZXDH_FUNC_NUM_REQUIRE = 0,
> +	ZXDH_FUNC_NP_MAC = 1,
> +	ZXDH_FUNC_IRQ_REQUEST = 2,
> +	ZXDH_FUNC_IRQ_FREE = 3,
> +	ZXDH_FUNC_PMTU_INFO_ADD = 4,
> +	ZXDH_FUNC_PMTU_INFO_DEL = 5,
> +	ZXDH_FUNC_QP_INFO_DEL_WX = 6,
> +	ZXDH_FUNC_NETDEV_SPEED_GET = 7,
> +	ZXDH_FUNC_SEARCH_MAC_FROM_FW = 8,
> +	ZXDH_COMM_FUNC_GET_TRUST_TYPE = 9,
> +	ZXDH_FUNC_VF_VLAN_GET = 10,
> +	ZXDH_FUNC_NUM_MAX,
> +};
> +
> +enum init_completion_state {
> +	INVALID_STATE = 0,
> +	INITIAL_STATE,
> +	CQP_CREATED,
> +	SMMU_PAGETABLE_INITIALIZED,
> +	DATA_CAP_CREATED,
> +	HMC_OBJS_CREATED,
> +	HW_RSRC_INITIALIZED,
> +	CQP_QP_CREATED,
> +	AEQ_CREATED,
> +	CCQ_CREATED,
> +	CEQ0_CREATED,
> +	CEQS_CREATED,
> +	PBLE_CHUNK_MEM,
> +};
> +
> +enum zxdh_rdma_vers {
> +	ZXDH_GEN_RSVD,
> +	ZXDH_GEN_1,
> +	ZXDH_GEN_2,
> +};
> +
> +struct zxdh_handler {
> +	struct list_head list;
> +	struct zxdh_device *zdev;
> +};
[ ... ]
> +struct zxdh_pci_f {
[ ... ]
> +	spinlock_t rsrc_lock; /* protects resource allocation arrays */
> +	spinlock_t qptable_lock; /* protects qp_table access */
> +	spinlock_t cqtable_lock; /* protects cq_table access */
> +	struct zxdh_qp **qp_table;
> +	struct zxdh_cq **cq_table;
> +	spinlock_t srqtable_lock; /* protects srq_table access */
> +	struct zxdh_srq **srq_table;
> +
> +	struct msix_entry *msix_entries;
> +	struct zxdh_gen_ops gen_ops;
> +	struct zxdh_device *zdev;
> +	u16 qp_index;
> +	u32 srq_mem_size;
> +	bool net_irq_cap;
> +	int common_func_num_max;
> +	void *dh_dev;
> +};
> +
> +struct zxdh_device {
> +	struct ib_device ibdev;
> +	struct zxdh_pci_f *rf;
> +	struct net_device *netdev;
> +	struct net_device *source_netdev;
> +	struct zxdh_handler *hdl;
[ ... ]
> +int zxdh_get_del_rdma_name(const char *sbdf, char *name, size_t name_len);
> +int zxdh_ctrl_init_hw(struct zxdh_pci_f *rf);
> +int zxdh_ib_register_device(struct zxdh_device *zdev);
> +void zxdh_del_handler(struct zxdh_handler *hdl);

[Severity: Low]
As reported by Leon Romanovsky on v2 [1], unused defines and functions
should be removed from the driver and the patches should be split cleanly to
simplify review.

This patch adds PCI_SBDF_SAFE_LEN, zxdh_handlers, zxdh_handler_lock,
struct zxdh_rdma_node, struct zxdh_handler, struct zxdh_device::hdl,
zxdh_get_del_rdma_name(), and zxdh_del_handler() in
drivers/infiniband/hw/zrdma/zrdma_main.h, which are never defined or used
and are then deleted in the subsequent patch "RDMA/zrdma: Add device probe
and remove logic".

In addition, even at the end of the series ("RDMA/zrdma: Implement context,
PD, and mmap operations"), zrdma_main.h still contains declarations that are
never used anywhere in the series:
- srq_mem_size in struct zxdh_pci_f and source_netdev in struct zxdh_device
  are never read or written.
- struct zxdh_qp, struct zxdh_cq, and struct zxdh_srq are never defined, and
  their corresponding tables in struct zxdh_pci_f are allocated but never
  populated or read.
- CQP_CREATED through PBLE_CHUNK_MEM in enum init_completion_state, along
  with unused values in enum zxdh_func_type and enum zxdh_rdma_vers, are
  never referenced.

Could these unused declarations and the intra-series churn be dropped from
zrdma_main.h?

[1] https://lore.kernel.org/r/20260705112915.GB15188@unreal

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

  reply	other threads:[~2026-11-02  9:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  8:20 [PATCH rdma v8 0/7] Add ZTE DingHai Ethernet Protocol Driver for RDMA Yanze Zhang
2026-11-02  8:20 ` [PATCH rdma v8 1/7] RDMA/zrdma: Add build infrastructure and module skeleton Yanze Zhang
2026-11-02  8:45   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 2/7] RDMA/zrdma: Add core data structures and ABI definitions Yanze Zhang
2026-11-02  8:55   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 3/7] RDMA/zrdma: Add internal headers and hardware register definitions Yanze Zhang
2026-11-02  9:00   ` sashiko-bot [this message]
2026-11-02  8:20 ` [PATCH rdma v8 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton Yanze Zhang
2026-11-02  9:14   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 5/7] RDMA/zrdma: Implement device and port query operations Yanze Zhang
2026-11-02  9:31   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 6/7] RDMA/zrdma: Add device probe and remove logic Yanze Zhang
2026-11-02  9:36   ` sashiko-bot
2026-11-02  8:20 ` [PATCH rdma v8 7/7] RDMA/zrdma: Implement context, PD, and mmap operations Yanze Zhang
2026-11-02  9:47   ` sashiko-bot

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-193147@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox