From 5fd17717f7553d357d1a2293258d8b463f12a7e2 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Fri, 17 Dec 2010 07:43:31 -0800 Subject: [PATCH] refresh (create temporary patch) --- meta | 5 +- patches/refresh-temp | 242 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 patches/refresh-temp diff --git a/meta b/meta index b820902..0b72102 100644 --- a/meta +++ b/meta @@ -1,9 +1,10 @@ Version: 1 -Previous: f79c426d4c3360bfc6c2690783efb11ab8ae2ff1 -Head: 528f95eeb2a79b603c31c3dc26409c19538cacf4 +Previous: bf8432578aa73c5315ec70da8ae0c8cedd6105d8 +Head: 2401f863b33fccda132e6618e72970510944d3ab Applied: lmc: b355854c79a1e446e87684a41663ad5aae258b73 xref-lid: 528f95eeb2a79b603c31c3dc26409c19538cacf4 + refresh-temp: 2401f863b33fccda132e6618e72970510944d3ab Unapplied: ibacm-check-for-nodelay-on-pat: 1540687d721504ec1810aac7cc53ec7272415eb9 Hidden: diff --git a/patches/refresh-temp b/patches/refresh-temp new file mode 100644 index 0000000..df8a5cb --- /dev/null +++ b/patches/refresh-temp @@ -0,0 +1,242 @@ +Bottom: 8a0f1c3a954f8c19ea1185f654423ff1769e72c5 +Top: a15744a4e313a55d0b2bac2e14be1aed79ec75f5 +Author: Sean Hefty +Date: 2010-12-17 07:43:31 -0800 + +Refresh of xref-lid + +--- + +diff --git a/src/acm.c b/src/acm.c +index c08799e..5da4044 100644 +--- a/src/acm.c ++++ b/src/acm.c +@@ -268,8 +268,13 @@ acm_format_name(int level, char *name, size_t name_size, + break; + case ACM_EP_INFO_PATH: + path = (struct ibv_path_record *) addr; +- sprintf(name, "SLID(%d) DLID(%d)", +- ntohs(path->slid), ntohs(path->dlid)); ++ if (path->dlid) { ++ sprintf(name, "SLID(%d) DLID(%d)", ++ ntohs(path->slid), ntohs(path->dlid)); ++ } else { ++ acm_format_name(level, name, name_size, ACM_ADDRESS_GID, ++ &path->dgid, sizeof path->dgid); ++ } + break; + case ACM_ADDRESS_LID: + sprintf(name, "LID(%d)", *((uint16_t *) addr)); +@@ -731,9 +736,23 @@ static int acm_addr_index(struct acm_ep *ep, uint8_t *addr, uint8_t addr_type) + 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_ADDR; i++) { ++ if (dest->mgid == ep->mc_dest[i].mgid) ++ break; ++ } ++ if (i == MAX_EP_ADDR) { ++ acm_log(0, "ERROR - cannot match mgid\n"); ++ return ACM_STATUS_EINVAL; ++ } ++ ++ 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"); +@@ -780,8 +799,7 @@ static uint8_t acm_resolve_path(struct acm_ep *ep, struct acm_dest *dest, + acm_init_path_query(mad); + + memcpy(mad->data, &dest->path, sizeof(dest->path)); +- mad->comp_mask = IB_COMP_MASK_PR_DGID | IB_COMP_MASK_PR_SGID | +- IB_COMP_MASK_PR_TCLASS | IB_COMP_MASK_PR_PKEY; ++ mad->comp_mask = acm_path_comp_mask(&dest->path); + + dest->state = ACM_QUERY_ROUTE; + acm_post_send(&ep->sa_queue, msg); +@@ -809,16 +827,29 @@ acm_record_acm_addr(struct acm_ep *ep, struct acm_dest *dest, struct ibv_wc *wc, + dest->av.grh.dgid = ((struct ibv_grh *) (uintptr_t) wc->wr_id)->sgid; + + dest->mgid = ep->mc_dest[index].mgid; +- +- dest->path = ep->mc_dest[index].path; ++ dest->path.sgid = ep->mc_dest[index].path.sgid; + dest->path.dgid = dest->av.grh.dgid; +- dest->path.dlid = htons(dest->av.dlid); ++ dest->path.tclass = ep->mc_dest[index].path.tclass; ++ dest->path.pkey = ep->mc_dest[index].path.pkey; + dest->remote_qpn = wc->src_qp; + + dest->state = ACM_ADDR_RESOLVED; + return ACM_STATUS_SUCCESS; + } + ++static void ++acm_record_path_addr(struct acm_ep *ep, struct acm_dest *dest, ++ struct ibv_path_record *path) ++{ ++ acm_log(2, "%s\n", dest->name); ++ dest->path.pkey = htons(ep->pkey); ++ dest->path.sgid = path->sgid; ++ dest->path.dgid = path->dgid; ++ dest->path.slid = path->slid; ++ dest->path.dlid = path->dlid; ++ dest->state = ACM_ADDR_RESOLVED; ++} ++ + static uint8_t acm_validate_addr_req(struct acm_mad *mad) + { + struct acm_resolve_rec *rec; +@@ -964,10 +995,12 @@ 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); +- 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 (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) { +@@ -1318,9 +1351,9 @@ static uint64_t acm_path_comp_mask(struct ibv_path_record *path) + acm_log(2, "\n"); + if (path->service_id) + comp_mask |= IB_COMP_MASK_PR_SERVICE_ID; +- if (path->dgid.global.interface_id || path->dgid.global.subnet_prefix) ++ if (!ib_any_gid(&path->dgid)) + comp_mask |= IB_COMP_MASK_PR_DGID; +- if (path->sgid.global.interface_id || path->sgid.global.subnet_prefix) ++ if (!ib_any_gid(&path->sgid)) + comp_mask |= IB_COMP_MASK_PR_SGID; + if (path->dlid) + comp_mask |= IB_COMP_MASK_PR_DLID; +@@ -1714,12 +1747,12 @@ static uint8_t acm_svr_query_sa(struct acm_ep *ep, struct acm_request *req) + } + + static int +-acm_is_port_addr(struct acm_port *port, struct ibv_path_record *path) ++acm_is_path_from_port(struct acm_port *port, struct ibv_path_record *path) + { +- if (path->slid) { +- return (port->lid == (ntohs(path.slid) & ~((uint16_t) port->lid_mask))); ++ if (ib_any_gid(&path->sgid)) { ++ return (port->lid == (ntohs(path.slid) & port->lid_mask)); + } +- ++ return (acm_gid_index(port, &path->sgid) < port->gid_cnt); + } + + static struct acm_ep * +@@ -1742,7 +1775,7 @@ acm_get_ep(struct acm_ep_addr_data *data) + port = &dev->port[i]; + + if (data->type == ACM_EP_INFO_PATH && +- port->lid != ntohs(data->info.path.slid)) ++ !acm_is_path_from_port(port, &data->info.path)) + continue; + + for (ep_entry = port->ep_list.Next; ep_entry != &port->ep_list; +@@ -1752,8 +1785,10 @@ acm_get_ep(struct acm_ep_addr_data *data) + if (ep->state != ACM_READY) + continue; + +- if (data->type == ACM_EP_INFO_PATH) +- return ep; // TODO: check pkey ++ if ((data->type == ACM_EP_INFO_PATH) && ++ (!data->info.path.pkey || ++ (ntohs(data->info.path.pkey) == ep->pkey))) ++ return ep; + + if (acm_addr_index(ep, data->info.addr, + (uint8_t) data->type) >= 0) +@@ -2090,26 +2125,23 @@ acm_svr_resolve_path(struct acm_client *client, struct acm_resolve_msg *msg) + return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_EDESTADDR); + } + +- ep = acm_get_ep(&msg->data[0]); +- if (!ep) { +- acm_log(0, "notice - unknown local end point\n"); +- return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR); +- } +-/* + acm_format_name(2, log_data, sizeof log_data, +- saddr->type, saddr->info.addr, sizeof saddr->info.addr); +- acm_log(2, "src %s\n", log_data); +- ep = acm_get_ep(saddr); ++ ACM_EP_INFO_PATH, path, sizeof *path); ++ acm_log(2, "path %s\n", log_data); ++ ep = acm_get_ep(&msg->data[0]); + if (!ep) { + acm_log(0, "notice - unknown local end point\n"); + return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR); + } + +- acm_format_name(2, log_data, sizeof log_data, +- daddr->type, daddr->info.addr, sizeof daddr->info.addr); +- acm_log(2, "dest %s\n", log_data); +- +- dest = acm_acquire_dest(ep, daddr->type, daddr->info.addr); ++ memset(addr, 0, sizeof addr); ++ if (path->dlid) { ++ * ((uint16_t *) addr) = path->dlid; ++ dest = acm_acquire_dest(ep, ACM_ADDRESS_LID, addr); ++ } else { ++ memcpy(addr, &path->dgid, sizeof path->dgid); ++ dest = acm_acquire_dest(ep, ACM_ADDRESS_GID, addr); ++ } + if (!dest) { + acm_log(0, "ERROR - unable to allocate destination in client request\n"); + return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ENOMEM); +@@ -2121,26 +2153,19 @@ acm_svr_resolve_path(struct acm_client *client, struct acm_resolve_msg *msg) + acm_log(2, "request satisfied from local cache\n"); + status = ACM_STATUS_SUCCESS; + break; ++ case ACM_INIT: ++ acm_log(2, "have path, bypassing address resolution"); ++ acm_record_path_addr(ep, dest, path); ++ /* fall through */ + case ACM_ADDR_RESOLVED: + acm_log(2, "have address, resolving route\n"); + status = acm_resolve_path(ep, dest, acm_dest_sa_resp); + if (status) { + break; + } +- goto queue; +- case ACM_INIT: +- acm_log(2, "sending resolve msg to dest\n"); +- status = acm_send_resolve(ep, dest, saddr); +- if (status) { +- break; +- } +- dest->state = ACM_QUERY_ADDR; +-*/ + /* fall through */ +-/* + default: +-queue: +- if (daddr->flags & ACM_FLAGS_NODELAY) { ++ if (msg->data[0].flags & ACM_FLAGS_NODELAY) { + acm_log(2, "lookup initiated, but client wants no delay\n"); + status = ACM_STATUS_ENODATA; + break; +@@ -2155,7 +2180,6 @@ queue: + } + lock_release(&dest->lock); + ret = acm_client_resolve_resp(client, msg, dest, status); +-*/ + put: + acm_put_dest(dest); + return ret; -- 2.46.0