diff --git a/libibverbs/cmd_ioctl.c b/libibverbs/cmd_ioctl.c
index 5bc2b59..b70bfae 100644
--- a/libibverbs/cmd_ioctl.c
+++ b/libibverbs/cmd_ioctl.c
@@ -35,6 +35,7 @@
 #include "ibverbs.h"
 
 #include <sys/ioctl.h>
+#include <infiniband/driver.h>
 
 #include <rdma/ib_user_ioctl_cmds.h>
 
@@ -125,12 +126,15 @@ static void finalize_attrs(struct ibv_command_buffer *cmd)
 
 int execute_ioctl(struct ibv_context *context, struct ibv_command_buffer *cmd)
 {
+	struct verbs_context *vctx = verbs_get_ctx(context);
+
 	prepare_attrs(cmd);
 	cmd->hdr.length = sizeof(cmd->hdr) +
 		sizeof(cmd->hdr.attrs[0]) * cmd->hdr.num_attrs;
 	cmd->hdr.reserved1 = 0;
 	cmd->hdr.reserved2 = 0;
 
+	cmd->hdr.driver_id = vctx->priv->driver_id;
 	if (ioctl(context->cmd_fd, RDMA_VERBS_IOCTL, &cmd->hdr))
 		return errno;
 
diff --git a/libibverbs/device.c b/libibverbs/device.c
index 8b97dde..ea571d0 100644
--- a/libibverbs/device.c
+++ b/libibverbs/device.c
@@ -186,7 +186,8 @@ __lib_ibv_create_cq_ex(struct ibv_context *context,
  * failure path of this function.
  */
 int verbs_init_context(struct verbs_context *context_ex,
-		       struct ibv_device *device, int cmd_fd)
+		       struct ibv_device *device, int cmd_fd,
+		       uint32_t driver_id)
 {
 	struct ibv_context *context = &context_ex->context;
 
@@ -224,6 +225,7 @@ int verbs_init_context(struct verbs_context *context_ex,
 		return -1;
 	}
 
+	context_ex->priv->driver_id = driver_id;
 	verbs_set_ops(context_ex, &verbs_dummy_ops);
 
 	return 0;
@@ -236,7 +238,8 @@ int verbs_init_context(struct verbs_context *context_ex,
  */
 void *_verbs_init_and_alloc_context(struct ibv_device *device, int cmd_fd,
 				    size_t alloc_size,
-				    struct verbs_context *context_offset)
+				    struct verbs_context *context_offset,
+				    uint32_t driver_id)
 {
 	void *drv_context;
 	struct verbs_context *context;
@@ -250,7 +253,7 @@ void *_verbs_init_and_alloc_context(struct ibv_device *device, int cmd_fd,
 
 	context = drv_context + (uintptr_t)context_offset;
 
-	if (verbs_init_context(context, device, cmd_fd))
+	if (verbs_init_context(context, device, cmd_fd, driver_id))
 		goto err_free;
 
 	return drv_context;
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 39b6bca..83b3870 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -41,6 +41,7 @@
 #include <ccan/list.h>
 #include <config.h>
 #include <stdbool.h>
+#include <rdma/rdma_user_ioctl_cmds.h>
 
 struct verbs_device;
 
@@ -300,15 +301,18 @@ void verbs_register_driver(const struct verbs_device_ops *ops);
 
 void *_verbs_init_and_alloc_context(struct ibv_device *device, int cmd_fd,
 				    size_t alloc_size,
-				    struct verbs_context *context_offset);
+				    struct verbs_context *context_offset,
+				    uint32_t driver_id);
 
-#define verbs_init_and_alloc_context(ibdev, cmd_fd, drv_ctx_ptr, ctx_memb)     \
+#define verbs_init_and_alloc_context(ibdev, cmd_fd, drv_ctx_ptr, ctx_memb,     \
+				     driver_id)				       \
 	((typeof(drv_ctx_ptr))_verbs_init_and_alloc_context(                   \
 		ibdev, cmd_fd, sizeof(*drv_ctx_ptr),                           \
-		&((typeof(drv_ctx_ptr))NULL)->ctx_memb))
+		&((typeof(drv_ctx_ptr))NULL)->ctx_memb, (driver_id)))
 
 int verbs_init_context(struct verbs_context *context_ex,
-		       struct ibv_device *device, int cmd_fd);
+		       struct ibv_device *device, int cmd_fd,
+		       uint32_t driver_id);
 void verbs_uninit_context(struct verbs_context *context);
 void verbs_set_ops(struct verbs_context *vctx,
 		   const struct verbs_context_ops *ops);
