On Fri, Jan 22, 2021 at 05:48:20PM -0600, Shiraz Saleem wrote: > From: Mustafa Ismail <mustafa.ismail@xxxxxxxxx> > > Implement device supported verb APIs. The supported APIs > vary based on the underlying transport the ibdev is > registered as (i.e. iWARP or RoCEv2). > > Signed-off-by: Mustafa Ismail <mustafa.ismail@xxxxxxxxx> > Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> > --- > drivers/infiniband/hw/irdma/verbs.c | 4617 +++++++++++++++++++++++++++++++ > drivers/infiniband/hw/irdma/verbs.h | 218 ++ > include/uapi/rdma/ib_user_ioctl_verbs.h | 1 + > 3 files changed, 4836 insertions(+) > create mode 100644 drivers/infiniband/hw/irdma/verbs.c > create mode 100644 drivers/infiniband/hw/irdma/verbs.h <...> > + if (req.userspace_ver > IRDMA_ABI_VER) > + goto ver_error; > + > + ucontext->iwdev = iwdev; > + ucontext->abi_ver = req.userspace_ver; > + > + uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; > + /* GEN_1 legacy support with libi40iw */ > + if (req.userspace_ver <= 5) { > + if (uk_attrs->hw_rev != IRDMA_GEN_1) > + goto ver_error; > + > + uresp_gen1.max_qps = iwdev->rf->max_qp; > + uresp_gen1.max_pds = iwdev->rf->sc_dev.hw_attrs.max_hw_pds; > + uresp_gen1.wq_size = iwdev->rf->sc_dev.hw_attrs.max_qp_wr * 2; > + uresp_gen1.kernel_ver = req.userspace_ver; > + if (ib_copy_to_udata(udata, &uresp_gen1, > + min(sizeof(uresp_gen1), udata->outlen))) > + return -EFAULT; > + } else { > + u64 bar_off = > + (uintptr_t)iwdev->rf->sc_dev.hw_regs[IRDMA_DB_ADDR_OFFSET]; > + ucontext->db_mmap_entry = > + irdma_user_mmap_entry_insert(ucontext, bar_off, > + IRDMA_MMAP_IO_NC, > + &uresp.db_mmap_key); > + > + if (!ucontext->db_mmap_entry) > + return -ENOMEM; > + > + uresp.kernel_ver = IRDMA_ABI_VER; > + uresp.feature_flags = uk_attrs->feature_flags; > + uresp.max_hw_wq_frags = uk_attrs->max_hw_wq_frags; > + uresp.max_hw_read_sges = uk_attrs->max_hw_read_sges; > + uresp.max_hw_inline = uk_attrs->max_hw_inline; > + uresp.max_hw_rq_quanta = uk_attrs->max_hw_rq_quanta; > + uresp.max_hw_wq_quanta = uk_attrs->max_hw_wq_quanta; > + uresp.max_hw_sq_chunk = uk_attrs->max_hw_sq_chunk; > + uresp.max_hw_cq_size = uk_attrs->max_hw_cq_size; > + uresp.min_hw_cq_size = uk_attrs->min_hw_cq_size; > + uresp.hw_rev = uk_attrs->hw_rev; > + if (ib_copy_to_udata(udata, &uresp, > + min(sizeof(uresp), udata->outlen))) > + return -EFAULT; > + } i40iw has different logic here, and in old code, if user supplied "req.userspace_ver < 4", he will get an error. In new code, it will pass and probably fail later. Thanks