Loading drivers/infiniband/hw/mlx4/main.c +8 −13 Original line number Original line Diff line number Diff line Loading @@ -140,7 +140,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->max_mr_size = ~0ull; props->max_mr_size = ~0ull; props->page_size_cap = dev->dev->caps.page_size_cap; props->page_size_cap = dev->dev->caps.page_size_cap; props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; props->max_qp_wr = dev->dev->caps.max_wqes; props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; props->max_sge = min(dev->dev->caps.max_sq_sg, props->max_sge = min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg); dev->dev->caps.max_rq_sg); props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; Loading Loading @@ -1084,12 +1084,9 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) int total_eqs = 0; int total_eqs = 0; int i, j, eq; int i, j, eq; /* Init eq table */ /* Legacy mode or comp_pool is not large enough */ ibdev->eq_table = NULL; if (dev->caps.comp_pool == 0 || ibdev->eq_added = 0; dev->caps.num_ports > dev->caps.comp_pool) /* Legacy mode? */ if (dev->caps.comp_pool == 0) return; return; eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ Loading Loading @@ -1135,7 +1132,10 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) { { int i; int i; int total_eqs; /* no additional eqs were added */ if (!ibdev->eq_table) return; /* Reset the advertised EQ number */ /* Reset the advertised EQ number */ ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; Loading @@ -1148,12 +1148,7 @@ static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) mlx4_release_eq(dev, ibdev->eq_table[i]); mlx4_release_eq(dev, ibdev->eq_table[i]); } } total_eqs = dev->caps.num_comp_vectors + ibdev->eq_added; memset(ibdev->eq_table, 0, total_eqs * sizeof(int)); kfree(ibdev->eq_table); kfree(ibdev->eq_table); ibdev->eq_table = NULL; ibdev->eq_added = 0; } } static void *mlx4_ib_add(struct mlx4_dev *dev) static void *mlx4_ib_add(struct mlx4_dev *dev) Loading drivers/infiniband/hw/mlx4/mlx4_ib.h +8 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,14 @@ #include <linux/mlx4/device.h> #include <linux/mlx4/device.h> #include <linux/mlx4/doorbell.h> #include <linux/mlx4/doorbell.h> enum { MLX4_IB_SQ_MIN_WQE_SHIFT = 6, MLX4_IB_MAX_HEADROOM = 2048 }; #define MLX4_IB_SQ_HEADROOM(shift) ((MLX4_IB_MAX_HEADROOM >> (shift)) + 1) #define MLX4_IB_SQ_MAX_SPARE (MLX4_IB_SQ_HEADROOM(MLX4_IB_SQ_MIN_WQE_SHIFT)) struct mlx4_ib_ucontext { struct mlx4_ib_ucontext { struct ib_ucontext ibucontext; struct ib_ucontext ibucontext; struct mlx4_uar uar; struct mlx4_uar uar; Loading drivers/infiniband/hw/mlx4/qp.c +15 −6 Original line number Original line Diff line number Diff line Loading @@ -310,8 +310,8 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, int is_user, int has_rq, struct mlx4_ib_qp *qp) int is_user, int has_rq, struct mlx4_ib_qp *qp) { { /* Sanity check RQ size before proceeding */ /* Sanity check RQ size before proceeding */ if (cap->max_recv_wr > dev->dev->caps.max_wqes || if (cap->max_recv_wr > dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE || cap->max_recv_sge > dev->dev->caps.max_rq_sg) cap->max_recv_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg)) return -EINVAL; return -EINVAL; if (!has_rq) { if (!has_rq) { Loading @@ -329,8 +329,17 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); } } /* leave userspace return values as they were, so as not to break ABI */ if (is_user) { cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; cap->max_recv_sge = qp->rq.max_gs; cap->max_recv_sge = qp->rq.max_gs; } else { cap->max_recv_wr = qp->rq.max_post = min(dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE, qp->rq.wqe_cnt); cap->max_recv_sge = min(qp->rq.max_gs, min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg)); } return 0; return 0; } } Loading @@ -341,8 +350,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, int s; int s; /* Sanity check SQ size before proceeding */ /* Sanity check SQ size before proceeding */ if (cap->max_send_wr > dev->dev->caps.max_wqes || if (cap->max_send_wr > (dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE) || cap->max_send_sge > dev->dev->caps.max_sq_sg || cap->max_send_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg) || cap->max_inline_data + send_wqe_overhead(type, qp->flags) + cap->max_inline_data + send_wqe_overhead(type, qp->flags) + sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) return -EINVAL; return -EINVAL; Loading drivers/infiniband/hw/ocrdma/ocrdma.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info { u32 entry_size; u32 entry_size; u32 max_cnt; u32 max_cnt; u32 max_wqe_idx; u32 max_wqe_idx; u32 free_delta; u16 dbid; /* qid, where to ring the doorbell. */ u16 dbid; /* qid, where to ring the doorbell. */ u32 len; u32 len; dma_addr_t pa; dma_addr_t pa; Loading drivers/infiniband/hw/ocrdma/ocrdma_abi.h +1 −4 Original line number Original line Diff line number Diff line Loading @@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp { u32 rsvd1; u32 rsvd1; u32 num_wqe_allocated; u32 num_wqe_allocated; u32 num_rqe_allocated; u32 num_rqe_allocated; u32 free_wqe_delta; u32 free_rqe_delta; u32 db_sq_offset; u32 db_sq_offset; u32 db_rq_offset; u32 db_rq_offset; u32 db_shift; u32 db_shift; Loading @@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp { u32 db_rq_offset; u32 db_rq_offset; u32 db_shift; u32 db_shift; u32 free_rqe_delta; u64 rsvd2; u32 rsvd2; u64 rsvd3; u64 rsvd3; } __packed; } __packed; Loading Loading
drivers/infiniband/hw/mlx4/main.c +8 −13 Original line number Original line Diff line number Diff line Loading @@ -140,7 +140,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, props->max_mr_size = ~0ull; props->max_mr_size = ~0ull; props->page_size_cap = dev->dev->caps.page_size_cap; props->page_size_cap = dev->dev->caps.page_size_cap; props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; props->max_qp_wr = dev->dev->caps.max_wqes; props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; props->max_sge = min(dev->dev->caps.max_sq_sg, props->max_sge = min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg); dev->dev->caps.max_rq_sg); props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; Loading Loading @@ -1084,12 +1084,9 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) int total_eqs = 0; int total_eqs = 0; int i, j, eq; int i, j, eq; /* Init eq table */ /* Legacy mode or comp_pool is not large enough */ ibdev->eq_table = NULL; if (dev->caps.comp_pool == 0 || ibdev->eq_added = 0; dev->caps.num_ports > dev->caps.comp_pool) /* Legacy mode? */ if (dev->caps.comp_pool == 0) return; return; eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ Loading Loading @@ -1135,7 +1132,10 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) { { int i; int i; int total_eqs; /* no additional eqs were added */ if (!ibdev->eq_table) return; /* Reset the advertised EQ number */ /* Reset the advertised EQ number */ ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; Loading @@ -1148,12 +1148,7 @@ static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) mlx4_release_eq(dev, ibdev->eq_table[i]); mlx4_release_eq(dev, ibdev->eq_table[i]); } } total_eqs = dev->caps.num_comp_vectors + ibdev->eq_added; memset(ibdev->eq_table, 0, total_eqs * sizeof(int)); kfree(ibdev->eq_table); kfree(ibdev->eq_table); ibdev->eq_table = NULL; ibdev->eq_added = 0; } } static void *mlx4_ib_add(struct mlx4_dev *dev) static void *mlx4_ib_add(struct mlx4_dev *dev) Loading
drivers/infiniband/hw/mlx4/mlx4_ib.h +8 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,14 @@ #include <linux/mlx4/device.h> #include <linux/mlx4/device.h> #include <linux/mlx4/doorbell.h> #include <linux/mlx4/doorbell.h> enum { MLX4_IB_SQ_MIN_WQE_SHIFT = 6, MLX4_IB_MAX_HEADROOM = 2048 }; #define MLX4_IB_SQ_HEADROOM(shift) ((MLX4_IB_MAX_HEADROOM >> (shift)) + 1) #define MLX4_IB_SQ_MAX_SPARE (MLX4_IB_SQ_HEADROOM(MLX4_IB_SQ_MIN_WQE_SHIFT)) struct mlx4_ib_ucontext { struct mlx4_ib_ucontext { struct ib_ucontext ibucontext; struct ib_ucontext ibucontext; struct mlx4_uar uar; struct mlx4_uar uar; Loading
drivers/infiniband/hw/mlx4/qp.c +15 −6 Original line number Original line Diff line number Diff line Loading @@ -310,8 +310,8 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, int is_user, int has_rq, struct mlx4_ib_qp *qp) int is_user, int has_rq, struct mlx4_ib_qp *qp) { { /* Sanity check RQ size before proceeding */ /* Sanity check RQ size before proceeding */ if (cap->max_recv_wr > dev->dev->caps.max_wqes || if (cap->max_recv_wr > dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE || cap->max_recv_sge > dev->dev->caps.max_rq_sg) cap->max_recv_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg)) return -EINVAL; return -EINVAL; if (!has_rq) { if (!has_rq) { Loading @@ -329,8 +329,17 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); } } /* leave userspace return values as they were, so as not to break ABI */ if (is_user) { cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; cap->max_recv_sge = qp->rq.max_gs; cap->max_recv_sge = qp->rq.max_gs; } else { cap->max_recv_wr = qp->rq.max_post = min(dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE, qp->rq.wqe_cnt); cap->max_recv_sge = min(qp->rq.max_gs, min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg)); } return 0; return 0; } } Loading @@ -341,8 +350,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, int s; int s; /* Sanity check SQ size before proceeding */ /* Sanity check SQ size before proceeding */ if (cap->max_send_wr > dev->dev->caps.max_wqes || if (cap->max_send_wr > (dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE) || cap->max_send_sge > dev->dev->caps.max_sq_sg || cap->max_send_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg) || cap->max_inline_data + send_wqe_overhead(type, qp->flags) + cap->max_inline_data + send_wqe_overhead(type, qp->flags) + sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) return -EINVAL; return -EINVAL; Loading
drivers/infiniband/hw/ocrdma/ocrdma.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info { u32 entry_size; u32 entry_size; u32 max_cnt; u32 max_cnt; u32 max_wqe_idx; u32 max_wqe_idx; u32 free_delta; u16 dbid; /* qid, where to ring the doorbell. */ u16 dbid; /* qid, where to ring the doorbell. */ u32 len; u32 len; dma_addr_t pa; dma_addr_t pa; Loading
drivers/infiniband/hw/ocrdma/ocrdma_abi.h +1 −4 Original line number Original line Diff line number Diff line Loading @@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp { u32 rsvd1; u32 rsvd1; u32 num_wqe_allocated; u32 num_wqe_allocated; u32 num_rqe_allocated; u32 num_rqe_allocated; u32 free_wqe_delta; u32 free_rqe_delta; u32 db_sq_offset; u32 db_sq_offset; u32 db_rq_offset; u32 db_rq_offset; u32 db_shift; u32 db_shift; Loading @@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp { u32 db_rq_offset; u32 db_rq_offset; u32 db_shift; u32 db_shift; u32 free_rqe_delta; u64 rsvd2; u32 rsvd2; u64 rsvd3; u64 rsvd3; } __packed; } __packed; Loading