diff --git a/libibverbs/ibverbs.h b/libibverbs/ibverbs.h
index 98000ff..ce8973a 100644
--- a/libibverbs/ibverbs.h
+++ b/libibverbs/ibverbs.h
@@ -62,6 +62,7 @@ struct verbs_ex_private {
 					  struct ibv_cq_init_attr_ex *init_attr);
 
 	uint64_t unsupported_ioctls;
+	uint32_t driver_id;
 };
 
 #define IBV_INIT_CMD(cmd, size, opcode)					\
diff --git a/providers/bnxt_re/main.c b/providers/bnxt_re/main.c
index eae50b0..fac5bd3 100644
--- a/providers/bnxt_re/main.c
+++ b/providers/bnxt_re/main.c
@@ -117,7 +117,8 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev,
 	struct bnxt_re_dev *dev = to_bnxt_re_dev(vdev);
 	struct bnxt_re_context *cntx;
 
-	cntx = verbs_init_and_alloc_context(vdev, cmd_fd, cntx, ibvctx);
+	cntx = verbs_init_and_alloc_context(vdev, cmd_fd, cntx, ibvctx,
+					    RDMA_DRIVER_BNXT_RE);
 	if (!cntx)
 		return NULL;
 
diff --git a/providers/cxgb3/iwch.c b/providers/cxgb3/iwch.c
index 8e2405f..c68626a 100644
--- a/providers/cxgb3/iwch.c
+++ b/providers/cxgb3/iwch.c
@@ -125,7 +125,8 @@ static struct verbs_context *iwch_alloc_context(struct ibv_device *ibdev,
 	struct iwch_alloc_ucontext_resp resp;
 	struct iwch_device *rhp = to_iwch_dev(ibdev);
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_CXGB3);
 	if (!context)
 		return NULL;
 
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index 4d60327..b1eeb52 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -115,7 +115,8 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
 	uint64_t raw_fw_ver;
 	struct ibv_device_attr attr;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_CXGB4);
 	if (!context)
 		return NULL;
 
diff --git a/providers/hfi1verbs/hfiverbs.c b/providers/hfi1verbs/hfiverbs.c
index d46ad86..2c70e48 100644
--- a/providers/hfi1verbs/hfiverbs.c
+++ b/providers/hfi1verbs/hfiverbs.c
@@ -144,7 +144,8 @@ static struct verbs_context *hfi1_alloc_context(struct ibv_device *ibdev,
 	struct ib_uverbs_get_context_resp  resp;
 	struct hfi1_device         *dev;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_HFI1);
 	if (!context)
 		return NULL;
 
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 781825b..f43722c 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -71,7 +71,8 @@ static struct verbs_context *hns_roce_alloc_context(struct ibv_device *ibdev,
 	struct hns_roce_alloc_ucontext_resp resp;
 	struct hns_roce_device *hr_dev = to_hr_dev(ibdev);
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_HNS);
 	if (!context)
 		return NULL;
 
