aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/cm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-07 16:33:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-07 16:33:07 -0500
commitab9f2faf8f40604551336e5b0a18e0910a57b92c (patch)
tree9068c73acf24452762d6e2b096df19e29436183e /drivers/infiniband/core/cm.c
parent75021d28594d9b6fb4d05bbc41f77948a0db0e02 (diff)
parentdb7489e07669073970358b6cacf6a9dd8dc9275e (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma updates from Doug Ledford: "This is my initial round of 4.4 merge window patches. There are a few other things I wish to get in for 4.4 that aren't in this pull, as this represents what has gone through merge/build/run testing and not what is the last few items for which testing is not yet complete. - "Checksum offload support in user space" enablement - Misc cxgb4 fixes, add T6 support - Misc usnic fixes - 32 bit build warning fixes - Misc ocrdma fixes - Multicast loopback prevention extension - Extend the GID cache to store and return attributes of GIDs - Misc iSER updates - iSER clustering update - Network NameSpace support for rdma CM - Work Request cleanup series - New Memory Registration API" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (76 commits) IB/core, cma: Make __attribute_const__ declarations sparse-friendly IB/core: Remove old fast registration API IB/ipath: Remove fast registration from the code IB/hfi1: Remove fast registration from the code RDMA/nes: Remove old FRWR API IB/qib: Remove old FRWR API iw_cxgb4: Remove old FRWR API RDMA/cxgb3: Remove old FRWR API RDMA/ocrdma: Remove old FRWR API IB/mlx4: Remove old FRWR API support IB/mlx5: Remove old FRWR API support IB/srp: Dont allocate a page vector when using fast_reg IB/srp: Remove srp_finish_mapping IB/srp: Convert to new registration API IB/srp: Split srp_map_sg RDS/IW: Convert to new memory registration API svcrdma: Port to new memory registration API xprtrdma: Port to new memory registration API iser-target: Port to new memory registration API IB/iser: Port to new fast registration API ...
Diffstat (limited to 'drivers/infiniband/core/cm.c')
-rw-r--r--drivers/infiniband/core/cm.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 4f918b929eca..0a26dd6d9b19 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -179,8 +179,6 @@ struct cm_av {
179 struct ib_ah_attr ah_attr; 179 struct ib_ah_attr ah_attr;
180 u16 pkey_index; 180 u16 pkey_index;
181 u8 timeout; 181 u8 timeout;
182 u8 valid;
183 u8 smac[ETH_ALEN];
184}; 182};
185 183
186struct cm_work { 184struct cm_work {
@@ -361,17 +359,21 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
361 unsigned long flags; 359 unsigned long flags;
362 int ret; 360 int ret;
363 u8 p; 361 u8 p;
362 struct net_device *ndev = ib_get_ndev_from_path(path);
364 363
365 read_lock_irqsave(&cm.device_lock, flags); 364 read_lock_irqsave(&cm.device_lock, flags);
366 list_for_each_entry(cm_dev, &cm.device_list, list) { 365 list_for_each_entry(cm_dev, &cm.device_list, list) {
367 if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid, 366 if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid,
368 &p, NULL)) { 367 ndev, &p, NULL)) {
369 port = cm_dev->port[p-1]; 368 port = cm_dev->port[p-1];
370 break; 369 break;
371 } 370 }
372 } 371 }
373 read_unlock_irqrestore(&cm.device_lock, flags); 372 read_unlock_irqrestore(&cm.device_lock, flags);
374 373
374 if (ndev)
375 dev_put(ndev);
376
375 if (!port) 377 if (!port)
376 return -EINVAL; 378 return -EINVAL;
377 379
@@ -384,9 +386,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
384 ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path, 386 ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
385 &av->ah_attr); 387 &av->ah_attr);
386 av->timeout = path->packet_life_time + 1; 388 av->timeout = path->packet_life_time + 1;
387 memcpy(av->smac, path->smac, sizeof(av->smac));
388 389
389 av->valid = 1;
390 return 0; 390 return 0;
391} 391}
392 392
@@ -1639,11 +1639,11 @@ static int cm_req_handler(struct cm_work *work)
1639 cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]); 1639 cm_format_paths_from_req(req_msg, &work->path[0], &work->path[1]);
1640 1640
1641 memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac, ETH_ALEN); 1641 memcpy(work->path[0].dmac, cm_id_priv->av.ah_attr.dmac, ETH_ALEN);
1642 work->path[0].vlan_id = cm_id_priv->av.ah_attr.vlan_id;
1643 ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); 1642 ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av);
1644 if (ret) { 1643 if (ret) {
1645 ib_get_cached_gid(work->port->cm_dev->ib_device, 1644 ib_get_cached_gid(work->port->cm_dev->ib_device,
1646 work->port->port_num, 0, &work->path[0].sgid); 1645 work->port->port_num, 0, &work->path[0].sgid,
1646 NULL);
1647 ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, 1647 ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
1648 &work->path[0].sgid, sizeof work->path[0].sgid, 1648 &work->path[0].sgid, sizeof work->path[0].sgid,
1649 NULL, 0); 1649 NULL, 0);
@@ -3618,32 +3618,6 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
3618 *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU | 3618 *qp_attr_mask = IB_QP_STATE | IB_QP_AV | IB_QP_PATH_MTU |
3619 IB_QP_DEST_QPN | IB_QP_RQ_PSN; 3619 IB_QP_DEST_QPN | IB_QP_RQ_PSN;
3620 qp_attr->ah_attr = cm_id_priv->av.ah_attr; 3620 qp_attr->ah_attr = cm_id_priv->av.ah_attr;
3621 if (!cm_id_priv->av.valid) {
3622 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
3623 return -EINVAL;
3624 }
3625 if (cm_id_priv->av.ah_attr.vlan_id != 0xffff) {
3626 qp_attr->vlan_id = cm_id_priv->av.ah_attr.vlan_id;
3627 *qp_attr_mask |= IB_QP_VID;
3628 }
3629 if (!is_zero_ether_addr(cm_id_priv->av.smac)) {
3630 memcpy(qp_attr->smac, cm_id_priv->av.smac,
3631 sizeof(qp_attr->smac));
3632 *qp_attr_mask |= IB_QP_SMAC;
3633 }
3634 if (cm_id_priv->alt_av.valid) {
3635 if (cm_id_priv->alt_av.ah_attr.vlan_id != 0xffff) {
3636 qp_attr->alt_vlan_id =
3637 cm_id_priv->alt_av.ah_attr.vlan_id;
3638 *qp_attr_mask |= IB_QP_ALT_VID;
3639 }
3640 if (!is_zero_ether_addr(cm_id_priv->alt_av.smac)) {
3641 memcpy(qp_attr->alt_smac,
3642 cm_id_priv->alt_av.smac,
3643 sizeof(qp_attr->alt_smac));
3644 *qp_attr_mask |= IB_QP_ALT_SMAC;
3645 }
3646 }
3647 qp_attr->path_mtu = cm_id_priv->path_mtu; 3621 qp_attr->path_mtu = cm_id_priv->path_mtu;
3648 qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn); 3622 qp_attr->dest_qp_num = be32_to_cpu(cm_id_priv->remote_qpn);
3649 qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn); 3623 qp_attr->rq_psn = be32_to_cpu(cm_id_priv->rq_psn);