summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-10-06 18:50:36 -0700
committerJakub Kicinski <kuba@kernel.org>2026-10-06 18:50:37 -0700
commit8e37d7bec7968f4b63b47e5b478c3d5b98f02793 (patch)
tree81344b049e78170764823673432fd193b4dcd7b3 /include/linux
parentd065de29c919afac71e46a91a7449203ceb018ce (diff)
parent00290b9ff59ef47b990d26a6b1a8b2ea6dedf5e9 (diff)
Merge branch 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
Tariq Toukan says: ==================== mlx5: Move data direct infrastructure to mlx5_core Data direct support currently lives in mlx5_ib, which owns the data direct PCI driver, device matching and resource management. To prepare for data direct support in netdev, move this infrastructure to mlx5_core and provide a common interface for its consumers. The series first replaces the direct IB unbind callback with a blocking notifier chain, allowing multiple consumers to receive unbind events. It then separates consumer registration from initialization, consolidates the per-device state and resources, and keeps IB-specific locking and MR teardown in mlx5_ib. With these preparations in place, the final patch moves the shared implementation and PCI driver to mlx5_core. Data direct initialization and resource creation run during core load, before consumers attach; cleanup runs during core unload, after consumers detach. The data direct PCI driver is also explicitly named "mlx5_dd", replacing the previous "mlx5_ib" name derived from KBUILD_MODNAME. This series prepares the shared infrastructure for netdev support. The netdev consumer will follow in a separate series. * 'mlx5-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux: mlx5: Move data direct implementation to mlx5_core RDMA/mlx5: Pull data_direct resource creation in init phase RDMA/mlx5: Consolidate data direct state into one object RDMA/mlx5: Extract IB specific lock out of data direct RDMA/mlx5: Add new registration stage for data direct users RDMA/mlx5: Move and rename data direct resource functions RDMA/mlx5: Give the data direct PCI driver a proper name RDMA/mlx5: Make the data direct VUID query self-contained RDMA/mlx5: Add mlx5_data_direct_supported() helper RDMA/mlx5: Notify data direct users via a notifier chain on unbind ==================== Link: https://patch.msgid.link/20261004064921.213888-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mlx5/data_direct.h47
-rw-r--r--include/linux/mlx5/driver.h8
2 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/mlx5/data_direct.h b/include/linux/mlx5/data_direct.h
new file mode 100644
index 000000000000..4cff5ff5489d
--- /dev/null
+++ b/include/linux/mlx5/data_direct.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
+/*
+ * Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved
+ */
+
+#ifndef _MLX5_DATA_DIRECT_H
+#define _MLX5_DATA_DIRECT_H
+
+#include <linux/compiler.h>
+#include <linux/list.h>
+
+struct device;
+struct mlx5_core_dev;
+struct notifier_block;
+struct pci_dev;
+
+enum mlx5_data_direct_event {
+ MLX5_DATA_DIRECT_UNBIND,
+};
+
+struct mlx5_data_direct_dev {
+ struct device *device;
+ struct pci_dev *pdev;
+ char *vuid;
+ struct list_head list;
+};
+
+struct mlx5_data_direct {
+ struct mlx5_data_direct_dev *dev;
+ u32 pdn;
+ u32 mkey;
+ u32 mkey_ro;
+ u8 mkey_ro_valid :1;
+};
+
+static inline struct mlx5_data_direct_dev *
+mlx5_data_direct_get_dev(struct mlx5_data_direct *dd)
+{
+ return dd ? READ_ONCE(dd->dev) : NULL;
+}
+
+int mlx5_data_direct_register(struct mlx5_core_dev *mdev,
+ struct notifier_block *nb);
+void mlx5_data_direct_unregister(struct mlx5_core_dev *mdev,
+ struct notifier_block *nb);
+
+#endif
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 83d0a83bbfbc..abb99371ff13 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -707,6 +707,7 @@ struct mlx5_rsvd_gids {
struct mlx5_clock;
struct mlx5_clock_dev_state;
+struct mlx5_data_direct;
struct mlx5_dm;
struct mlx5_fw_tracer;
struct mlx5_vxlan;
@@ -801,6 +802,7 @@ struct mlx5_core_dev {
/* sync write combining state */
struct mutex wc_state_lock;
struct devlink *shd;
+ struct mlx5_data_direct *data_direct;
};
struct mlx5_db {
@@ -1395,4 +1397,10 @@ static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
#define MLX5_SW_IMAGE_GUID_MAX_BYTES 9
+static inline bool mlx5_data_direct_supported(struct mlx5_core_dev *mdev)
+{
+ return MLX5_CAP_GEN(mdev, data_direct) &&
+ MLX5_CAP_GEN_2(mdev, query_vuid);
+}
+
#endif /* MLX5_DRIVER_H */