aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoni Shoua <monis@mellanox.com>2014-03-27 04:52:58 -0400
committerRoland Dreier <roland@purestorage.com>2014-04-01 17:05:26 -0400
commitb2853fd6c2d0f383dbdf7427e263eb576a633867 (patch)
treec82122c657ab89679fc10a298ac3c8ffef31deac
parentcfbf8d4857c26a8a307fb7cd258074c9dcd8c691 (diff)
IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler
The code that resolves the passive side source MAC within the rdma_cm connection request handler was both redundant and buggy, so remove it. It was redundant since later, when an RC QP is modified to RTR state, the resolution will take place in the ib_core module. It was buggy because this callback also deals with UD SIDR exchange, for which we incorrectly looked at the REQ member of the CM event and dereferenced a random value. Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures") Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--drivers/infiniband/core/cm.c17
-rw-r--r--drivers/infiniband/core/cma.c26
-rw-r--r--include/rdma/ib_cm.h1
3 files changed, 0 insertions, 44 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 0601b9daf840..c3239170d8b7 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -349,23 +349,6 @@ static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
349 grh, &av->ah_attr); 349 grh, &av->ah_attr);
350} 350}
351 351
352int ib_update_cm_av(struct ib_cm_id *id, const u8 *smac, const u8 *alt_smac)
353{
354 struct cm_id_private *cm_id_priv;
355
356 cm_id_priv = container_of(id, struct cm_id_private, id);
357
358 if (smac != NULL)
359 memcpy(cm_id_priv->av.smac, smac, sizeof(cm_id_priv->av.smac));
360
361 if (alt_smac != NULL)
362 memcpy(cm_id_priv->alt_av.smac, alt_smac,
363 sizeof(cm_id_priv->alt_av.smac));
364
365 return 0;
366}
367EXPORT_SYMBOL(ib_update_cm_av);
368
369static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) 352static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
370{ 353{
371 struct cm_device *cm_dev; 354 struct cm_device *cm_dev;
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 199958d9ddc8..42c3058e6e9c 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1284,15 +1284,6 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1284 struct rdma_id_private *listen_id, *conn_id; 1284 struct rdma_id_private *listen_id, *conn_id;
1285 struct rdma_cm_event event; 1285 struct rdma_cm_event event;
1286 int offset, ret; 1286 int offset, ret;
1287 u8 smac[ETH_ALEN];
1288 u8 alt_smac[ETH_ALEN];
1289 u8 *psmac = smac;
1290 u8 *palt_smac = alt_smac;
1291 int is_iboe = ((rdma_node_get_transport(cm_id->device->node_type) ==
1292 RDMA_TRANSPORT_IB) &&
1293 (rdma_port_get_link_layer(cm_id->device,
1294 ib_event->param.req_rcvd.port) ==
1295 IB_LINK_LAYER_ETHERNET));
1296 1287
1297 listen_id = cm_id->context; 1288 listen_id = cm_id->context;
1298 if (!cma_check_req_qp_type(&listen_id->id, ib_event)) 1289 if (!cma_check_req_qp_type(&listen_id->id, ib_event))
@@ -1336,28 +1327,11 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
1336 ret = conn_id->id.event_handler(&conn_id->id, &event); 1327 ret = conn_id->id.event_handler(&conn_id->id, &event);
1337 if (ret) 1328 if (ret)
1338 goto err3; 1329 goto err3;
1339
1340 if (is_iboe) {
1341 if (ib_event->param.req_rcvd.primary_path != NULL)
1342 rdma_addr_find_smac_by_sgid(
1343 &ib_event->param.req_rcvd.primary_path->sgid,
1344 psmac, NULL);
1345 else
1346 psmac = NULL;
1347 if (ib_event->param.req_rcvd.alternate_path != NULL)
1348 rdma_addr_find_smac_by_sgid(
1349 &ib_event->param.req_rcvd.alternate_path->sgid,
1350 palt_smac, NULL);
1351 else
1352 palt_smac = NULL;
1353 }
1354 /* 1330 /*
1355 * Acquire mutex to prevent user executing rdma_destroy_id() 1331 * Acquire mutex to prevent user executing rdma_destroy_id()
1356 * while we're accessing the cm_id. 1332 * while we're accessing the cm_id.
1357 */ 1333 */
1358 mutex_lock(&lock); 1334 mutex_lock(&lock);
1359 if (is_iboe)
1360 ib_update_cm_av(cm_id, psmac, palt_smac);
1361 if (cma_comp(conn_id, RDMA_CM_CONNECT) && 1335 if (cma_comp(conn_id, RDMA_CM_CONNECT) &&
1362 (conn_id->id.qp_type != IB_QPT_UD)) 1336 (conn_id->id.qp_type != IB_QPT_UD))
1363 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0); 1337 ib_send_cm_mra(cm_id, CMA_CM_MRA_SETTING, NULL, 0);
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index f29e3a27c2cc..0e3ff30647d5 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -601,5 +601,4 @@ struct ib_cm_sidr_rep_param {
601int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, 601int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
602 struct ib_cm_sidr_rep_param *param); 602 struct ib_cm_sidr_rep_param *param);
603 603
604int ib_update_cm_av(struct ib_cm_id *id, const u8 *smac, const u8 *alt_smac);
605#endif /* IB_CM_H */ 604#endif /* IB_CM_H */