From 2a5cced7687f853eff6c5332967186731b00094f Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Mon, 15 Nov 2010 16:41:03 -0800 Subject: [PATCH] refresh --- meta | 7 +- patches/dest_string | 301 +++++++++++++++++++++++++++++++++++++++++- patches/refresh-temp | 307 ------------------------------------------- 3 files changed, 302 insertions(+), 313 deletions(-) delete mode 100644 patches/refresh-temp diff --git a/meta b/meta index 1b35640..37d1bf8 100644 --- a/meta +++ b/meta @@ -1,12 +1,11 @@ Version: 1 -Previous: cba485ccfc4610e3767bb32c2b70481331da1cf5 -Head: 5be15a5fb860c3fa9049243f17857a3e30c3cac6 +Previous: 035bae79ec09c68a7501b2091cb19734ef738458 +Head: 2e94f39a37bce0c467bace1934fdfc246920b50f Applied: acm_snoop: 6d9b27b37026f9090ad55a36f26814f90f3772dd log_lid: 6ac592a74d5289b4800c84ef8c20e8ff3f2f263e logging: 4ca254f3d8fda6ae709f0c38461f75b9677fa5df - dest_string: ca189f12b9d737510e252cc33821edb1570efa08 - refresh-temp: 5be15a5fb860c3fa9049243f17857a3e30c3cac6 + dest_string: 2e94f39a37bce0c467bace1934fdfc246920b50f Unapplied: loopback: 8c3473645ff2d6097b6a9c351a726ea48c1d8165 Hidden: diff --git a/patches/dest_string b/patches/dest_string index 7eff320..a9f4e61 100644 --- a/patches/dest_string +++ b/patches/dest_string @@ -1,5 +1,5 @@ Bottom: 9962a940efd219c52418715f8e1c4d496699b292 -Top: 9962a940efd219c52418715f8e1c4d496699b292 +Top: b021b7eea3776c2bdf94df82c8c4791a53d7eb81 Author: Sean Hefty Date: 2010-11-15 14:42:59 -0800 @@ -15,4 +15,301 @@ Signed-off-by: Sean Hefty --- - +diff --git a/linux/osd.h b/linux/osd.h +index 28c3647..33ea842 100644 +--- a/linux/osd.h ++++ b/linux/osd.h +@@ -148,6 +148,7 @@ static inline uint64_t time_stamp_us(void) + + #define time_stamp_ms() (time_stamp_us() / 1000) + ++#define PER_THREAD __thread + static inline int beginthread(void (*func)(void *), void *arg) + { + pthread_t thread; +diff --git a/src/acm.c b/src/acm.c +index daa0985..766a291 100644 +--- a/src/acm.c ++++ b/src/acm.c +@@ -75,6 +75,7 @@ enum acm_route_prot + struct acm_dest + { + uint8_t address[ACM_MAX_ADDRESS]; /* keep first */ ++ char name[ACM_MAX_ADDRESS]; + struct ibv_ah *ah; + struct ibv_ah_attr av; + struct ibv_path_record path; +@@ -135,6 +136,7 @@ struct acm_ep + uint8_t *recv_bufs; + DLIST_ENTRY entry; + union acm_ep_info addr[MAX_EP_ADDR]; ++ char name[MAX_EP_ADDR]; + uint8_t addr_type[MAX_EP_ADDR]; + void *dest_map[ACM_ADDRESS_RESERVED - 1]; + struct acm_dest mc_dest[MAX_EP_MC]; +@@ -194,6 +196,7 @@ static struct acm_client client[FD_SETSIZE - 1]; + + static FILE *flog; + static lock_t log_lock; ++PER_THREAD char log_data[ACM_MAX_ADDRESS]; + + static char *opts_file = "/etc/ibacm/acm_opts.cfg"; + static char *addr_file = "/etc/ibacm/acm_addr.cfg"; +@@ -232,44 +235,38 @@ static void acm_write(int level, const char *format, ...) + va_end(args); + } + +-static void acm_log_addr(int level, const char *msg, uint16_t addr_type, uint8_t *addr) ++static void ++acm_format_name(int level, char *name, size_t name_size, ++ uint8_t addr_type, uint8_t *addr, size_t addr_size) + { + struct ibv_path_record *path; +- char ip_addr[ACM_MAX_ADDRESS]; +- struct timeval tv; + + if (level > log_level) + return; + +- gettimeofday(&tv, NULL); +- lock_acquire(&log_lock); +- fprintf(flog, "%u.%03u: ", (unsigned) tv.tv_sec, (unsigned) (tv.tv_usec / 1000)); +- fprintf(flog, msg); + switch (addr_type) { + case ACM_EP_INFO_NAME: +- fprintf(flog, "%s\n", addr); ++ memcpy(name, addr, addr_size); + break; + case ACM_EP_INFO_ADDRESS_IP: +- inet_ntop(AF_INET, addr, ip_addr, ACM_MAX_ADDRESS); +- fprintf(flog, "%s\n", ip_addr); ++ inet_ntop(AF_INET, addr, name, name_size); + break; + case ACM_EP_INFO_ADDRESS_IP6: + case ACM_ADDRESS_GID: +- inet_ntop(AF_INET6, addr, ip_addr, ACM_MAX_ADDRESS); +- fprintf(flog, "%s\n", ip_addr); ++ inet_ntop(AF_INET6, addr, name, name_size); + break; + case ACM_EP_INFO_PATH: + path = (struct ibv_path_record *) addr; +- fprintf(flog, "path record, SLID 0x%x, DLID 0x%x\n", ++ sprintf(name, "SLID(%d) DLID(%d)", + ntohs(path->slid), ntohs(path->dlid)); + break; + case ACM_ADDRESS_LID: +- fprintf(flog, "LID 0x%x\n", *((uint16_t *) addr)); ++ sprintf(name, "LID(%d)\n", *((uint16_t *) addr)); + break; + default: +- fprintf(flog, "unknown address 0x%x\n", addr_type); ++ strcpy(name, "Unknown"); ++ break; + } +- lock_release(&log_lock); + } + + static int acm_compare_dest(const void *dest1, const void *dest2) +@@ -280,12 +277,15 @@ static int acm_compare_dest(const void *dest1, const void *dest2) + static void + acm_init_dest(struct acm_dest *dest, uint8_t addr_type, uint8_t *addr, size_t size) + { ++ struct ibv_path_record *path; ++ + memcpy(dest->address, addr, size); + dest->addr_type = addr_type; + DListInit(&dest->req_queue); + atomic_init(&dest->refcnt); + atomic_set(&dest->refcnt, 1); + lock_init(&dest->lock); ++ acm_format_name(0, dest->name, ACM_MAX_ADDRESS, addr_type, addr, size); + } + + static struct acm_dest * +@@ -300,7 +300,7 @@ acm_alloc_dest(uint8_t addr_type, uint8_t *addr) + } + + acm_init_dest(dest, addr_type, addr, ACM_MAX_ADDRESS); +- acm_log_addr(1, "acm_alloc_dest: ", addr_type, addr); ++ acm_log(1, "%s\n", dest->name); + return dest; + } + +@@ -314,10 +314,12 @@ acm_get_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) + if (tdest) { + dest = *tdest; + (void) atomic_inc(&dest->refcnt); +- acm_log_addr(2, "acm_get_dest: ", dest->addr_type, dest->address); ++ acm_log(2, "%s\n", dest->name); + } else { + dest = NULL; +- acm_log_addr(2, "acm_get_dest: not found ", addr_type, addr); ++ acm_format_name(2, log_data, sizeof log_data, ++ addr_type, addr, ACM_MAX_ADDRESS); ++ acm_log(2, "%s not found\n", log_data); + } + return dest; + } +@@ -325,7 +327,7 @@ acm_get_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) + static void + acm_put_dest(struct acm_dest *dest) + { +- acm_log_addr(2, "acm_put_dest: ", dest->addr_type, dest->address); ++ acm_log(2, "%s\n", dest->name); + if (atomic_dec(&dest->refcnt) == 0) { + free(dest); + } +@@ -336,7 +338,9 @@ acm_acquire_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) + { + struct acm_dest *dest; + +- acm_log_addr(2, "acm_acquire_dest: ", addr_type, addr); ++ acm_format_name(2, log_data, sizeof log_data, ++ addr_type, addr, ACM_MAX_ADDRESS); ++ acm_log(2, "%s\n", log_data); + lock_acquire(&ep->lock); + dest = acm_get_dest(ep, addr_type, addr); + if (!dest) { +@@ -354,7 +358,7 @@ acm_acquire_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) + //static void + //acm_remove_dest(struct acm_ep *ep, struct acm_dest *dest) + //{ +-// acm_log_addr(2, "acm_remove_dest: ", dest->addr_type, dest->addr); ++// acm_log(2, "%s\n", dest->name); + // tdelete(dest->address, &ep->dest_map[dest->addr_type - 1], acm_compare_dest); + // acm_put_dest(dest); + //} +@@ -748,7 +752,7 @@ static uint8_t acm_resolve_path(struct acm_ep *ep, struct acm_dest *dest, + struct acm_send_msg *msg; + struct ib_sa_mad *mad; + +- acm_log_addr(2, "acm_resolve_path: ", dest->addr_type, dest->address); ++ acm_log(2, "%s\n", dest->name); + msg = acm_alloc_send(ep, &ep->port->sa_dest, sizeof(*mad)); + if (!msg) { + acm_log(0, "ERROR - cannot allocate send msg\n"); +@@ -776,7 +780,7 @@ acm_record_acm_addr(struct acm_ep *ep, struct acm_dest *dest, struct ibv_wc *wc, + { + int index; + +- acm_log_addr(2, "acm_record_acm_addr: ", dest->addr_type, dest->address); ++ acm_log(2, "%s\n", dest->name); + index = acm_best_mc_index(ep, rec); + if (index < 0) { + acm_log(0, "ERROR - no shared multicast groups\n"); +@@ -826,7 +830,7 @@ acm_send_addr_resp(struct acm_ep *ep, struct acm_dest *dest) + struct acm_send_msg *msg; + struct acm_mad *mad; + +- acm_log_addr(2, "acm_send_addr_resp: ", dest->addr_type, dest->address); ++ acm_log(2, "%s\n", dest->name); + msg = acm_alloc_send(ep, dest, sizeof (*mad)); + if (!msg) { + acm_log(0, "ERROR - failed to allocate message\n"); +@@ -934,8 +938,7 @@ acm_dest_sa_resp(struct acm_send_msg *msg, struct ibv_wc *wc, struct acm_mad *ma + } else { + status = ACM_STATUS_ETIMEDOUT; + } +- acm_log(2, "resp status 0x%x\n", status); +- acm_log_addr(2, "acm_dest_sa_resp: ", dest->addr_type, dest->address); ++ acm_log(2, "%s status=0x%x\n", dest->name, status); + + lock_acquire(&dest->lock); + if (dest->state != ACM_QUERY_ROUTE) { +@@ -1110,8 +1113,12 @@ static void acm_process_acm_recv(struct acm_ep *ep, struct ibv_wc *wc, struct ac + } + + rec = (struct acm_resolve_rec *) mad->data; +- acm_log_addr(2, "acm_process_acm_recv: src ", rec->src_type, rec->src); +- acm_log_addr(2, "acm_process_acm_recv: dest ", rec->dest_type, rec->dest); ++ acm_format_name(2, log_data, sizeof log_data, ++ rec->src_type, rec->src, sizeof rec->src); ++ acm_log(2, "src %s\n", log_data); ++ acm_format_name(2, log_data, sizeof log_data, ++ rec->dest_type, rec->dest, sizeof rec->dest); ++ acm_log(2, "dest %s\n", log_data); + if (mad->method & IB_METHOD_RESP) { + acm_log(2, "received response\n"); + req = acm_get_request(ep, mad->tid, &free); +@@ -1207,7 +1214,7 @@ static void acm_process_recv(struct acm_ep *ep, struct ibv_wc *wc) + { + struct acm_mad *mad; + +- acm_log_addr(2, "acm_process_recv: ep ", ep->addr_type[0], ep->addr[0].addr); ++ acm_log(2, "base endpoint name %s\n", ep->name[0]); + mad = (struct acm_mad *) (uintptr_t) (wc->wr_id + sizeof(struct ibv_grh)); + switch (mad->mgmt_class) { + case IB_MGMT_CLASS_SA: +@@ -1501,7 +1508,9 @@ static void acm_process_timeouts(void) + msg = container_of(entry, struct acm_send_msg, entry); + rec = (struct acm_resolve_rec *) ((struct acm_mad *) msg->data)->data; + +- acm_log_addr(0, "acm_process_timeouts: dest ", rec->dest_type, rec->dest); ++ acm_format_name(0, log_data, sizeof log_data, ++ rec->dest_type, rec->dest, sizeof rec->dest); ++ acm_log(0, "dest %s\n", log_data); + msg->resp_handler(msg, NULL, NULL); + } + } +@@ -1691,7 +1700,9 @@ acm_get_ep(struct acm_ep_addr_data *data) + DLIST_ENTRY *dev_entry, *ep_entry; + int i; + +- acm_log_addr(2, "acm_get_ep: ", data->type, data->info.addr); ++ acm_format_name(2, log_data, sizeof log_data, ++ data->type, data->info.addr, sizeof data->info.addr); ++ acm_log(2, "%s\n", log_data); + for (dev_entry = dev_list.Next; dev_entry != &dev_list; + dev_entry = dev_entry->Next) { + +@@ -1720,7 +1731,9 @@ acm_get_ep(struct acm_ep_addr_data *data) + } + } + +- acm_log_addr(0, "acm_get_ep: could not find ", data->type, data->info.addr); ++ acm_format_name(0, log_data, sizeof log_data, ++ data->type, data->info.addr, sizeof data->info.addr); ++ acm_log(0, "could not find %s\n", log_data); + return NULL; + } + +@@ -1968,14 +1981,18 @@ acm_svr_resolve(struct acm_client *client, struct acm_resolve_msg *msg) + return acm_client_resolve_resp(client, msg, NULL, status); + } + +- acm_log_addr(2, "acm_svr_resolve: source ", saddr->type, saddr->info.addr); ++ 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); + if (!ep) { + acm_log(0, "unknown local end point\n"); + return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR); + } + +- acm_log_addr(2, "acm_svr_resolve: dest ", daddr->type, daddr->info.addr); ++ 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); + if (!dest) { +@@ -2260,6 +2277,7 @@ static int acm_assign_ep_names(struct acm_ep *ep) + + ep->addr_type[index] = type; + acm_log(1, "assigning %s\n", addr); ++ strncpy(ep->name, addr, ACM_MAX_ADDRESS); + if (type == ACM_ADDRESS_IP) + memcpy(ep->addr[index].addr, &ip_addr, 4); + else if (type == ACM_ADDRESS_IP6) +diff --git a/windows/osd.h b/windows/osd.h +index 9587c51..2ca2c52 100644 +--- a/windows/osd.h ++++ b/windows/osd.h +@@ -84,6 +84,7 @@ static __inline UINT64 time_stamp_us(void) + #define time_stamp_ms() (time_stamp_us() * 1000) + + #define getpid() ((int) GetCurrentProcessId()) ++#define PER_THREAD __declspec(thread) + #define beginthread(func, arg) (int) _beginthread(func, 0, arg) + #define container_of CONTAINING_RECORD diff --git a/patches/refresh-temp b/patches/refresh-temp deleted file mode 100644 index cc8bbf4..0000000 --- a/patches/refresh-temp +++ /dev/null @@ -1,307 +0,0 @@ -Bottom: 9962a940efd219c52418715f8e1c4d496699b292 -Top: b021b7eea3776c2bdf94df82c8c4791a53d7eb81 -Author: Sean Hefty -Date: 2010-11-15 16:41:02 -0800 - -Refresh of dest_string - ---- - -diff --git a/linux/osd.h b/linux/osd.h -index 28c3647..33ea842 100644 ---- a/linux/osd.h -+++ b/linux/osd.h -@@ -148,6 +148,7 @@ static inline uint64_t time_stamp_us(void) - - #define time_stamp_ms() (time_stamp_us() / 1000) - -+#define PER_THREAD __thread - static inline int beginthread(void (*func)(void *), void *arg) - { - pthread_t thread; -diff --git a/src/acm.c b/src/acm.c -index daa0985..766a291 100644 ---- a/src/acm.c -+++ b/src/acm.c -@@ -75,6 +75,7 @@ enum acm_route_prot - struct acm_dest - { - uint8_t address[ACM_MAX_ADDRESS]; /* keep first */ -+ char name[ACM_MAX_ADDRESS]; - struct ibv_ah *ah; - struct ibv_ah_attr av; - struct ibv_path_record path; -@@ -135,6 +136,7 @@ struct acm_ep - uint8_t *recv_bufs; - DLIST_ENTRY entry; - union acm_ep_info addr[MAX_EP_ADDR]; -+ char name[MAX_EP_ADDR]; - uint8_t addr_type[MAX_EP_ADDR]; - void *dest_map[ACM_ADDRESS_RESERVED - 1]; - struct acm_dest mc_dest[MAX_EP_MC]; -@@ -194,6 +196,7 @@ static struct acm_client client[FD_SETSIZE - 1]; - - static FILE *flog; - static lock_t log_lock; -+PER_THREAD char log_data[ACM_MAX_ADDRESS]; - - static char *opts_file = "/etc/ibacm/acm_opts.cfg"; - static char *addr_file = "/etc/ibacm/acm_addr.cfg"; -@@ -232,44 +235,38 @@ static void acm_write(int level, const char *format, ...) - va_end(args); - } - --static void acm_log_addr(int level, const char *msg, uint16_t addr_type, uint8_t *addr) -+static void -+acm_format_name(int level, char *name, size_t name_size, -+ uint8_t addr_type, uint8_t *addr, size_t addr_size) - { - struct ibv_path_record *path; -- char ip_addr[ACM_MAX_ADDRESS]; -- struct timeval tv; - - if (level > log_level) - return; - -- gettimeofday(&tv, NULL); -- lock_acquire(&log_lock); -- fprintf(flog, "%u.%03u: ", (unsigned) tv.tv_sec, (unsigned) (tv.tv_usec / 1000)); -- fprintf(flog, msg); - switch (addr_type) { - case ACM_EP_INFO_NAME: -- fprintf(flog, "%s\n", addr); -+ memcpy(name, addr, addr_size); - break; - case ACM_EP_INFO_ADDRESS_IP: -- inet_ntop(AF_INET, addr, ip_addr, ACM_MAX_ADDRESS); -- fprintf(flog, "%s\n", ip_addr); -+ inet_ntop(AF_INET, addr, name, name_size); - break; - case ACM_EP_INFO_ADDRESS_IP6: - case ACM_ADDRESS_GID: -- inet_ntop(AF_INET6, addr, ip_addr, ACM_MAX_ADDRESS); -- fprintf(flog, "%s\n", ip_addr); -+ inet_ntop(AF_INET6, addr, name, name_size); - break; - case ACM_EP_INFO_PATH: - path = (struct ibv_path_record *) addr; -- fprintf(flog, "path record, SLID 0x%x, DLID 0x%x\n", -+ sprintf(name, "SLID(%d) DLID(%d)", - ntohs(path->slid), ntohs(path->dlid)); - break; - case ACM_ADDRESS_LID: -- fprintf(flog, "LID 0x%x\n", *((uint16_t *) addr)); -+ sprintf(name, "LID(%d)\n", *((uint16_t *) addr)); - break; - default: -- fprintf(flog, "unknown address 0x%x\n", addr_type); -+ strcpy(name, "Unknown"); -+ break; - } -- lock_release(&log_lock); - } - - static int acm_compare_dest(const void *dest1, const void *dest2) -@@ -280,12 +277,15 @@ static int acm_compare_dest(const void *dest1, const void *dest2) - static void - acm_init_dest(struct acm_dest *dest, uint8_t addr_type, uint8_t *addr, size_t size) - { -+ struct ibv_path_record *path; -+ - memcpy(dest->address, addr, size); - dest->addr_type = addr_type; - DListInit(&dest->req_queue); - atomic_init(&dest->refcnt); - atomic_set(&dest->refcnt, 1); - lock_init(&dest->lock); -+ acm_format_name(0, dest->name, ACM_MAX_ADDRESS, addr_type, addr, size); - } - - static struct acm_dest * -@@ -300,7 +300,7 @@ acm_alloc_dest(uint8_t addr_type, uint8_t *addr) - } - - acm_init_dest(dest, addr_type, addr, ACM_MAX_ADDRESS); -- acm_log_addr(1, "acm_alloc_dest: ", addr_type, addr); -+ acm_log(1, "%s\n", dest->name); - return dest; - } - -@@ -314,10 +314,12 @@ acm_get_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) - if (tdest) { - dest = *tdest; - (void) atomic_inc(&dest->refcnt); -- acm_log_addr(2, "acm_get_dest: ", dest->addr_type, dest->address); -+ acm_log(2, "%s\n", dest->name); - } else { - dest = NULL; -- acm_log_addr(2, "acm_get_dest: not found ", addr_type, addr); -+ acm_format_name(2, log_data, sizeof log_data, -+ addr_type, addr, ACM_MAX_ADDRESS); -+ acm_log(2, "%s not found\n", log_data); - } - return dest; - } -@@ -325,7 +327,7 @@ acm_get_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) - static void - acm_put_dest(struct acm_dest *dest) - { -- acm_log_addr(2, "acm_put_dest: ", dest->addr_type, dest->address); -+ acm_log(2, "%s\n", dest->name); - if (atomic_dec(&dest->refcnt) == 0) { - free(dest); - } -@@ -336,7 +338,9 @@ acm_acquire_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) - { - struct acm_dest *dest; - -- acm_log_addr(2, "acm_acquire_dest: ", addr_type, addr); -+ acm_format_name(2, log_data, sizeof log_data, -+ addr_type, addr, ACM_MAX_ADDRESS); -+ acm_log(2, "%s\n", log_data); - lock_acquire(&ep->lock); - dest = acm_get_dest(ep, addr_type, addr); - if (!dest) { -@@ -354,7 +358,7 @@ acm_acquire_dest(struct acm_ep *ep, uint8_t addr_type, uint8_t *addr) - //static void - //acm_remove_dest(struct acm_ep *ep, struct acm_dest *dest) - //{ --// acm_log_addr(2, "acm_remove_dest: ", dest->addr_type, dest->addr); -+// acm_log(2, "%s\n", dest->name); - // tdelete(dest->address, &ep->dest_map[dest->addr_type - 1], acm_compare_dest); - // acm_put_dest(dest); - //} -@@ -748,7 +752,7 @@ static uint8_t acm_resolve_path(struct acm_ep *ep, struct acm_dest *dest, - struct acm_send_msg *msg; - struct ib_sa_mad *mad; - -- acm_log_addr(2, "acm_resolve_path: ", dest->addr_type, dest->address); -+ acm_log(2, "%s\n", dest->name); - msg = acm_alloc_send(ep, &ep->port->sa_dest, sizeof(*mad)); - if (!msg) { - acm_log(0, "ERROR - cannot allocate send msg\n"); -@@ -776,7 +780,7 @@ acm_record_acm_addr(struct acm_ep *ep, struct acm_dest *dest, struct ibv_wc *wc, - { - int index; - -- acm_log_addr(2, "acm_record_acm_addr: ", dest->addr_type, dest->address); -+ acm_log(2, "%s\n", dest->name); - index = acm_best_mc_index(ep, rec); - if (index < 0) { - acm_log(0, "ERROR - no shared multicast groups\n"); -@@ -826,7 +830,7 @@ acm_send_addr_resp(struct acm_ep *ep, struct acm_dest *dest) - struct acm_send_msg *msg; - struct acm_mad *mad; - -- acm_log_addr(2, "acm_send_addr_resp: ", dest->addr_type, dest->address); -+ acm_log(2, "%s\n", dest->name); - msg = acm_alloc_send(ep, dest, sizeof (*mad)); - if (!msg) { - acm_log(0, "ERROR - failed to allocate message\n"); -@@ -934,8 +938,7 @@ acm_dest_sa_resp(struct acm_send_msg *msg, struct ibv_wc *wc, struct acm_mad *ma - } else { - status = ACM_STATUS_ETIMEDOUT; - } -- acm_log(2, "resp status 0x%x\n", status); -- acm_log_addr(2, "acm_dest_sa_resp: ", dest->addr_type, dest->address); -+ acm_log(2, "%s status=0x%x\n", dest->name, status); - - lock_acquire(&dest->lock); - if (dest->state != ACM_QUERY_ROUTE) { -@@ -1110,8 +1113,12 @@ static void acm_process_acm_recv(struct acm_ep *ep, struct ibv_wc *wc, struct ac - } - - rec = (struct acm_resolve_rec *) mad->data; -- acm_log_addr(2, "acm_process_acm_recv: src ", rec->src_type, rec->src); -- acm_log_addr(2, "acm_process_acm_recv: dest ", rec->dest_type, rec->dest); -+ acm_format_name(2, log_data, sizeof log_data, -+ rec->src_type, rec->src, sizeof rec->src); -+ acm_log(2, "src %s\n", log_data); -+ acm_format_name(2, log_data, sizeof log_data, -+ rec->dest_type, rec->dest, sizeof rec->dest); -+ acm_log(2, "dest %s\n", log_data); - if (mad->method & IB_METHOD_RESP) { - acm_log(2, "received response\n"); - req = acm_get_request(ep, mad->tid, &free); -@@ -1207,7 +1214,7 @@ static void acm_process_recv(struct acm_ep *ep, struct ibv_wc *wc) - { - struct acm_mad *mad; - -- acm_log_addr(2, "acm_process_recv: ep ", ep->addr_type[0], ep->addr[0].addr); -+ acm_log(2, "base endpoint name %s\n", ep->name[0]); - mad = (struct acm_mad *) (uintptr_t) (wc->wr_id + sizeof(struct ibv_grh)); - switch (mad->mgmt_class) { - case IB_MGMT_CLASS_SA: -@@ -1501,7 +1508,9 @@ static void acm_process_timeouts(void) - msg = container_of(entry, struct acm_send_msg, entry); - rec = (struct acm_resolve_rec *) ((struct acm_mad *) msg->data)->data; - -- acm_log_addr(0, "acm_process_timeouts: dest ", rec->dest_type, rec->dest); -+ acm_format_name(0, log_data, sizeof log_data, -+ rec->dest_type, rec->dest, sizeof rec->dest); -+ acm_log(0, "dest %s\n", log_data); - msg->resp_handler(msg, NULL, NULL); - } - } -@@ -1691,7 +1700,9 @@ acm_get_ep(struct acm_ep_addr_data *data) - DLIST_ENTRY *dev_entry, *ep_entry; - int i; - -- acm_log_addr(2, "acm_get_ep: ", data->type, data->info.addr); -+ acm_format_name(2, log_data, sizeof log_data, -+ data->type, data->info.addr, sizeof data->info.addr); -+ acm_log(2, "%s\n", log_data); - for (dev_entry = dev_list.Next; dev_entry != &dev_list; - dev_entry = dev_entry->Next) { - -@@ -1720,7 +1731,9 @@ acm_get_ep(struct acm_ep_addr_data *data) - } - } - -- acm_log_addr(0, "acm_get_ep: could not find ", data->type, data->info.addr); -+ acm_format_name(0, log_data, sizeof log_data, -+ data->type, data->info.addr, sizeof data->info.addr); -+ acm_log(0, "could not find %s\n", log_data); - return NULL; - } - -@@ -1968,14 +1981,18 @@ acm_svr_resolve(struct acm_client *client, struct acm_resolve_msg *msg) - return acm_client_resolve_resp(client, msg, NULL, status); - } - -- acm_log_addr(2, "acm_svr_resolve: source ", saddr->type, saddr->info.addr); -+ 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); - if (!ep) { - acm_log(0, "unknown local end point\n"); - return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR); - } - -- acm_log_addr(2, "acm_svr_resolve: dest ", daddr->type, daddr->info.addr); -+ 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); - if (!dest) { -@@ -2260,6 +2277,7 @@ static int acm_assign_ep_names(struct acm_ep *ep) - - ep->addr_type[index] = type; - acm_log(1, "assigning %s\n", addr); -+ strncpy(ep->name, addr, ACM_MAX_ADDRESS); - if (type == ACM_ADDRESS_IP) - memcpy(ep->addr[index].addr, &ip_addr, 4); - else if (type == ACM_ADDRESS_IP6) -diff --git a/windows/osd.h b/windows/osd.h -index 9587c51..2ca2c52 100644 ---- a/windows/osd.h -+++ b/windows/osd.h -@@ -84,6 +84,7 @@ static __inline UINT64 time_stamp_us(void) - #define time_stamp_ms() (time_stamp_us() * 1000) - - #define getpid() ((int) GetCurrentProcessId()) -+#define PER_THREAD __declspec(thread) - #define beginthread(func, arg) (int) _beginthread(func, 0, arg) - #define container_of CONTAINING_RECORD -- 2.41.0