]> git.openfabrics.org - ~shefty/ibacm.git/commitdiff
ibacm: Define provider endpoint identifier
authorSean Hefty <sean.hefty@intel.com>
Mon, 24 Mar 2014 06:24:54 +0000 (23:24 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 16 Apr 2014 06:32:59 +0000 (23:32 -0700)
Introduce a header file that will be included by providers that
will define the interface between the ibacm core layer and the
providers.

Define an endpoint identifier that is associated with a set of
addresses.  Providers will be given this structure in requests.
The endpoint is defined as a <device, port, pkey> tuple, though
it may be used with "any" values in order to identify any
port on a device and/or any pkey on a port.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Makefile.am
include/infiniband/acm_prov.h [new file with mode: 0644]
src/acm.c

index 9070a5a572e672ed19a0ac7ae6dfb5123c18399e..e3c618c977c58c78ee428a839dbd78ab2a45f181 100644 (file)
@@ -11,7 +11,7 @@ util_ib_acme_CFLAGS = $(AM_CFLAGS) -DACME_PRINTS
 
 ibacmincludedir = $(includedir)/infiniband
 
-ibacminclude_HEADERS = include/infiniband/acm.h
+ibacminclude_HEADERS = include/infiniband/acm.h include/infiniband/acm_prov.h
 
 man_MANS = \
        man/ib_acme.1 \
diff --git a/include/infiniband/acm_prov.h b/include/infiniband/acm_prov.h
new file mode 100644 (file)
index 0000000..0f774a5
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under the OpenFabrics.org BSD license
+ * below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined(ACM_PROV_H)
+#define ACM_PROV_H
+
+#include <infiniband/acm.h>
+
+struct acm_endpoint {
+       void                    *prov_context;
+       uint64_t                dev_guid;
+       uint8_t                 port_num;
+       uint16_t                pkey;
+};
+
+#endif /* ACM_PROV_H */
index c6b4910fafc8a709653d185d342210fb0f6b61fe..384c77290c1257f645d3a5fa5a18045a2c540623 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -42,6 +42,7 @@
 #include <sys/time.h>
 #include <fcntl.h>
 #include <infiniband/acm.h>
+#include <infiniband/acm_prov.h>
 #include <infiniband/umad.h>
 #include <infiniband/verbs.h>
 #include <dlist.h>
@@ -167,7 +168,8 @@ struct acmp_ep {
        struct acm_dest       mc_dest[MAX_EP_MC];
        int                   mc_cnt;
        uint16_t              pkey_index;
-       uint16_t              pkey;
+       uint16_t              pkey;
+       struct acm_endpoint   endpoint;
        lock_t                lock;
        struct acm_send_queue resolve_queue;
        struct acm_send_queue sa_queue;
@@ -3340,7 +3342,7 @@ static int acm_assign_ep_names(struct acmp_ep *ep)
                }
 
                if (!stricmp(dev_name, dev) && (ep->port->port_num == (uint8_t) port) &&
-                       (ep->pkey == pkey)) {
+                   (ep->pkey == pkey)) {
 
                        acm_log(1, "assigning %s\n", addr);
                        if ((ret = acm_ep_insert_addr(ep, (uint8_t *)&ip_addr, addr_len, type)) != 0) {
@@ -3462,6 +3464,10 @@ acmp_alloc_ep(struct acmp_port *port, uint16_t pkey, uint16_t pkey_index)
        sprintf(ep->id_string, "%s-%d-0x%x", port->dev->verbs->device->name,
                port->port_num, pkey);
 
+       ep->endpoint.dev_guid = port->dev->guid;
+       ep->endpoint.port_num = port->port_num;
+       ep->endpoint.pkey = pkey;
+
        return ep;
 }