DLIST_ENTRY wait_queue;
enum acmp_state state;
struct acmp_addr addr_info[MAX_EP_ADDR];
+ atomic_t counters[ACM_MAX_COUNTER];
};
struct acmp_send_msg {
uint64_t id;
DLIST_ENTRY entry;
struct acm_msg msg;
+ struct acmp_ep *ep;
};
static int acmp_open_dev(const struct acm_device *device, void **dev_context);
mad->comp_mask = acm_path_comp_mask(&dest->path);
atomic_inc(&counter[ACM_CNTR_ROUTE_QUERY]);
+ atomic_inc(&ep->counters[ACM_CNTR_ROUTE_QUERY]);
dest->state = ACMP_QUERY_ROUTE;
if (acm_send_sa_mad(sa_mad)) {
acm_log(0, "Error - Failed to send sa mad\n");
acm_log(2, "client %lld, status 0x%x\n", id, status);
memset(&msg, 0, sizeof msg);
+ if (dest) {
+ if (status == ACM_STATUS_ENODATA)
+ atomic_inc(&dest->ep->counters[ACM_CNTR_NODATA]);
+ else if (status)
+ atomic_inc(&dest->ep->counters[ACM_CNTR_ERROR]);
+ }
msg.hdr = req_msg->hdr;
msg.hdr.status = status;
msg.hdr.length = ACM_MSG_HDR_LENGTH;
}
acm_log(2, "status 0x%x\n", req->msg.hdr.status);
+ if (req->msg.hdr.status)
+ atomic_inc(&req->ep->counters[ACM_CNTR_ERROR]);
acm_query_response(req->id, &req->msg);
acm_free_sa_mad(mad);
acmp_free_req(req);
status = ACM_STATUS_ENOMEM;
goto resp;
}
+ req->ep = ep;
sa_mad = acm_alloc_sa_mad(ep->endpoint, req, acmp_sa_resp);
if (!sa_mad) {
mad->comp_mask = acm_path_comp_mask(&msg->resolve_data[0].info.path);
atomic_inc(&counter[ACM_CNTR_ROUTE_QUERY]);
+ atomic_inc(&ep->counters[ACM_CNTR_ROUTE_QUERY]);
if (acm_send_sa_mad(sa_mad)) {
acm_log(0, "Error - Failed to send sa mad\n");
status = ACM_STATUS_ENODATA;
resp:
msg->hdr.opcode |= ACM_OP_ACK;
msg->hdr.status = status;
+ if (status == ACM_STATUS_ENODATA)
+ atomic_inc(&ep->counters[ACM_CNTR_NODATA]);
+ else
+ atomic_inc(&ep->counters[ACM_CNTR_ERROR]);
return acm_query_response(id, msg);
}
memcpy(&rec->gid[i], ep->mc_dest[i].address, 16);
atomic_inc(&counter[ACM_CNTR_ADDR_QUERY]);
+ atomic_inc(&ep->counters[ACM_CNTR_ADDR_QUERY]);
acmp_post_send(&ep->resolve_queue, msg);
return 0;
}
if (!req) {
return ACM_STATUS_ENOMEM;
}
+ req->ep = dest->ep;
DListInsertTail(&req->entry, &dest->req_queue);
return ACM_STATUS_SUCCESS;
dest = acmp_acquire_dest(ep, daddr->type, daddr->info.addr);
if (!dest) {
acm_log(0, "ERROR - unable to allocate destination in request\n");
+ atomic_inc(&ep->counters[ACM_CNTR_ERROR]);
return acmp_resolve_response(id, msg, NULL, ACM_STATUS_ENOMEM);
}
goto test;
acm_log(2, "request satisfied from local cache\n");
atomic_inc(&counter[ACM_CNTR_ROUTE_CACHE]);
+ atomic_inc(&ep->counters[ACM_CNTR_ROUTE_CACHE]);
status = ACM_STATUS_SUCCESS;
break;
case ACMP_ADDR_RESOLVED:
acm_log(2, "have address, resolving route\n");
atomic_inc(&counter[ACM_CNTR_ADDR_CACHE]);
+ atomic_inc(&ep->counters[ACM_CNTR_ADDR_CACHE]);
status = acmp_resolve_path_sa(ep, dest, acmp_dest_sa_resp);
if (status) {
break;
}
if (!dest) {
acm_log(0, "ERROR - unable to allocate destination in request\n");
+ atomic_inc(&ep->counters[ACM_CNTR_ERROR]);
return acmp_resolve_response(id, msg, NULL, ACM_STATUS_ENOMEM);
}
goto test;
acm_log(2, "request satisfied from local cache\n");
atomic_inc(&counter[ACM_CNTR_ROUTE_CACHE]);
+ atomic_inc(&ep->counters[ACM_CNTR_ROUTE_CACHE]);
status = ACM_STATUS_SUCCESS;
break;
case ACMP_INIT:
{
struct acmp_ep *ep = addr_context;
- if (ep->state != ACMP_READY)
+ if (ep->state != ACMP_READY) {
+ atomic_inc(&ep->counters[ACM_CNTR_NODATA]);
return acmp_resolve_response(id, msg, NULL, ACM_STATUS_ENODATA);
+ }
+ atomic_inc(&ep->counters[ACM_CNTR_RESOLVE]);
if (msg->resolve_data[0].type == ACM_EP_INFO_PATH)
return acmp_resolve_path(ep, msg, id);
else
acmp_alloc_ep(struct acmp_port *port, struct acm_endpoint *endpoint)
{
struct acmp_ep *ep;
+ int i;
acm_log(1, "\n");
ep = calloc(1, sizeof *ep);
lock_init(&ep->lock);
sprintf(ep->id_string, "%s-%d-0x%x", port->dev->verbs->device->name,
port->port_num, endpoint->pkey);
+ for (i = 0; i < ACM_MAX_COUNTER; i++)
+ atomic_init(&ep->counters[i]);
return ep;
}