aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2006-06-17 23:37:40 -0400
committerRoland Dreier <rolandd@cisco.com>2006-06-17 23:37:40 -0400
commitca222c6b2c48e1e0be330a55611ba394251330cb (patch)
tree80491af9034f3cadad8b68fdb140bb6909f4e48e /drivers/infiniband
parent6d969a471ba107d94cf03dab3c69f45b9733f500 (diff)
IB/cm: Use address handle helpers
Use new ib_init_ah_from_wc() and ib_init_ah_from_path() helper functions to clean up the IB CM. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cm.c25
-rw-r--r--drivers/infiniband/core/sa_query.c6
2 files changed, 11 insertions, 20 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 629ed26a0176..450adfe0a4f1 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -254,23 +254,13 @@ static void cm_set_private_data(struct cm_id_private *cm_id_priv,
254 cm_id_priv->private_data_len = private_data_len; 254 cm_id_priv->private_data_len = private_data_len;
255} 255}
256 256
257static void cm_set_ah_attr(struct ib_ah_attr *ah_attr, u8 port_num, 257static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
258 u16 dlid, u8 sl, u16 src_path_bits) 258 struct ib_grh *grh, struct cm_av *av)
259{
260 memset(ah_attr, 0, sizeof ah_attr);
261 ah_attr->dlid = dlid;
262 ah_attr->sl = sl;
263 ah_attr->src_path_bits = src_path_bits;
264 ah_attr->port_num = port_num;
265}
266
267static void cm_init_av_for_response(struct cm_port *port,
268 struct ib_wc *wc, struct cm_av *av)
269{ 259{
270 av->port = port; 260 av->port = port;
271 av->pkey_index = wc->pkey_index; 261 av->pkey_index = wc->pkey_index;
272 cm_set_ah_attr(&av->ah_attr, port->port_num, wc->slid, 262 ib_init_ah_from_wc(port->cm_dev->device, port->port_num, wc,
273 wc->sl, wc->dlid_path_bits); 263 grh, &av->ah_attr);
274} 264}
275 265
276static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) 266static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
@@ -300,9 +290,8 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av)
300 return ret; 290 return ret;
301 291
302 av->port = port; 292 av->port = port;
303 cm_set_ah_attr(&av->ah_attr, av->port->port_num, 293 ib_init_ah_from_path(cm_dev->device, port->port_num, path,
304 be16_to_cpu(path->dlid), path->sl, 294 &av->ah_attr);
305 be16_to_cpu(path->slid) & 0x7F);
306 av->packet_life_time = path->packet_life_time; 295 av->packet_life_time = path->packet_life_time;
307 return 0; 296 return 0;
308} 297}
@@ -1342,6 +1331,7 @@ static int cm_req_handler(struct cm_work *work)
1342 cm_id_priv = container_of(cm_id, struct cm_id_private, id); 1331 cm_id_priv = container_of(cm_id, struct cm_id_private, id);
1343 cm_id_priv->id.remote_id = req_msg->local_comm_id; 1332 cm_id_priv->id.remote_id = req_msg->local_comm_id;
1344 cm_init_av_for_response(work->port, work->mad_recv_wc->wc, 1333 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
1334 work->mad_recv_wc->recv_buf.grh,
1345 &cm_id_priv->av); 1335 &cm_id_priv->av);
1346 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> 1336 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
1347 id.local_id); 1337 id.local_id);
@@ -2707,6 +2697,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
2707 cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid); 2697 cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid);
2708 cm_id_priv->av.dgid.global.interface_id = 0; 2698 cm_id_priv->av.dgid.global.interface_id = 0;
2709 cm_init_av_for_response(work->port, work->mad_recv_wc->wc, 2699 cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
2700 work->mad_recv_wc->recv_buf.grh,
2710 &cm_id_priv->av); 2701 &cm_id_priv->av);
2711 cm_id_priv->id.remote_id = sidr_req_msg->request_id; 2702 cm_id_priv->id.remote_id = sidr_req_msg->request_id;
2712 cm_id_priv->id.state = IB_CM_SIDR_REQ_RCVD; 2703 cm_id_priv->id.state = IB_CM_SIDR_REQ_RCVD;
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 08d9dd5e0487..e911c99ff843 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -463,9 +463,9 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
463 if (ret) 463 if (ret)
464 return ret; 464 return ret;
465 465
466 ah_attr->grh.sgid_index = gid_index; 466 ah_attr->grh.sgid_index = gid_index;
467 ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label); 467 ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label);
468 ah_attr->grh.hop_limit = rec->hop_limit; 468 ah_attr->grh.hop_limit = rec->hop_limit;
469 ah_attr->grh.traffic_class = rec->traffic_class; 469 ah_attr->grh.traffic_class = rec->traffic_class;
470 } 470 }
471 return 0; 471 return 0;