History

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma

Pull rdma fixes from Doug Ledford: "This is the second batch of queued up rdma patches for this rc cycle. There isn't anything really major in here. It's passed 0day, linux-next, and local testing across a wide variety of hardware. There are still a few known issues to be tracked down, but this should amount to the vast majority of the rdma RC fixes. Round two of 4.7 rc fixes: - A couple minor fixes to the rdma core - Multiple minor fixes to hfi1 - Multiple minor fixes to mlx4/mlx4 - A few minor fixes to i40iw" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (31 commits) IB/srpt: Reduce QP buffer size i40iw: Enable level-1 PBL for fast memory registration i40iw: Return correct max_fast_reg_page_list_len i40iw: Correct status check on i40iw_get_pble i40iw: Correct CQ arming IB/rdmavt: Correct qp_priv_alloc() return value test IB/hfi1: Don't zero out qp->s_ack_queue in rvt_reset_qp IB/hfi1: Fix deadlock with txreq allocation slow path IB/mlx4: Prevent cross page boundary allocation IB/mlx4: Fix memory leak if QP creation failed IB/mlx4: Verify port number in flow steering create flow IB/mlx4: Fix error flow when sending mads under SRIOV IB/mlx4: Fix the SQ size of an RC QP IB/mlx5: Fix wrong naming of port_rcv_data counter IB/mlx5: Fix post send fence logic IB/uverbs: Initialize ib_qp_init_attr with zeros IB/core: Fix false search of the IB_SA_WELL_KNOWN_GUID IB/core: Fix RoCE v1 multicast join logic issue IB/core: Fix no default GIDs when netdevice reregisters IB/hfi1: Send a pkey change event on driver pkey update ...

Linus Torvalds committed 10 years ago

Commit aebe9bb2 parents 3fb5e59 9903fd130 files · +190 −113Browse files

Unified · Split

30 files
  1. drivers/infiniband/core/cache.c +3 −1
  2. drivers/infiniband/core/cma.c +30 −32
  3. drivers/infiniband/core/uverbs_cmd.c +1 −1
  4. drivers/infiniband/core/verbs.c +10 −6
  5. drivers/infiniband/hw/hfi1/chip.c +20 −8
  6. drivers/infiniband/hw/hfi1/file_ops.c +3 −0
  7. drivers/infiniband/hw/hfi1/init.c +1 −1
  8. drivers/infiniband/hw/hfi1/mad.c +12 −7
  9. drivers/infiniband/hw/hfi1/mad.h +2 −0
  10. drivers/infiniband/hw/hfi1/pio.c +23 −3
  11. drivers/infiniband/hw/hfi1/qsfp.c +2 −1
  12. drivers/infiniband/hw/hfi1/verbs_txreq.c +1 −3
  13. drivers/infiniband/hw/hfi1/verbs_txreq.h +1 −0
  14. drivers/infiniband/hw/i40iw/i40iw.h +2 −0
  15. drivers/infiniband/hw/i40iw/i40iw_verbs.c +13 −4
  16. drivers/infiniband/hw/mlx4/ah.c +1 −1
  17. drivers/infiniband/hw/mlx4/mad.c +18 −6
  18. drivers/infiniband/hw/mlx4/main.c +3 −0
  19. drivers/infiniband/hw/mlx4/mlx4_ib.h +1 −1
  20. drivers/infiniband/hw/mlx4/mr.c +17 −17
  21. drivers/infiniband/hw/mlx4/qp.c +4 −2
  22. drivers/infiniband/hw/mlx5/mad.c +1 −1
  23. drivers/infiniband/hw/mlx5/qp.c +4 −3
  24. drivers/infiniband/hw/qib/qib_file_ops.c +5 −0
  25. drivers/infiniband/sw/rdmavt/qp.c +5 −9
  26. drivers/infiniband/sw/rdmavt/vt.c +1 −3
  27. drivers/infiniband/ulp/srpt/ib_srpt.c +1 −2
  28. drivers/infiniband/ulp/srpt/ib_srpt.h +1 −0
  29. include/linux/mlx5/qp.h +1 −0
  30. include/rdma/rdma_vt.h +3 −1
