diff options
Diffstat (limited to 'drivers/infiniband/core/cm.c')
-rw-r--r-- | drivers/infiniband/core/cm.c | 40 |
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 | ||
186 | struct cm_work { | 184 | struct 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); |