+++ /dev/null
-Bottom: 0e56d97e8e6ce359a7d2f4979f99fcc197cb8302
-Top: e8b5bb1cf92f403d8767fc1d61cb8c538da64fe3
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2011-04-01 16:03:40 -0700
-
-ibacm: Allocate address handles dynamically when needed
-
-ibacm allocates an address handle for every remote destination
-that it tracks. However, under normal operation, the handle
-is used infrequently - typically only once by the target
-service to send a response and not at all on the initiator
-service. Avoid the overhead of having 1 address handle per
-destination by allocating them dynamically only when they are needed.
-
-The exceptions to this are the address handles allocated to
-communicate with the SA and the primary multicast group.
-
-Signed-off-by: Sean Hefty <sean.hefty@intel.com>
-
-
-
----
-
-diff --git a/src/acm.c b/src/acm.c
-index fe42498..53a8e7b 100644
---- a/src/acm.c
-+++ b/src/acm.c
-@@ -164,6 +164,7 @@ struct acm_send_msg
- DLIST_ENTRY entry;
- struct acm_ep *ep;
- struct acm_dest *dest;
-+ struct ibv_ah *ah;
- void *context;
- void (*resp_handler)(struct acm_send_msg *req,
- struct ibv_wc *wc, struct acm_mad *resp);
-@@ -449,20 +450,30 @@ acm_alloc_send(struct acm_ep *ep, struct acm_dest *dest, size_t size)
- msg->mr = ibv_reg_mr(ep->port->dev->pd, msg->data, size, 0);
- if (!msg->mr) {
- acm_log(0, "ERROR - failed to register send buffer\n");
-- goto err;
-+ goto err1;
-+ }
-+
-+ if (!dest->ah) {
-+ msg->ah = ibv_create_ah(ep->port->dev->pd, &dest->av);
-+ if (!msg->ah) {
-+ acm_log(0, "ERROR - unable to create ah\n");
-+ goto err2;
-+ }
-+ msg->wr.wr.ud.ah = msg->ah;
-+ } else {
-+ msg->wr.wr.ud.ah = dest->ah;
- }
-
-+ acm_log(2, "get dest %s\n", dest->name);
-+ (void) atomic_inc(&dest->refcnt);
-+ msg->dest = dest;
-+
- msg->wr.next = NULL;
- msg->wr.sg_list = &msg->sge;
- msg->wr.num_sge = 1;
- msg->wr.opcode = IBV_WR_SEND;
- msg->wr.send_flags = IBV_SEND_SIGNALED;
- msg->wr.wr_id = (uintptr_t) msg;
--
-- acm_log(2, "get dest %s\n", dest->name);
-- (void) atomic_inc(&dest->refcnt);
-- msg->dest = dest;
-- msg->wr.wr.ud.ah = dest->ah;
- msg->wr.wr.ud.remote_qpn = dest->remote_qpn;
- msg->wr.wr.ud.remote_qkey = ACM_QKEY;
-
-@@ -471,7 +482,10 @@ acm_alloc_send(struct acm_ep *ep, struct acm_dest *dest, size_t size)
- msg->sge.addr = (uintptr_t) msg->data;
- acm_log(2, "%p\n", msg);
- return msg;
--err:
-+
-+err2:
-+ ibv_dereg_mr(msg->mr);
-+err1:
- free(msg);
- return NULL;
- }
-@@ -490,6 +504,8 @@ acm_init_send_req(struct acm_send_msg *msg, void *context,
- static void acm_free_send(struct acm_send_msg *msg)
- {
- acm_log(2, "%p\n", msg);
-+ if (msg->ah)
-+ ibv_destroy_ah(msg->ah);
- ibv_dereg_mr(msg->mr);
- acm_put_dest(msg->dest);
- free(msg);
-@@ -774,7 +790,6 @@ static uint8_t
- acm_record_acm_route(struct acm_ep *ep, struct acm_dest *dest)
- {
- int i;
-- uint8_t status;
-
- acm_log(2, "\n");
- for (i = 0; i < MAX_EP_MC; i++) {
-@@ -789,18 +804,8 @@ acm_record_acm_route(struct acm_ep *ep, struct acm_dest *dest)
- dest->path = ep->mc_dest[i].path;
- dest->path.dgid = dest->av.grh.dgid;
- dest->path.dlid = htons(dest->av.dlid);
--
-- dest->ah = ibv_create_ah(ep->port->dev->pd, &dest->av);
-- if (!dest->ah) {
-- acm_log(0, "ERROR - failed to create ah\n");
-- dest->state = ACM_INIT;
-- status = ACM_STATUS_ENOMEM;
-- } else {
-- dest->state = ACM_READY;
-- status = ACM_STATUS_SUCCESS;
-- }
--
-- return status;
-+ dest->state = ACM_READY;
-+ return ACM_STATUS_SUCCESS;
- }
-
- static void acm_init_path_query(struct ib_sa_mad *mad)
-@@ -1096,15 +1101,6 @@ acm_dest_sa_resp(struct acm_send_msg *msg, struct ibv_wc *wc, struct acm_mad *ma
- if (!status) {
- memcpy(&dest->path, sa_mad->data, sizeof(dest->path));
- acm_init_path_av(msg->ep->port, dest);
-- if (dest->remote_qpn) {
-- dest->ah = ibv_create_ah(msg->ep->port->dev->pd, &dest->av);
-- if (!dest->ah) {
-- acm_log(0, "ERROR - failed to create ah\n");
-- status = ACM_STATUS_ENOMEM;
-- }
-- }
-- }
-- if (!status) {
- dest->state = ACM_READY;
- } else {
- dest->state = ACM_INIT;
-@@ -1164,7 +1160,6 @@ acm_process_addr_req(struct acm_ep *ep, struct ibv_wc *wc, struct acm_mad *mad)
- break;
-
- acm_log(2, "src service has new qp, resetting\n");
-- ibv_destroy_ah(dest->ah); // TODO: ah could be in use
- /* fall through */
- case ACM_INIT:
- case ACM_QUERY_ADDR:
+++ /dev/null
-Bottom: 613b7a74933df2af9b7b765f153ed3c74a67c4e1
-Top: 0e56d97e8e6ce359a7d2f4979f99fcc197cb8302
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2011-04-01 15:58:19 -0700
-
-ibacm: Join only the base multicast group if using SA path resolution
-
-If the ACM service is configured to use the SA to resolve path
-record data, then only join the base multicast group. We only
-need to join other groups if we're creating path records based
-on multicast data, using the acm route protocol.
-
-Signed-off-by: Sean Hefty <sean.hefty@intel.com>
-
-
----
-
-diff --git a/src/acm.c b/src/acm.c
-index 3df996b..fe42498 100644
---- a/src/acm.c
-+++ b/src/acm.c
-@@ -1556,7 +1556,8 @@ static void acm_port_join(struct acm_port *port)
- if ((ep->state = ep->mc_dest[0].state) != ACM_READY)
- continue;
-
-- if (port->rate != min_rate || port->mtu != min_mtu)
-+ if ((route_prot == ACM_ROUTE_PROT_ACM) &&
-+ (port->rate != min_rate || port->mtu != min_mtu))
- acm_join_group(ep, &port_gid, 0, 0, 0, port->rate, port->mtu);
- }
- acm_log(1, "joins for device %s port %d complete\n", dev->verbs->device->name,
+++ /dev/null
-Bottom: 4a725c3b21d37e7ff6d4e2430fc69ddf4d72920a
-Top: 613b7a74933df2af9b7b765f153ed3c74a67c4e1
-Author: Sean Hefty <sean.hefty@intel.com>
-Date: 2011-04-01 14:46:34 -0700
-
-ibacm: Reduce overhead on multicast groups not used
-
-ACM may join several multicast groups when using the multicast
-group protocol. No data is ever sent on those groups. They exist
-simply to see if a port *could* send data across those groups, for
-example, to validate the mtu or rate between two endpoints. Since
-we don't send data on them, there's no need to create an address
-handle for them or attach the ACM UD QP to it.
-
-Signed-off-by: Sean Hefty <sean.hefty@intel.com>
-
-
----
-
-diff --git a/src/acm.c b/src/acm.c
-index 15f2631..3df996b 100644
---- a/src/acm.c
-+++ b/src/acm.c
-@@ -724,22 +724,32 @@ static void acm_process_join_resp(struct acm_ep *ep, struct ib_user_mad *umad)
- mc_rec = (struct ib_mc_member_rec *) mad->data;
- lock_acquire(&ep->lock);
- index = acm_mc_index(ep, &mc_rec->mgid);
-- if (index >= 0) {
-- dest = &ep->mc_dest[index];
-- dest->remote_qpn = IB_MC_QPN;
-- dest->mgid = mc_rec->mgid;
-- acm_record_mc_av(ep->port, mc_rec, dest);
-+ if (index < 0) {
-+ acm_log(0, "ERROR - MGID in join response not found\n");
-+ goto out;
-+ }
-+
-+ dest = &ep->mc_dest[index];
-+ dest->remote_qpn = IB_MC_QPN;
-+ dest->mgid = mc_rec->mgid;
-+ acm_record_mc_av(ep->port, mc_rec, dest);
-+
-+ if (index == 0) {
- dest->ah = ibv_create_ah(ep->port->dev->pd, &dest->av);
-+ if (!dest->ah) {
-+ acm_log(0, "ERROR - unable to create ah\n");
-+ goto out;
-+ }
- ret = ibv_attach_mcast(ep->qp, &mc_rec->mgid, mc_rec->mlid);
- if (ret) {
- acm_log(0, "ERROR - unable to attach QP to multicast group\n");
-- } else {
-- dest->state = ACM_READY;
-- acm_log(1, "join successful\n");
-+ goto out;
- }
-- } else {
-- acm_log(0, "ERROR - MGID in join response not found\n");
- }
-+
-+ dest->state = ACM_READY;
-+ acm_log(1, "join successful\n");
-+out:
- lock_release(&ep->lock);
- }