History

Merge tag 'rdma-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband

Pull InfiniBand/RDMA fixes from Roland Dreier: "All in hardware drivers: - Fix crash in cxgb4 - Fixes to new ocrdma driver - Regression fixes for mlx4" * tag 'rdma-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/mlx4: Fix max_wqe capacity reported from query device mlx4_core: Fix setting VL_cap in mlx4_SET_PORT wrapper flow IB/mlx4: Fix EQ deallocation in legacy mode RDMA/cxgb4: Fix crash when peer address is 0.0.0.0 RDMA/ocrdma: Remove unnecessary version.h includes RDMA/ocrdma: Fix signaled event for SRQ_LIMIT_REACHED RDMA/ocrdma: Correct queue free count math

Linus Torvalds committed 14 years ago

Commit ae501be2 parents 374916e 20952cd11 files · +39 −41Browse files

Unified · Split

11 files
  1. drivers/infiniband/hw/cxgb4/cm.c +4 −0
  2. drivers/infiniband/hw/mlx4/main.c +8 −13
  3. drivers/infiniband/hw/mlx4/mlx4_ib.h +8 −0
  4. drivers/infiniband/hw/mlx4/qp.c +15 −6
  5. drivers/infiniband/hw/ocrdma/ocrdma.h +0 −1
  6. drivers/infiniband/hw/ocrdma/ocrdma_abi.h +1 −4
  7. drivers/infiniband/hw/ocrdma/ocrdma_hw.c +1 −8
  8. drivers/infiniband/hw/ocrdma/ocrdma_main.c +0 −1
  9. drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +0 −5
  10. drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +0 −1
  11. drivers/net/ethernet/mellanox/mlx4/port.c +2 −2