drivers/infiniband/core/cache.c+3−1
@@ -411,7 +411,9 @@ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, · 410 unmodified lines
411411
412412 for (ix = 0; ix < table->sz; ix++)
413413 if (table->data_vec[ix].attr.ndev == ndev)
414− if (!del_gid(ib_dev, port, table, ix, false))
414+ if (!del_gid(ib_dev, port, table, ix,
415+ !!(table->data_vec[ix].props &
416+ GID_TABLE_ENTRY_DEFAULT)))
415417 deleted = true;
416418
417419 write_unlock_irq(&table->rwlock);
drivers/infiniband/core/cma.c+30−32
@@ -708,17 +708,6 @@ static void cma_deref_id(struct rdma_id_private *id_priv) · 707 unmodified lines
708708 complete(&id_priv->comp);
709709 }
710710
711−static int cma_disable_callback(struct rdma_id_private *id_priv,
712− enum rdma_cm_state state)
713−{
714− mutex_lock(&id_priv->handler_mutex);
715− if (id_priv->state != state) {
716− mutex_unlock(&id_priv->handler_mutex);
717− return -EINVAL;
718− }
719− return 0;
720−}
721−
722711 struct rdma_cm_id *rdma_create_id(struct net *net,
723712 rdma_cm_event_handler event_handler,
724713 void *context, enum rdma_port_space ps,
@@ -1671,11 +1660,12 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) · 946 unmodified lines
16711660 struct rdma_cm_event event;
16721661 int ret = 0;
16731662
1663+ mutex_lock(&id_priv->handler_mutex);
16741664 if ((ib_event->event != IB_CM_TIMEWAIT_EXIT &&
1675− cma_disable_callback(id_priv, RDMA_CM_CONNECT)) ||
1665+ id_priv->state != RDMA_CM_CONNECT) ||
16761666 (ib_event->event == IB_CM_TIMEWAIT_EXIT &&
1677− cma_disable_callback(id_priv, RDMA_CM_DISCONNECT)))
1678− return 0;
1667+ id_priv->state != RDMA_CM_DISCONNECT))
1668+ goto out;
16791669
16801670 memset(&event, 0, sizeof event);
16811671 switch (ib_event->event) {
@@ -1870,7 +1860,7 @@ static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_e · 188 unmodified lines
18701860
18711861 static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
18721862 {
1873− struct rdma_id_private *listen_id, *conn_id;
1863+ struct rdma_id_private *listen_id, *conn_id = NULL;
18741864 struct rdma_cm_event event;
18751865 struct net_device *net_dev;
18761866 int offset, ret;
@@ -1884,9 +1874,10 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) · 7 unmodified lines
18841874 goto net_dev_put;
18851875 }
18861876
1887− if (cma_disable_callback(listen_id, RDMA_CM_LISTEN)) {
1877+ mutex_lock(&listen_id->handler_mutex);
1878+ if (listen_id->state != RDMA_CM_LISTEN) {
18881879 ret = -ECONNABORTED;
1889− goto net_dev_put;
1880+ goto err1;
18901881 }
18911882
18921883 memset(&event, 0, sizeof event);
@@ -1976,8 +1967,9 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) · 83 unmodified lines
19761967 struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr;
19771968 struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr;
19781969
1979− if (cma_disable_callback(id_priv, RDMA_CM_CONNECT))
1980− return 0;
1970+ mutex_lock(&id_priv->handler_mutex);
1971+ if (id_priv->state != RDMA_CM_CONNECT)
1972+ goto out;
19811973
19821974 memset(&event, 0, sizeof event);
19831975 switch (iw_event->event) {
@@ -2029,6 +2021,7 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event) · 45 unmodified lines
20292021 return ret;
20302022 }
20312023
2024+out:
20322025 mutex_unlock(&id_priv->handler_mutex);
20332026 return ret;
20342027 }
@@ -2039,13 +2032,15 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id, · 4 unmodified lines
20392032 struct rdma_cm_id *new_cm_id;
20402033 struct rdma_id_private *listen_id, *conn_id;
20412034 struct rdma_cm_event event;
2042− int ret;
2035+ int ret = -ECONNABORTED;
20432036 struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr;
20442037 struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr;
20452038
20462039 listen_id = cm_id->context;
2047− if (cma_disable_callback(listen_id, RDMA_CM_LISTEN))
2048− return -ECONNABORTED;
2040+
2041+ mutex_lock(&listen_id->handler_mutex);
2042+ if (listen_id->state != RDMA_CM_LISTEN)
2043+ goto out;
20492044
20502045 /* Create a new RDMA id for the new IW CM ID */
20512046 new_cm_id = rdma_create_id(listen_id->id.route.addr.dev_addr.net,
@@ -3216,8 +3211,9 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id, · 1164 unmodified lines
32163211 struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd;
32173212 int ret = 0;
32183213
3219− if (cma_disable_callback(id_priv, RDMA_CM_CONNECT))
3220− return 0;
3214+ mutex_lock(&id_priv->handler_mutex);
3215+ if (id_priv->state != RDMA_CM_CONNECT)
3216+ goto out;
32213217
32223218 memset(&event, 0, sizeof event);
32233219 switch (ib_event->event) {
@@ -3673,12 +3669,13 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) · 449 unmodified lines
36733669 struct rdma_id_private *id_priv;
36743670 struct cma_multicast *mc = multicast->context;
36753671 struct rdma_cm_event event;
3676− int ret;
3672+ int ret = 0;
36773673
36783674 id_priv = mc->id_priv;
3679− if (cma_disable_callback(id_priv, RDMA_CM_ADDR_BOUND) &&
3680− cma_disable_callback(id_priv, RDMA_CM_ADDR_RESOLVED))
3681− return 0;
3675+ mutex_lock(&id_priv->handler_mutex);
3676+ if (id_priv->state != RDMA_CM_ADDR_BOUND &&
3677+ id_priv->state != RDMA_CM_ADDR_RESOLVED)
3678+ goto out;
36823679
36833680 if (!status)
36843681 status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey));
@@ -3720,6 +3717,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) · 35 unmodified lines
37203717 return 0;
37213718 }
37223719
3720+out:
37233721 mutex_unlock(&id_priv->handler_mutex);
37243722 return 0;
37253723 }
@@ -3878,12 +3876,12 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, · 152 unmodified lines
38783876 gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num -
38793877 rdma_start_port(id_priv->cma_dev->device)];
38803878 if (addr->sa_family == AF_INET) {
3881− if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
3879+ if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) {
3880+ mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT;
38823881 err = cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid,
38833882 true);
3884− if (!err) {
3885− mc->igmp_joined = true;
3886− mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT;
3883+ if (!err)
3884+ mc->igmp_joined = true;
38873885 }
38883886 } else {
38893887 if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
drivers/infiniband/core/uverbs_cmd.c+1−1
@@ -1747,7 +1747,7 @@ static int create_qp(struct ib_uverbs_file *file, · 1746 unmodified lines
17471747 struct ib_srq *srq = NULL;
17481748 struct ib_qp *qp;
17491749 char *buf;
1750− struct ib_qp_init_attr attr;
1750+ struct ib_qp_init_attr attr = {};
17511751 struct ib_uverbs_ex_create_qp_resp resp;
17521752 int ret;
17531753
drivers/infiniband/core/verbs.c+10−6
@@ -511,12 +511,16 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, · 510 unmodified lines
511511 ah_attr->grh.dgid = sgid;
512512
513513 if (!rdma_cap_eth_ah(device, port_num)) {
514− ret = ib_find_cached_gid_by_port(device, &dgid,
515− IB_GID_TYPE_IB,
516− port_num, NULL,
517− &gid_index);
518− if (ret)
519− return ret;
514+ if (dgid.global.interface_id != cpu_to_be64(IB_SA_WELL_KNOWN_GUID)) {
515+ ret = ib_find_cached_gid_by_port(device, &dgid,
516+ IB_GID_TYPE_IB,
517+ port_num, NULL,
518+ &gid_index);
519+ if (ret)
520+ return ret;
521+ } else {
522+ gid_index = 0;
523+ }
520524 }
521525
522526 ah_attr->grh.sgid_index = (u8) gid_index;
drivers/infiniband/hw/hfi1/chip.c+20−8
@@ -1037,7 +1037,7 @@ static void dc_shutdown(struct hfi1_devdata *); · 1036 unmodified lines
10371037 static void dc_start(struct hfi1_devdata *);
10381038 static int qos_rmt_entries(struct hfi1_devdata *dd, unsigned int *mp,
10391039 unsigned int *np);
1040−static void remove_full_mgmt_pkey(struct hfi1_pportdata *ppd);
1040+static void clear_full_mgmt_pkey(struct hfi1_pportdata *ppd);
10411041
10421042 /*
10431043 * Error interrupt table entry. This is used as input to the interrupt
@@ -6962,8 +6962,6 @@ void handle_link_down(struct work_struct *work) · 5918 unmodified lines
69626962 }
69636963
69646964 reset_neighbor_info(ppd);
6965− if (ppd->mgmt_allowed)
6966− remove_full_mgmt_pkey(ppd);
69676965
69686966 /* disable the port */
69696967 clear_rcvctrl(ppd->dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
@@ -7070,12 +7068,16 @@ static void add_full_mgmt_pkey(struct hfi1_pportdata *ppd) · 100 unmodified lines
70707068 __func__, ppd->pkeys[2], FULL_MGMT_P_KEY);
70717069 ppd->pkeys[2] = FULL_MGMT_P_KEY;
70727070 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0);
7071+ hfi1_event_pkey_change(ppd->dd, ppd->port);
70737072 }
70747073
7075−static void remove_full_mgmt_pkey(struct hfi1_pportdata *ppd)
7074+static void clear_full_mgmt_pkey(struct hfi1_pportdata *ppd)
70767075 {
7077− ppd->pkeys[2] = 0;
7078− (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0);
7076+ if (ppd->pkeys[2] != 0) {
7077+ ppd->pkeys[2] = 0;
7078+ (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0);
7079+ hfi1_event_pkey_change(ppd->dd, ppd->port);
7080+ }
70797081 }
70807082
70817083 /*
@@ -9168,6 +9170,13 @@ int start_link(struct hfi1_pportdata *ppd) · 2086 unmodified lines
91689170 return 0;
91699171 }
91709172
9173+ /*
9174+ * FULL_MGMT_P_KEY is cleared from the pkey table, so that the
9175+ * pkey table can be configured properly if the HFI unit is connected
9176+ * to switch port with MgmtAllowed=NO
9177+ */
9178+ clear_full_mgmt_pkey(ppd);
9179+
91719180 return set_link_state(ppd, HLS_DN_POLL);
91729181 }
91739182
@@ -9777,7 +9786,7 @@ static void set_send_length(struct hfi1_pportdata *ppd) · 603 unmodified lines
97779786 u64 len1 = 0, len2 = (((dd->vld[15].mtu + max_hb) >> 2)
97789787 & SEND_LEN_CHECK1_LEN_VL15_MASK) <<
97799788 SEND_LEN_CHECK1_LEN_VL15_SHIFT;
9780− int i;
9789+ int i, j;
97819790 u32 thres;
97829791
97839792 for (i = 0; i < ppd->vls_supported; i++) {
@@ -9801,7 +9810,10 @@ static void set_send_length(struct hfi1_pportdata *ppd) · 17 unmodified lines
98019810 sc_mtu_to_threshold(dd->vld[i].sc,
98029811 dd->vld[i].mtu,
98039812 dd->rcd[0]->rcvhdrqentsize));
9804− sc_set_cr_threshold(dd->vld[i].sc, thres);
9813+ for (j = 0; j < INIT_SC_PER_VL; j++)
9814+ sc_set_cr_threshold(
9815+ pio_select_send_context_vl(dd, j, i),
9816+ thres);
98059817 }
98069818 thres = min(sc_percent_to_threshold(dd->vld[15].sc, 50),
98079819 sc_mtu_to_threshold(dd->vld[15].sc,
drivers/infiniband/hw/hfi1/file_ops.c+3−0
@@ -203,6 +203,9 @@ static long hfi1_file_ioctl(struct file *fp, unsigned int cmd, · 202 unmodified lines
203203
204204 switch (cmd) {
205205 case HFI1_IOCTL_ASSIGN_CTXT:
206+ if (uctxt)
207+ return -EINVAL;
208+
206209 if (copy_from_user(&uinfo,
207210 (struct hfi1_user_info __user *)arg,
208211 sizeof(uinfo)))
drivers/infiniband/hw/hfi1/init.c+1−1
@@ -1383,7 +1383,7 @@ static void postinit_cleanup(struct hfi1_devdata *dd) · 1382 unmodified lines
13831383 static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
13841384 {
13851385 int ret = 0, j, pidx, initfail;
1386− struct hfi1_devdata *dd = NULL;
1386+ struct hfi1_devdata *dd = ERR_PTR(-EINVAL);
13871387 struct hfi1_pportdata *ppd;
13881388
13891389 /* First, lock the non-writable module parameters */
drivers/infiniband/hw/hfi1/mad.c+12−7
@@ -78,6 +78,16 @@ static inline void clear_opa_smp_data(struct opa_smp *smp) · 77 unmodified lines
7878 memset(data, 0, size);
7979 }
8080
81+void hfi1_event_pkey_change(struct hfi1_devdata *dd, u8 port)
82+{
83+ struct ib_event event;
84+
85+ event.event = IB_EVENT_PKEY_CHANGE;
86+ event.device = &dd->verbs_dev.rdi.ibdev;
87+ event.element.port_num = port;
88+ ib_dispatch_event(&event);
89+}
90+
8191 static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
8292 {
8393 struct ib_mad_send_buf *send_buf;
@@ -1418,15 +1428,10 @@ static int set_pkeys(struct hfi1_devdata *dd, u8 port, u16 *pkeys) · 1334 unmodified lines
14181428 }
14191429
14201430 if (changed) {
1421− struct ib_event event;
1422−
14231431 (void)hfi1_set_ib_cfg(ppd, HFI1_IB_CFG_PKEYS, 0);
1424−
1425− event.event = IB_EVENT_PKEY_CHANGE;
1426− event.device = &dd->verbs_dev.rdi.ibdev;
1427− event.element.port_num = port;
1428− ib_dispatch_event(&event);
1432+ hfi1_event_pkey_change(dd, port);
14291433 }
1434+
14301435 return 0;
14311436 }
14321437
drivers/infiniband/hw/hfi1/mad.h+2−0
@@ -434,4 +434,6 @@ struct sc2vlnt { · 433 unmodified lines
434434 COUNTER_MASK(1, 3) | \
435435 COUNTER_MASK(1, 4))
436436
437+void hfi1_event_pkey_change(struct hfi1_devdata *dd, u8 port);
438+
437439 #endif /* _HFI1_MAD_H */
drivers/infiniband/hw/hfi1/pio.c+23−3
@@ -995,7 +995,7 @@ static void sc_wait_for_packet_egress(struct send_context *sc, int pause) · 994 unmodified lines
995995 /* counter is reset if occupancy count changes */
996996 if (reg != reg_prev)
997997 loop = 0;
998− if (loop > 500) {
998+ if (loop > 50000) {
999999 /* timed out - bounce the link */
10001000 dd_dev_err(dd,
10011001 "%s: context %u(%u) timeout waiting for packets to egress, remaining count %u, bouncing link\n",
@@ -1797,6 +1797,21 @@ static void pio_map_rcu_callback(struct rcu_head *list) · 795 unmodified lines
17971797 pio_map_free(m);
17981798 }
17991799
1800+/*
1801+ * Set credit return threshold for the kernel send context
1802+ */
1803+static void set_threshold(struct hfi1_devdata *dd, int scontext, int i)
1804+{
1805+ u32 thres;
1806+
1807+ thres = min(sc_percent_to_threshold(dd->kernel_send_context[scontext],
1808+ 50),
1809+ sc_mtu_to_threshold(dd->kernel_send_context[scontext],
1810+ dd->vld[i].mtu,
1811+ dd->rcd[0]->rcvhdrqentsize));
1812+ sc_set_cr_threshold(dd->kernel_send_context[scontext], thres);
1813+}
1814+
18001815 /*
18011816 * pio_map_init - called when #vls change
18021817 * @dd: hfi1_devdata
@@ -1872,11 +1887,16 @@ int pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, u8 *vl_scontexts) · 69 unmodified lines
18721887 if (!newmap->map[i])
18731888 goto bail;
18741889 newmap->map[i]->mask = (1 << ilog2(sz)) - 1;
1875− /* assign send contexts */
1890+ /*
1891+ * assign send contexts and
1892+ * adjust credit return threshold
1893+ */
18761894 for (j = 0; j < sz; j++) {
1877− if (dd->kernel_send_context[scontext])
1895+ if (dd->kernel_send_context[scontext]) {
18781896 newmap->map[i]->ksc[j] =
18791897 dd->kernel_send_context[scontext];
1898+ set_threshold(dd, scontext, i);
1899+ }
18801900 if (++scontext >= first_scontext +
18811901 vl_scontexts[i])
18821902 /* wrap back to first send context */
drivers/infiniband/hw/hfi1/qsfp.c+2−1
@@ -579,7 +579,8 @@ int qsfp_dump(struct hfi1_pportdata *ppd, char *buf, int len) · 578 unmodified lines
579579
580580 if (ppd->qsfp_info.cache_valid) {
581581 if (QSFP_IS_CU(cache[QSFP_MOD_TECH_OFFS]))
582− sprintf(lenstr, "%dM ", cache[QSFP_MOD_LEN_OFFS]);
582+ snprintf(lenstr, sizeof(lenstr), "%dM ",
583+ cache[QSFP_MOD_LEN_OFFS]);
583584
584585 power_byte = cache[QSFP_MOD_PWR_OFFS];
585586 sofar += scnprintf(buf + sofar, len - sofar, "PWR:%.3sW\n",
drivers/infiniband/hw/hfi1/verbs_txreq.c+1−3
@@ -92,11 +92,10 @@ void hfi1_put_txreq(struct verbs_txreq *tx) · 91 unmodified lines
9292
9393 struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev,
9494 struct rvt_qp *qp)
95+ __must_hold(&qp->s_lock)
9596 {
9697 struct verbs_txreq *tx = ERR_PTR(-EBUSY);
97− unsigned long flags;
9898
99− spin_lock_irqsave(&qp->s_lock, flags);
10099 write_seqlock(&dev->iowait_lock);
101100 if (ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK) {
102101 struct hfi1_qp_priv *priv;
@@ -116,7 +115,6 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, · 13 unmodified lines
116115 }
117116 out:
118117 write_sequnlock(&dev->iowait_lock);
119− spin_unlock_irqrestore(&qp->s_lock, flags);
120118 return tx;
121119 }
122120
drivers/infiniband/hw/hfi1/verbs_txreq.h+1−0
@@ -73,6 +73,7 @@ struct verbs_txreq *__get_txreq(struct hfi1_ibdev *dev, · 72 unmodified lines
7373
7474 static inline struct verbs_txreq *get_txreq(struct hfi1_ibdev *dev,
7575 struct rvt_qp *qp)
76+ __must_hold(&qp->slock)
7677 {
7778 struct verbs_txreq *tx;
7879 struct hfi1_qp_priv *priv = qp->priv;
drivers/infiniband/hw/i40iw/i40iw.h+2−0
@@ -113,6 +113,8 @@ · 112 unmodified lines
113113
114114 #define IW_HMC_OBJ_TYPE_NUM ARRAY_SIZE(iw_hmc_obj_types)
115115 #define IW_CFG_FPM_QP_COUNT 32768
116+#define I40IW_MAX_PAGES_PER_FMR 512
117+#define I40IW_MIN_PAGES_PER_FMR 1
116118
117119 #define I40IW_MTU_TO_MSS 40
118120 #define I40IW_DEFAULT_MSS 1460
drivers/infiniband/hw/i40iw/i40iw_verbs.c+13−4
@@ -79,6 +79,7 @@ static int i40iw_query_device(struct ib_device *ibdev, · 78 unmodified lines
7979 props->max_qp_init_rd_atom = props->max_qp_rd_atom;
8080 props->atomic_cap = IB_ATOMIC_NONE;
8181 props->max_map_per_fmr = 1;
82+ props->max_fast_reg_page_list_len = I40IW_MAX_PAGES_PER_FMR;
8283 return 0;
8384 }
8485
@@ -1527,7 +1528,7 @@ static struct ib_mr *i40iw_alloc_mr(struct ib_pd *pd, · 1442 unmodified lines
15271528 mutex_lock(&iwdev->pbl_mutex);
15281529 status = i40iw_get_pble(&iwdev->sc_dev, iwdev->pble_rsrc, palloc, iwmr->page_cnt);
15291530 mutex_unlock(&iwdev->pbl_mutex);
1530− if (!status)
1531+ if (status)
15311532 goto err1;
15321533
15331534 if (palloc->level != I40IW_LEVEL_1)
@@ -2149,6 +2150,7 @@ static int i40iw_post_send(struct ib_qp *ibqp, · 615 unmodified lines
21492150 struct i40iw_sc_dev *dev = &iwqp->iwdev->sc_dev;
21502151 struct i40iw_fast_reg_stag_info info;
21512152
2153+ memset(&info, 0, sizeof(info));
21522154 info.access_rights = I40IW_ACCESS_FLAGS_LOCALREAD;
21532155 info.access_rights |= i40iw_get_user_access(flags);
21542156 info.stag_key = reg_wr(ib_wr)->key & 0xff;
@@ -2158,10 +2160,14 @@ static int i40iw_post_send(struct ib_qp *ibqp, · 3 unmodified lines
21582160 info.addr_type = I40IW_ADDR_TYPE_VA_BASED;
21592161 info.va = (void *)(uintptr_t)iwmr->ibmr.iova;
21602162 info.total_len = iwmr->ibmr.length;
2163+ info.reg_addr_pa = *(u64 *)palloc->level1.addr;
21612164 info.first_pm_pbl_index = palloc->level1.idx;
21622165 info.local_fence = ib_wr->send_flags & IB_SEND_FENCE;
21632166 info.signaled = ib_wr->send_flags & IB_SEND_SIGNALED;
21642167
2168+ if (iwmr->npages > I40IW_MIN_PAGES_PER_FMR)
2169+ info.chunk_size = 1;
2170+
21652171 if (page_shift == 21)
21662172 info.page_size = 1; /* 2M page */
21672173
@@ -2327,13 +2333,16 @@ static int i40iw_req_notify_cq(struct ib_cq *ibcq, · 159 unmodified lines
23272333 {
23282334 struct i40iw_cq *iwcq;
23292335 struct i40iw_cq_uk *ukcq;
2330− enum i40iw_completion_notify cq_notify = IW_CQ_COMPL_SOLICITED;
2336+ unsigned long flags;
2337+ enum i40iw_completion_notify cq_notify = IW_CQ_COMPL_EVENT;
23312338
23322339 iwcq = (struct i40iw_cq *)ibcq;
23332340 ukcq = &iwcq->sc_cq.cq_uk;
2334− if (notify_flags == IB_CQ_NEXT_COMP)
2335− cq_notify = IW_CQ_COMPL_EVENT;
2341+ if (notify_flags == IB_CQ_SOLICITED)
2342+ cq_notify = IW_CQ_COMPL_SOLICITED;
2343+ spin_lock_irqsave(&iwcq->lock, flags);
23362344 ukcq->ops.iw_cq_request_notification(ukcq, cq_notify);
2345+ spin_unlock_irqrestore(&iwcq->lock, flags);
23372346 return 0;
23382347 }
23392348
drivers/infiniband/hw/mlx4/ah.c+1−1
@@ -47,6 +47,7 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, · 46 unmodified lines
4747
4848 ah->av.ib.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24));
4949 ah->av.ib.g_slid = ah_attr->src_path_bits;
50+ ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28);
5051 if (ah_attr->ah_flags & IB_AH_GRH) {
5152 ah->av.ib.g_slid |= 0x80;
5253 ah->av.ib.gid_index = ah_attr->grh.sgid_index;
@@ -64,7 +65,6 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, · 11 unmodified lines
6465 !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support))
6566 --ah->av.ib.stat_rate;
6667 }
67− ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28);
6868
6969 return &ah->ibah;
7070 }
drivers/infiniband/hw/mlx4/mad.c+18−6
@@ -527,7 +527,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, · 526 unmodified lines
527527 tun_tx_ix = (++tun_qp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1);
528528 spin_unlock(&tun_qp->tx_lock);
529529 if (ret)
530− goto out;
530+ goto end;
531531
532532 tun_mad = (struct mlx4_rcv_tunnel_mad *) (tun_qp->tx_ring[tun_tx_ix].buf.addr);
533533 if (tun_qp->tx_ring[tun_tx_ix].ah)
@@ -596,9 +596,15 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, · 62 unmodified lines
596596 wr.wr.send_flags = IB_SEND_SIGNALED;
597597
598598 ret = ib_post_send(src_qp, &wr.wr, &bad_wr);
599−out:
600− if (ret)
601− ib_destroy_ah(ah);
599+ if (!ret)
600+ return 0;
601+ out:
602+ spin_lock(&tun_qp->tx_lock);
603+ tun_qp->tx_ix_tail++;
604+ spin_unlock(&tun_qp->tx_lock);
605+ tun_qp->tx_ring[tun_tx_ix].ah = NULL;
606+end:
607+ ib_destroy_ah(ah);
602608 return ret;
603609 }
604610
@@ -1326,9 +1332,15 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, · 721 unmodified lines
13261332
13271333
13281334 ret = ib_post_send(send_qp, &wr.wr, &bad_wr);
1335+ if (!ret)
1336+ return 0;
1337+
1338+ spin_lock(&sqp->tx_lock);
1339+ sqp->tx_ix_tail++;
1340+ spin_unlock(&sqp->tx_lock);
1341+ sqp->tx_ring[wire_tx_ix].ah = NULL;
13291342 out:
1330− if (ret)
1331− ib_destroy_ah(ah);
1343+ ib_destroy_ah(ah);
13321344 return ret;
13331345 }
13341346
drivers/infiniband/hw/mlx4/main.c+3−0
@@ -1704,6 +1704,9 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 1703 unmodified lines
17041704 struct mlx4_dev *dev = (to_mdev(qp->device))->dev;
17051705 int is_bonded = mlx4_is_bonded(dev);
17061706
1707+ if (flow_attr->port < 1 || flow_attr->port > qp->device->phys_port_cnt)
1708+ return ERR_PTR(-EINVAL);
1709+
17071710 if ((flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) &&
17081711 (flow_attr->type != IB_FLOW_ATTR_NORMAL))
17091712 return ERR_PTR(-EOPNOTSUPP);
drivers/infiniband/hw/mlx4/mlx4_ib.h+1−1
@@ -139,7 +139,7 @@ struct mlx4_ib_mr { · 138 unmodified lines
139139 u32 max_pages;
140140 struct mlx4_mr mmr;
141141 struct ib_umem *umem;
142− void *pages_alloc;
142+ size_t page_map_size;
143143 };
144144
145145 struct mlx4_ib_mw {
drivers/infiniband/hw/mlx4/mr.c+17−17
@@ -277,20 +277,23 @@ mlx4_alloc_priv_pages(struct ib_device *device, · 276 unmodified lines
277277 struct mlx4_ib_mr *mr,
278278 int max_pages)
279279 {
280− int size = max_pages * sizeof(u64);
281− int add_size;
282280 int ret;
283281
284− add_size = max_t(int, MLX4_MR_PAGES_ALIGN - ARCH_KMALLOC_MINALIGN, 0);
282+ /* Ensure that size is aligned to DMA cacheline
283+ * requirements.
284+ * max_pages is limited to MLX4_MAX_FAST_REG_PAGES
285+ * so page_map_size will never cross PAGE_SIZE.
286+ */
287+ mr->page_map_size = roundup(max_pages * sizeof(u64),
288+ MLX4_MR_PAGES_ALIGN);
285289
286− mr->pages_alloc = kzalloc(size + add_size, GFP_KERNEL);
287− if (!mr->pages_alloc)
290+ /* Prevent cross page boundary allocation. */
291+ mr->pages = (__be64 *)get_zeroed_page(GFP_KERNEL);
292+ if (!mr->pages)
288293 return -ENOMEM;
289294
290− mr->pages = PTR_ALIGN(mr->pages_alloc, MLX4_MR_PAGES_ALIGN);
291−
292295 mr->page_map = dma_map_single(device->dma_device, mr->pages,
293− size, DMA_TO_DEVICE);
296+ mr->page_map_size, DMA_TO_DEVICE);
294297
295298 if (dma_mapping_error(device->dma_device, mr->page_map)) {
296299 ret = -ENOMEM;
@@ -298,9 +301,9 @@ mlx4_alloc_priv_pages(struct ib_device *device, · 1 unmodified line
298301 }
299302
300303 return 0;
301−err:
302− kfree(mr->pages_alloc);
303304
305+err:
306+ free_page((unsigned long)mr->pages);
304307 return ret;
305308 }
306309
@@ -309,11 +312,10 @@ mlx4_free_priv_pages(struct mlx4_ib_mr *mr) · 2 unmodified lines
309312 {
310313 if (mr->pages) {
311314 struct ib_device *device = mr->ibmr.device;
312− int size = mr->max_pages * sizeof(u64);
313315
314316 dma_unmap_single(device->dma_device, mr->page_map,
315− size, DMA_TO_DEVICE);
316− kfree(mr->pages_alloc);
317+ mr->page_map_size, DMA_TO_DEVICE);
318+ free_page((unsigned long)mr->pages);
317319 mr->pages = NULL;
318320 }
319321 }
@@ -537,14 +539,12 @@ int mlx4_ib_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents, · 217 unmodified lines
537539 mr->npages = 0;
538540
539541 ib_dma_sync_single_for_cpu(ibmr->device, mr->page_map,
540− sizeof(u64) * mr->max_pages,
541− DMA_TO_DEVICE);
542+ mr->page_map_size, DMA_TO_DEVICE);
542543
543544 rc = ib_sg_to_pages(ibmr, sg, sg_nents, sg_offset, mlx4_set_page);
544545
545546 ib_dma_sync_single_for_device(ibmr->device, mr->page_map,
546− sizeof(u64) * mr->max_pages,
547− DMA_TO_DEVICE);
547+ mr->page_map_size, DMA_TO_DEVICE);
548548
549549 return rc;
550550 }
drivers/infiniband/hw/mlx4/qp.c+4−2
@@ -362,7 +362,7 @@ static int send_wqe_overhead(enum mlx4_ib_qp_type type, u32 flags) · 361 unmodified lines
362362 sizeof (struct mlx4_wqe_raddr_seg);
363363 case MLX4_IB_QPT_RC:
364364 return sizeof (struct mlx4_wqe_ctrl_seg) +
365− sizeof (struct mlx4_wqe_atomic_seg) +
365+ sizeof (struct mlx4_wqe_masked_atomic_seg) +
366366 sizeof (struct mlx4_wqe_raddr_seg);
367367 case MLX4_IB_QPT_SMI:
368368 case MLX4_IB_QPT_GSI:
@@ -1191,8 +1191,10 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, · 822 unmodified lines
11911191 {
11921192 err = create_qp_common(to_mdev(pd->device), pd, init_attr,
11931193 udata, 0, &qp, gfp);
1194− if (err)
1194+ if (err) {
1195+ kfree(qp);
11951196 return ERR_PTR(err);
1197+ }
11961198
11971199 qp->ibqp.qp_num = qp->mqp.qpn;
11981200 qp->xrcdn = xrcdn;
drivers/infiniband/hw/mlx5/mad.c+1−1
@@ -121,7 +121,7 @@ static void pma_cnt_ext_assign(struct ib_pma_portcounters_ext *pma_cnt_ext, · 120 unmodified lines
121121 pma_cnt_ext->port_xmit_data =
122122 cpu_to_be64(MLX5_SUM_CNT(out, transmitted_ib_unicast.octets,
123123 transmitted_ib_multicast.octets) >> 2);
124− pma_cnt_ext->port_xmit_data =
124+ pma_cnt_ext->port_rcv_data =
125125 cpu_to_be64(MLX5_SUM_CNT(out, received_ib_unicast.octets,
126126 received_ib_multicast.octets) >> 2);
127127 pma_cnt_ext->port_xmit_packets =
drivers/infiniband/hw/mlx5/qp.c+4−3
@@ -3332,10 +3332,11 @@ static u8 get_fence(u8 fence, struct ib_send_wr *wr) · 3331 unmodified lines
33323332 return MLX5_FENCE_MODE_SMALL_AND_FENCE;
33333333 else
33343334 return fence;
3335−
3336− } else {
3337− return 0;
3335+ } else if (unlikely(wr->send_flags & IB_SEND_FENCE)) {
3336+ return MLX5_FENCE_MODE_FENCE;
33383337 }
3338+
3339+ return 0;
33393340 }
33403341
33413342 static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
drivers/infiniband/hw/qib/qib_file_ops.c+5−0
@@ -2178,6 +2178,11 @@ static ssize_t qib_write(struct file *fp, const char __user *data, · 2177 unmodified lines
21782178
21792179 switch (cmd.type) {
21802180 case QIB_CMD_ASSIGN_CTXT:
2181+ if (rcd) {
2182+ ret = -EINVAL;
2183+ goto bail;
2184+ }
2185+
21812186 ret = qib_assign_ctxt(fp, &cmd.cmd.user_info);
21822187 if (ret)
21832188 goto bail;
drivers/infiniband/sw/rdmavt/qp.c+5−9
@@ -369,8 +369,8 @@ static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, · 368 unmodified lines
369369 /* wrap to first map page, invert bit 0 */
370370 offset = qpt->incr | ((offset & 1) ^ 1);
371371 }
372− /* there can be no bits at shift and below */
373− WARN_ON(offset & (rdi->dparms.qos_shift - 1));
372+ /* there can be no set bits in low-order QoS bits */
373+ WARN_ON(offset & (BIT(rdi->dparms.qos_shift) - 1));
374374 qpn = mk_qpn(qpt, map, offset);
375375 }
376376
@@ -576,12 +576,6 @@ static void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp, · 199 unmodified lines
576576 qp->s_ssn = 1;
577577 qp->s_lsn = 0;
578578 qp->s_mig_state = IB_MIG_MIGRATED;
579− if (qp->s_ack_queue)
580− memset(
581− qp->s_ack_queue,
582− 0,
583− rvt_max_atomic(rdi) *
584− sizeof(*qp->s_ack_queue));
585579 qp->r_head_ack_queue = 0;
586580 qp->s_tail_ack_queue = 0;
587581 qp->s_num_rd_atomic = 0;
@@ -705,8 +699,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, · 117 unmodified lines
705699 * initialization that is needed.
706700 */
707701 priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp);
708− if (!priv)
702+ if (IS_ERR(priv)) {
703+ ret = priv;
709704 goto bail_qp;
705+ }
710706 qp->priv = priv;
711707 qp->timeout_jiffies =
712708 usecs_to_jiffies((4096UL * (1UL << qp->timeout)) /
drivers/infiniband/sw/rdmavt/vt.c+1−3
@@ -501,9 +501,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb) · 500 unmodified lines
501501 !rdi->driver_f.quiesce_qp ||
502502 !rdi->driver_f.notify_error_qp ||
503503 !rdi->driver_f.mtu_from_qp ||
504− !rdi->driver_f.mtu_to_path_mtu ||
505− !rdi->driver_f.shut_down_port ||
506− !rdi->driver_f.cap_mask_chg)
504+ !rdi->driver_f.mtu_to_path_mtu)
507505 return -EINVAL;
508506 break;
509507
drivers/infiniband/ulp/srpt/ib_srpt.c+1−2
@@ -1638,8 +1638,7 @@ retry: · 1637 unmodified lines
16381638 */
16391639 qp_init->cap.max_send_wr = srp_sq_size / 2;
16401640 qp_init->cap.max_rdma_ctxs = srp_sq_size / 2;
1641− qp_init->cap.max_send_sge = max(sdev->device->attrs.max_sge_rd,
1642− sdev->device->attrs.max_sge);
1641+ qp_init->cap.max_send_sge = SRPT_DEF_SG_PER_WQE;
16431642 qp_init->port_num = ch->sport->port;
16441643
16451644 ch->qp = ib_create_qp(sdev->pd, qp_init);
drivers/infiniband/ulp/srpt/ib_srpt.h+1−0
@@ -106,6 +106,7 @@ enum { · 105 unmodified lines
106106 SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
107107
108108 SRPT_DEF_SG_TABLESIZE = 128,
109+ SRPT_DEF_SG_PER_WQE = 16,
109110
110111 MIN_SRPT_SQ_SIZE = 16,
111112 DEF_SRPT_SQ_SIZE = 4096,
include/linux/mlx5/qp.h+1−0
@@ -172,6 +172,7 @@ enum { · 171 unmodified lines
172172 enum {
173173 MLX5_FENCE_MODE_NONE = 0 << 5,
174174 MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
175+ MLX5_FENCE_MODE_FENCE = 2 << 5,
175176 MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
176177 MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
177178 };
include/rdma/rdma_vt.h+3−1
@@ -203,7 +203,9 @@ struct rvt_driver_provided { · 202 unmodified lines
203203
204204 /*
205205 * Allocate a private queue pair data structure for driver specific
206− * information which is opaque to rdmavt.
206+ * information which is opaque to rdmavt. Errors are returned via
207+ * ERR_PTR(err). The driver is free to return NULL or a valid
208+ * pointer.
207209 */
208210 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp,
209211 gfp_t gfp);

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