int (*open_endpoint)(const struct acm_endpoint *endpoint,
void *port_context, void **ep_context);
void (*close_endpoint)(void *ep_context);
- int (*add_address)(const struct acm_address *addr, void *ep_context,
+ int (*add_address)(const struct acm_address *addr, void *ep_context,
void **addr_context);
- void (*remove_address)(void *addr_context, struct acm_address *addr);
+ void (*remove_address)(void *addr_context);
int (*resolve)(void *addr_context, struct acm_msg *msg, uint64_t id);
int (*query)(void *addr_context, struct acm_msg *msg, uint64_t id);
int (*handle_event)(void *port_context, enum ibv_event_type type);
uint16_t type;
union acm_ep_info info;
struct acm_address *addr;
+ struct acmp_ep *ep;
};
struct acmp_ep {
static void acmp_close_endpoint(void *ep_context);
static int acmp_add_addr(const struct acm_address *addr, void *ep_context,
void **addr_context);
-static void acmp_remove_addr(void *addr_context, struct acm_address *addr);
+static void acmp_remove_addr(void *addr_context);
static int acmp_resolve(void *addr_context, struct acm_msg *msg, uint64_t id);
static int acmp_query(void *addr_context, struct acm_msg *msg, uint64_t id);
static int acmp_handle_event(void *port_context, enum ibv_event_type type);
{
struct acmp_request *req;
struct ib_sa_mad *mad;
- struct acmp_ep *ep = addr_context;
+ struct acmp_addr *address = addr_context;
+ struct acmp_ep *ep = address->ep;
uint8_t status;
struct acm_sa_mad *sa_mad;
static int
acmp_resolve(void *addr_context, struct acm_msg *msg, uint64_t id)
{
- struct acmp_ep *ep = addr_context;
+ struct acmp_addr *address = addr_context;
+ struct acmp_ep *ep = address->ep;
if (ep->state != ACMP_READY) {
atomic_inc(&ep->counters[ACM_CNTR_NODATA]);
ep->addr_info[i].type = addr->type;
memcpy(&ep->addr_info[i].info, &addr->info, sizeof(addr->info));
ep->addr_info[i].addr = (struct acm_address *) addr;
+ ep->addr_info[i].ep = ep;
if (loopback_prot != ACMP_LOOPBACK_PROT_LOCAL) {
- *addr_context = (void *) ep;
+ *addr_context = &ep->addr_info[i];
return 0;
}
dest->route_timeout = (uint64_t) ~0ULL;
dest->state = ACMP_READY;
acmp_put_dest(dest);
- *addr_context = ep;
+ *addr_context = &ep->addr_info[i];
acm_log(1, "added loopback dest %s\n", dest->name);
return 0;
}
-static void acmp_remove_addr(void *addr_context, struct acm_address *addr)
+static void acmp_remove_addr(void *addr_context)
{
- struct acmp_ep *ep = addr_context;
- struct acmp_addr *address;
+ struct acmp_addr *address = addr_context;
acm_log(2, "\n");
- address = acmp_addr_lookup(ep, addr->info.addr, addr->type);
- if (address)
- memset(address, 0, sizeof(*address));
+ memset(address, 0, sizeof(*address));
}
static struct acmp_port *acmp_get_port(struct acm_endpoint *endpoint)