drivers/infiniband/hw/cxgb4/cm.c+4−0
@@ -1593,6 +1593,10 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst, · 1592 unmodified lines
15931593 struct net_device *pdev;
15941594
15951595 pdev = ip_dev_find(&init_net, peer_ip);
1596+ if (!pdev) {
1597+ err = -ENODEV;
1598+ goto out;
1599+ }
15961600 ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t,
15971601 n, pdev, 0);
15981602 if (!ep->l2t)
drivers/infiniband/hw/mlx4/main.c+8−13
@@ -140,7 +140,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 139 unmodified lines
140140 props->max_mr_size = ~0ull;
141141 props->page_size_cap = dev->dev->caps.page_size_cap;
142142 props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps;
143− props->max_qp_wr = dev->dev->caps.max_wqes;
143+ props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
144144 props->max_sge = min(dev->dev->caps.max_sq_sg,
145145 dev->dev->caps.max_rq_sg);
146146 props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs;
@@ -1084,12 +1084,9 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) · 937 unmodified lines
10841084 int total_eqs = 0;
10851085 int i, j, eq;
10861086
1087− /* Init eq table */
1088− ibdev->eq_table = NULL;
1089− ibdev->eq_added = 0;
1090−
1091− /* Legacy mode? */
1092− if (dev->caps.comp_pool == 0)
1087+ /* Legacy mode or comp_pool is not large enough */
1088+ if (dev->caps.comp_pool == 0 ||
1089+ dev->caps.num_ports > dev->caps.comp_pool)
10931090 return;
10941091
10951092 eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/
@@ -1135,7 +1132,10 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) · 39 unmodified lines
11351132 static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev)
11361133 {
11371134 int i;
1138− int total_eqs;
1135+
1136+ /* no additional eqs were added */
1137+ if (!ibdev->eq_table)
1138+ return;
11391139
11401140 /* Reset the advertised EQ number */
11411141 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors;
@@ -1148,12 +1148,7 @@ static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) · 6 unmodified lines
11481148 mlx4_release_eq(dev, ibdev->eq_table[i]);
11491149 }
11501150
1151− total_eqs = dev->caps.num_comp_vectors + ibdev->eq_added;
1152− memset(ibdev->eq_table, 0, total_eqs * sizeof(int));
11531151 kfree(ibdev->eq_table);
1154−
1155− ibdev->eq_table = NULL;
1156− ibdev->eq_added = 0;
11571152 }
11581153
11591154 static void *mlx4_ib_add(struct mlx4_dev *dev)
drivers/infiniband/hw/mlx4/mlx4_ib.h+8−0
@@ -44,6 +44,14 @@ · 43 unmodified lines
4444 #include <linux/mlx4/device.h>
4545 #include <linux/mlx4/doorbell.h>
4646
47+enum {
48+ MLX4_IB_SQ_MIN_WQE_SHIFT = 6,
49+ MLX4_IB_MAX_HEADROOM = 2048
50+};
51+
52+#define MLX4_IB_SQ_HEADROOM(shift) ((MLX4_IB_MAX_HEADROOM >> (shift)) + 1)
53+#define MLX4_IB_SQ_MAX_SPARE (MLX4_IB_SQ_HEADROOM(MLX4_IB_SQ_MIN_WQE_SHIFT))
54+
4755 struct mlx4_ib_ucontext {
4856 struct ib_ucontext ibucontext;
4957 struct mlx4_uar uar;
drivers/infiniband/hw/mlx4/qp.c+15−6
@@ -310,8 +310,8 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, · 309 unmodified lines
310310 int is_user, int has_rq, struct mlx4_ib_qp *qp)
311311 {
312312 /* Sanity check RQ size before proceeding */
313− if (cap->max_recv_wr > dev->dev->caps.max_wqes ||
314− cap->max_recv_sge > dev->dev->caps.max_rq_sg)
313+ if (cap->max_recv_wr > dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE ||
314+ cap->max_recv_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg))
315315 return -EINVAL;
316316
317317 if (!has_rq) {
@@ -329,8 +329,17 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, · 11 unmodified lines
329329 qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg));
330330 }
331331
332− cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt;
333− cap->max_recv_sge = qp->rq.max_gs;
332+ /* leave userspace return values as they were, so as not to break ABI */
333+ if (is_user) {
334+ cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt;
335+ cap->max_recv_sge = qp->rq.max_gs;
336+ } else {
337+ cap->max_recv_wr = qp->rq.max_post =
338+ min(dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE, qp->rq.wqe_cnt);
339+ cap->max_recv_sge = min(qp->rq.max_gs,
340+ min(dev->dev->caps.max_sq_sg,
341+ dev->dev->caps.max_rq_sg));
342+ }
334343
335344 return 0;
336345 }
@@ -341,8 +350,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, · 4 unmodified lines
341350 int s;
342351
343352 /* Sanity check SQ size before proceeding */
344− if (cap->max_send_wr > dev->dev->caps.max_wqes ||
345− cap->max_send_sge > dev->dev->caps.max_sq_sg ||
353+ if (cap->max_send_wr > (dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE) ||
354+ cap->max_send_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg) ||
346355 cap->max_inline_data + send_wqe_overhead(type, qp->flags) +
347356 sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz)
348357 return -EINVAL;
drivers/infiniband/hw/ocrdma/ocrdma.h+0−1
@@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info { · 230 unmodified lines
231231 u32 entry_size;
232232 u32 max_cnt;
233233 u32 max_wqe_idx;
234− u32 free_delta;
235234 u16 dbid; /* qid, where to ring the doorbell. */
236235 u32 len;
237236 dma_addr_t pa;
drivers/infiniband/hw/ocrdma/ocrdma_abi.h+1−4
@@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp { · 100 unmodified lines
101101 u32 rsvd1;
102102 u32 num_wqe_allocated;
103103 u32 num_rqe_allocated;
104− u32 free_wqe_delta;
105− u32 free_rqe_delta;
106104 u32 db_sq_offset;
107105 u32 db_rq_offset;
108106 u32 db_shift;
@@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp { · 17 unmodified lines
126124 u32 db_rq_offset;
127125 u32 db_shift;
128126
129− u32 free_rqe_delta;
130− u32 rsvd2;
127+ u64 rsvd2;
131128 u64 rsvd3;
132129 } __packed;
133130
drivers/infiniband/hw/ocrdma/ocrdma_hw.c+1−8
@@ -732,7 +732,7 @@ static void ocrdma_dispatch_ibevent(struct ocrdma_dev *dev, · 731 unmodified lines
732732 break;
733733 case OCRDMA_SRQ_LIMIT_EVENT:
734734 ib_evt.element.srq = &qp->srq->ibsrq;
735− ib_evt.event = IB_EVENT_QP_LAST_WQE_REACHED;
735+ ib_evt.event = IB_EVENT_SRQ_LIMIT_REACHED;
736736 srq_event = 1;
737737 qp_event = 0;
738738 break;
@@ -1990,19 +1990,12 @@ static void ocrdma_get_create_qp_rsp(struct ocrdma_create_qp_rsp *rsp, · 1251 unmodified lines
19901990 max_wqe_allocated = 1 << max_wqe_allocated;
19911991 max_rqe_allocated = 1 << ((u16)rsp->max_wqe_rqe);
19921992
1993− if (qp->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
1994− qp->sq.free_delta = 0;
1995− qp->rq.free_delta = 1;
1996− } else
1997− qp->sq.free_delta = 1;
1998−
19991993 qp->sq.max_cnt = max_wqe_allocated;
20001994 qp->sq.max_wqe_idx = max_wqe_allocated - 1;
20011995
20021996 if (!attrs->srq) {
20031997 qp->rq.max_cnt = max_rqe_allocated;
20041998 qp->rq.max_wqe_idx = max_rqe_allocated - 1;
2005− qp->rq.free_delta = 1;
20061999 }
20072000 }
20082001
drivers/infiniband/hw/ocrdma/ocrdma_main.c+0−1
@@ -26,7 +26,6 @@ · 25 unmodified lines
2626 *******************************************************************/
2727
2828 #include <linux/module.h>
29−#include <linux/version.h>
3029 #include <linux/idr.h>
3130 #include <rdma/ib_verbs.h>
3231 #include <rdma/ib_user_verbs.h>
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c+0−5
@@ -940,8 +940,6 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, · 939 unmodified lines
940940 uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
941941 uresp.db_shift = 16;
942942 }
943− uresp.free_wqe_delta = qp->sq.free_delta;
944− uresp.free_rqe_delta = qp->rq.free_delta;
945943
946944 if (qp->dpp_enabled) {
947945 uresp.dpp_credit = dpp_credit_lmt;
@@ -1307,8 +1305,6 @@ static int ocrdma_hwq_free_cnt(struct ocrdma_qp_hwq_info *q) · 359 unmodified lines
13071305 free_cnt = (q->max_cnt - q->head) + q->tail;
13081306 else
13091307 free_cnt = q->tail - q->head;
1310− if (q->free_delta)
1311− free_cnt -= q->free_delta;
13121308 return free_cnt;
13131309 }
13141310
@@ -1501,7 +1497,6 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) · 186 unmodified lines
15011497 (srq->pd->id * srq->dev->nic_info.db_page_size);
15021498 uresp.db_page_size = srq->dev->nic_info.db_page_size;
15031499 uresp.num_rqe_allocated = srq->rq.max_cnt;
1504− uresp.free_rqe_delta = 1;
15051500 if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
15061501 uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET;
15071502 uresp.db_shift = 24;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.h+0−1
@@ -28,7 +28,6 @@ · 27 unmodified lines
2828 #ifndef __OCRDMA_VERBS_H__
2929 #define __OCRDMA_VERBS_H__
3030
31−#include <linux/version.h>
3231 int ocrdma_post_send(struct ib_qp *, struct ib_send_wr *,
3332 struct ib_send_wr **bad_wr);
3433 int ocrdma_post_recv(struct ib_qp *, struct ib_recv_wr *,
drivers/net/ethernet/mellanox/mlx4/port.c+2−2
@@ -697,10 +697,10 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod, · 696 unmodified lines
697697 if (slave != dev->caps.function)
698698 memset(inbox->buf, 0, 256);
699699 if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) {
700− *(u8 *) inbox->buf = !!reset_qkey_viols << 6;
700+ *(u8 *) inbox->buf |= !!reset_qkey_viols << 6;
701701 ((__be32 *) inbox->buf)[2] = agg_cap_mask;
702702 } else {
703− ((u8 *) inbox->buf)[3] = !!reset_qkey_viols;
703+ ((u8 *) inbox->buf)[3] |= !!reset_qkey_viols;
704704 ((__be32 *) inbox->buf)[1] = agg_cap_mask;
705705 }
706706

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t