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 v9 3/7] RDMA/zrdma: Add internal headers and hardware register definitions
Date: Tue, 03 Nov 2026 13:18:22 +0000	[thread overview]
Message-ID: <sashiko-outbox-195319@kernel.org> (raw)
In-Reply-To: <20261103125654.2707069-4-zhang.yanze@zte.com.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] RDMA/zrdma: private duplication of PF driver auxiliary device structures
--

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

RDMA/zrdma: Add internal headers and hardware register definitions

This commit adds internal header files defining driver device structures,
resource allocation helpers, and hardware limits 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..d65811735e74e
> --- /dev/null
> +++ b/drivers/infiniband/hw/zrdma/zrdma_main.h
> @@ -0,0 +1,177 @@

[ ... ]

> +struct zxdh_pci_f {

[ ... ]

> +	struct zxdh_sc_dev sc_dev;
> +	struct pci_dev *pcidev;
> +	struct zxdh_rdma_core_dev *zdev_info;
> +	struct zxdh_hw hw;
> +
> +	spinlock_t rsrc_lock; /* protects resource allocation arrays */
> +
> +	struct msix_entry *msix_entries;
> +	struct zxdh_gen_ops gen_ops;
> +	struct zxdh_device *zdev;
> +	u16 qp_index;
> +	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 list_head ah_list;
> +	struct mutex ah_list_lock; /* protects ah_list operations */
> +	u8 ibdev_status;
> +	u8 roce_mode : 1;
> +	enum init_completion_state init_state;
> +	struct zxdh_auxiliary_dev *zxdh_adev;

[ ... ]

> diff --git a/drivers/infiniband/hw/zrdma/zrdma_type.h b/drivers/infiniband/hw/zrdma/zrdma_type.h
> index ded4052453455..c6ad2be17c159 100644
> --- a/drivers/infiniband/hw/zrdma/zrdma_type.h
> +++ b/drivers/infiniband/hw/zrdma/zrdma_type.h
> @@ -21,6 +21,12 @@ enum zxdh_function_type {
>  	ZXDH_FUNCTION_TYPE_VF,
>  };
>  
> +/*
> + * The structures below describe the auxiliary device of the DingHai PF
> + * driver. Their layout has to match the definition of the PF driver
> + * exactly, because the probe path reads them through the auxiliary device
> + * that the PF driver provides.
> + */
>  struct zxdh_rdma_core_dev;

[Severity: Medium]
Should the cross-driver auxiliary device structures (struct
zxdh_auxiliary_dev, struct zxdh_rdma_core_dev, struct zxdh_rdma_core_ops, and
struct zxdh_rdma_if) be defined in a shared header under include/linux/
rather than privately duplicated in drivers/infiniband/hw/zrdma/zrdma_type.h
and referenced by struct zxdh_pci_f (zdev_info) and struct zxdh_device
(zxdh_adev) in drivers/infiniband/hw/zrdma/zrdma_main.h?

In a subsequent patch in the series, zxdh_probe() in
drivers/infiniband/hw/zrdma/zrdma_main.c casts the auxiliary_device pointer
via container_of(aux_dev, struct zxdh_auxiliary_dev, adev) and dereferences
zxdh_adev->rdma_ops and zxdh_adev->zxdh_info.

However, the in-tree DingHai PF driver under drivers/net/ethernet/zte/dinghai/
(en_pf.c, en_pf.h, dh_queue.h) does not define struct zxdh_auxiliary_dev or
struct zxdh_rdma_core_dev and does not register any auxiliary device. Relying
on manual struct layout matching across subsystems with untyped void *
placeholders (such as ops, parent, auxiliary_ops[18], and dh_dev) risks type
confusion and memory corruption if either driver changes.

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

  reply	other threads:[~2026-11-03 13:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 12:56 [PATCH rdma v9 0/7] Add ZTE DingHai Ethernet Protocol Driver for RDMA Yanze Zhang
2026-11-03 12:56 ` [PATCH rdma v9 1/7] RDMA/zrdma: Add build infrastructure and module skeleton Yanze Zhang
2026-11-03 13:20   ` sashiko-bot
2026-11-03 12:56 ` [PATCH rdma v9 2/7] RDMA/zrdma: Add core data structures and ABI definitions Yanze Zhang
2026-11-03 13:19   ` sashiko-bot
2026-11-03 12:56 ` [PATCH rdma v9 3/7] RDMA/zrdma: Add internal headers and hardware register definitions Yanze Zhang
2026-11-03 13:18   ` sashiko-bot [this message]
2026-11-03 12:56 ` [PATCH rdma v9 4/7] RDMA/zrdma: Add hardware resource initialization and verbs skeleton Yanze Zhang
2026-11-03 13:21   ` sashiko-bot
2026-11-03 12:56 ` [PATCH rdma v9 5/7] RDMA/zrdma: Implement device and port query operations Yanze Zhang
2026-11-03 13:25   ` sashiko-bot
2026-11-03 12:56 ` [PATCH rdma v9 6/7] RDMA/zrdma: Add device probe and remove logic Yanze Zhang
2026-11-03 13:17   ` sashiko-bot
2026-11-03 12:56 ` [PATCH rdma v9 7/7] RDMA/zrdma: Implement context, PD, and mmap operations Yanze Zhang
2026-11-03 13:23   ` 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-195319@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.