diff --git a/providers/i40iw/i40iw_umain.c b/providers/i40iw/i40iw_umain.c
index 6e25267..b169881 100644
--- a/providers/i40iw/i40iw_umain.c
+++ b/providers/i40iw/i40iw_umain.c
@@ -134,7 +134,8 @@ static struct verbs_context *i40iw_ualloc_context(struct ibv_device *ibdev,
 	struct i40iw_get_context cmd;
 	struct i40iw_ualloc_ucontext_resp resp;
 
-	iwvctx = verbs_init_and_alloc_context(ibdev, cmd_fd, iwvctx, ibv_ctx);
+	iwvctx = verbs_init_and_alloc_context(ibdev, cmd_fd, iwvctx, ibv_ctx,
+					      RDMA_DRIVER_I40IW);
 	if (!iwvctx)
 		return NULL;
 
diff --git a/providers/ipathverbs/ipathverbs.c b/providers/ipathverbs/ipathverbs.c
index 00d84b7..95715d9 100644
--- a/providers/ipathverbs/ipathverbs.c
+++ b/providers/ipathverbs/ipathverbs.c
@@ -143,7 +143,8 @@ static struct verbs_context *ipath_alloc_context(struct ibv_device *ibdev,
 	struct ib_uverbs_get_context_resp  resp;
 	struct ipath_device         *dev;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_QIB);
 	if (!context)
 		return NULL;
 
diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c
index dd7b98b..1b9be11 100644
--- a/providers/mlx4/mlx4.c
+++ b/providers/mlx4/mlx4.c
@@ -177,7 +177,8 @@ static struct verbs_context *mlx4_alloc_context(struct ibv_device *ibdev,
 	struct verbs_context		*verbs_ctx;
 	struct ibv_device_attr_ex	dev_attrs;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_MLX4);
 	if (!context)
 		return NULL;
 
diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index 55b466c..0be76a7 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -974,7 +974,8 @@ static struct verbs_context *mlx5_alloc_context(struct ibv_device *ibdev,
 	int				bfi;
 	int				num_sys_page_map;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_MLX5);
 	if (!context)
 		return NULL;
 
diff --git a/providers/mthca/mthca.c b/providers/mthca/mthca.c
index 25cf316..d2a9330 100644
--- a/providers/mthca/mthca.c
+++ b/providers/mthca/mthca.c
@@ -137,7 +137,8 @@ static struct verbs_context *mthca_alloc_context(struct ibv_device *ibdev,
 	struct mthca_alloc_ucontext_resp resp;
 	int                              i;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_MTHCA);
 	if (!context)
 		return NULL;
 
diff --git a/providers/nes/nes_umain.c b/providers/nes/nes_umain.c
index c2c8b03..1a79132 100644
--- a/providers/nes/nes_umain.c
+++ b/providers/nes/nes_umain.c
@@ -109,7 +109,8 @@ static struct verbs_context *nes_ualloc_context(struct ibv_device *ibdev,
 
 	page_size = sysconf(_SC_PAGESIZE);
 
-	nesvctx = verbs_init_and_alloc_context(ibdev, cmd_fd, nesvctx, ibv_ctx);
+	nesvctx = verbs_init_and_alloc_context(ibdev, cmd_fd, nesvctx, ibv_ctx,
+					       RDMA_DRIVER_NES);
 	if (!nesvctx)
 		return NULL;
 
diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c
index 5fb5714..76c3b30 100644
--- a/providers/ocrdma/ocrdma_main.c
+++ b/providers/ocrdma/ocrdma_main.c
@@ -112,7 +112,8 @@ static struct verbs_context *ocrdma_alloc_context(struct ibv_device *ibdev,
 	struct ocrdma_get_context cmd;
 	struct ocrdma_alloc_ucontext_resp resp;
 
-	ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx);
+	ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx,
+					   RDMA_DRIVER_OCRDMA);
 	if (!ctx)
 		return NULL;
 
diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
index 9926f52..84a8576 100644
--- a/providers/qedr/qelr_main.c
+++ b/providers/qedr/qelr_main.c
@@ -162,7 +162,8 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
 	struct qelr_get_context cmd;
 	struct qelr_alloc_ucontext_resp resp;
 
-	ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx);
+	ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx,
+					   RDMA_DRIVER_QEDR);
 	if (!ctx)
 		return NULL;
 
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 53f0bf6..30d2e68 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -862,7 +862,8 @@ static struct verbs_context *rxe_alloc_context(struct ibv_device *ibdev,
 	struct ibv_get_context cmd;
 	struct ib_uverbs_get_context_resp resp;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_RXE);
 	if (!context)
 		return NULL;
 
diff --git a/providers/vmw_pvrdma/pvrdma_main.c b/providers/vmw_pvrdma/pvrdma_main.c
index ab23bec..cbcc855 100644
--- a/providers/vmw_pvrdma/pvrdma_main.c
+++ b/providers/vmw_pvrdma/pvrdma_main.c
@@ -147,7 +147,8 @@ static struct verbs_context *pvrdma_alloc_context(struct ibv_device *ibdev,
 {
 	struct pvrdma_context *context;
 
-	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx);
+	context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
+					       RDMA_DRIVER_VMW_PVRDMA);
 	if (!context)
 		return NULL;
 
