From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796304095; b=JJ2YXAEQNRv6qan4HU6HifYabjoE4j7UWnnPWP/h4GiKTbBYOh+LHVTa30HCFbRy4ypz jJfsUYByMKaJraTq9cpL8X8ezQPfz+gtsWmlrsw1yqehIbfxPMBJiMxzZFA1l2Kx5Swzn S4iP/r+CxJnIJ8ejk/ehm6ws9OEaL8h7dsCyJVlrVwSQc3eXzgTDUHFUpQeC40i0sMH9g jAy0Vpipaqc0f1IJGCDvA5vuMI7Y0EFnOTCK+5vcNG2C2/6Bg/15TRIVfOT85XjTyCMrj Ywo5A4xMMKKNnPmXrOSAjmX9zocFacRAePTlLe4JOH0uxylCgD98s21xLIgtrWDOA3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796304095; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=x8E+aCnFO9m5WQFk87lk3Xc4Y0gNMgwjuOVhvI/t5pM=; b=N1xMXjdYyDvGm/DCivpO47pbfrp6Q9gOVEUziUfA7fnd25QSy+v/dAuX9yA1TePuMU+y +IDKc9qJwo+2eJAqpwxx0fZ1foSbvE0e/GMeQ+5ojEHbPiQ7OseNjYSqdbzebMSg6W0dp jjeMhyU4PMpSH42uIV1MAkNoGAgGOkcEdGb7HayOzOBpRG4seQtIzyddiTNqhdAqWJKxs R4I4iZ67jxy+sUgDnX5wGAh0W8JwpTRdtiOS7tp1cwhxJJCgLM6/fTBTVEniEZv3H52Pa USwdGX3lxti+tTpBz187mkpmUCWqC+gZAoqTKkOVl2Y3RAhAJ+3gucIE8Suju+bQh0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fODzUx+B; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 949C0606A322 for ; Thu, 3 Dec 2026 13:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fODzUx+B Received: by smtp.kernel.org (Postfix) with ESMTPSA id E26461F00893; Thu, 3 Dec 2026 13:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796304095; bh=x8E+aCnFO9m5WQFk87lk3Xc4Y0gNMgwjuOVhvI/t5pM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=fODzUx+BpqsantvEaxVJSPXKExs6Ke++hkrS8wv4MgnSublj5VMzVwPZyTHcJsiIP Y+tS6HAhmPJEcjrps87npCe+aI+X6ePOYVOtDiyQIu71aEDZd84TvAPesqNPT5LUmF v0RWA37cV5DL9L207zpYs+/TcIkAkmRu/+Z8CwhwZkLBDcY3P8qdUXSIJvYZmNjyzo hH66GkSn0YWQ6eyysRc2JhF/4y4jdhq2yc/sZ6EFenuXJ8Boe86HeDNeZvDsm7sWw/ tlvWHj683cu17ApsjkYuJopGWJSYoSZ334XV7Sxvqq5fUiKYC3VvUWUrQCTVHUbR7X 123O2oXFQOMcQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH rdma v10 2/7] RDMA/zrdma: Add core data structures and ABI definitions Reply-To: sashiko-reviews@lists.linux.dev To: "Yanze Zhang" Cc: linux-rdma@vger.kernel.org In-Reply-To: <20261203124928.48716-3-zhang.yanze@zte.com.cn> References: <20261203124928.48716-1-zhang.yanze@zte.com.cn> <20261203124928.48716-3-zhang.yanze@zte.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 13:21:33 +0000 X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [Medium] RDMA/zrdma: UAPI naming, legacy versioning, and comment defects in zrdma_abi.h - [Medium] RDMA/zrdma: unimplemented tool flags and physical DB mode in UAPI zrdma_abi.h - [Medium] RDMA/zrdma: private untyped auxiliary device contract in zrdma_type.h - [Low] RDMA/zrdma: missing linux/types.h in zrdma_ctrl.h and unused header includes - [Low] RDMA/zrdma: zrdma_type.h includes disallowed internal header linux/msi.h - [Low] RDMA/zrdma: ucontext feature_flags bits omitted from UAPI header zrdma_abi.h -- commit 4a62fdca8db6526c72b37236b1beb85ab11eb48b Author: Yanze Zhang RDMA/zrdma: Add core data structures and ABI definitions This commit adds the initial internal data structure headers and the user-space ABI header for the ZTE DingHai RDMA driver. > diff --git a/drivers/infiniband/hw/zrdma/zrdma_ctrl.h b/drivers/infiniban= d/hw/zrdma/zrdma_ctrl.h > new file mode 100644 > index 0000000000000..935b4cbd3e4a9 > --- /dev/null > +++ b/drivers/infiniband/hw/zrdma/zrdma_ctrl.h > @@ -0,0 +1,20 @@ [ ... ] > +struct zxdh_hw { > + struct device *device; > +}; > + > +struct zxdh_sc_dev { > + u32 max_ceqs; > + u8 ep_id; > + u8 driver_load; > +}; > diff --git a/drivers/infiniband/hw/zrdma/zrdma_defs.h b/drivers/infiniban= d/hw/zrdma/zrdma_defs.h > new file mode 100644 > index 0000000000000..208f1f60bbaee > --- /dev/null > +++ b/drivers/infiniband/hw/zrdma/zrdma_defs.h > @@ -0,0 +1,19 @@ [ ... ] > +#include > +#include [Severity: Low] Can zrdma_ctrl.h fail to compile when included standalone? struct zxdh_sc_dev uses u32 and u8 without including linux/types.h, and struct zxdh_hw references struct device * without forward-declaring struct device. Also, zrdma_defs.h includes linux/bitfield.h and rdma/ib_verbs.h even though neither header is used anywhere in the file. Adding linux/types.h and a struct device forward declaration to zrdma_ctrl.h and dropping the unused includes from zrdma_defs.h would keep both headers self-contained. > diff --git a/drivers/infiniband/hw/zrdma/zrdma_type.h b/drivers/infiniban= d/hw/zrdma/zrdma_type.h > new file mode 100644 > index 0000000000000..ded4052453455 > --- /dev/null > +++ b/drivers/infiniband/hw/zrdma/zrdma_type.h > @@ -0,0 +1,86 @@ [ ... ] > +#include > +#include [Severity: Low] Should zrdma_type.h include linux/msi.h? include/linux/msi.h is restricted to interrupt, PCI/MSI, and IOMMU core code and explicitly states that regular device drivers have no business including it (driver-facing MSI APIs live in linux/msi_api.h). The only MSI-related type here is struct msix_entry *, which belongs to linux/pci.h, and both struct pci_dev and struct msix_entry are only referenced by pointer. Removing linux/msi.h and using forward declarations or linux/pci.h (alongside linux/bits.h and linux/types.h) would avoid the core-internal header. [ ... ] > +struct zxdh_rdma_core_ops { > + int (*request_reset)(struct zxdh_rdma_core_dev *cdev, > + enum zxdh_rdma_reset_type reset_type); > + int (*zxdh_common_func)(void *in_param, void *out_param, u32 opcode); > +}; > + > +struct zxdh_rdma_ver_info { > + u16 major; > + u16 minor; > + u64 support; /* 0~7:net_major,8~15:net_minor,16~23:rdma_minor,24~63:rsc= v */ > +}; [ ... ] > +struct zxdh_rdma_core_dev { > + struct pci_dev *pdev; > + struct auxiliary_device *adev; > + u8 __iomem *hw_addr; > + int zdev_info_id; > + struct zxdh_rdma_ver_info ver; > + void *auxiliary_priv; > + enum zxdh_function_type ftype; > + u16 vport_id; > + u16 slot_id; > + enum zxdh_rdma_protocol rdma_protocol; > + > + struct zxdh_qos_params qos_info; > + struct msix_entry *msix_entries; > + u16 msix_count; > + const struct zxdh_rdma_core_ops *ops; > + void *dh_dev; > +}; > + > +struct zxdh_rdma_if { > + void *(*get_rdma_netdev)(void *dh_dev); > +}; > + > +struct zxdh_auxiliary_dev { > + struct auxiliary_device adev; > + struct zxdh_rdma_core_dev *zxdh_info; > + struct zxdh_rdma_if *rdma_ops; > + void *ops; > + void *parent; > + s32 aux_id; > + void *auxiliary_ops[18]; > +}; [Severity: Medium] Should struct zxdh_auxiliary_dev and the shared PF-to-RDMA interface structures live in a shared header under include/linux/ rather than privately in zrdma_type.h? As documented in include/linux/auxiliary_bus.h, the parent object embedding struct auxiliary_device and the shared objects it points to must be defined in a shared header included by both drivers. Keeping private copies here bypasses compile-time layout and signature checking, so any divergence from the PF driver causes silent type confusion or memory corruption when zxdh_probe() casts the auxiliary device with container_of(). These definitions also carry untyped void * fields (such as auxiliary_ops[18], get_rdma_netdev() returning void *, and the zxdh_common_func() opcode multiplexer), internal kernel-to-kernel ABI versioning in struct zxdh_rdma_ver_info, and legacy struct msix_entry *. In addition, the in-tree dinghai10e PF driver under drivers/net/ethernet/zte/dinghai/ defines none of these structures and registers no auxiliary device, leaving this driver unable to bind in-tree. > diff --git a/include/uapi/rdma/zrdma_abi.h b/include/uapi/rdma/zrdma_abi.h > new file mode 100644 > index 0000000000000..53f15591f894e > --- /dev/null > +++ b/include/uapi/rdma/zrdma_abi.h > @@ -0,0 +1,114 @@ [ ... ] > +#define ZXDH_ABI_VER 5 > + > +/* The versions of the context that the user space can ask for with > + * struct zxdh_alloc_ucontext_req.userspace_ver. A version tells the > + * driver which features of the user space are available. > + */ > +#define ZXDH_CONTEXT_VER_V1 5 > +#define ZXDH_CONTEXT_VER_V2 6 > +#define ZXDH_CONTEXT_VER_V3 7 [Severity: Medium] Should this UAPI header follow the -abi.h naming convention and drop legacy out-of-tree ABI versioning before it becomes permanent UAPI? All existing RDMA provider headers in include/uapi/rdma/ use a hyphen (such as irdma-abi.h and mlx5-abi.h), so zrdma_abi.h introduces a permanent naming inconsistency once merged. For a brand-new upstream driver, starting ZXDH_ABI_VER at 5 with three legacy context versions (ZXDH_CONTEXT_VER_V1..V3), carrying an unused leading rsvd32 field in struct zxdh_alloc_ucontext_req, omitting comp_mask, and ending struct zxdh_alloc_ucontext_resp with 12 trailing reserved bytes (__u16 rsv[6]) hinders future udata->outlen-based UAPI extension. The struct comments also reference non-existent commands (INFINIBAND_UVERBS_CMD_ALLOC_CONTEXT and INFINIBAND_UVERBS_CMD_ALLOC_PD instead of IB_USER_VERBS_CMD_GET_CONTEXT and IB_USER_VERBS_CMD_ALLOC_PD), and describe the rdma_tool_flags bitmask as "one of the enum zxdh_rdma_tool_flags". > +enum zxdh_rdma_tool_flags { > + ZXDH_QP_EXTEND_OP =3D 1 << 0, > + ZXDH_CAPTURE =3D 1 << 1, > + ZXDH_GET_HW_DATA =3D 1 << 2, > + ZXDH_GET_HW_OBJECT_DATA =3D 1 << 3, > + ZXDH_CHECK_HW_HEALTH =3D 1 << 4, > + ZXDH_RDMA_TOOL_CFG_DEV_PARAM =3D 1 << 5, > + ZXDH_RDMA_TOOL_READ_RAM =3D 1 << 6, > + ZXDH_RDMA_TOOL_DEVX_MODIFY_CQ =3D 1 << 7, > + ZXDH_RDMA_SET_CREDIT_CAP =3D 1 << 8, > + ZXDH_RDMA_SWITCH =3D 1 << 9, > + ZXDH_RDMA_TOOL_DEVX_EXT_MEM =3D 1 << 10, > + ZXDH_RDMA_TOOL_PRIV_EXT =3D 1 << 11, > + ZXDH_RDMA_TOOL_IOVA_CAP =3D 1 << 12, > +}; > + > +enum zxdh_db_addr_type { > + ZXDH_DB_ADDR_PHY =3D 0, > + ZXDH_DB_ADDR_BAR =3D 1, > +}; [Severity: Medium] Should unimplemented vendor tool flags and a physical-address doorbell mode be exposed in a permanent UAPI header? None of the 13 flags in enum zxdh_rdma_tool_flags have any backing implementation in the driver, yet zxdh_alloc_ucontext() later in the series unconditionally advertises all 13 bits to userspace. Exposing proprietary RAM reads, packet capture, hardware parameter configuration, and private extensions through ucontext flags bypasses standard interfaces (devlink, rdma netlink, fwctl, debugfs) and locks unreviewed vendor tooling into UAPI. Similarly, ZXDH_DB_ADDR_PHY in enum zxdh_db_addr_type is never used and conflicts with kernel-userspace isolation and the rdma_user_mmap_entry BAR-mapping model. [ ... ] > + /* The features that the driver supports. */ > + __aligned_u64 feature_flags; [Severity: Low] Should the feature_flags bit constants be defined in zrdma_abi.h? The driver populates uresp.feature_flags using ZXDH_FEATURE_RTS_AE, ZXDH_FEATURE_CQ_RESIZE, and ZXDH_FEATURE_64_BYTE_CQE from the private kernel header drivers/infiniband/hw/zrdma/zrdma_defs.h. Leaving them out of the installed UAPI header forces userspace providers to duplicate private magic bit values and risks silent ABI divergence. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203124928.4871= 6-1-zhang.yanze@zte.com.cn?part=3D2