]> git.openfabrics.org - ~shefty/ibacm.git/commitdiff
ibacm: Move ep state check
authorSean Hefty <sean.hefty@intel.com>
Fri, 21 Mar 2014 06:32:09 +0000 (23:32 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 16 Apr 2014 06:33:05 +0000 (23:33 -0700)
acm_get_port_ep() checks that the state of the endpoint
is ready.  If not, it is skipped in the search for a
matching address.

The state of the endpoint is a property that belongs to
the provider, not the acm core.  Move the state check
into the provider specific code.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/acm.c

index f5c85ea2799c97fb81d89bd66afa303accd72c59..9ead345e7b5766345565b00b900f04f955156b7c 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -1883,9 +1883,6 @@ acm_get_port_ep(struct acmp_port *port, struct acm_ep_addr_data *data)
                 ep_entry = ep_entry->Next) {
 
                ep = container_of(ep_entry, struct acmp_ep, entry);
-               if (ep->state != ACM_READY)
-                       continue;
-
                if ((data->type == ACM_EP_INFO_PATH) &&
                    (!data->info.path.pkey || (ntohs(data->info.path.pkey) == ep->pkey)))
                        return ep;
@@ -1956,6 +1953,11 @@ acmp_query(struct acm_endpoint *endpoint, struct acm_msg *msg, uint64_t id)
        struct acmp_ep *ep = endpoint->prov_context;
        uint8_t status;
 
+       if (ep->state != ACM_READY) {
+               status = ACM_STATUS_ENODATA;
+               goto resp;
+       }
+
        req = acmp_alloc_req(id, msg);
        if (!req) {
                status = ACM_STATUS_ENOMEM;
@@ -2400,6 +2402,9 @@ acmp_resolve(struct acm_endpoint *endpoint, struct acm_msg *msg, uint64_t id)
 {
        struct acmp_ep *ep = endpoint->prov_context;
 
+       if (ep->state != ACM_READY)
+               return acm_resolve_response(id, msg, NULL, ACM_STATUS_ENODATA);
+
        if (msg->resolve_data[0].type == ACM_EP_INFO_PATH)
                return acmp_resolve_path(ep, msg, id);
        else