1
1

libfabric: update to github:ofiwg/libfabric HEAD

Specifically: bbf0f3ea8e92c92a7cee56473ecdbbbb34cceb7d (15 Jan 2015)
Этот коммит содержится в:
Jeff Squyres 2015-01-14 13:12:53 -08:00
родитель f49981bb2a
Коммит 400b02e566
83 изменённых файлов: 2846 добавлений и 1780 удалений

Просмотреть файл

@ -3,7 +3,7 @@ AM_CPPFLAGS = \
-D_GNU_SOURCE \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DRDMADIR=\"@rdmadir@\" \
-DEXTDIR=\"$(pkglibdir)\"
-DPROVDLDIR=\"$(pkglibdir)\"
lib_LTLIBRARIES = src/libfabric.la
@ -82,7 +82,7 @@ _verbs_files = prov/verbs/src/fi_verbs.c
if HAVE_VERBS_DL
pkglib_LTLIBRARIES += libverbs-fi.la
libverbs_fi_la_SOURCES = $(_verbs_files) $(common_srcs)
libverbs_fi_la_LIBADD = -libverbs -lrdmacm $(linkback)
libverbs_fi_la_LIBADD = $(linkback)
libverbs_fi_la_LDFLAGS = -module -avoid-version -shared -export-dynamic
libverbs_fi_la_DEPENDENCIES = $(linkback)
else !HAVE_VERBS_DL
@ -186,6 +186,7 @@ _usnic_files = \
_usnic_cppflags = \
-D__LIBUSNIC__ \
-DHAVE_LIBNL3=$(HAVE_LIBNL3) $(USNIC_LIBNL_CPPFLAGS) \
-I$(top_srcdir)/prov/usnic/src/usnic_direct
if HAVE_USNIC_DL
@ -279,6 +280,7 @@ real_man_pages = \
man/fi_direct.7 \
man/fi_domain.3 \
man/fi_endpoint.3 \
man/fi_errno.3 \
man/fi_eq.3 \
man/fi_fabric.3 \
man/fi_getinfo.3 \

Просмотреть файл

@ -1,7 +1,7 @@
This README is for userspace RDMA fabric library.
Version Libfabric v0.0.2
Released on 2014-12-19
Released on 2015-01-15
Building
========

Просмотреть файл

@ -15,8 +15,8 @@
/* Define to 1 if you have the `ibverbs' library (-libverbs). */
#undef HAVE_LIBIBVERBS
/* Define to 1 if you have the `nl' library (-lnl). */
#undef HAVE_LIBNL
/* set to 1 if should use libnl v3, set to 0 for libnl v11 */
#undef HAVE_LIBNL3
/* Define to 1 if you have the `psm_infinipath' library (-lpsm_infinipath). */
#undef HAVE_LIBPSM_INFINIPATH

Просмотреть файл

@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT([libfabric], [0.0.2], [linux-rdma@vger.kernel.org])
AC_INIT([libfabric], [0.0.2], [ofiwg@lists.openfabrics.org])
AC_CONFIG_SRCDIR([src/fabric.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
@ -75,8 +75,10 @@ AC_CHECK_LIB(rt, clock_gettime, [],
dnl Check for gcc atomic intrinsics
AC_MSG_CHECKING(compiler support for c11 atomics)
AC_TRY_LINK([#include <stdatomic.h>],
[#ifdef __STDC_NO_ATOMICS__
return 1;
[atomic_int a;
atomic_init(&a, 0);
#ifdef __STDC_NO_ATOMICS__
#error c11 atomics are not supported
#else
return 0;
#endif

Просмотреть файл

@ -66,6 +66,7 @@ static struct fi_ops_fabric X = {
.domain = fi_no_domain,
.endpoint = fi_no_passive_ep,
.eq_open = fi_no_eq_open,
.wait_open = fi_no_wait_open,
};
*/
int fi_no_domain(struct fid_fabric *fabric, struct fi_domain_attr *attr,
@ -74,6 +75,8 @@ int fi_no_passive_ep(struct fid_fabric *fabric, struct fi_info *info,
struct fid_pep **pep, void *context);
int fi_no_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context);
int fi_no_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset);
/*
static struct fi_ops_atomic X = {
@ -154,8 +157,6 @@ static struct fi_ops_cm X = {
.accept = fi_no_accept,
.reject = fi_no_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
*/
int fi_no_getname(fid_t fid, void *addr, size_t *addrlen);
@ -167,10 +168,6 @@ int fi_no_accept(struct fid_ep *ep, const void *param, size_t paramlen);
int fi_no_reject(struct fid_pep *pep, fi_connreq_t connreq,
const void *param, size_t paramlen);
int fi_no_shutdown(struct fid_ep *ep, uint64_t flags);
int fi_no_join(struct fid_ep *ep, void *addr, fi_addr_t *fi_addr,
uint64_t flags, void *context);
int fi_no_leave(struct fid_ep *ep, void *addr, fi_addr_t fi_addr,
uint64_t flags);
/*
static struct fi_ops_av X = {
@ -191,7 +188,6 @@ static struct fi_ops_domain X = {
.cq_open = fi_no_cq_open,
.endpoint = fi_no_endpoint,
.cntr_open = fi_no_cntr_open,
.wait_open = fi_no_wait_open,
.poll_open = fi_no_poll_open,
.stx_ctx = fi_no_stx_context,
.srx_ctx = fi_no_srx_context,
@ -205,8 +201,6 @@ int fi_no_endpoint(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **ep, void *context);
int fi_no_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct fid_cntr **cntr, void *context);
int fi_no_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int fi_no_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset);
int fi_no_stx_context(struct fid_domain *domain, struct fi_tx_attr *attr,

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2014 Intel Corporation. All rights reserved.
* Copyright (c) 2013-2015 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@ -97,7 +97,6 @@ typedef struct fid *fid_t;
#define FI_RMA (1ULL << 2)
#define FI_TAGGED (1ULL << 3)
#define FI_ATOMICS (1ULL << 4)
#define FI_MULTICAST (1ULL << 5) /* multicast uses MSG ops */
#define FI_DYNAMIC_MR (1ULL << 7)
#define FI_NAMED_RX_CTX (1ULL << 8)
#define FI_BUFFERED_RECV (1ULL << 9)
@ -168,9 +167,19 @@ enum fi_progress {
enum fi_threading {
FI_THREAD_UNSPEC,
FI_THREAD_SAFE,
FI_THREAD_PROGRESS
FI_THREAD_FID,
FI_THREAD_DOMAIN,
FI_THREAD_COMPLETION,
FI_THREAD_ENDPOINT,
};
enum fi_resource_mgmt {
FI_RM_UNSPEC,
FI_RM_DISABLED,
FI_RM_ENABLED
};
#define FI_ORDER_NONE 0
#define FI_ORDER_RAR (1 << 0)
#define FI_ORDER_RAW (1 << 1)
#define FI_ORDER_RAS (1 << 2)
@ -180,6 +189,8 @@ enum fi_threading {
#define FI_ORDER_SAR (1 << 6)
#define FI_ORDER_SAW (1 << 7)
#define FI_ORDER_SAS (1 << 8)
#define FI_ORDER_RECV (1 << 9)
#define FI_ORDER_STRICT 0xFFFFFFFF
enum fi_ep_type {
FI_EP_UNSPEC,
@ -215,6 +226,7 @@ struct fi_tx_attr {
uint64_t mode;
uint64_t op_flags;
uint64_t msg_order;
uint64_t comp_order;
size_t inject_size;
size_t size;
size_t iov_limit;
@ -225,6 +237,7 @@ struct fi_rx_attr {
uint64_t mode;
uint64_t op_flags;
uint64_t msg_order;
uint64_t comp_order;
size_t total_buffered_recv;
size_t size;
size_t iov_limit;
@ -242,6 +255,7 @@ struct fi_ep_attr {
size_t max_order_waw_size;
uint64_t mem_tag_format;
uint64_t msg_order;
uint64_t comp_order;
size_t tx_ctx_cnt;
size_t rx_ctx_cnt;
};
@ -252,6 +266,7 @@ struct fi_domain_attr {
enum fi_threading threading;
enum fi_progress control_progress;
enum fi_progress data_progress;
enum fi_resource_mgmt resource_mgmt;
size_t mr_key_size;
size_t cq_data_size;
size_t cq_cnt;
@ -309,6 +324,7 @@ enum {
};
struct fi_eq_attr;
struct fi_wait_attr;
struct fi_ops {
size_t size;
@ -341,6 +357,8 @@ struct fi_ops_fabric {
struct fid_pep **pep, void *context);
int (*eq_open)(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context);
int (*wait_open)(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset);
};
struct fid_fabric {
@ -420,6 +438,8 @@ enum fi_type {
FI_TYPE_MSG_ORDER,
FI_TYPE_MODE,
FI_TYPE_AV_TYPE,
FI_TYPE_ATOMIC_TYPE,
FI_TYPE_ATOMIC_OP,
};
char *fi_tostr(const void *data, enum fi_type datatype);

Просмотреть файл

@ -52,10 +52,6 @@ struct fi_ops_cm {
int (*reject)(struct fid_pep *pep, fi_connreq_t connreq,
const void *param, size_t paramlen);
int (*shutdown)(struct fid_ep *ep, uint64_t flags);
int (*join)(struct fid_ep *ep, void *addr, fi_addr_t *fi_addr,
uint64_t flags, void *context);
int (*leave)(struct fid_ep *ep, void *addr, fi_addr_t fi_addr,
uint64_t flags);
};
@ -102,19 +98,6 @@ static inline int fi_shutdown(struct fid_ep *ep, uint64_t flags)
return ep->cm->shutdown(ep, flags);
}
static inline int
fi_join(struct fid_ep *ep, void *addr, fi_addr_t *fi_addr, uint64_t flags,
void *context)
{
return ep->cm->join(ep, addr, fi_addr, flags, context);
}
static inline int
fi_leave(struct fid_ep *ep, void *addr, fi_addr_t fi_addr, uint64_t flags)
{
return ep->cm->leave(ep, addr, fi_addr, flags);
}
#else // FABRIC_DIRECT
#include <rdma/fi_direct_cm.h>
#endif

Просмотреть файл

@ -123,8 +123,6 @@ struct fi_ops_domain {
struct fid_sep **sep, void *context);
int (*cntr_open)(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct fid_cntr **cntr, void *context);
int (*wait_open)(struct fid_domain *domain, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int (*poll_open)(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset);
int (*stx_ctx)(struct fid_domain *domain,
@ -193,12 +191,12 @@ fi_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
}
static inline int
fi_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
fi_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset)
{
return domain->ops->wait_open(domain, attr, waitset);
return fabric->ops->wait_open(fabric, attr, waitset);
}
static inline int
fi_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset)

Просмотреть файл

@ -134,7 +134,7 @@ struct fid_pep {
struct fid_stx {
struct fid fid;
struct fi_ops_ep ops;
struct fi_ops_ep *ops;
};
struct fid_sep {

Просмотреть файл

@ -115,9 +115,12 @@ struct fi_eq_attr {
/* Standard EQ events */
enum {
FI_COMPLETE,
FI_NOTIFY,
FI_CONNREQ,
FI_SHUTDOWN
FI_CONNECTED,
FI_SHUTDOWN,
FI_MR_COMPLETE,
FI_AV_COMPLETE,
};
struct fi_eq_entry {

Просмотреть файл

@ -59,7 +59,7 @@ struct fi_triggered_context {
union {
struct fi_trigger_threshold threshold;
void *internal[3];
};
} trigger;
};
#else // FABRIC_DIRECT

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_cm 3 "2014\-12\-05" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_cm 3 "2015\-01\-01" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_cm - Connection management operations
@ -7,8 +7,6 @@ fi_connect / fi_listen / fi_accept / fi_reject / fi_shutdown : Manage
endpoint connection state.
.PP
fi_getname / fi_getpeer : Return local or peer endpoint address
.PP
fi_join / fi_leave : Have an endpoint join or leave a multicast group.
.SH SYNOPSIS
.IP
.nf
@ -30,12 +28,6 @@ int\ fi_shutdown(struct\ fid_ep\ *ep,\ uint64_t\ flags);
int\ fi_getname(fid_t\ fid,\ void\ *addr,\ size_t\ *addrlen);
int\ fi_getpeer(struct\ fid_ep\ *ep,\ void\ *addr,\ size_t\ *addrlen);
int\ fi_join(struct\ fid_ep\ *ep,\ void\ *addr,\ fi_addr_t\ *fi_addr,
\ \ \ \ uint64_t\ flags,\ void\ *context);
int\ fi_leave(struct\ fid_ep\ *ep,\ void\ *addr,\ fi_addr_t\ fi_addr,
\ \ \ \ uint64_t\ flags);
\f[]
.fi
.SH ARGUMENTS
@ -43,7 +35,7 @@ int\ fi_leave(struct\ fid_ep\ *ep,\ void\ *addr,\ fi_addr_t\ fi_addr,
\f[I]ep / pep\f[] : Fabric endpoint on which to change connection state.
.PP
\f[I]addr\f[] : Buffer to store queried address (get), or address to
connect/join/leave.
connect.
The address must be in the same format as that specified using fi_info:
addr_format when the endpoint was created.
.PP
@ -57,8 +49,6 @@ exchange.
.PP
\f[I]info\f[] : Fabric information associated with a connection request.
.PP
\f[I]fi_addr\f[] : Fabric address associated with a multicast address.
.PP
\f[I]flags\f[] : Additional flags for controlling connection operation.
.PP
\f[I]context\f[] : User context associated with the request.
@ -145,46 +135,9 @@ If the actual address is larger than what can fit into the buffer, it
will be truncated.
On output, addrlen is set to the size of the buffer needed to store the
address, which may be larger than the input value.
.SS fi_join / fi_leave
.PP
fi_join and fi_leave are use to associate or dissociate an endpoint with
a multicast group.
Join operations complete asynchronously, with the completion reported
through the event queue associated with the endpoint or domain, if an
event queue has not been bound to the endpoint.
.PP
A fabric address will be provided as part of the join request.
The address will be written to the memory location referenced by the
fi_addr parameter.
This address must be used when issuing data transfer operations to the
multicast group.
Because join operations are asynchronous, the memory location referenced
by the fi_addr parameter must remain valid until an event associated
with the join is reported, or a corresponding call to leave the
multicast group returns.
Fi_addr is not guaranteed to be set upon return from fi_join, and it is
strongly recommended that fi_addr not be declared on the stack, as data
corruption may result.
.PP
The fi_leave call will result in an endpoint leaving a multicast group.
The fi_leave call may be called even if the join operation has not
completed, in which case the join will be canceled if it has not yet
completed.
.SH FLAGS
.PP
The fi_join call allows the user to specify flags requesting the type of
join operation being requested.
Flags for fi_leave must be 0.
.PP
\f[I]FI_SEND\f[] : Setting FI_SEND, but not FI_RECV, indicates that the
endpoint should join the multicast group as a send-only member.
If FI_RECV is also set or neither FI_SEND or FI_RECV are set, then the
endpoint will join the group with send and receive capabilities.
.PP
\f[I]FI_RECV\f[] : Setting FI_RECV, but not FI_SEND, indicates that the
endpoint should join the multicast group as a receive-only member.
If FI_SEND is also set or neither FI_SEND or FI_RECV are set, then the
endpoint will join the group with send and receive capabilities.
Flag values are reserved and must be 0.
.SH RETURN VALUE
.PP
Returns 0 on success.

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_domain 3 "2014\-12\-19" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_domain 3 "2015\-01\-12" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_domain - Open a fabric access domain
@ -91,19 +91,20 @@ associated with a domain.
.nf
\f[C]
struct\ fi_domain_attr\ {
\ \ \ \ struct\ fid_domain\ *domain;
\ \ \ \ char\ \ \ \ \ \ \ \ \ \ \ \ \ \ *name;
\ \ \ \ enum\ fi_threading\ threading;
\ \ \ \ enum\ fi_progress\ \ control_progress;
\ \ \ \ enum\ fi_progress\ \ data_progress;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ mr_key_size;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ cq_data_size;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ cq_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ ep_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ tx_ctx_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ rx_ctx_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ max_ep_tx_ctx;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ max_ep_rx_ctx;
\ \ \ \ struct\ fid_domain\ \ \ \ \ *domain;
\ \ \ \ char\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *name;
\ \ \ \ enum\ fi_threading\ \ \ \ \ threading;
\ \ \ \ enum\ fi_progress\ \ \ \ \ \ control_progress;
\ \ \ \ enum\ fi_progress\ \ \ \ \ \ data_progress;
\ \ \ \ enum\ fi_resource_mgmt\ resource_mgmt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ mr_key_size;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cq_data_size;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cq_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ep_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ tx_ctx_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rx_ctx_cnt;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max_ep_tx_ctx;
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max_ep_rx_ctx;
};
\f[]
.fi
@ -131,35 +132,61 @@ eliminate lower-level locks.
\f[I]FI_THREAD_UNSPEC\f[] : This value indicates that no threading model
has been defined.
It may be used on input hints to the fi_getinfo call.
When specified, providers will return a threading model that allows for
the greatest level of parallelism.
.PP
\f[I]FI_THREAD_SAFE\f[] : A thread safe serialization model allows a
multi-threaded application to access any allocated resources through any
interface without restriction.
All providers are required to support FI_THREAD_SAFE.
.PP
\f[I]FI_THREAD_PROGRESS\f[] : A progress serialization model requires
applications to serialize access to provider resources and interfaces
based on the progress model.
For providers with automatic progress, access to each endpoint must be
serialized, and access to each event queue, counter, wait or poll set
must be serialized.
\f[I]FI_THREAD_FID\f[] : A fabric descriptor (FID) serialization model
requires applications to serialize access to individual fabric resources
associated with data transfer operations and completions.
Multiple threads must be serialized when accessing the same endpoint,
transmit context, receive context, completion queue, counter, wait set,
or poll set.
Serialization is required only by threads accessing the same object.
For example, one thread may be initiating a data transfer on an
endpoint, while another thread reads from an event queue associated with
the endpoint.
Serialization to endpoint access is further limited to different
endpoint data flows, if available.
Multiple threads may initiate transfers on the same endpoint if they
reference different data flows.
.PP
For providers with manual progress, applications must serialize their
access to any object that is part of a single progress domain.
A progress domain is any set of associated endpoints, event queues,
counters, wait sets, and poll sets.
For instance, endpoints that share the same event queue or poll set
belong to the same progress domain.
Applications that can allocate endpoint resources to specific threads
can reduce provider locking by using FI_THREAD_PROGRESS.
For example, one thread may be initiating a data transfer on an
endpoint, while another thread reads from a completion queue associated
with the endpoint.
.PP
Serialization to endpoint access is only required when accessing the
same endpoint data flow.
Multiple threads may initiate transfers on different transmit contexts
of the same endpoint without serializing, and no serialization is
required between the submission of data transmit requests and data
receive operations.
.PP
In general, FI_THREAD_FID allows the provider to be implemented without
needing internal locking when handling data transfers.
Conceptually, FI_THREAD_FID maps well to providers that implement fabric
services in hardware and provide separate command queues to different
data flows.
.PP
\f[I]FI_THREAD_ENDPOINT\f[] : The endpoint threading model is similar to
FI_THREAD_FID, but with the added restriction that serialization is
required when accessing the same endpoint, even if multiple transmit and
receive contexts are used.
Conceptualy, FI_THREAD_ENDPOINT maps well to providers that implement
fabric services in hardware but use a single command queue to access
different data flows.
.PP
\f[I]FI_THREAD_COMPLETION\f[] The completion threading model is intended
for providers that make use of manual progress.
Applications must serialize access to all objects that are associated
through the use of having a shared completion structure.
This includes endpoint, completion queue, counter, wait set, and poll
set objects.
.PP
For example, threads must serialize access to an endpoint and its bound
completion queue(s) and/or counters.
Access to endpoints that share the same completion queue must also be
serialized.
.PP
The use of FI_THREAD_COMPLETION can increase parallelism over
FI_THREAD_SAFE, but requires the use of isolated resources.
.PP
\f[I]FI_THREAD_DOMAIN\f[] : A domain serialization model requires
applications to serialize access to all objects belonging to a domain.
@ -219,6 +246,118 @@ Only wait operations defined by the fabric interface will result in an
operation progressing.
Operating system or external wait functions, such as select, poll, or
pthread routines, cannot.
.SS Resource Management (resource_mgmt)
.PP
Resource management (RM) is provider and protocol support to protect
against overrunning local and remote resources.
This includes local and remote transmit contexts, receive contexts,
completion queues, and source and target data buffers.
.PP
When enabled, applications are given some level of protection against
overrunning provider queues and local and remote data buffers.
Such support may be built directly into the hardware and/or network
protocol, but may also require that checks be enabled in the provider
software.
By disabling resource management, an application assumes all
responsibility for preventing queue and buffer overruns, but doing so
may allow a provider to eliminate internal synchronization calls, such
as atomic variables or locks.
.PP
It should be noted that even if resource management is disabled, the
provider implementation and protocol may still provide some level of
protection against overruns.
However, such protection is not guaranteed.
The following values for resource management are defined.
.PP
\f[I]FI_RM_UNSPEC\f[] : This value indicates that no resource management
model has been defined.
It may be used on input hints to the fi_getinfo call.
.PP
\f[I]FI_RM_DISABLED\f[] : The provider is free to select an
implementation and protocol that does not protect against resource
overruns.
The application is responsible for resource protection.
.PP
\f[I]FI_RM_ENABLED\f[] : Resource management is enabled for this
provider domain.
.PP
The behavior of the various resource management options depends on
whether the endpoint is reliable or unreliable, as well as provider and
protocol specific implementation details, as shown in the following
tables.
.PP
| Resource | Unrel EP-RM Disabled| Unrel EP-RM Enabled | Rel EP-RM
Disabled | Rel EP-RM Enabled |
|:--------:|:-------------------:|:-------------------:|:------------------:|:-----------------:|
| Tx | error | EAGAIN | error | EAGAIN | | Rx | error | EAGAIN | error |
EAGAIN | | Tx CQ | error | EAGAIN | error | EAGAIN | | Rx CQ | error |
EAGAIN or drop | error | EAGAIN or retry | | Unmatched Recv | buffered
or drop | buffered or drop | buffered or error | buffered or retry | |
Recv Overrun | truncate or drop | truncate or drop | truncate or error |
truncate or error | | Unmatched RMA | not applicable | not applicable |
error | error | | RMA Overrun | not applicable | not applicable | error
| error |
.PP
The resource column indicates the resource being accessed by a data
transfer operation.
Tx refers to the transmit context when a data transfer operation posted.
Rx refers to the receive context when receive data buffers are posted.
When RM is enabled, the provider will ensure that space is available to
accept the operation.
If space is not available, the operation will fail with -FI_EAGAIN.
If resource management is disabled, the application is responsible for
ensuring that there is space available before attempting to queue an
operation.
.PP
Tx CQ and Rx CQ refer to the completion queues associated with the
transmit and receive contexts, respectively.
When RM is disabled, applications must take care to ensure that
completion queues do not get overrun.
This can be accomplished by sizing the CQs appropriately or by deferring
the posting of a data transfer operation unless CQ space is available to
store its completion.
When RM is enabled, providers may use different mechanisms to prevent CQ
overruns.
This includes failing (returning -FI_EAGAIN) the posting of operations
that could result in CQ overruns, dropping received messages, or forcing
requests to be retried.
.PP
Unmatched receives and receive overruns deal with the processing of
messages that consume a receive buffers.
Unmatched receives references incoming messages that are received by an
endpoint, but do not have an application data buffer to consume.
No buffers may be available at the receive side, or buffers may
available, but restricted from accepting the received message (such as
being associated with different tags).
Unmatched receives may be handled by protocol flow control, resulting in
the message being retried.
For unreliable endpoints, unmatched messages are usually dropped, unless
the provider can internally buffer the data.
An error will usually occur on a reliable endpoint if received data
cannot be placed if RM is disabled, or the data cannot be received with
RM enabled after retries have been exhausted.
.PP
In some cases, buffering on the receive side may be available, but
insufficient space may have been provided to receive the full message
that was sent.
This is considered an error, however, rather than failing the operation,
a provider may instead truncate the message and report the truncation to
the app.
.PP
Unmatched RMA and RMA overruns deal with the processing of RMA and
atomic operations that access registered memory buffers directly.
RMA operations are not defined for unreliable endpoints.
For reliable endpoints, unmatched RMA and RMA overruns are both treated
as errors.
.PP
When a resource management error occurs on an endpoint, the endpoint is
transitioned into a disabled state.
Any operations which have not already completed will fail and be
discarded.
For unconnected endpoints, the endpoint must be re-enabled before it
will accept new data transfer operations.
For connected endpoints, the connection is torn down and must be
re-established.
.SS MR Key Size
.PP
Size of the memory region remote access key, in bytes.

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_endpoint 3 "2014\-12\-18" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_endpoint 3 "2015\-01\-08" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_endpoint - Fabric endpoint operations
@ -215,10 +215,14 @@ This includes send message, RMA, and atomic operations.
the specified completion queue.
This includes received messages.
.PP
\f[I]FI_COMPLETION\f[] : If FI_COMPLETION is specified, the indicated
data transfer operations won\[aq]t generate entries for successful
completions in the completion queue unless FI_COMPLETION is set for that
specific operation.
\f[I]FI_COMPLETION\f[] : By default, data transfer operations generate
completion entries into a completion queue after they have successfully
completed.
Applications can use this bind flag to selectively enable when
completions are generated.
If FI_COMPLETION is specified, data transfer operations will not
generate entries for successful completions unless FI_COMPLETION is set
as an operational flag for the given operation.
FI_COMPLETION must be OR\[aq]ed with FI_SEND and/or FI_RECV flags.
.PP
When set the user must determine when a request that does NOT have
@ -227,6 +231,32 @@ completion of a subsequent operation.
Use of this flag may improve performance by allowing the provider to
avoid writing a completion entry for every operation.
.PP
Example: An application can selectively generate send completions by
using the following general approach:
.IP
.nf
\f[C]
\ \ fi_tx_attr::op_flags\ =\ 0;\ //\ default\ -\ no\ completion
\ \ fi_ep_bind(ep,\ cq,\ FI_SEND\ |\ FI_COMPLETION);
\ \ fi_send(ep,\ ...);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ no\ completion
\ \ fi_sendv(ep,\ ...);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ no\ completion
\ \ fi_sendmsg(ep,\ ...,\ FI_COMPLETION);\ //\ completion!
\f[]
.fi
.PP
Example: An application can selectively disable send completions by
modifying the operational flags:
.IP
.nf
\f[C]
\ \ fi_tx_attr::op_flags\ =\ FI_COMPLETION;\ //\ default\ -\ completion
\ \ fi_ep_bind(ep,\ cq,\ FI_SEND\ |\ FI_COMPLETION);
\ \ fi_send(ep,\ ...);\ \ \ \ \ \ \ //\ completion
\ \ fi_sendv(ep,\ ...);\ \ \ \ \ \ //\ completion
\ \ fi_sendmsg(ep,\ ...,\ 0);\ //\ no\ completion!
\f[]
.fi
.PP
An endpoint may also, or instead, be bound to a fabric counter.
When binding an endpoint to a counter, the following flags may be
specified.
@ -362,6 +392,7 @@ struct\ fi_ep_attr\ {
\ \ \ \ size_t\ \ \ \ max_order_waw_size;
\ \ \ \ uint64_t\ \ mem_tag_format;
\ \ \ \ uint64_t\ \ msg_order;
\ \ \ \ uint64_t\ \ comp_order;
\ \ \ \ size_t\ \ \ \ tx_ctx_cnt;
\ \ \ \ size_t\ \ \ \ rx_ctx_cnt;
};
@ -397,12 +428,12 @@ PSMX is an extended version of the PSM protocol to support the libfabric
interfaces.
.SS protocol_version - Protocol Version
.PP
Identifies which version of the protocol is employeed by the provider.
Identifies which version of the protocol is employed by the provider.
The protocol version allows providers to extend an existing protocol, by
adding support for additional features or functionality for example, in
a backward compatible manner.
Providers that support different versions of the same protocol should
interoperate, but only when using the capabilities defined for the
inter-operate, but only when using the capabilities defined for the
lesser version.
.SS max_msg_size - Max Message Size
.PP
@ -586,6 +617,46 @@ If set, message send operations, including tagged sends, are processed
in the order submitted relative to other message send.
If not set, message sends may be processed out of order from their
submission.
.SS comp_order - Completion Ordering
.PP
Completion ordering refers to the order in which completed requests are
written into the completion queue.
Completion ordering is similar to message order.
Relaxed completion order may enable faster reporting of completed
transfers, allow acknowledgments to be sent over different fabric paths,
and support more sophisticated retry mechanisms.
This can result in lower-latency completions, particularly when using
unconnected endpoints.
Strict completion ordering may require that providers queue completed
operations or limit available optimizations
.PP
For transmit requests, completion ordering depends on the endpoint
communication type.
For unreliable communication, completion ordering applies to all data
transfer requests submitted to an endpoint.
For reliable communication, completion ordering only applies to requests
that target a single destination endpoint.
Completion ordering of requests that target different endpoints over a
reliable transport is not defined.
.PP
Applications should specify the completion ordering that they support or
require.
Providers should return the completion order that they actually provide,
with the constraint that the returned ordering is stricter than that
specified by the application.
Supported completion order values are:
.PP
\f[I]FI_ORDER_NONE\f[] : No ordering is defined for completed
operations.
Requests submitted to the transmit and receive queues may complete in
any order.
.PP
\f[I]FI_ORDER_STRICT\f[] : Requests complete in the order in which they
are submitted, in the case of transmit requests, or processed, in the
case of receive operations, by the provider.
Transmit operations complete in the order in which the requests were
submitted.
Receive operations complete in order, subject to buffer matching.
.SS tx_ctx_cnt - Transmit Context Count
.PP
Number of transmit contexts to associate with the endpoint.
@ -673,6 +744,7 @@ struct\ fi_tx_attr\ {
\ \ \ \ uint64_t\ \ mode;
\ \ \ \ uint64_t\ \ op_flags;
\ \ \ \ uint64_t\ \ msg_order;
\ \ \ \ uint64_t\ \ comp_order;
\ \ \ \ size_t\ \ \ \ inject_size;
\ \ \ \ size_t\ \ \ \ size;
\ \ \ \ size_t\ \ \ \ iov_limit;
@ -698,6 +770,12 @@ The message ordering must be the same or more relaxed than those
specified of the associated endpoint.
See the fi_endpoint Message Ordering section.
.PP
\f[I]comp_order\f[] : The completion ordering requirements of the
context.
The completion ordering must be the same or more relaxed than those
specified of the associated endpoint.
See the fi_endpoint Completion Ordering section.
.PP
\f[I]inject_size\f[] : The requested inject operation size (see the
FI_INJECT flag) that the context will support.
This value must be equal to or less than the inject_size of the
@ -754,6 +832,7 @@ struct\ fi_rx_attr\ {
\ \ \ \ uint64_t\ \ mode;
\ \ \ \ uint64_t\ \ op_flags;
\ \ \ \ uint64_t\ \ msg_order;
\ \ \ \ uint64_t\ \ comp_order;
\ \ \ \ size_t\ \ \ \ total_buffered_recv;
\ \ \ \ size_t\ \ \ \ size;
\ \ \ \ size_t\ \ \ \ iov_limit;
@ -779,6 +858,12 @@ The message ordering must be the same or more relaxed than those
specified of the associated endpoint.
See the fi_endpoint Message Ordering section.
.PP
\f[I]comp_order\f[] : The completion ordering requirements of the
context.
The completion ordering must be the same or more relaxed than those
specified of the associated endpoint.
See the fi_endpoint Completion Ordering section.
.PP
\f[I]total_buffered_recv\f[] : Defines the total available space
allocated by the provider to buffer received messages on the context.
This value must be less than or equal to that specified for the

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_eq 3 "2014\-12\-15" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_eq 3 "2015\-01\-01" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_eq - Event queue operations
@ -208,7 +208,7 @@ information regarding the format associated with each event.
operations are basic requests that simply need to generate an event to
indicate that they have completed.
These include the following types of events: memory registration,
address vector resolution, connection established, and multicast join.
address vector resolution, and connection established.
.PP
Control requests report their completion by inserting a
\f[C]struct\ \ \ fi_eq_entry\f[] into the EQ.
@ -225,12 +225,14 @@ struct\ fi_eq_entry\ {
.fi
.PP
For the completion of basic asynchronous control operations, the
returned event will be to FI_COMPLETE.
The fid will reference the fabric descriptor associated with the event.
For memory registration, this will be the fid_mr, address resolution
will reference a fid_av, and CM events will refer to a fid_ep.
returned event will indicate the operation that has completed, and the
fid will reference the fabric descriptor associated with the event.
For memory registration, this will be an FI_MR_COMPLETE event and the
fid_mr, address resolution will reference an FI_AV_COMPLETE event and
fid_av, and CM events will refer to a FI_CONNECTED event and fid_ep.
The context field will be set to the context specified as part of the
operation.
operation, if available, otherwise the context will be associated with
the fabric descriptor.
.PP
\f[I]Connection Request Notification\f[] : Connection requests are
unsolicited notifications that a remote endpoint wishes to establish a

Просмотреть файл

@ -0,0 +1,109 @@
.TH fi_errno 3 "2015\-01\-08" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_errno - fabric errors
.PP
fi_strerror - Convert fabric error into a printable string
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <rdma/fi_errno.h>
const\ char\ *fi_strerror(int\ errnum);
\f[]
.fi
.SH ERRORS
.PP
\f[I]FI_ENOENT\f[] : No such file or directory.
.PP
\f[I]FI_EIO\f[] : I/O error
.PP
\f[I]FI_E2BIG\f[] : Argument list too long.
.PP
\f[I]FI_EBADF\f[] : Bad file number.
.PP
\f[I]FI_EAGAIN\f[] : Try again.
.PP
\f[I]FI_ENOMEM\f[] : Out of memory.
.PP
\f[I]FI_EACCES\f[] : Permission denied.
.PP
\f[I]FI_EBUSY\f[] : Device or resource busy
.PP
\f[I]FI_ENODEV\f[] : No such device
.PP
\f[I]FI_EINVAL\f[] : Invalid argument
.PP
\f[I]FI_EMFILE\f[] : Too many open files
.PP
\f[I]FI_ENOSPC\f[] : No space left on device
.PP
\f[I]FI_ENOSYS\f[] : Function not implemented
.PP
\f[I]FI_ENOMSG\f[] : No message of desired type
.PP
\f[I]FI_ENODATA\f[] : No data available
.PP
\f[I]FI_EMSGSIZE\f[] : Message too long
.PP
\f[I]FI_ENOPROTOOPT\f[] : Protocol not available
.PP
\f[I]FI_EOPNOTSUPP\f[] : Operation not supported on transport endpoint
.PP
\f[I]FI_EADDRINUSE\f[] : Address already in use
.PP
\f[I]FI_EADDRNOTAVAIL\f[] : Cannot assign requested address
.PP
\f[I]FI_ENETDOWN\f[] : Network is down
.PP
\f[I]FI_ENETUNREACH\f[] : Network is unreachable
.PP
\f[I]FI_ECONNABORTED\f[] : Software caused connection abort
.PP
\f[I]FI_ECONNRESET\f[] : Connection reset by peer
.PP
\f[I]FI_EISCONN\f[] : Transport endpoint is already connected
.PP
\f[I]FI_ENOTCONN\f[] : Transport endpoint is not connected
.PP
\f[I]FI_ESHUTDOWN\f[] : Cannot send after transport endpoint shutdown
.PP
\f[I]FI_ETIMEDOUT\f[] : Operation timed out
.PP
\f[I]FI_ECONNREFUSED\f[] : Connection refused
.PP
\f[I]FI_EHOSTUNREACH\f[] : No route to host
.PP
\f[I]FI_EALREADY\f[] : Operation already in progress
.PP
\f[I]FI_EINPROGRESS\f[] : Operation now in progress
.PP
\f[I]FI_EREMOTEIO\f[] : Remote I/O error
.PP
\f[I]FI_ECANCELED\f[] : Operation Canceled
.PP
\f[I]FI_ENOKEY\f[] : Required key not available
.PP
\f[I]FI_EKEYREJECTED\f[] : Key was rejected by service
.PP
\f[I]FI_EOTHER\f[] : Unspecified error
.PP
\f[I]FI_ETOOSMALL\f[] : Provided buffer is too small
.PP
\f[I]FI_EOPBADSTATE\f[] : Operation not permitted in current state
.PP
\f[I]FI_EAVAIL\f[] : Error available
.PP
\f[I]FI_EBADFLAGS\f[] : Flags not supported
.PP
\f[I]FI_ENOEQ\f[] : Missing or unavailable event queue
.PP
\f[I]FI_EDOMAIN\f[] : Invalid resource domain
.PP
\f[I]FI_ENOCQ\f[] : Missing or unavailable completion queue
.SH SEE ALSO
.PP
\f[C]fabric\f[](7)
.SH AUTHORS
OpenFabrics.

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_fabric 3 "2014\-12\-12" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_fabric 3 "2015\-01\-08" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_fabric - Fabric domain operations
@ -138,7 +138,7 @@ Fabric errno values are defined in \f[C]rdma/fi_errno.h\f[].
.SH ERRORS
.SH SEE ALSO
.PP
\f[C]fi_fabric\f[](7), \f[C]fi_getinfo\f[](3), \f[C]fi_domain\f[](3),
\f[C]fabric\f[](7), \f[C]fi_getinfo\f[](3), \f[C]fi_domain\f[](3),
\f[C]fi_eq\f[](3), \f[C]fi_endpoint\f[](3)
.SH AUTHORS
OpenFabrics.

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_getinfo 3 "2014\-12\-16" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_getinfo 3 "2015\-01\-07" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_getinfo / fi_freeinfo - Obtain / free fabric interface information
@ -134,7 +134,7 @@ This field will be ignored in hints if FI_SOURCE is specified.
.PP
\f[I]dest_addrlen - destination address length\f[] : Indicates the
length of the destination address (must be specified if
\f[I]dst_addr\f[] is specified).
\f[I]dest_addr\f[] is specified).
This field will be ignored in hints unless FI_SOURCE is specified.
.PP
\f[I]src_addr - source address\f[] : If specified, indicates the source
@ -260,16 +260,6 @@ Applications can use the FI_READ, FI_WRITE, FI_REMOTE_READ, and
FI_REMOTE_WRITE flags to restrict the types of atomic operations
supported by an endpoint.
.PP
\f[I]FI_MULTICAST\f[] : Indicates that the endpoint should support
multicast data transfers.
Endpoints supporting this capability support multicast operations
defined by struct fi_ops_msg, when a multicast address is specified as
the destination address.
In the absence of any relevant flags, FI_MULTICAST implies the ability
to send and receive messages.
Applications can use the FI_SEND and FI_RECV flags to optimize an
endpoint as send-only or receive-only.
.PP
\f[I]FI_DYNAMIC_MR\f[] : The provider supports applications registering
any range of addresses in their virtual address space, whether or not
those addresses are back by physical pages or have been allocated to the

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_poll 3 "2014\-12\-15" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_poll 3 "2015\-01\-06" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_poll - Polling and wait set operations
@ -32,7 +32,7 @@ int\ fi_poll_del(struct\ fid_poll\ *pollset,\ struct\ fid\ *event_fid,
int\ fi_poll(struct\ fid_poll\ *pollset,\ void\ **context,\ int\ count);
int\ fi_wait_open(struct\ fid_domain\ *domain,\ struct\ fi_wait_attr\ *attr,
int\ fi_wait_open(struct\ fid_fabric\ *fabric,\ struct\ fi_wait_attr\ *attr,
\ \ \ \ struct\ fid_wait\ **waitset);
int\ fi_close(struct\ fid\ *waitset);
@ -42,6 +42,8 @@ int\ fi_wait(struct\ fid_wait\ *waitset,\ int\ timeout);
.fi
.SH ARGUMENTS
.PP
\f[I]fabric\f[] : Fabric provider
.PP
\f[I]domain\f[] : Resource domain
.PP
\f[I]pollset\f[] : Event poll set

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_rma 3 "2014\-12\-02" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_rma 3 "2015\-01\-07" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_rma - Remote memory access operations
@ -146,7 +146,7 @@ struct\ fi_msg_rma\ {
\ \ \ \ void\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ **desc;\ \ \ \ \ \ \ /*\ operation\ descriptor\ */
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ iov_count;\ \ \ \ /*\ #\ elements\ in\ msg_iov\ */
\ \ \ \ const\ void\ \ \ \ \ \ \ \ \ *addr;\ \ \ \ \ \ \ \ /*\ optional\ endpoint\ address\ */
\ \ \ \ const\ struct\ fi_rma_iov\ rma_iov;\ /*\ remote\ SGL\ */
\ \ \ \ const\ struct\ fi_rma_iov\ *rma_iov;/*\ remote\ SGL\ */
\ \ \ \ size_t\ \ \ \ \ \ \ \ \ \ \ \ \ rma_iov_count;/*\ #\ elements\ in\ rma_iov\ */
\ \ \ \ void\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *context;\ \ \ \ \ /*\ user-defined\ context\ */
\ \ \ \ uint64_t\ \ \ \ \ \ \ \ \ \ \ data;\ \ \ \ \ \ \ \ \ /*\ optional\ immediate\ data\ */

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_tagged 3 "2014\-12\-08" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_tagged 3 "2015\-01\-06" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_tagged - Tagged data transfer operations
@ -52,8 +52,7 @@ ssize_t\ fi_tsenddata(struct\ fid_ep\ *ep,\ const\ void\ *buf,\ size_t\ len,
\ \ \ \ void\ *context);
ssize_t\ fi_tsearch(struct\ fid_ep\ *ep,\ uint64_t\ *tag,\ uint64_t\ ignore,
\ \ \ \ uint64_t\ flags,\ void\ *src_addr,\ size_t\ *src_addrlen,
\ \ \ \ size_t\ *len,\ void\ *context);
\ \ \ \ uint64_t\ flags,\ void\ *src_addr,\ size_t\ *len,\ void\ *context);
\f[]
.fi
.SH ARGUMENTS

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_trigger 3 "2014\-12\-10" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_trigger 3 "2015\-01\-01" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_trigger - Triggered operations
@ -50,7 +50,7 @@ struct\ fi_triggered_context\ {
\ \ \ \ union\ {
\ \ \ \ \ \ \ \ struct\ fi_trigger_threshold\ threshold;
\ \ \ \ \ \ \ \ void\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *internal[3];\ /*\ reserved\ */
\ \ \ \ };
\ \ \ \ }\ trigger;
};
\f[]
.fi

Просмотреть файл

@ -1,4 +1,4 @@
.TH fi_version 3 "2014-11-14" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.TH fi_version 3 "2015\-01\-08" "Libfabric Programmer\[aq]s Manual" "\@VERSION\@"
.SH NAME
.PP
fi_version - Version of the library interfaces
@ -31,6 +31,6 @@ The upper 16-bits of the version correspond to the major number, and the
lower 16-bits correspond with the minor number.
.SH SEE ALSO
.PP
\f[C]fi_fabric\f[](7), \f[C]fi_getinfo\f[](3)
\f[C]fabric\f[](7), \f[C]fi_getinfo\f[](3)
.SH AUTHORS
OpenFabrics.

Просмотреть файл

@ -257,6 +257,7 @@ struct psmx_fid_fabric {
struct psmx_fid_domain {
struct fid_domain domain;
struct psmx_fid_fabric *fabric;
psm_ep_t psm_ep;
psm_epid_t psm_epid;
psm_mq_t psm_mq;
@ -316,7 +317,7 @@ struct psmx_cq_event_queue {
struct psmx_fid_wait {
struct fid_wait wait;
struct psmx_fid_domain *domain;
struct psmx_fid_fabric *fabric;
int type;
union {
int fd[2];
@ -572,6 +573,8 @@ extern struct psmx_env psmx_env;
int psmx_domain_open(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **domain, void *context);
int psmx_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int psmx_ep_open(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **ep, void *context);
int psmx_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
@ -580,8 +583,6 @@ int psmx_av_open(struct fid_domain *domain, struct fi_av_attr *attr,
struct fid_av **av, void *context);
int psmx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct fid_cntr **cntr, void *context);
int psmx_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int psmx_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset);

Просмотреть файл

@ -51,23 +51,6 @@
static pthread_mutex_t psmx_atomic_lock = PTHREAD_MUTEX_INITIALIZER;
static size_t psmx_datatype_size[FI_DATATYPE_LAST] = {
sizeof(int8_t), /* FI_INT8 */
sizeof(uint8_t), /* FI_UINT8 */
sizeof(int16_t), /* FI_INT16 */
sizeof(uint16_t), /* FI_UINT16 */
sizeof(int32_t), /* FI_INT32 */
sizeof(uint32_t), /* FI_UINT32 */
sizeof(int64_t), /* FI_INT64 */
sizeof(uint64_t), /* FI_UINT64 */
sizeof(float), /* FI_FLOAT */
sizeof(double), /* FI_DOUBLE */
sizeof(float complex), /* FI_FLOAT_COMPLEX */
sizeof(double complex), /* FI_DOUBLE_COMPLEX */
sizeof(long double), /* FI_LONG_DOUBLE */
sizeof(long double complex), /* FI_LONG_DOUBLE_COMPLEX */
};
#define CASE_INT_TYPE(FUNC,...) \
case FI_INT8: FUNC(__VA_ARGS__,int8_t); break; \
case FI_UINT8: FUNC(__VA_ARGS__,uint8_t); break; \
@ -406,7 +389,7 @@ int psmx_am_atomic_handler(psm_am_token_t token, psm_epaddr_t epaddr,
key = args[3].u64;
datatype = args[4].u32w0;
op = args[4].u32w1;
assert(len == psmx_datatype_size[datatype] * count);
assert(len == fi_datatype_size(datatype) * count);
mr = psmx_mr_hash_get(key);
op_error = mr ?
@ -455,7 +438,7 @@ int psmx_am_atomic_handler(psm_am_token_t token, psm_epaddr_t epaddr,
key = args[3].u64;
datatype = args[4].u32w0;
op = args[4].u32w1;
assert(len == psmx_datatype_size[datatype] * count);
assert(len == fi_datatype_size(datatype) * count);
mr = psmx_mr_hash_get(key);
op_error = mr ?
@ -528,7 +511,7 @@ int psmx_am_atomic_handler(psm_am_token_t token, psm_epaddr_t epaddr,
datatype = args[4].u32w0;
op = args[4].u32w1;
len /= 2;
assert(len == psmx_datatype_size[datatype] * count);
assert(len == fi_datatype_size(datatype) * count);
mr = psmx_mr_hash_get(key);
op_error = mr ?
@ -672,7 +655,7 @@ static int psmx_atomic_self(int am_cmd,
else
access = FI_REMOTE_READ | FI_REMOTE_WRITE;
len = psmx_datatype_size[datatype] * count;
len = fi_datatype_size(datatype) * count;
mr = psmx_mr_hash_get(key);
op_error = mr ? psmx_mr_validate(mr, addr, len, access) : -EINVAL;
@ -805,9 +788,9 @@ ssize_t _psmx_atomic_write(struct fid_ep *ep,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_ATOMIC_WRITE;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->atomic_write.ep = ep;
trigger->atomic_write.buf = buf;
trigger->atomic_write.count = count;
@ -854,7 +837,7 @@ ssize_t _psmx_atomic_write(struct fid_ep *ep,
context, flags);
chunk_size = MIN(PSMX_AM_CHUNK_SIZE, psmx_am_param.max_request_short);
len = psmx_datatype_size[datatype] * count;
len = fi_datatype_size(datatype)* count;
if (len > chunk_size)
return -FI_EMSGSIZE;
@ -990,9 +973,9 @@ ssize_t _psmx_atomic_readwrite(struct fid_ep *ep,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_ATOMIC_READWRITE;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->atomic_readwrite.ep = ep;
trigger->atomic_readwrite.buf = buf;
trigger->atomic_readwrite.count = count;
@ -1041,7 +1024,7 @@ ssize_t _psmx_atomic_readwrite(struct fid_ep *ep,
context, flags);
chunk_size = MIN(PSMX_AM_CHUNK_SIZE, psmx_am_param.max_request_short);
len = psmx_datatype_size[datatype] * count;
len = fi_datatype_size(datatype) * count;
if (len > chunk_size)
return -FI_EMSGSIZE;
@ -1175,9 +1158,9 @@ ssize_t _psmx_atomic_compwrite(struct fid_ep *ep,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_ATOMIC_COMPWRITE;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->atomic_compwrite.ep = ep;
trigger->atomic_compwrite.buf = buf;
trigger->atomic_compwrite.count = count;
@ -1229,7 +1212,7 @@ ssize_t _psmx_atomic_compwrite(struct fid_ep *ep,
context, flags);
chunk_size = MIN(PSMX_AM_CHUNK_SIZE, psmx_am_param.max_request_short);
len = psmx_datatype_size[datatype] * count;
len = fi_datatype_size(datatype) * count;
if (len * 2 > chunk_size)
return -FI_EMSGSIZE;
@ -1387,7 +1370,7 @@ static int psmx_atomic_writevalid(struct fid_ep *ep,
if (count) {
chunk_size = MIN(PSMX_AM_CHUNK_SIZE,
psmx_am_param.max_request_short);
*count = chunk_size / psmx_datatype_size[datatype];
*count = chunk_size / fi_datatype_size(datatype);
}
return 0;
}
@ -1423,7 +1406,7 @@ static int psmx_atomic_readwritevalid(struct fid_ep *ep,
if (count) {
chunk_size = MIN(PSMX_AM_CHUNK_SIZE,
psmx_am_param.max_request_short);
*count = chunk_size / psmx_datatype_size[datatype];
*count = chunk_size / fi_datatype_size(datatype);
}
return 0;
}
@ -1469,7 +1452,7 @@ static int psmx_atomic_compwritevalid(struct fid_ep *ep,
if (count) {
chunk_size = MIN(PSMX_AM_CHUNK_SIZE,
psmx_am_param.max_request_short);
*count = chunk_size / (2 * psmx_datatype_size[datatype]);
*count = chunk_size / (2 * fi_datatype_size(datatype));
}
return 0;
}

Просмотреть файл

@ -60,7 +60,5 @@ struct fi_ops_cm psmx_cm_ops = {
.accept = fi_no_accept,
.reject = fi_no_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};

Просмотреть файл

@ -357,6 +357,7 @@ int psmx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
events = FI_CNTR_EVENTS_COMP;
flags = 0;
domain_priv = container_of(domain, struct psmx_fid_domain, domain);
switch (attr->events) {
case FI_CNTR_EVENTS_COMP:
@ -387,7 +388,8 @@ int psmx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
case FI_WAIT_MUTEX_COND:
wait_attr.wait_obj = attr->wait_obj;
wait_attr.flags = 0;
err = psmx_wait_open(domain, &wait_attr, (struct fid_wait **)&wait);
err = psmx_wait_open(&domain_priv->fabric->fabric,
&wait_attr, (struct fid_wait **)&wait);
if (err)
return err;
break;
@ -398,7 +400,6 @@ int psmx_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
return -FI_EINVAL;
}
domain_priv = container_of(domain, struct psmx_fid_domain, domain);
cntr_priv = (struct psmx_fid_cntr *) calloc(1, sizeof *cntr_priv);
if (!cntr_priv)
return -ENOMEM;

Просмотреть файл

@ -704,6 +704,7 @@ int psmx_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
int entry_size;
int err;
domain_priv = container_of(domain, struct psmx_fid_domain, domain);
switch (attr->format) {
case FI_CQ_FORMAT_UNSPEC:
attr->format = FI_CQ_FORMAT_TAGGED;
@ -750,7 +751,8 @@ int psmx_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
case FI_WAIT_MUTEX_COND:
wait_attr.wait_obj = attr->wait_obj;
wait_attr.flags = 0;
err = psmx_wait_open(domain, &wait_attr, (struct fid_wait **)&wait);
err = psmx_wait_open(&domain_priv->fabric->fabric,
&wait_attr, (struct fid_wait **)&wait);
if (err)
return err;
break;
@ -774,7 +776,6 @@ int psmx_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
}
}
domain_priv = container_of(domain, struct psmx_fid_domain, domain);
cq_priv = (struct psmx_fid_cq *) calloc(1, sizeof *cq_priv);
if (!cq_priv) {
if (wait)

Просмотреть файл

@ -82,7 +82,6 @@ static struct fi_ops_domain psmx_domain_ops = {
.cq_open = psmx_cq_open,
.endpoint = psmx_ep_open,
.cntr_open = psmx_cntr_open,
.wait_open = psmx_wait_open,
.poll_open = psmx_poll_open,
};
@ -111,6 +110,7 @@ int psmx_domain_open(struct fid_fabric *fabric, struct fi_info *info,
domain_priv->domain.ops = &psmx_domain_ops;
domain_priv->domain.mr = &psmx_mr_ops;
domain_priv->mode = info->mode;
domain_priv->fabric = container_of(fabric, struct psmx_fid_fabric, fabric);
psm_ep_open_opts_get_defaults(&opts);

Просмотреть файл

@ -248,22 +248,6 @@ static int psmx_ep_control(fid_t fid, int command, void *arg)
alias = arg;
*new_ep = *ep;
new_ep->flags = alias->flags;
/* REMOVE ME: [ temporary fix for backward compatibility */
if (new_ep->flags & FI_EVENT) {
if (psmx_env.warning) {
printf("WARNING: deprecated FI_EVENT flag in fi_alias().\n"
"\tThe flag passed to fi_alias should only mean op flags.\n"
"\tHere temporary backward compatibility is provided, but\n"
"\tthis may go away at any time. The proper way to create\n"
"\tan alias that doesn't automatically generate events is:\n"
"\t(1) call fi_alias() to create the new EP\n"
"\t(2) bind the new EP to the EQ with FI_EVENT flag\n"
"\tSet SFI_PSM_WARNING=0 to suppress this message.\n");
}
new_ep->send_cq_event_flag = new_ep->recv_cq_event_flag = 1;
new_ep->flags &= ~FI_EVENT;
}
/* REMOVE ME: ] */
psmx_ep_optimize_ops(new_ep);
*alias->fid = &new_ep->ep.fid;
break;

Просмотреть файл

@ -107,7 +107,7 @@ static int psmx_getinfo(uint32_t version, const char *node, const char *service,
int ep_type = FI_EP_RDM;
int caps = 0;
uint64_t max_tag_value = 0;
int err = -ENODATA;
int err = -FI_ENODATA;
psmx_debug("%s\n", __func__);
@ -126,7 +126,6 @@ static int psmx_getinfo(uint32_t version, const char *node, const char *service,
case FI_EP_UNSPEC:
case FI_EP_RDM:
break;
break;
default:
psmx_debug("%s: hints->ep_type=%d, supported=%d,%d.\n",
__func__, hints->ep_type, FI_EP_UNSPEC,
@ -145,6 +144,18 @@ static int psmx_getinfo(uint32_t version, const char *node, const char *service,
FI_PROTO_UNSPEC, FI_PROTO_PSMX);
goto err_out;
}
if (hints->ep_attr->tx_ctx_cnt > 1) {
psmx_debug("%s: hints->ep_attr->tx_ctx_cnt=%d, supported=0,1\n",
__func__, hints->ep_attr->tx_ctx_cnt);
goto err_out;
}
if (hints->ep_attr->rx_ctx_cnt > 1) {
psmx_debug("%s: hints->ep_attr->rx_ctx_cnt=%d, supported=0,1\n",
__func__, hints->ep_attr->rx_ctx_cnt);
goto err_out;
}
}
if ((hints->caps & PSMX_CAPS) != hints->caps) {
@ -221,19 +232,17 @@ static int psmx_getinfo(uint32_t version, const char *node, const char *service,
goto err_out;
}
psmx_info->tx_attr->op_flags = (hints && hints->tx_attr && hints->tx_attr->op_flags)
? hints->tx_attr->op_flags : 0;
psmx_info->rx_attr->op_flags = (hints && hints->rx_attr && hints->tx_attr->op_flags)
? hints->tx_attr->op_flags : 0;
psmx_info->ep_attr->protocol = FI_PROTO_PSMX;
psmx_info->ep_attr->max_msg_size = PSMX_MAX_MSG_SIZE;
psmx_info->ep_attr->inject_size = PSMX_INJECT_SIZE;
psmx_info->ep_attr->total_buffered_recv = ~(0ULL); /* that's how PSM handles it internally! */
psmx_info->ep_attr->mem_tag_format = fi_tag_format(max_tag_value);
psmx_info->ep_attr->msg_order = FI_ORDER_SAS;
psmx_info->ep_attr->comp_order = FI_ORDER_NONE;
psmx_info->ep_attr->tx_ctx_cnt = 1;
psmx_info->ep_attr->rx_ctx_cnt = 1;
psmx_info->domain_attr->threading = FI_THREAD_PROGRESS;
psmx_info->domain_attr->threading = FI_THREAD_COMPLETION;
psmx_info->domain_attr->control_progress = FI_PROGRESS_MANUAL;
psmx_info->domain_attr->data_progress = FI_PROGRESS_MANUAL;
psmx_info->domain_attr->name = strdup("psm");
@ -248,6 +257,27 @@ static int psmx_getinfo(uint32_t version, const char *node, const char *service,
psmx_info->src_addr = NULL;
psmx_info->dest_addr = dest_addr;
psmx_info->fabric_attr->name = strdup("psm");
psmx_info->fabric_attr->prov_name = strdup("psm");
psmx_info->tx_attr->caps = psmx_info->caps;
psmx_info->tx_attr->mode = psmx_info->mode;
psmx_info->tx_attr->op_flags = (hints && hints->tx_attr && hints->tx_attr->op_flags)
? hints->tx_attr->op_flags : 0;
psmx_info->tx_attr->msg_order = psmx_info->ep_attr->msg_order;
psmx_info->tx_attr->comp_order = psmx_info->ep_attr->comp_order;
psmx_info->tx_attr->inject_size = psmx_info->ep_attr->inject_size;
psmx_info->tx_attr->size = UINT64_MAX;
psmx_info->tx_attr->iov_limit = 1;
psmx_info->rx_attr->caps = psmx_info->caps;
psmx_info->rx_attr->mode = psmx_info->mode;
psmx_info->rx_attr->op_flags = (hints && hints->rx_attr && hints->tx_attr->op_flags)
? hints->tx_attr->op_flags : 0;
psmx_info->rx_attr->msg_order = psmx_info->ep_attr->msg_order;
psmx_info->rx_attr->comp_order = psmx_info->ep_attr->comp_order;
psmx_info->rx_attr->total_buffered_recv = psmx_info->ep_attr->total_buffered_recv;
psmx_info->rx_attr->size = UINT64_MAX;
psmx_info->rx_attr->iov_limit = 1;
*info = psmx_info;
return 0;
@ -270,6 +300,7 @@ static struct fi_ops psmx_fabric_fi_ops = {
static struct fi_ops_fabric psmx_fabric_ops = {
.size = sizeof(struct fi_ops_fabric),
.domain = psmx_domain_open,
.wait_open = psmx_wait_open,
};
static int psmx_fabric(struct fi_fabric_attr *attr,

Просмотреть файл

@ -58,9 +58,9 @@ ssize_t _psmx_recv(struct fid_ep *ep, void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_RECV;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->recv.ep = ep;
trigger->recv.buf = buf;
trigger->recv.len = len;
@ -216,9 +216,9 @@ ssize_t _psmx_send(struct fid_ep *ep, const void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_SEND;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->send.ep = ep;
trigger->send.buf = buf;
trigger->send.len = len;

Просмотреть файл

@ -460,9 +460,9 @@ ssize_t _psmx_read(struct fid_ep *ep, void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_READ;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->read.ep = ep;
trigger->read.buf = buf;
trigger->read.len = len;
@ -628,9 +628,9 @@ ssize_t _psmx_write(struct fid_ep *ep, const void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_WRITE;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->write.ep = ep;
trigger->write.buf = buf;
trigger->write.len = len;

Просмотреть файл

@ -58,9 +58,9 @@ ssize_t _psmx_tagged_recv(struct fid_ep *ep, void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_TRECV;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->trecv.ep = ep;
trigger->trecv.buf = buf;
trigger->trecv.len = len;
@ -414,9 +414,9 @@ ssize_t _psmx_tagged_send(struct fid_ep *ep, const void *buf, size_t len,
return -ENOMEM;
trigger->op = PSMX_TRIGGERED_TSEND;
trigger->cntr = container_of(ctxt->threshold.cntr,
trigger->cntr = container_of(ctxt->trigger.threshold.cntr,
struct psmx_fid_cntr, cntr);
trigger->threshold = ctxt->threshold.threshold;
trigger->threshold = ctxt->trigger.threshold.threshold;
trigger->tsend.ep = ep;
trigger->tsend.buf = buf;
trigger->tsend.len = len;
@ -889,7 +889,8 @@ static ssize_t psmx_tagged_search(struct fid_ep *ep, uint64_t *tag, uint64_t ign
case PSM_OK:
*tag = psm_status.msg_tag;
*len = psm_status.msg_length;
*src_addr = FI_ADDR_NOTAVAIL;
if (src_addr)
*src_addr = FI_ADDR_NOTAVAIL;
return 1;
case PSM_MQ_NO_COMPLETIONS:

Просмотреть файл

@ -184,16 +184,13 @@ static int psmx_wait_init(struct psmx_fid_wait *wait, int type)
return 0;
}
int psmx_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
int psmx_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset)
{
struct psmx_fid_domain *domain_priv;
struct psmx_fid_wait *wait_priv;
int type = FI_WAIT_FD;
int err;
domain_priv = container_of(domain, struct psmx_fid_domain, domain);
if (attr) {
switch (attr->wait_obj) {
case FI_WAIT_UNSPEC:
@ -222,11 +219,11 @@ int psmx_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
return err;
}
wait_priv->fabric = container_of(fabric, struct psmx_fid_fabric, fabric);
wait_priv->wait.fid.fclass = FI_CLASS_WAIT;
wait_priv->wait.fid.context = 0;
wait_priv->wait.fid.ops = &psmx_fi_ops;
wait_priv->wait.ops = &psmx_wait_ops;
wait_priv->domain = domain_priv;
*waitset = &wait_priv->wait;
return 0;

Просмотреть файл

@ -77,6 +77,7 @@
#define SOCK_EQ_DEF_SZ (1<<8)
#define SOCK_CQ_DEF_SZ (1<<8)
#define SOCK_AV_DEF_SZ (1<<8)
#define SOCK_CQ_DATA_SIZE (sizeof(uint64_t))
#define SOCK_TAG_SIZE (sizeof(uint64_t))
@ -101,6 +102,9 @@
FI_BUFFERED_RECV | FI_READ | FI_WRITE | \
FI_REMOTE_READ | FI_REMOTE_WRITE)
#define SOCK_DGRAM_DEF_OPS (FI_SEND | FI_RECV | FI_BUFFERED_RECV)
#define SOCK_EP_MSG_ORDER (FI_ORDER_RAR | FI_ORDER_RAW | FI_ORDER_RAS| \
FI_ORDER_WAR | FI_ORDER_WAW | FI_ORDER_WAS | \
FI_ORDER_SAR | FI_ORDER_SAW | FI_ORDER_SAS)
@ -151,7 +155,9 @@ struct sock_domain {
struct sock_conn_map r_cmap;
pthread_t listen_thread;
int listening;
char service[NI_MAXSERV];
int service;
int signal_fds[2];
struct sockaddr_storage src_addr;
};
struct sock_cntr {
@ -187,8 +193,15 @@ struct sock_mr {
};
struct sock_av_addr {
uint16_t key;
struct sockaddr_storage addr;
uint8_t valid;
uint8_t reserved[7];
};
struct sock_av_table_hdr {
uint64_t size;
uint64_t stored;
uint64_t req_sz;
};
struct sock_av {
@ -198,10 +211,15 @@ struct sock_av {
struct fi_av_attr attr;
uint64_t mask;
int rx_ctx_bits;
size_t stored;
struct index_map addr_idm;
socklen_t addrlen;
struct sock_conn_map *cmap;
struct sock_eq *eq;
struct sock_av_table_hdr *table_hdr;
struct sock_av_addr *table;
uint16_t *key;
char *name;
int shared_fd;
};
struct sock_fid_list {
@ -217,16 +235,16 @@ struct sock_poll {
struct sock_wait {
struct fid_wait wait_fid;
struct sock_domain *domain;
struct sock_fabric *fab;
struct dlist_entry fid_list;
enum fi_wait_obj type;
union {
int fd[2];
struct {
struct sock_mutex_cond {
pthread_mutex_t mutex;
pthread_cond_t cond;
};
};
} mutex_cond;
} wobj;
};
enum {
@ -243,12 +261,9 @@ enum {
SOCK_OP_READ_COMPLETE = 7,
SOCK_OP_READ_ERROR = 8,
SOCK_OP_ATOMIC_WRITE = 9,
SOCK_OP_ATOMIC_READ_WRITE = 10,
SOCK_OP_ATOMIC_COMP_WRITE = 11,
SOCK_OP_ATOMIC_COMPLETE = 12,
SOCK_OP_ATOMIC_ERROR = 13,
SOCK_OP_ATOMIC = 9,
SOCK_OP_ATOMIC_COMPLETE = 10,
SOCK_OP_ATOMIC_ERROR = 11,
/* internal */
SOCK_OP_RECV,
@ -266,15 +281,13 @@ struct sock_op {
uint8_t op;
uint8_t src_iov_len;
uint8_t dest_iov_len;
union {
struct {
uint8_t op;
uint8_t datatype;
uint8_t res_iov_len;
uint8_t cmp_iov_len;
} atomic;
uint8_t reserved[5];
};
struct {
uint8_t op;
uint8_t datatype;
uint8_t res_iov_len;
uint8_t cmp_iov_len;
} atomic;
uint8_t reserved[1];
};
struct sock_op_send {
@ -322,6 +335,8 @@ struct sock_eq{
struct fid_wait *waitset;
int signal;
int wait_fd;
char service[NI_MAXSERV];
};
struct sock_comp {
@ -351,14 +366,15 @@ struct sock_comp {
};
struct sock_ep {
union{
union {
struct fid_ep ep;
struct fid_sep sep;
struct fid_pep pep;
};
} fid;
size_t fclass;
uint64_t op_flags;
uint8_t connected;
uint16_t buffered_len;
uint16_t min_multi_recv;
char reserved[4];
@ -389,6 +405,26 @@ struct sock_ep {
enum fi_ep_type ep_type;
struct sockaddr_in *src_addr;
struct sockaddr_in *dest_addr;
fi_addr_t conn_addr;
uint16_t key;
};
struct sock_pep {
struct fid_pep pep;
struct sock_fabric *sock_fab;
struct sock_domain *dom;
struct fi_info info;
int sock_fd;
char service[NI_MAXSERV];
struct sock_eq *eq;
struct sock_cq *send_cq;
struct sock_cq *recv_cq;
uint64_t op_flags;
uint64_t pep_cap;
};
struct sock_rx_entry {
@ -452,7 +488,7 @@ struct sock_tx_ctx {
union {
struct fid_ep ctx;
struct fid_stx stx;
};
} fid;
size_t fclass;
struct ringbuffd rbfd;
@ -568,8 +604,8 @@ struct sock_tx_pe_entry{
struct sock_tx_ctx *tx_ctx;
union {
struct sock_tx_iov tx_iov[SOCK_EP_MAX_IOV_LIMIT];
char inject_data[SOCK_EP_MAX_INJECT_SZ];
};
char inject[SOCK_EP_MAX_INJECT_SZ];
} data;
};
struct sock_rx_pe_entry{
@ -580,7 +616,6 @@ struct sock_rx_pe_entry{
uint8_t pending_send;
uint8_t reserved[6];
struct sock_rx_entry *rx_entry;
struct sock_msg_response response;
union sock_iov rx_iov[SOCK_EP_MAX_IOV_LIMIT];
char atomic_cmp[SOCK_EP_MAX_ATOMIC_SZ];
char atomic_src[SOCK_EP_MAX_ATOMIC_SZ];
@ -593,12 +628,13 @@ enum{
};
struct sock_pe_entry{
union{
union {
struct sock_tx_pe_entry tx;
struct sock_rx_pe_entry rx;
};
} pe;
struct sock_msg_hdr msg_hdr;
struct sock_msg_response response;
uint64_t flags;
uint64_t context;
@ -664,6 +700,27 @@ struct sock_cq {
sock_cq_report_fn report_completion;
};
struct sock_conn_req {
int type;
fid_t c_fid;
fid_t s_fid;
struct fi_info info;
struct sockaddr_in src_addr;
struct sockaddr_in dest_addr;
struct fi_tx_attr tx_attr;
struct fi_rx_attr rx_attr;
struct fi_ep_attr ep_attr;
struct fi_domain_attr domain_attr;
struct fi_fabric_attr fabric_attr;
};
enum {
SOCK_CONNREQ,
SOCK_ACCEPT,
SOCK_REJECT,
SOCK_CONNECTED,
SOCK_SHUTDOWN
};
int sock_verify_info(struct fi_info *hints);
int sock_verify_fabric_attr(struct fi_fabric_attr *attr);
@ -687,6 +744,8 @@ int sock_msg_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints, struct fi_info **info);
void free_fi_info(struct fi_info *info);
int sock_msg_getinfo(uint32_t version, const char *node, const char *service,
uint64_t flags, struct fi_info *hints, struct fi_info **info);
int sock_domain(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **dom, void *context);
@ -694,6 +753,7 @@ int sock_domain(struct fid_fabric *fabric, struct fi_info *info,
int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
struct sock_ep **ep, void *context, size_t fclass);
struct sock_conn *sock_ep_lookup_conn(struct sock_ep *ep);
int sock_rdm_ep(struct fid_domain *domain, struct fi_info *info,
struct fid_ep **ep, void *context);
int sock_rdm_sep(struct fid_domain *domain, struct fi_info *info,
@ -725,6 +785,15 @@ int sock_cq_report_error(struct sock_cq *cq, struct sock_pe_entry *entry,
int sock_cq_progress(struct sock_cq *cq);
int sock_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context);
ssize_t sock_eq_report_event(struct sock_eq *sock_eq, uint32_t event,
const void *buf, size_t len, uint64_t flags);
ssize_t sock_eq_report_error(struct sock_eq *sock_eq, fid_t fid, void *context,
int err, int prov_errno, void *err_data);
int sock_eq_openwait(struct sock_eq *eq, char *service);
struct fi_info * sock_ep_msg_process_info(struct sock_conn_req *req);
int sock_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct fid_cntr **cntr, void *context);
int sock_cntr_inc(struct sock_cntr *cntr);
@ -760,9 +829,7 @@ void sock_tx_ctx_abort(struct sock_tx_ctx *tx_ctx);
int sock_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset);
int sock_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
struct fid_wait **waitset);
int sock_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
int sock_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset);
void sock_wait_signal(struct fid_wait *wait_fid);
int sock_wait_get_obj(struct fid_wait *fid, void *arg);
@ -775,11 +842,14 @@ fi_addr_t _sock_av_lookup(struct sock_av *av, struct sockaddr *addr);
fi_addr_t sock_av_get_fiaddr(struct sock_av *av, struct sock_conn *conn);
fi_addr_t sock_av_lookup_key(struct sock_av *av, int key);
struct sock_conn *sock_av_lookup_addr(struct sock_av *av, fi_addr_t addr);
int sock_av_compare_addr(struct sock_av *av,
fi_addr_t addr1, fi_addr_t addr2);
struct sock_conn *sock_conn_map_lookup_key(struct sock_conn_map *conn_map,
struct sock_conn *sock_conn_map_lookup_key(struct sock_conn_map *conn_map,
uint16_t key);
uint16_t sock_conn_map_match_or_connect(struct sock_conn_map *map,
uint16_t sock_conn_map_match_or_connect(struct sock_domain *dom,
struct sock_conn_map *map,
struct sockaddr_in *addr, int match_only);
int sock_conn_listen(struct sock_domain *domain);
int sock_conn_map_clear_pe_entry(struct sock_conn *conn_entry, uint16_t key);
@ -807,6 +877,7 @@ int sock_comm_buffer_init(struct sock_conn *conn);
void sock_comm_buffer_finalize(struct sock_conn *conn);
ssize_t sock_comm_send(struct sock_conn *conn, const void *buf, size_t len);
ssize_t sock_comm_recv(struct sock_conn *conn, void *buf, size_t len);
ssize_t sock_comm_peek(struct sock_conn *conn, void *buf, size_t len);
ssize_t sock_comm_flush(struct sock_conn *conn);
#endif

Просмотреть файл

@ -61,8 +61,7 @@ static ssize_t sock_ep_tx_atomic(struct fid_ep *ep,
const struct fi_msg_atomic *msg,
const struct fi_ioc *comparev, void **compare_desc,
size_t compare_count, struct fi_ioc *resultv,
void **result_desc, size_t result_count,
uint64_t flags, int type)
void **result_desc, size_t result_count, uint64_t flags)
{
int i, ret;
size_t datatype_sz;
@ -75,12 +74,12 @@ static ssize_t sock_ep_tx_atomic(struct fid_ep *ep,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
tx_ctx = sock_ep->tx_ctx;
break;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx);
sock_ep = tx_ctx->ep;
break;
@ -93,7 +92,11 @@ static ssize_t sock_ep_tx_atomic(struct fid_ep *ep,
msg->iov_count <= SOCK_EP_MAX_IOV_LIMIT &&
msg->rma_iov_count <= SOCK_EP_MAX_IOV_LIMIT);
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
if (sock_ep->connected) {
conn = sock_ep_lookup_conn(sock_ep);
} else {
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
}
assert(conn);
src_len = 0;
@ -120,7 +123,7 @@ static ssize_t sock_ep_tx_atomic(struct fid_ep *ep,
flags |= tx_ctx->attr.op_flags;
memset(&tx_op, 0, sizeof(struct sock_op));
tx_op.op = type;
tx_op.op = SOCK_OP_ATOMIC;
tx_op.dest_iov_len = msg->rma_iov_count;
tx_op.atomic.op = msg->op;
tx_op.atomic.datatype = msg->datatype;
@ -190,6 +193,7 @@ static ssize_t sock_ep_tx_atomic(struct fid_ep *ep,
goto err;
}
dst_len = 0;
for (i = 0; i< compare_count; i++) {
tx_iov.ioc.addr = (uint64_t)comparev[i].addr;
tx_iov.ioc.count = comparev[i].count;
@ -216,7 +220,7 @@ static ssize_t sock_ep_atomic_writemsg(struct fid_ep *ep,
const struct fi_msg_atomic *msg, uint64_t flags)
{
return sock_ep_tx_atomic(ep, msg, NULL, NULL, 0,
NULL, NULL, 0, flags, SOCK_OP_ATOMIC_WRITE);
NULL, NULL, 0, flags);
}
static ssize_t sock_ep_atomic_write(struct fid_ep *ep,
@ -311,8 +315,7 @@ static ssize_t sock_ep_atomic_readwritemsg(struct fid_ep *ep,
size_t result_count, uint64_t flags)
{
return sock_ep_tx_atomic(ep, msg, NULL, NULL, 0,
resultv, result_desc, result_count, flags,
SOCK_OP_ATOMIC_READ_WRITE);
resultv, result_desc, result_count, flags);
}
static ssize_t sock_ep_atomic_readwrite(struct fid_ep *ep,
@ -386,8 +389,7 @@ static ssize_t sock_ep_atomic_compwritemsg(struct fid_ep *ep,
uint64_t flags)
{
return sock_ep_tx_atomic(ep, msg, comparev, compare_desc, compare_count,
resultv, result_desc, result_count, flags,
SOCK_OP_ATOMIC_COMP_WRITE);
resultv, result_desc, result_count, flags);
}
static ssize_t sock_ep_atomic_compwrite(struct fid_ep *ep,

Просмотреть файл

@ -42,45 +42,71 @@
#include <string.h>
#include <sys/socket.h>
#include <ctype.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include "sock.h"
#include "sock_util.h"
fi_addr_t sock_av_lookup_key(struct sock_av *av, int key)
{
int i;
int i, idx;
struct sock_av_addr *av_addr;
for (i = 0; i < IDX_MAX_INDEX; i++) {
av_addr = idm_lookup(&av->addr_idm, i);
if (!av_addr)
continue;
if (!av_addr->key) {
av_addr->key = sock_conn_map_match_or_connect(
av->cmap,
idx = av_addr - &av->table[0];
if (!av->key[idx]) {
av->key[idx] = sock_conn_map_match_or_connect(
av->domain, av->cmap,
(struct sockaddr_in*)&av_addr->addr, 1);
if (!av_addr->key) {
if (!av->key[idx]) {
continue;
}
}
if (av_addr->key == key + 1) {
if (av->key[idx] == key + 1) {
return i;
}
}
SOCK_LOG_INFO("Reverse-lookup failed: %d\n", key);
return FI_ADDR_NOTAVAIL;
}
int sock_av_compare_addr(struct sock_av *av,
fi_addr_t addr1, fi_addr_t addr2)
{
int index1, index2;
struct sock_av_addr *av_addr1, *av_addr2;
index1 = ((uint64_t)addr1 & av->mask);
index2 = ((uint64_t)addr2 & av->mask);
if (index1 >= av->table_hdr->stored || index1 < 0 ||
index2 >= av->table_hdr->stored || index2 < 0) {
SOCK_LOG_ERROR("requested rank is larger than av table\n");
return -1;
}
av_addr1 = idm_lookup(&av->addr_idm, index1);
av_addr2 = idm_lookup(&av->addr_idm, index2);
return memcmp(&av_addr1->addr, &av_addr2->addr,
sizeof(struct sockaddr_in));
}
struct sock_conn *sock_av_lookup_addr(struct sock_av *av,
fi_addr_t addr)
{
int idx;
int index = ((uint64_t)addr & av->mask);
struct sock_av_addr *av_addr;
if (index >= av->stored || index < 0) {
if (index >= av->table_hdr->stored || index < 0) {
SOCK_LOG_ERROR("requested rank is larger than av table\n");
errno = EINVAL;
return NULL;
@ -93,39 +119,124 @@ struct sock_conn *sock_av_lookup_addr(struct sock_av *av,
}
av_addr = idm_lookup(&av->addr_idm, index);
if (!av_addr->key) {
av_addr->key = sock_conn_map_match_or_connect(av->cmap,
(struct sockaddr_in*)&av_addr->addr, 0);
if (!av_addr->key) {
idx = av_addr - &av->table[0];
if (!av->key[idx]) {
av->key[idx] = sock_conn_map_match_or_connect(
av->domain, av->cmap,
(struct sockaddr_in*)&av_addr->addr, 0);
if (!av->key[idx]) {
SOCK_LOG_ERROR("failed to match or connect to addr %lu\n", addr);
errno = EINVAL;
return NULL;
}
}
return sock_conn_map_lookup_key(av->cmap, av_addr->key);
return sock_conn_map_lookup_key(av->cmap, av->key[idx]);
}
static inline void sock_av_report_success(struct sock_av *av,
int *index, uint64_t flags)
{
if (av->eq)
sock_eq_report_event(av->eq, FI_COMPLETION,
index, sizeof(int), flags);
}
static inline void sock_av_report_error(struct sock_av *av, void *context,
uint64_t flags, int *index)
{
if (av->eq)
sock_eq_report_error(av->eq, &av->av_fid.fid,
context, -FI_EINVAL, -FI_EINVAL, NULL);
sock_av_report_success(av, index, flags);
}
static int sock_check_table_in(struct sock_av *_av, struct sockaddr_in *addr,
fi_addr_t *fi_addr, int count)
fi_addr_t *fi_addr, int count, uint64_t flags,
void *context, int index)
{
int i, ret;
int i, j, ret = 0;
char sa_ip[INET_ADDRSTRLEN];
struct sock_av_addr *av_addr;
av_addr = calloc(count, sizeof(struct sock_av_addr));
if (!av_addr)
return -ENOMEM;
size_t new_count, table_sz;
if ((_av->attr.flags & FI_EVENT) && !_av->eq)
return -FI_ENOEQ;
for (i=0, ret = 0; i<count; i++) {
memcpy(&av_addr[i].addr, &addr[i], sizeof(struct sockaddr_in));
if (idm_set(&_av->addr_idm, _av->stored, &av_addr[i]) < 0) {
if (fi_addr)
fi_addr[i] = FI_ADDR_NOTAVAIL;
continue;
if (_av->attr.flags & FI_READ) {
for (i = 0; i < count; i++) {
for (j = 0; j < _av->table_hdr->stored; j++) {
av_addr = &_av->table[j];
if (memcmp(&av_addr->addr, &addr[i],
sizeof(struct sockaddr_in)) == 0) {
SOCK_LOG_INFO("Found addr in shared av\n");
if (idm_set(&_av->addr_idm, _av->key[j], av_addr) < 0) {
if (fi_addr)
fi_addr[i] = FI_ADDR_NOTAVAIL;
sock_av_report_error(
_av, context, flags,
count > 1 ? &i : &index);
continue;
}
if (fi_addr)
fi_addr[i] = (fi_addr_t)j;
sock_av_report_success(
_av, count > 1 ? &i : &index, flags);
ret++;
}
}
}
return ret;
}
for (i = 0, ret = 0; i < count; i++) {
if (_av->table_hdr->stored == _av->table_hdr->size) {
if (_av->table_hdr->req_sz) {
SOCK_LOG_ERROR("Cannot insert to AV table\n");
return -FI_EINVAL;
} else{
new_count = _av->table_hdr->size * 2;
_av->key = realloc(_av->key,
sizeof(uint16_t) * new_count);
if (!_av->key)
return -FI_ENOMEM;
table_sz = sizeof(struct sock_av_table_hdr) +
new_count * sizeof(struct sock_av_addr);
_av->table_hdr = realloc(_av->table_hdr, table_sz);
if (!_av->table_hdr)
return -FI_ENOMEM;
_av->table_hdr->size = new_count;
_av->table = (struct sock_av_addr*)((char*)_av->table_hdr +
sizeof(struct sock_av_table_hdr));
}
}
if (fi_addr)
fi_addr[i] = (fi_addr_t)_av->stored;
av_addr = &_av->table[_av->table_hdr->stored];
memcpy(sa_ip, inet_ntoa((&addr[i])->sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("AV-INSERT:src_addr: family: %d, IP is %s, port: %d\n",
((struct sockaddr_in*)&addr[i])->sin_family, sa_ip,
ntohs(((struct sockaddr_in*)&addr[i])->sin_port));
_av->stored++;
memcpy(&av_addr->addr, &addr[i], sizeof(struct sockaddr_in));
if (idm_set(&_av->addr_idm, _av->table_hdr->stored, av_addr) < 0) {
if (fi_addr)
fi_addr[i] = FI_ADDR_NOTAVAIL;
sock_av_report_error(
_av, context, flags,
count > 1 ? &i : &index);
continue;
}
if (fi_addr)
fi_addr[i] = (fi_addr_t)_av->table_hdr->stored;
sock_av_report_success(_av, count > 1 ? &i : &index, flags);
av_addr->valid = 1;
_av->table_hdr->stored++;
ret++;
}
return ret;
@ -135,26 +246,12 @@ static int sock_av_insert(struct fid_av *av, const void *addr, size_t count,
fi_addr_t *fi_addr, uint64_t flags, void *context)
{
struct sock_av *_av;
_av = container_of(av, struct sock_av, av_fid);
switch(((struct sockaddr *)addr)->sa_family) {
case AF_INET:
return sock_check_table_in(_av, (struct sockaddr_in *)addr,
fi_addr, count);
default:
SOCK_LOG_ERROR("invalid address type inserted: only IPv4 supported\n");
return -EINVAL;
}
return sock_check_table_in(_av, (struct sockaddr_in *)addr,
fi_addr, count, flags, context, 0);
}
static int sock_at_remove(struct fid_av *av, fi_addr_t *fi_addr, size_t count,
uint64_t flags)
{
return 0;
}
static int sock_at_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr,
static int sock_av_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr,
size_t *addrlen)
{
int index;
@ -163,7 +260,7 @@ static int sock_at_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr,
_av = container_of(av, struct sock_av, av_fid);
index = ((uint64_t)fi_addr & _av->mask);
if (index >= _av->stored || index < 0) {
if (index >= _av->table_hdr->stored || index < 0) {
SOCK_LOG_ERROR("requested address not inserted\n");
return -EINVAL;
}
@ -174,36 +271,47 @@ static int sock_at_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr,
return 0;
}
static const char * sock_at_straddr(struct fid_av *av, const void *addr,
char *buf, size_t *len)
static int _sock_av_insertsvc(struct fid_av *av, const char *node,
const char *service, fi_addr_t *fi_addr,
uint64_t flags, void *context, int index)
{
return NULL;
int ret;
struct addrinfo sock_hints;
struct addrinfo *result = NULL;
struct sock_av *_av;
if (!service) {
SOCK_LOG_ERROR("Port not provided\n");
return -FI_EINVAL;
}
_av = container_of(av, struct sock_av, av_fid);
memset(&sock_hints, 0, sizeof(struct addrinfo));
sock_hints.ai_family = AF_INET;
sock_hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(node, service, &sock_hints, &result);
if (ret) {
if (_av->eq) {
sock_eq_report_error(_av->eq, &_av->av_fid.fid,
context, -FI_EINVAL, -FI_EINVAL, NULL);
sock_eq_report_event(_av->eq, FI_COMPLETION,
&index, sizeof(int), flags);
}
return -ret;
}
ret = sock_check_table_in(_av, (struct sockaddr_in*)result->ai_addr,
fi_addr, 1, flags, context, index);
freeaddrinfo(result);
return ret;
}
int sock_av_insertsvc(struct fid_av *av, const char *node,
const char *service, fi_addr_t *fi_addr,
uint64_t flags, void *context)
{
int ret;
struct addrinfo sock_hints;
struct addrinfo *result = NULL;
if (!service) {
SOCK_LOG_ERROR("Port not provided\n");
return -FI_EINVAL;
}
memset(&sock_hints, 0, sizeof(struct addrinfo));
sock_hints.ai_family = AF_INET;
sock_hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(node, service, &sock_hints, &result);
if (ret)
return -ret;
ret = sock_av_insert(av, result->ai_addr, 1, fi_addr, flags, context);
freeaddrinfo(result);
return ret;
return _sock_av_insertsvc(av, node, service, fi_addr, flags, context, 0);
}
int sock_av_insertsym(struct fid_av *av, const char *node, size_t nodecnt,
@ -240,9 +348,8 @@ int sock_av_insertsym(struct fid_av *av, const char *node, size_t nodecnt,
sprintf(tmp_host, "%s%0*d", base_host, fmt, var_host + i);
sprintf(tmp_port, "%d", var_port + j);
if (sock_av_insertsvc(av, tmp_host, tmp_port,
&fi_addr[i * nodecnt + j],
flags, context) == 1)
if (_sock_av_insertsvc(av, node, service, fi_addr, flags,
context, i * nodecnt + j) == 1)
ret++;
}
}
@ -250,20 +357,22 @@ int sock_av_insertsym(struct fid_av *av, const char *node, size_t nodecnt,
}
static int sock_am_remove(struct fid_av *av, fi_addr_t *fi_addr, size_t count,
static int sock_av_remove(struct fid_av *av, fi_addr_t *fi_addr, size_t count,
uint64_t flags)
{
int i;
struct sock_av *_av;
struct sock_av_addr *av_addr;
_av = container_of(av, struct sock_av, av_fid);
for (i = 0; i < count; i++) {
av_addr = &_av->table[fi_addr[i]];
av_addr->valid = 0;
}
return 0;
}
static int sock_am_lookup(struct fid_av *av, fi_addr_t fi_addr, void *addr,
size_t *addrlen)
{
sock_at_lookup(av, fi_addr, addr, addrlen);
return 0;
}
static const char * sock_am_straddr(struct fid_av *av, const void *addr,
static const char * sock_av_straddr(struct fid_av *av, const void *addr,
char *buf, size_t *len)
{
const struct sockaddr_in *sin;
@ -280,26 +389,44 @@ static const char * sock_am_straddr(struct fid_av *av, const void *addr,
static int sock_av_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
{
return -FI_ENOSYS;
struct sock_av *av;
struct sock_eq *eq;
if (bfid->fclass != FI_CLASS_EQ)
return -FI_EINVAL;
av = container_of(fid, struct sock_av, av_fid.fid);
eq = container_of(bfid, struct sock_eq, eq.fid);
av->eq = eq;
return 0;
}
static int sock_av_close(struct fid *fid)
{
struct sock_av *av;
void *addr;
int i;
av = container_of(fid, struct sock_av, av_fid.fid);
if (atomic_get(&av->ref))
return -FI_EBUSY;
for (i=0; i<av->stored; i++) {
addr = idm_clear(&av->addr_idm , i);
if (addr)
free(addr);
for (i=0; i<av->table_hdr->stored; i++) {
if(idm_lookup(&av->addr_idm, i))
idm_clear(&av->addr_idm , i);
}
if (!av->name)
free(av->table_hdr);
else {
free(av->name);
munmap(av->table_hdr, sizeof(struct sock_av_table_hdr) +
av->attr.count * sizeof(struct sock_av_addr));
close(av->shared_fd);
shm_unlink(av->name);
}
atomic_dec(&av->domain->ref);
free(av->key);
free(av);
return 0;
}
@ -317,9 +444,9 @@ static struct fi_ops_av sock_am_ops = {
.insert = sock_av_insert,
.insertsvc = sock_av_insertsvc,
.insertsym = sock_av_insertsym,
.remove = sock_am_remove,
.lookup = sock_am_lookup,
.straddr = sock_am_straddr
.remove = sock_av_remove,
.lookup = sock_av_lookup,
.straddr = sock_av_straddr
};
static struct fi_ops_av sock_at_ops = {
@ -327,66 +454,121 @@ static struct fi_ops_av sock_at_ops = {
.insert = sock_av_insert,
.insertsvc = sock_av_insertsvc,
.insertsym = sock_av_insertsym,
.remove = sock_at_remove,
.lookup = sock_at_lookup,
.straddr = sock_at_straddr
.remove = sock_av_remove,
.lookup = sock_av_lookup,
.straddr = sock_av_straddr
};
//static struct fi_ops_av sock_av_ops = {
// .size = sizeof(struct fi_ops_av),
// .insert = sock_av_insert,
// .remove = sock_av_remove,
// .lookup = sock_av_lookup,
// .straddr = sock_av_straddr
//};
#if 0
static int sock_open_am(struct sock_domain *dom, struct fi_av_attr *attr,
struct sock_av **av, void *context)
static int sock_verify_av_attr(struct fi_av_attr *attr)
{
struct sock_av *_av;
switch (attr->type) {
case FI_AV_MAP:
case FI_AV_TABLE:
break;
default:
return -FI_EINVAL;
}
if (attr->flags & FI_READ && !attr->name)
return -FI_EINVAL;
_av = calloc(1, sizeof(*_av));
if (!_av)
return -FI_ENOMEM;
_av->av_fid.fid.fclass = FI_CLASS_AV;
_av->av_fid.fid.context = context;
_av->av_fid.fid.ops = &sock_av_fi_ops;
_av->av_fid.ops = &sock_am_ops;
*av = _av;
if (attr->rx_ctx_bits > SOCK_EP_MAX_CTX_BITS) {
SOCK_LOG_ERROR("Invalid rx_ctx_bits\n");
return -FI_EINVAL;
}
return 0;
}
#endif
int sock_av_open(struct fid_domain *domain, struct fi_av_attr *attr,
struct fid_av **av, void *context)
{
struct sock_domain *dom;
struct sock_av *_av;
if (attr->flags)
return -FI_ENOSYS;
if (attr->rx_ctx_bits > SOCK_EP_MAX_CTX_BITS) {
SOCK_LOG_ERROR("Invalid rx_ctx_bits\n");
return -EINVAL;
}
size_t table_sz, i;
uint64_t flags = O_RDWR;
if (!attr || sock_verify_av_attr(attr))
return -FI_EINVAL;
dom = container_of(domain, struct sock_domain, dom_fid);
_av = calloc(1, sizeof(*_av));
if (!_av)
return -FI_ENOMEM;
_av->attr = *attr;
_av->attr.count = (attr->count) ? attr->count : SOCK_AV_DEF_SZ;
_av->key = calloc(_av->attr.count, sizeof(uint16_t));
if (!_av->key) {
free(_av);
return -FI_ENOMEM;
}
table_sz = sizeof(struct sock_av_table_hdr) +
_av->attr.count * sizeof(struct sock_av_addr);
if (attr->name) {
_av->name = calloc(1, FI_NAME_MAX);
if(!_av->name)
return -FI_ENOMEM;
strcpy(_av->name, attr->name);
if (!(attr->flags & FI_READ))
flags |= O_CREAT;
for (i = 0; i < strlen(_av->name); i ++)
if (_av->name[i] == ' ')
_av->name[i] = '_';
SOCK_LOG_INFO("Creating shm segment :%s (size: %lu)\n",
_av->name, table_sz);
_av->shared_fd = shm_open(_av->name, flags, S_IRUSR | S_IWUSR);
if (_av->shared_fd < 0) {
SOCK_LOG_ERROR("shm_open failed\n");
free(_av);
return -FI_EINVAL;
}
if (ftruncate(_av->shared_fd, table_sz) == -1) {
SOCK_LOG_ERROR("ftruncate failed\n");
free(_av);
shm_unlink(_av->name);
return -FI_EINVAL;
}
_av->table_hdr = mmap(NULL, table_sz, PROT_READ | PROT_WRITE,
MAP_SHARED, _av->shared_fd, 0);
if (attr->flags & FI_READ) {
if (_av->table_hdr->size != _av->attr.count)
return -FI_EINVAL;
} else {
_av->table_hdr->size = _av->attr.count;
_av->table_hdr->stored = 0;
}
if (_av->table_hdr == MAP_FAILED) {
SOCK_LOG_ERROR("mmap failed\n");
free(_av);
shm_unlink(_av->name);
return -FI_EINVAL;
}
} else {
_av->table_hdr = calloc(1, table_sz);
if (!_av->table_hdr)
return -FI_ENOMEM;
_av->table_hdr->size = _av->attr.count;
_av->table_hdr->req_sz = attr->count;
}
_av->table = (struct sock_av_addr*)((char*)_av->table_hdr +
sizeof(struct sock_av_table_hdr));
_av->av_fid.fid.fclass = FI_CLASS_AV;
_av->av_fid.fid.context = context;
_av->av_fid.fid.ops = &sock_av_fi_ops;
switch (attr->type) {
case FI_AV_MAP:
// ret = sock_open_am(dom, attr, &_av, context);
_av->av_fid.ops = &sock_am_ops;
break;
case FI_AV_TABLE:
@ -408,8 +590,8 @@ int sock_av_open(struct fid_domain *domain, struct fi_av_attr *attr,
goto err;
}
_av->rx_ctx_bits = attr->rx_ctx_bits;
_av->mask = ((uint64_t)1<<(64 - attr->rx_ctx_bits + 1))-1;
_av->attr = *attr;
_av->mask = attr->rx_ctx_bits ?
((uint64_t)1<<(64 - attr->rx_ctx_bits + 1))-1 : ~0;
*av = &_av->av_fid;
return 0;
err:

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -275,6 +275,7 @@ int sock_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
struct sock_fid_list *list_entry;
struct sock_wait *wait;
dom = container_of(domain, struct sock_domain, dom_fid);
if (attr && sock_cntr_verify_attr(attr))
return -FI_ENOSYS;
@ -302,7 +303,8 @@ int sock_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
case FI_WAIT_FD:
wait_attr.flags = 0;
wait_attr.wait_obj = FI_WAIT_FD;
ret = sock_wait_open(domain, &wait_attr, &_cntr->waitset);
ret = sock_wait_open(&dom->fab->fab_fid, &wait_attr,
&_cntr->waitset);
if (ret)
goto err1;
_cntr->signal = 1;
@ -338,7 +340,6 @@ int sock_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
_cntr->cntr_fid.fid.ops = &sock_cntr_fi_ops;
_cntr->cntr_fid.ops = &sock_cntr_ops;
dom = container_of(domain, struct sock_domain, dom_fid);
atomic_inc(&dom->ref);
_cntr->domain = dom;
*cntr = &_cntr->cntr_fid;

Просмотреть файл

@ -63,7 +63,7 @@ static ssize_t sock_comm_send_socket(struct sock_conn *conn, const void *buf, si
while(rem > 0) {
len = MIN(rem, SOCK_COMM_BUF_SZ);
ret = send(conn->sock_fd, buf + offset, len, 0);
ret = send(conn->sock_fd, (char *)buf + offset, len, 0);
if (ret <= 0)
break;
@ -190,6 +190,16 @@ ssize_t sock_comm_recv(struct sock_conn *conn, void *buf, size_t len)
return ret + read_len;
}
ssize_t sock_comm_peek(struct sock_conn *conn, void *buf, size_t len)
{
sock_comm_recv_buffer(conn);
if (rbused(&conn->inbuf) >= len) {
rbpeek(&conn->inbuf, buf, len);
return len;
}
return 0;
}
int sock_comm_buffer_init(struct sock_conn *conn)
{
uint64_t flags;

Просмотреть файл

@ -48,6 +48,7 @@
#include <arpa/inet.h>
#include <net/if.h>
#include <ifaddrs.h>
#include <poll.h>
#include "sock.h"
#include "sock_util.h"
@ -97,24 +98,29 @@ struct sock_conn *sock_conn_map_lookup_key(struct sock_conn_map *conn_map,
return &conn_map->table[key-1];
}
uint16_t sock_conn_map_match_or_connect(struct sock_conn_map *map, struct
sockaddr_in *addr, int match_only)
#define SOCK_ADDR_IN_PTR(sa)((struct sockaddr_in *)(sa))
#define SOCK_ADDR_IN_FAMILY(sa)SOCK_ADDR_IN_PTR(sa)->sin_family
#define SOCK_ADDR_IN_PORT(sa)SOCK_ADDR_IN_PTR(sa)->sin_port
#define SOCK_ADDR_IN_ADDR(sa)SOCK_ADDR_IN_PTR(sa)->sin_addr
uint16_t sock_conn_map_match_or_connect(struct sock_domain *dom,
struct sock_conn_map *map,
struct sockaddr_in *addr, int match_only)
{
int i, conn_fd, arg, optval;
socklen_t optlen;
char entry_ip[INET_ADDRSTRLEN];
char sa_ip[INET_ADDRSTRLEN];
struct sockaddr_in *entry;
struct timeval tv;
fd_set fds;
struct sock_conn *conn;
memcpy(sa_ip, inet_ntoa(addr->sin_addr), INET_ADDRSTRLEN);
/* match */
for (i=0; i < map->used; i++) {
entry = (struct sockaddr_in *)&map->table[i].addr;
memcpy(entry_ip, inet_ntoa(entry->sin_addr), INET_ADDRSTRLEN);
if(!strcmp(entry_ip, sa_ip)) {
entry = (struct sockaddr_in *)&(map->table[i].addr);
if ((SOCK_ADDR_IN_ADDR(entry).s_addr ==
SOCK_ADDR_IN_ADDR(addr).s_addr) &&
(SOCK_ADDR_IN_PORT(entry) == SOCK_ADDR_IN_PORT(addr))) {
return i+1;
}
}
@ -128,7 +134,25 @@ uint16_t sock_conn_map_match_or_connect(struct sock_conn_map *map, struct
SOCK_LOG_ERROR("failed to create conn_fd, errno: %d\n", errno);
return 0;
}
optval = 1;
setsockopt(conn_fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval);
optval = 1;
setsockopt(conn_fd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof optval);
fcntl(conn_fd, F_SETFL, O_NONBLOCK);
memcpy(sa_ip, inet_ntoa(addr->sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("Connecting to: %s:%d\n",
sa_ip, ntohs(((struct sockaddr_in*)addr)->sin_port));
if (bind(conn_fd, (struct sockaddr*)&dom->src_addr,
sizeof(struct sockaddr_in)) != 0) {
SOCK_LOG_ERROR("Cannot bind to src_addr\n");
return 0;
}
SOCK_LOG_INFO("Binding conn_fd to port: %d\n",
ntohs(((struct sockaddr_in*)&dom->src_addr)->sin_port));
if (connect(conn_fd, addr, sizeof *addr) < 0) {
if (errno == EINPROGRESS) {
@ -173,7 +197,6 @@ uint16_t sock_conn_map_match_or_connect(struct sock_conn_map *map, struct
map->used++;
return map->used;
}
static void * _sock_conn_listen(void *arg)
@ -182,48 +205,85 @@ static void * _sock_conn_listen(void *arg)
struct sock_conn_map *map = &domain->r_cmap;
struct addrinfo *s_res = NULL, *p;
struct addrinfo hints;
int optval;
int optval, flags, tmp;
int listen_fd = 0, conn_fd;
struct sockaddr_in remote;
socklen_t addr_size;
struct sock_conn *conn;
struct pollfd poll_fds[2];
char service[NI_MAXSERV];
struct sockaddr_in addr;
char sa_ip[INET_ADDRSTRLEN];
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
if(getaddrinfo(NULL, domain->service, &hints, &s_res)) {
sprintf(service, "%d", domain->service);
if(getaddrinfo(NULL, service, &hints, &s_res)) {
SOCK_LOG_ERROR("no available AF_INET address\n");
perror("no available AF_INET address");
return NULL;
}
SOCK_LOG_INFO("Binding listener thread to port: %d\n", domain->service);
for (p=s_res; p; p=p->ai_next) {
listen_fd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (listen_fd >= 0) {
flags = fcntl(listen_fd, F_GETFL, 0);
fcntl(listen_fd, F_SETFL, flags | O_NONBLOCK);
optval = 1;
setsockopt(listen_fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof
optval);
optval = 1;
setsockopt(listen_fd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof
optval);
if (!bind(listen_fd, s_res->ai_addr, s_res->ai_addrlen))
break;
close(listen_fd);
listen_fd = -1;
}
}
freeaddrinfo(s_res);
if (listen_fd < 0) {
SOCK_LOG_ERROR("failed to listen to port: %s\n", domain->service);
SOCK_LOG_ERROR("failed to listen to port: %d\n", domain->service);
goto err;
}
if (domain->service == 0) {
addr_size = sizeof(struct sockaddr_in);
if (getsockname(listen_fd, (struct sockaddr*)&addr, &addr_size))
goto err;
domain->service = ntohs(addr.sin_port);
SOCK_LOG_INFO("Bound to port: %d\n", domain->service);
}
if (listen(listen_fd, 128)) {
SOCK_LOG_ERROR("failed to listen socket: %d\n", errno);
goto err;
}
while(domain->listening) {
((struct sockaddr_in*)&(domain->src_addr))->sin_port =
htons(domain->service);
domain->listening = 1;
poll_fds[0].fd = listen_fd;
poll_fds[1].fd = domain->signal_fds[1];
poll_fds[0].events = poll_fds[1].events = POLLIN;
while(domain->listening) {
if (poll(poll_fds, 2, -1) > 0) {
if (poll_fds[1].revents & POLLIN) {
read(domain->signal_fds[1], &tmp, 1);
continue;
}
} else
goto err;
addr_size = sizeof(struct sockaddr_in);
conn_fd = accept(listen_fd, (struct sockaddr *)&remote, &addr_size);
SOCK_LOG_INFO("CONN: accepted conn-req: %d\n", conn_fd);
@ -231,6 +291,12 @@ static void * _sock_conn_listen(void *arg)
SOCK_LOG_ERROR("failed to accept: %d\n", errno);
goto err;
}
addr_size = sizeof(struct sockaddr_in);
getpeername(conn_fd, &remote, &addr_size);
memcpy(sa_ip, inet_ntoa(remote.sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("ACCEPT: %s, %d\n", sa_ip, ntohs(remote.sin_port));
/* TODO: lock for multi-threads */
if ((map->size - map->used) == 0) {
@ -257,7 +323,6 @@ err:
int sock_conn_listen(struct sock_domain *domain)
{
_init_map(&domain->r_cmap, 128); /* TODO: init cmap size */
domain->listening = 1;
pthread_create(&domain->listen_thread, 0, _sock_conn_listen, domain);
return 0;
}

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -488,7 +488,6 @@ int sock_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
sock_cq->cq_fid.fid.context = context;
sock_cq->cq_fid.fid.ops = &sock_cq_fi_ops;
sock_cq->cq_fid.ops = &sock_cq_ops;
atomic_inc(&sock_dom->ref);
if (attr == NULL)
sock_cq->attr = _sock_cq_def_attr;
@ -529,7 +528,7 @@ int sock_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
case FI_WAIT_MUTEX_COND:
wait_attr.flags = 0;
wait_attr.wait_obj = FI_WAIT_MUTEX_COND;
ret = sock_wait_open(&sock_dom->dom_fid, &wait_attr,
ret = sock_wait_open(&sock_dom->fab->fab_fid, &wait_attr,
&sock_cq->waitset);
if (ret)
goto err3;
@ -585,9 +584,9 @@ int sock_cq_report_error(struct sock_cq *cq, struct sock_pe_entry *entry,
err_entry.op_context = (void*)entry->context;
if (entry->type == SOCK_PE_RX) {
err_entry.buf = (void*)entry->rx.rx_iov[0].iov.addr;
err_entry.buf = (void*)entry->pe.rx.rx_iov[0].iov.addr;
}else {
err_entry.buf = (void*)entry->tx.tx_iov[0].src.iov.addr;
err_entry.buf = (void*)entry->pe.tx.data.tx_iov[0].src.iov.addr;
}
rbwrite(&cq->cqerr_rb, &err_entry, sizeof(struct fi_cq_err_entry));

Просмотреть файл

@ -95,12 +95,12 @@ static struct sock_tx_ctx *sock_tx_context_alloc(struct fi_tx_attr *attr,
switch (fclass) {
case FI_CLASS_TX_CTX:
tx_ctx->ctx.fid.fclass = FI_CLASS_TX_CTX;
tx_ctx->ctx.fid.context = context;
tx_ctx->fid.ctx.fid.fclass = FI_CLASS_TX_CTX;
tx_ctx->fid.ctx.fid.context = context;
break;
case FI_CLASS_STX_CTX:
tx_ctx->stx.fid.fclass = FI_CLASS_TX_CTX;
tx_ctx->stx.fid.context = context;
tx_ctx->fid.stx.fid.fclass = FI_CLASS_TX_CTX;
tx_ctx->fid.stx.fid.context = context;
break;
default:
goto err;

Просмотреть файл

@ -69,7 +69,9 @@ int sock_verify_domain_attr(struct fi_domain_attr *attr)
switch(attr->threading){
case FI_THREAD_UNSPEC:
case FI_THREAD_SAFE:
case FI_THREAD_PROGRESS:
case FI_THREAD_FID:
case FI_THREAD_DOMAIN:
case FI_THREAD_COMPLETION:
break;
default:
SOCK_LOG_INFO("Invalid threading model!\n");
@ -117,6 +119,7 @@ static int sock_dom_close(struct fid *fid)
{
struct sock_domain *dom;
void *res;
int c;
dom = container_of(fid, struct sock_domain, dom_fid.fid);
if (atomic_get(&dom->ref)) {
@ -124,6 +127,7 @@ static int sock_dom_close(struct fid *fid)
}
dom->listening = 0;
write(dom->signal_fds[0], &c, 1);
if (pthread_join(dom->listen_thread, &res)) {
SOCK_LOG_ERROR("could not join listener thread, errno = %d\n", errno);
return -FI_EBUSY;
@ -283,7 +287,7 @@ static int sock_regattr(struct fid_domain *domain, const struct fi_mr_attr *attr
if (dom->mr_eq) {
eq_entry.fid = &domain->fid;
eq_entry.context = attr->context;
return sock_eq_report_event(dom->mr_eq, FI_COMPLETE,
return sock_eq_report_event(dom->mr_eq, FI_MR_COMPLETE,
&eq_entry, sizeof(eq_entry), 0);
}
@ -386,7 +390,6 @@ static struct fi_ops_domain sock_dom_ops = {
.endpoint = sock_endpoint,
.scalable_ep = sock_scalable_ep,
.cntr_open = sock_cntr_open,
.wait_open = sock_wait_open,
.poll_open = sock_poll_open,
.stx_ctx = sock_stx_ctx,
.srx_ctx = sock_srx_ctx,
@ -402,7 +405,8 @@ static struct fi_ops_mr sock_dom_mr_ops = {
int sock_domain(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **dom, void *context)
{
int ret;
int ret, flags;
char service[NI_MAXSERV];
struct sock_domain *sock_domain;
if(info && info->domain_attr){
@ -420,13 +424,14 @@ int sock_domain(struct fid_fabric *fabric, struct fi_info *info,
if(info && info->src_addr) {
if (getnameinfo(info->src_addr, info->src_addrlen, NULL, 0,
sock_domain->service,
sizeof(sock_domain->service),
NI_NUMERICSERV)) {
service, sizeof(service), NI_NUMERICSERV)) {
SOCK_LOG_ERROR("could not resolve src_addr\n");
goto err;
}
sock_domain->service = atoi(service);
sock_domain->info = *info;
memcpy(&sock_domain->src_addr, info->src_addr,
sizeof(struct sockaddr_in));
} else {
SOCK_LOG_ERROR("invalid fi_info\n");
goto err;
@ -453,8 +458,16 @@ int sock_domain(struct fid_fabric *fabric, struct fi_info *info,
sock_domain->r_cmap.domain = sock_domain;
sock_domain->u_cmap.domain = sock_domain;
if(socketpair(AF_UNIX, SOCK_STREAM, 0, sock_domain->signal_fds) < 0)
goto err;
flags = fcntl(sock_domain->signal_fds[1], F_GETFL, 0);
fcntl(sock_domain->signal_fds[1], F_SETFL, flags | O_NONBLOCK);
sock_conn_listen(sock_domain);
while(!(volatile int)sock_domain->listening)
pthread_yield();
*dom = &sock_domain->dom_fid;
return 0;

Просмотреть файл

@ -49,7 +49,6 @@ extern struct fi_ops_cm sock_ep_cm_ops;
extern struct fi_ops_ep sock_ep_ops;
extern struct fi_ops sock_ep_fi_ops;
extern struct fi_ops_ep sock_ctx_ep_ops;
extern struct fi_ops sock_ctx_ops;
extern const struct fi_domain_attr sock_domain_attr;
extern const struct fi_fabric_attr sock_fabric_attr;
@ -57,45 +56,53 @@ extern const struct fi_fabric_attr sock_fabric_attr;
extern const char const sock_fab_name[];
extern const char const sock_dom_name[];
static void sock_dequeue_tx_ctx(struct sock_tx_ctx *tx_ctx)
{
fastlock_acquire(&tx_ctx->domain->pe->lock);
dlist_remove(&tx_ctx->pe_entry);
fastlock_release(&tx_ctx->domain->pe->lock);
}
static void sock_dequeue_rx_ctx(struct sock_rx_ctx *rx_ctx)
{
fastlock_acquire(&rx_ctx->domain->pe->lock);
dlist_remove(&rx_ctx->pe_entry);
fastlock_release(&rx_ctx->domain->pe->lock);
}
static int sock_ctx_close(struct fid *fid)
{
struct sock_ep *ep;
struct dlist_entry *entry;
struct sock_tx_ctx *tx_ctx;
struct sock_rx_ctx *rx_ctx;
switch (fid->fclass) {
case FI_CLASS_TX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, ctx.fid);
for (entry = tx_ctx->ep_list.next; entry != &tx_ctx->ep_list;
entry = entry->next) {
ep = container_of(entry, struct sock_ep, tx_ctx_entry);
atomic_dec(&ep->num_tx_ctx);
}
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.ctx.fid);
sock_dequeue_tx_ctx(tx_ctx);
atomic_dec(&tx_ctx->ep->num_rx_ctx);
atomic_dec(&tx_ctx->domain->ref);
sock_tx_ctx_free(tx_ctx);
break;
case FI_CLASS_RX_CTX:
rx_ctx = container_of(fid, struct sock_rx_ctx, ctx.fid);
for (entry = rx_ctx->ep_list.next; entry != &rx_ctx->ep_list;
entry = entry->next) {
ep = container_of(entry, struct sock_ep, rx_ctx_entry);
atomic_dec(&ep->num_rx_ctx);
}
sock_dequeue_rx_ctx(rx_ctx);
atomic_dec(&rx_ctx->ep->num_rx_ctx);
atomic_dec(&rx_ctx->domain->ref);
sock_rx_ctx_free(rx_ctx);
break;
case FI_CLASS_STX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, stx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.stx.fid);
atomic_dec(&tx_ctx->domain->ref);
sock_dequeue_tx_ctx(tx_ctx);
sock_tx_ctx_free(tx_ctx);
break;
case FI_CLASS_SRX_CTX:
rx_ctx = container_of(fid, struct sock_rx_ctx, ctx.fid);
atomic_dec(&rx_ctx->domain->ref);
sock_dequeue_rx_ctx(rx_ctx);
sock_rx_ctx_free(rx_ctx);
break;
@ -115,7 +122,7 @@ static int sock_ctx_bind_cq(struct fid *fid, struct fid *bfid, uint64_t flags)
sock_cq = container_of(bfid, struct sock_cq, cq_fid.fid);
switch (fid->fclass) {
case FI_CLASS_TX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, ctx);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.ctx);
if (flags & FI_SEND) {
tx_ctx->comp.send_cq = sock_cq;
if (flags & FI_COMPLETION)
@ -169,7 +176,7 @@ static int sock_ctx_bind_cq(struct fid *fid, struct fid *bfid, uint64_t flags)
break;
case FI_CLASS_STX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, stx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.stx.fid);
if (flags & FI_SEND) {
tx_ctx->comp.send_cq = sock_cq;
if (flags & FI_COMPLETION)
@ -211,7 +218,7 @@ static int sock_ctx_bind_cntr(struct fid *fid, struct fid *bfid, uint64_t flags)
cntr = container_of(bfid, struct sock_cntr, cntr_fid.fid);
switch (fid->fclass) {
case FI_CLASS_TX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, ctx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.ctx.fid);
if (flags & FI_SEND)
tx_ctx->comp.send_cntr = cntr;
@ -248,7 +255,7 @@ static int sock_ctx_bind_cntr(struct fid *fid, struct fid *bfid, uint64_t flags)
break;
case FI_CLASS_STX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, ctx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.ctx.fid);
if (flags & FI_SEND)
tx_ctx->comp.send_cntr = cntr;
@ -296,7 +303,7 @@ static int sock_ctx_control(struct fid *fid, int command, void *arg)
switch (fid->fclass) {
case FI_CLASS_TX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, ctx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.ctx.fid);
switch (command) {
case FI_GETOPSFLAG:
*(uint64_t*)arg = tx_ctx->attr.op_flags;
@ -324,7 +331,7 @@ static int sock_ctx_control(struct fid *fid, int command, void *arg)
break;
case FI_CLASS_STX_CTX:
tx_ctx = container_of(fid, struct sock_tx_ctx, stx.fid);
tx_ctx = container_of(fid, struct sock_tx_ctx, fid.stx.fid);
switch (command) {
case FI_GETOPSFLAG:
*(uint64_t*)arg = tx_ctx->attr.op_flags;
@ -344,7 +351,7 @@ static int sock_ctx_control(struct fid *fid, int command, void *arg)
return 0;
}
struct fi_ops sock_ctx_ops = {
static struct fi_ops sock_ctx_ops = {
.size = sizeof(struct fi_ops),
.close = sock_ctx_close,
.bind = sock_ctx_bind,
@ -363,7 +370,7 @@ static int sock_ctx_enable(struct fid_ep *ep)
return 0;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx.fid);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx.fid);
tx_ctx->enabled = 1;
return 0;
@ -425,7 +432,7 @@ static ssize_t sock_ep_cancel(fid_t fid, void *context)
switch (fid->fclass) {
case FI_CLASS_EP:
sock_ep = container_of(fid, struct sock_ep, ep.fid);
sock_ep = container_of(fid, struct sock_ep, fid.ep.fid);
rx_ctx = sock_ep->rx_ctx;
break;
@ -472,16 +479,38 @@ struct fi_ops_ep sock_ctx_ep_ops = {
static int sock_ep_close(struct fid *fid)
{
struct sock_ep *sock_ep;
sock_ep = container_of(fid, struct sock_ep, ep.fid);
switch(fid->fclass) {
case FI_CLASS_EP:
sock_ep = container_of(fid, struct sock_ep, fid.ep.fid);
break;
case FI_CLASS_SEP:
sock_ep = container_of(fid, struct sock_ep, fid.sep.fid);
break;
case FI_CLASS_PEP:
sock_ep = container_of(fid, struct sock_ep, fid.pep.fid);
break;
default:
return -FI_EINVAL;
}
if (atomic_get(&sock_ep->ref) || atomic_get(&sock_ep->num_rx_ctx) ||
atomic_get(&sock_ep->num_tx_ctx))
return -FI_EBUSY;
if (sock_ep->tx_array[sock_ep->ep_attr.tx_ctx_cnt])
sock_tx_ctx_free(sock_ep->tx_array[sock_ep->ep_attr.tx_ctx_cnt]);
if (sock_ep->rx_array[sock_ep->ep_attr.rx_ctx_cnt])
sock_rx_ctx_free(sock_ep->rx_array[sock_ep->ep_attr.rx_ctx_cnt]);
if (sock_ep->fclass != FI_CLASS_SEP &&
sock_ep->ep_attr.tx_ctx_cnt != FI_SHARED_CONTEXT) {
sock_dequeue_tx_ctx(sock_ep->tx_array[0]);
sock_tx_ctx_free(sock_ep->tx_array[0]);
}
if (sock_ep->fclass != FI_CLASS_SEP &&
sock_ep->ep_attr.rx_ctx_cnt != FI_SHARED_CONTEXT) {
sock_dequeue_rx_ctx(sock_ep->rx_array[0]);
sock_rx_ctx_free(sock_ep->rx_array[0]);
}
free(sock_ep->tx_array);
free(sock_ep->rx_array);
@ -491,6 +520,7 @@ static int sock_ep_close(struct fid *fid)
if (sock_ep->dest_addr)
free(sock_ep->dest_addr);
atomic_dec(&sock_ep->domain->ref);
free(sock_ep);
return 0;
}
@ -499,17 +529,36 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
{
int ret, i;
struct sock_ep *ep;
struct sock_eq *eq;
struct sock_cq *cq;
struct sock_av *av;
struct sock_cntr *cntr;
struct sock_tx_ctx *tx_ctx;
struct sock_rx_ctx *rx_ctx;
ep = container_of(fid, struct sock_ep, ep.fid);
switch(fid->fclass) {
case FI_CLASS_EP:
ep = container_of(fid, struct sock_ep, fid.ep.fid);
break;
case FI_CLASS_SEP:
ep = container_of(fid, struct sock_ep, fid.sep.fid);
break;
case FI_CLASS_PEP:
ep = container_of(fid, struct sock_ep, fid.pep.fid);
break;
default:
return -FI_EINVAL;
}
switch (bfid->fclass) {
case FI_CLASS_EQ:
return -FI_EINVAL;
eq = container_of(bfid, struct sock_eq, eq.fid);
ep->eq = eq;
if ((eq->attr.wait_obj == FI_WAIT_FD) && (eq->wait_fd < 0))
sock_eq_openwait(eq, (char *)&ep->domain->service);
break;
case FI_CLASS_MR:
return -FI_EINVAL;
@ -555,13 +604,13 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
}
if (flags & FI_SEND || flags & FI_WRITE || flags & FI_READ) {
for (i=0; i<=ep->ep_attr.tx_ctx_cnt; i++) {
for (i=0; i < ep->ep_attr.tx_ctx_cnt; i++) {
tx_ctx = ep->tx_array[i];
if (!tx_ctx)
continue;
if ((ret = sock_ctx_bind_cq(&tx_ctx->ctx.fid,
if ((ret = sock_ctx_bind_cq(&tx_ctx->fid.ctx.fid,
bfid, flags)))
return ret;
}
@ -569,7 +618,7 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
if (flags & FI_RECV || flags & FI_REMOTE_READ ||
flags & FI_REMOTE_WRITE) {
for (i=0; i<=ep->ep_attr.rx_ctx_cnt; i++) {
for (i = 0; i < ep->ep_attr.rx_ctx_cnt; i++) {
rx_ctx = ep->rx_array[i];
if (!rx_ctx)
@ -605,13 +654,13 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
ep->comp.rem_write_cntr = cntr;
if (flags & FI_SEND || flags & FI_WRITE || flags & FI_READ) {
for (i=0; i<=ep->ep_attr.tx_ctx_cnt; i++) {
for (i = 0; i < ep->ep_attr.tx_ctx_cnt; i++) {
tx_ctx = ep->tx_array[i];
if (!tx_ctx)
continue;
if ((ret = sock_ctx_bind_cntr(&tx_ctx->ctx.fid,
if ((ret = sock_ctx_bind_cntr(&tx_ctx->fid.ctx.fid,
bfid, flags)))
return ret;
}
@ -619,7 +668,7 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
if (flags & FI_RECV || flags & FI_REMOTE_READ ||
flags & FI_REMOTE_WRITE) {
for (i=0; i<=ep->ep_attr.rx_ctx_cnt; i++) {
for (i = 0; i < ep->ep_attr.rx_ctx_cnt; i++) {
rx_ctx = ep->rx_array[i];
if (!rx_ctx)
@ -640,7 +689,7 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
av->cmap = &av->domain->r_cmap;
if (ep->tx_ctx &&
ep->tx_ctx->ctx.fid.fclass == FI_CLASS_TX_CTX) {
ep->tx_ctx->fid.ctx.fid.fclass == FI_CLASS_TX_CTX) {
ep->tx_ctx->av = av;
}
@ -648,12 +697,12 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
ep->rx_ctx->ctx.fid.fclass == FI_CLASS_RX_CTX)
ep->rx_ctx->av = av;
for (i=0; i<ep->ep_attr.tx_ctx_cnt; i++) {
for (i = 0; i < ep->ep_attr.tx_ctx_cnt; i++) {
if (ep->tx_array[i])
ep->tx_array[i]->av = av;
}
for (i=0; i<ep->ep_attr.rx_ctx_cnt; i++) {
for (i = 0; i < ep->ep_attr.rx_ctx_cnt; i++) {
if (ep->rx_array[i])
ep->rx_array[i]->av = av;
}
@ -661,17 +710,17 @@ static int sock_ep_bind(struct fid *fid, struct fid *bfid, uint64_t flags)
break;
case FI_CLASS_STX_CTX:
tx_ctx = container_of(bfid, struct sock_tx_ctx, stx.fid);
tx_ctx = container_of(bfid, struct sock_tx_ctx, fid.stx.fid);
dlist_insert_tail(&ep->tx_ctx_entry, &tx_ctx->ep_list);
ep->tx_ctx = tx_ctx;
ep->tx_array[ep->ep_attr.tx_ctx_cnt] = tx_ctx;
ep->tx_array[0] = tx_ctx;
break;
case FI_CLASS_SRX_CTX:
rx_ctx = container_of(bfid, struct sock_rx_ctx, ctx);
dlist_insert_tail(&ep->rx_ctx_entry, &rx_ctx->ep_list);
ep->rx_ctx = rx_ctx;
ep->rx_array[ep->ep_attr.rx_ctx_cnt] = rx_ctx;
ep->rx_array[0] = rx_ctx;
break;
default:
@ -685,7 +734,22 @@ static int sock_ep_control(struct fid *fid, int command, void *arg)
{
struct fi_alias *alias;
struct sock_ep *ep, *new_ep;
ep = container_of(fid, struct sock_ep, ep.fid);
switch(fid->fclass) {
case FI_CLASS_EP:
ep = container_of(fid, struct sock_ep, fid.ep.fid);
break;
case FI_CLASS_SEP:
ep = container_of(fid, struct sock_ep, fid.sep.fid);
break;
case FI_CLASS_PEP:
ep = container_of(fid, struct sock_ep, fid.pep.fid);
break;
default:
return -FI_EINVAL;
}
switch (command) {
case FI_ALIAS:
@ -695,7 +759,7 @@ static int sock_ep_control(struct fid *fid, int command, void *arg)
return -FI_ENOMEM;
*new_ep = *ep;
new_ep->op_flags = alias->flags;
*alias->fid = &new_ep->ep.fid;
*alias->fid = &new_ep->fid.ep.fid;
break;
case FI_GETOPSFLAG:
@ -726,22 +790,22 @@ static int sock_ep_enable(struct fid_ep *ep)
int i;
struct sock_ep *sock_ep;
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
if (sock_ep->tx_ctx &&
sock_ep->tx_ctx->ctx.fid.fclass == FI_CLASS_TX_CTX)
sock_ep->tx_ctx->fid.ctx.fid.fclass == FI_CLASS_TX_CTX)
sock_ep->tx_ctx->enabled = 1;
if (sock_ep->rx_ctx &&
sock_ep->rx_ctx->ctx.fid.fclass == FI_CLASS_RX_CTX)
sock_ep->rx_ctx->enabled = 1;
for (i=0; i<sock_ep->ep_attr.tx_ctx_cnt; i++) {
for (i = 0; i < sock_ep->ep_attr.tx_ctx_cnt; i++) {
if (sock_ep->tx_array[i])
sock_ep->tx_array[i]->enabled = 1;
}
for (i=0; i<sock_ep->ep_attr.rx_ctx_cnt; i++) {
for (i = 0; i < sock_ep->ep_attr.rx_ctx_cnt; i++) {
if (sock_ep->rx_array[i])
sock_ep->rx_array[i]->enabled = 1;
}
@ -752,7 +816,7 @@ static int sock_ep_getopt(fid_t fid, int level, int optname,
void *optval, size_t *optlen)
{
struct sock_ep *sock_ep;
sock_ep = container_of(fid, struct sock_ep, ep.fid);
sock_ep = container_of(fid, struct sock_ep, fid.ep.fid);
if (level != FI_OPT_ENDPOINT)
return -ENOPROTOOPT;
@ -774,7 +838,7 @@ static int sock_ep_setopt(fid_t fid, int level, int optname,
{
int i;
struct sock_ep *sock_ep;
sock_ep = container_of(fid, struct sock_ep, ep.fid);
sock_ep = container_of(fid, struct sock_ep, fid.ep.fid);
if (level != FI_OPT_ENDPOINT)
return -ENOPROTOOPT;
@ -803,7 +867,7 @@ static int sock_ep_tx_ctx(struct fid_sep *ep, int index, struct fi_tx_attr *attr
struct sock_ep *sock_ep;
struct sock_tx_ctx *tx_ctx;
sock_ep = container_of(ep, struct sock_ep, sep);
sock_ep = container_of(ep, struct sock_ep, fid.sep);
if (index >= sock_ep->ep_attr.tx_ctx_cnt)
return -FI_EINVAL;
@ -816,15 +880,17 @@ static int sock_ep_tx_ctx(struct fid_sep *ep, int index, struct fi_tx_attr *attr
tx_ctx->domain = sock_ep->domain;
dlist_insert_tail(&sock_ep->tx_ctx_entry, &tx_ctx->ep_list);
tx_ctx->ctx.ops = &sock_ctx_ep_ops;
tx_ctx->ctx.msg = &sock_ep_msg_ops;
tx_ctx->ctx.tagged = &sock_ep_tagged;
tx_ctx->ctx.rma = &sock_ep_rma;
tx_ctx->ctx.atomic = &sock_ep_atomic;
tx_ctx->fid.ctx.fid.ops = &sock_ctx_ops;
tx_ctx->fid.ctx.ops = &sock_ctx_ep_ops;
tx_ctx->fid.ctx.msg = &sock_ep_msg_ops;
tx_ctx->fid.ctx.tagged = &sock_ep_tagged;
tx_ctx->fid.ctx.rma = &sock_ep_rma;
tx_ctx->fid.ctx.atomic = &sock_ep_atomic;
*tx_ep = &tx_ctx->ctx;
*tx_ep = &tx_ctx->fid.ctx;
sock_ep->tx_array[index] = tx_ctx;
atomic_inc(&sock_ep->num_tx_ctx);
atomic_inc(&sock_ep->domain->ref);
return 0;
}
@ -834,7 +900,7 @@ static int sock_ep_rx_ctx(struct fid_sep *ep, int index, struct fi_rx_attr *attr
struct sock_ep *sock_ep;
struct sock_rx_ctx *rx_ctx;
sock_ep = container_of(ep, struct sock_ep, sep);
sock_ep = container_of(ep, struct sock_ep, fid.sep);
if (index >= sock_ep->ep_attr.rx_ctx_cnt)
return -FI_EINVAL;
@ -842,11 +908,15 @@ static int sock_ep_rx_ctx(struct fid_sep *ep, int index, struct fi_rx_attr *attr
if (!rx_ctx)
return -FI_ENOMEM;
rx_ctx->attr.total_buffered_recv = rx_ctx->attr.total_buffered_recv ?
rx_ctx->attr.total_buffered_recv : SOCK_EP_MAX_BUFF_RECV;
rx_ctx->rx_id = index;
rx_ctx->ep = sock_ep;
rx_ctx->domain = sock_ep->domain;
dlist_insert_tail(&sock_ep->rx_ctx_entry, &rx_ctx->ep_list);
rx_ctx->ctx.fid.ops = &sock_ctx_ops;
rx_ctx->ctx.ops = &sock_ctx_ep_ops;
rx_ctx->ctx.msg = &sock_ep_msg_ops;
rx_ctx->ctx.tagged = &sock_ep_tagged;
@ -855,6 +925,7 @@ static int sock_ep_rx_ctx(struct fid_sep *ep, int index, struct fi_rx_attr *attr
*rx_ep = &rx_ctx->ctx;
sock_ep->rx_array[index] = rx_ctx;
atomic_inc(&sock_ep->num_rx_ctx);
atomic_inc(&sock_ep->domain->ref);
return 0;
}
@ -868,33 +939,6 @@ struct fi_ops_ep sock_ep_ops ={
.rx_ctx = sock_ep_rx_ctx,
};
static int sock_ep_cm_getname(fid_t fid, void *addr, size_t *addrlen)
{
struct sock_ep *sock_ep;
if (*addrlen == 0) {
*addrlen = sizeof(struct sockaddr_in);
return -FI_ETOOSMALL;
}
sock_ep = container_of(fid, struct sock_ep, ep.fid);
*addrlen = MIN(*addrlen, sizeof(struct sockaddr_in));
memcpy(addr, sock_ep->src_addr, *addrlen);
return 0;
}
struct fi_ops_cm sock_ep_cm_ops = {
.size = sizeof(struct fi_ops_cm),
.getname = sock_ep_cm_getname,
.getpeer = fi_no_getpeer,
.connect = fi_no_connect,
.listen = fi_no_listen,
.accept = fi_no_accept,
.reject = fi_no_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
int sock_stx_ctx(struct fid_domain *domain,
struct fi_tx_attr *attr, struct fid_stx **stx, void *context)
{
@ -908,10 +952,11 @@ int sock_stx_ctx(struct fid_domain *domain,
return -FI_ENOMEM;
tx_ctx->domain = dom;
tx_ctx->stx.ops = sock_ep_ops;
tx_ctx->fid.stx.fid.ops = &sock_ctx_ops;
tx_ctx->fid.stx.ops = &sock_ep_ops;
atomic_inc(&dom->ref);
*stx = &tx_ctx->stx;
*stx = &tx_ctx->fid.stx;
return 0;
}
@ -928,7 +973,8 @@ int sock_srx_ctx(struct fid_domain *domain,
rx_ctx->domain = dom;
rx_ctx->ctx.fid.fclass = FI_CLASS_SRX_CTX;
rx_ctx->ctx.fid.ops = &sock_ctx_ops;
rx_ctx->ctx.ops = &sock_ctx_ep_ops;
rx_ctx->ctx.msg = &sock_ep_msg_ops;
rx_ctx->ctx.tagged = &sock_ep_tagged;
@ -967,19 +1013,8 @@ struct fi_info *sock_fi_info(enum fi_ep_type ep_type,
if (hints->caps)
_info->caps = hints->caps;
if (hints->ep_attr)
*(_info->ep_attr) = *hints->ep_attr;
if (hints->tx_attr)
*(_info->tx_attr) = *hints->tx_attr;
if (hints->rx_attr)
*(_info->rx_attr) = *hints->rx_attr;
*(_info->domain_attr) = hints->domain_attr ? *hints->domain_attr :
sock_domain_attr;
*(_info->fabric_attr) = hints->fabric_attr ? *hints->fabric_attr :
sock_fabric_attr;
*(_info->domain_attr) = sock_domain_attr;
*(_info->fabric_attr) = sock_fabric_attr;
_info->domain_attr->name = strdup(sock_dom_name);
_info->fabric_attr->name = strdup(sock_fab_name);
@ -1014,38 +1049,36 @@ int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
if (!sock_ep)
return -FI_ENOMEM;
atomic_init(&sock_ep->ref, 0);
switch (fclass) {
case FI_CLASS_EP:
sock_ep->ep.fid.fclass = FI_CLASS_EP;
sock_ep->ep.fid.context = context;
sock_ep->ep.fid.ops = &sock_ep_fi_ops;
sock_ep->fid.ep.fid.fclass = FI_CLASS_EP;
sock_ep->fid.ep.fid.context = context;
sock_ep->fid.ep.fid.ops = &sock_ep_fi_ops;
sock_ep->ep.ops = &sock_ep_ops;
sock_ep->ep.cm = &sock_ep_cm_ops;
sock_ep->ep.msg = &sock_ep_msg_ops;
sock_ep->ep.rma = &sock_ep_rma;
sock_ep->ep.tagged = &sock_ep_tagged;
sock_ep->ep.atomic = &sock_ep_atomic;
sock_ep->fid.ep.ops = &sock_ep_ops;
sock_ep->fid.ep.cm = &sock_ep_cm_ops;
sock_ep->fid.ep.msg = &sock_ep_msg_ops;
sock_ep->fid.ep.rma = &sock_ep_rma;
sock_ep->fid.ep.tagged = &sock_ep_tagged;
sock_ep->fid.ep.atomic = &sock_ep_atomic;
break;
case FI_CLASS_SEP:
sock_ep->sep.fid.fclass = FI_CLASS_SEP;
sock_ep->sep.fid.context = context;
sock_ep->sep.fid.ops = &sock_ep_fi_ops;
sock_ep->fid.sep.fid.fclass = FI_CLASS_SEP;
sock_ep->fid.sep.fid.context = context;
sock_ep->fid.sep.fid.ops = &sock_ep_fi_ops;
sock_ep->sep.ops = &sock_ep_ops;
sock_ep->sep.cm = &sock_ep_cm_ops;
sock_ep->fid.sep.ops = &sock_ep_ops;
sock_ep->fid.sep.cm = &sock_ep_cm_ops;
break;
case FI_CLASS_PEP:
sock_ep->pep.fid.fclass = FI_CLASS_SEP;
sock_ep->pep.fid.context = context;
sock_ep->pep.fid.ops = &sock_ep_fi_ops;
sock_ep->fid.pep.fid.fclass = FI_CLASS_SEP;
sock_ep->fid.pep.fid.context = context;
sock_ep->fid.pep.fid.ops = &sock_ep_fi_ops;
sock_ep->pep.ops = &sock_ep_ops;
sock_ep->pep.cm = &sock_ep_cm_ops;
sock_ep->fid.pep.ops = &sock_ep_ops;
sock_ep->fid.pep.cm = &sock_ep_cm_ops;
break;
default:
@ -1056,6 +1089,7 @@ int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
*ep = sock_ep;
if (info) {
sock_ep->ep_type = info->ep_type;
sock_ep->info.caps = info->caps;
sock_ep->info.addr_format = FI_SOCKADDR_IN;
@ -1063,6 +1097,8 @@ int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
sock_ep->src_addr = calloc(1, sizeof(struct sockaddr_in));
memcpy(sock_ep->src_addr, info->src_addr,
sizeof(struct sockaddr_in));
((struct sockaddr_in*)sock_ep->src_addr)->sin_port =
htons(sock_dom->service);
}
if (info->dest_addr) {
@ -1071,19 +1107,28 @@ int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
sizeof(struct sockaddr_in));
}
if (info->ep_attr)
if (info->ep_attr) {
sock_ep->ep_attr = *info->ep_attr;
sock_ep->ep_attr.total_buffered_recv =
sock_ep->ep_attr.total_buffered_recv ?
sock_ep->ep_attr.total_buffered_recv :
SOCK_EP_MAX_BUFF_RECV;
}
if (info->tx_attr) {
sock_ep->tx_attr = *info->tx_attr;
sock_ep->op_flags = info->tx_attr->op_flags;
sock_ep->tx_attr.size = sock_ep->tx_attr.size ?
sock_ep->tx_attr.size : SOCK_EP_MAX_TX_CTX_SZ;
sock_ep->tx_attr.size : SOCK_EP_MAX_TX_CTX_SZ;
}
if (info->rx_attr) {
sock_ep->rx_attr = *info->rx_attr;
sock_ep->op_flags |= info->rx_attr->op_flags;
sock_ep->rx_attr.total_buffered_recv =
sock_ep->rx_attr.total_buffered_recv ?
sock_ep->rx_attr.total_buffered_recv :
SOCK_EP_MAX_BUFF_RECV;
}
}
@ -1092,41 +1137,44 @@ int sock_alloc_endpoint(struct fid_domain *domain, struct fi_info *info,
atomic_init(&sock_ep->num_rx_ctx, 0);
if (sock_ep->fclass != FI_CLASS_SEP) {
sock_ep->ep_attr.tx_ctx_cnt = 0;
sock_ep->ep_attr.rx_ctx_cnt = 0;
sock_ep->ep_attr.tx_ctx_cnt = 1;
sock_ep->ep_attr.rx_ctx_cnt = 1;
}
if (sock_ep->ep_attr.tx_ctx_cnt != FI_SHARED_CONTEXT) {
sock_ep->tx_array = calloc(sock_ep->ep_attr.tx_ctx_cnt + 1,
sizeof(struct sock_tx_ctx *));
sock_ep->tx_array = calloc(sock_ep->ep_attr.tx_ctx_cnt,
sizeof(struct sock_tx_ctx *));
sock_ep->rx_array = calloc(sock_ep->ep_attr.rx_ctx_cnt,
sizeof(struct sock_rx_ctx *));
if (sock_ep->fclass != FI_CLASS_SEP &&
sock_ep->ep_attr.tx_ctx_cnt != FI_SHARED_CONTEXT) {
/* default tx ctx */
tx_ctx = sock_tx_ctx_alloc(&sock_ep->tx_attr, context);
tx_ctx->ep = sock_ep;
tx_ctx->domain = sock_dom;
tx_ctx->tx_id = sock_ep->ep_attr.tx_ctx_cnt;
tx_ctx->tx_id = 0;
dlist_insert_tail(&sock_ep->tx_ctx_entry, &tx_ctx->ep_list);
sock_ep->tx_array[sock_ep->ep_attr.tx_ctx_cnt] = tx_ctx;
sock_ep->tx_array[0] = tx_ctx;
sock_ep->tx_ctx = tx_ctx;
}
if (sock_ep->ep_attr.rx_ctx_cnt != FI_SHARED_CONTEXT) {
sock_ep->rx_array = calloc(sock_ep->ep_attr.rx_ctx_cnt + 1,
sizeof(struct sock_rx_ctx *));
if (sock_ep->fclass != FI_CLASS_SEP &&
sock_ep->ep_attr.rx_ctx_cnt != FI_SHARED_CONTEXT) {
/* default rx_ctx */
rx_ctx = sock_rx_ctx_alloc(&sock_ep->rx_attr, context);
rx_ctx->ep = sock_ep;
rx_ctx->domain = sock_dom;
rx_ctx->rx_id = sock_ep->ep_attr.rx_ctx_cnt;
rx_ctx->rx_id = 0;
dlist_insert_tail(&sock_ep->rx_ctx_entry, &rx_ctx->ep_list);
sock_ep->rx_array[sock_ep->ep_attr.rx_ctx_cnt] = rx_ctx;
sock_ep->rx_array[0] = rx_ctx;
sock_ep->rx_ctx = rx_ctx;
}
/* default config */
sock_ep->min_multi_recv = SOCK_EP_MIN_MULTI_RECV;
memcpy(&sock_ep->info, info, sizeof(struct fi_info));
sock_ep->domain = sock_dom;
atomic_inc(&sock_dom->ref);
return 0;
@ -1135,3 +1183,18 @@ err:
free(sock_ep);
return -FI_EAVAIL;
}
struct sock_conn *sock_ep_lookup_conn(struct sock_ep *ep)
{
if (!ep->key) {
ep->key = sock_conn_map_match_or_connect(
ep->domain, &ep->domain->r_cmap, ep->dest_addr, 0);
if (!ep->key) {
SOCK_LOG_ERROR("failed to match or connect to addr\n");
errno = EINVAL;
return NULL;
}
}
return sock_conn_map_lookup_key(&ep->domain->r_cmap, ep->key);
}

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -65,13 +65,13 @@ const struct fi_ep_attr sock_dgram_ep_attr = {
.max_order_waw_size = SOCK_EP_MAX_ORDER_WAW_SZ,
.mem_tag_format = SOCK_EP_MEM_TAG_FMT,
.msg_order = SOCK_EP_MSG_ORDER,
.tx_ctx_cnt = 0,
.rx_ctx_cnt = 0,
.tx_ctx_cnt = SOCK_EP_MAX_TX_CNT,
.rx_ctx_cnt = SOCK_EP_MAX_RX_CNT,
};
const struct fi_tx_attr sock_dgram_tx_attr = {
.caps = SOCK_EP_DGRAM_CAP,
.op_flags = SOCK_DEF_OPS,
.op_flags = SOCK_DGRAM_DEF_OPS,
.msg_order = SOCK_EP_MSG_ORDER,
.inject_size = SOCK_EP_MAX_INJECT_SZ,
.size = SOCK_EP_MAX_TX_CTX_SZ,
@ -80,7 +80,7 @@ const struct fi_tx_attr sock_dgram_tx_attr = {
const struct fi_rx_attr sock_dgram_rx_attr = {
.caps = SOCK_EP_DGRAM_CAP,
.op_flags = SOCK_DEF_OPS,
.op_flags = SOCK_DGRAM_DEF_OPS,
.msg_order = SOCK_EP_MSG_ORDER,
.total_buffered_recv = SOCK_EP_MAX_BUFF_RECV,
.size = SOCK_EP_MAX_MSG_SZ,
@ -336,11 +336,20 @@ int sock_dgram_getinfo(uint32_t version, const char *node, const char *service,
ret = FI_ENODATA;
goto err;
}
close(udp_sock);
freeaddrinfo(result);
}
if (hints->src_addr) {
assert(hints->src_addrlen == sizeof(struct sockaddr_in));
memcpy(src_addr, hints->src_addr, hints->src_addrlen);
}
if (hints->dest_addr) {
assert(hints->dest_addrlen == sizeof(struct sockaddr_in));
memcpy(dest_addr, hints->dest_addr, hints->dest_addrlen);
}
if (dest_addr) {
memcpy(sa_ip, inet_ntoa(dest_addr->sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("dest_addr: family: %d, IP is %s\n",
@ -424,7 +433,7 @@ int sock_dgram_ep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*ep = &endpoint->ep;
*ep = &endpoint->fid.ep;
return 0;
}
@ -438,6 +447,6 @@ int sock_dgram_sep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*sep = &endpoint->sep;
*sep = &endpoint->fid.sep;
return 0;
}

Просмотреть файл

@ -66,8 +66,8 @@ const struct fi_ep_attr sock_msg_ep_attr = {
.max_order_waw_size = SOCK_EP_MAX_ORDER_WAW_SZ,
.mem_tag_format = SOCK_EP_MEM_TAG_FMT,
.msg_order = SOCK_EP_MSG_ORDER,
.tx_ctx_cnt = 0,
.rx_ctx_cnt = 0,
.tx_ctx_cnt = SOCK_EP_MAX_TX_CNT,
.rx_ctx_cnt = SOCK_EP_MAX_RX_CNT,
};
const struct fi_tx_attr sock_msg_tx_attr = {
@ -337,11 +337,20 @@ int sock_msg_getinfo(uint32_t version, const char *node, const char *service,
ret = FI_ENODATA;
goto err;
}
close(udp_sock);
freeaddrinfo(result);
}
if (hints->src_addr) {
assert(hints->src_addrlen == sizeof(struct sockaddr_in));
memcpy(src_addr, hints->src_addr, hints->src_addrlen);
}
if (hints->dest_addr) {
assert(hints->dest_addrlen == sizeof(struct sockaddr_in));
memcpy(dest_addr, hints->dest_addr, hints->dest_addrlen);
}
if (dest_addr) {
memcpy(sa_ip, inet_ntoa(dest_addr->sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("dest_addr: family: %d, IP is %s\n",
@ -372,7 +381,7 @@ err:
return ret;
}
static int sock_msg_ep_cm_getname(fid_t fid, void *addr, size_t *addrlen)
static int sock_ep_cm_getname(fid_t fid, void *addr, size_t *addrlen)
{
struct sock_ep *sock_ep;
if (*addrlen == 0) {
@ -380,13 +389,13 @@ static int sock_msg_ep_cm_getname(fid_t fid, void *addr, size_t *addrlen)
return -FI_ETOOSMALL;
}
sock_ep = container_of(fid, struct sock_ep, ep.fid);
sock_ep = container_of(fid, struct sock_ep, fid.ep.fid);
*addrlen = MIN(*addrlen, sizeof(struct sockaddr_in));
memcpy(addr, sock_ep->src_addr, *addrlen);
return 0;
}
static int sock_msg_ep_cm_getpeer(struct fid_ep *ep, void *addr, size_t *addrlen)
static int sock_ep_cm_getpeer(struct fid_ep *ep, void *addr, size_t *addrlen)
{
struct sock_ep *sock_ep;
@ -395,50 +404,99 @@ static int sock_msg_ep_cm_getpeer(struct fid_ep *ep, void *addr, size_t *addrlen
return -FI_ETOOSMALL;
}
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
*addrlen = MIN(*addrlen, sizeof(struct sockaddr_in));
memcpy(addr, sock_ep->dest_addr, *addrlen);
return 0;
}
static int sock_msg_ep_cm_connect(struct fid_ep *ep, const void *addr,
static int sock_ep_cm_connect(struct fid_ep *ep, const void *addr,
const void *param, size_t paramlen)
{
return -FI_ENOSYS;
struct sock_conn_req req;
struct sock_ep *_ep;
struct sock_eq *_eq;
_ep = container_of(ep, struct sock_ep, fid.ep);
_eq = _ep->eq;
if (!_eq) {
SOCK_LOG_ERROR("no EQ bound with this ep\n");
return -FI_EINVAL;
}
if(((struct sockaddr *)addr)->sa_family != AF_INET) {
SOCK_LOG_ERROR("invalid address type to connect: only IPv4 supported\n");
return -FI_EINVAL;
}
req.type = SOCK_CONNREQ;
req.c_fid = &ep->fid;
req.s_fid = 0;
memcpy(&req.info, &_ep->info, sizeof(struct fi_info));
memcpy(&req.src_addr, _ep->info.src_addr, sizeof(struct sockaddr_in));
memcpy(&req.dest_addr, _ep->info.dest_addr, sizeof(struct sockaddr_in));
memcpy(&req.tx_attr, _ep->info.tx_attr, sizeof(struct fi_tx_attr));
memcpy(&req.rx_attr, _ep->info.rx_attr, sizeof(struct fi_rx_attr));
memcpy(&req.ep_attr, _ep->info.ep_attr, sizeof(struct fi_ep_attr));
memcpy(&req.domain_attr, _ep->info.domain_attr, sizeof(struct fi_domain_attr));
memcpy(&req.fabric_attr, _ep->info.fabric_attr, sizeof(struct fi_fabric_attr));
if (sock_util_sendto(_eq->wait_fd, &req, sizeof(struct sock_conn_req),
(struct sockaddr_in *)addr, sizeof(struct sockaddr_in), 0))
return -errno;
return 0;
}
static int sock_msg_ep_cm_listen(struct fid_pep *pep)
static int sock_ep_cm_accept(struct fid_ep *ep, const void *param, size_t paramlen)
{
return -FI_ENOSYS;
struct sock_conn_req *req;
struct sock_domain *_dom;
struct sockaddr_in *addr;
socklen_t addrlen;
struct sock_ep *_ep;
struct sock_eq *_eq;
_ep = container_of(ep, struct sock_ep, fid.ep);
_eq = _ep->eq;
if (!_eq) {
SOCK_LOG_ERROR("no EQ bound with this ep\n");
return -FI_EINVAL;
}
_dom = _ep->domain;
addr = _dom->info.dest_addr;
addrlen = _dom->info.dest_addrlen;
req = (struct sock_conn_req *)_dom->info.connreq;
if (!req) {
SOCK_LOG_ERROR("invalid connreq for cm_accept\n");
return -FI_EINVAL;
}
if (((struct sockaddr *)addr)->sa_family != AF_INET) {
SOCK_LOG_ERROR("invalid address type to connect: only IPv4 supported\n");
return -FI_EINVAL;
}
req->type = SOCK_ACCEPT;
req->s_fid = &ep->fid;
if (sock_util_sendto(_eq->wait_fd, req, sizeof(req->type) +
sizeof(req->c_fid) + sizeof(req->s_fid), addr, addrlen, 0))
return -errno;
free(req);
return 0;
}
static int sock_msg_ep_cm_accept(struct fid_ep *ep, const void *param, size_t paramlen)
{
return -FI_ENOSYS;
}
static int sock_msg_ep_cm_reject(struct fid_pep *pep, fi_connreq_t connreq,
const void *param, size_t paramlen)
{
return -FI_ENOSYS;
}
static int sock_msg_ep_cm_shutdown(struct fid_ep *ep, uint64_t flags)
{
return -FI_ENOSYS;
}
struct fi_ops_cm sock_msg_ep_cm_ops = {
struct fi_ops_cm sock_ep_cm_ops = {
.size = sizeof(struct fi_ops_cm),
.getname = sock_msg_ep_cm_getname,
.getpeer = sock_msg_ep_cm_getpeer,
.connect = sock_msg_ep_cm_connect,
.listen = sock_msg_ep_cm_listen,
.accept = sock_msg_ep_cm_accept,
.reject = sock_msg_ep_cm_reject,
.shutdown = sock_msg_ep_cm_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
.getname = sock_ep_cm_getname,
.getpeer = sock_ep_cm_getpeer,
.connect = sock_ep_cm_connect,
.listen = fi_no_listen,
.accept = sock_ep_cm_accept,
.reject = fi_no_reject,
.shutdown = fi_no_shutdown,
};
int sock_msg_endpoint(struct fid_domain *domain, struct fi_info *info,
@ -494,10 +552,105 @@ int sock_msg_ep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*ep = &endpoint->ep;
*ep = &endpoint->fid.ep;
return 0;
}
static int sock_pep_fi_bind(fid_t fid, struct fid *bfid, uint64_t flags)
{
struct sock_pep *pep;
struct sock_eq *eq;
pep = container_of(fid, struct sock_pep, pep.fid);
if (bfid->fclass != FI_CLASS_EQ)
return -FI_EINVAL;
eq = container_of(bfid, struct sock_eq, eq.fid);
if (pep->sock_fab != eq->sock_fab) {
SOCK_LOG_ERROR("Cannot bind Passive EP and EQ on different fabric\n");
return -FI_EINVAL;
}
pep->eq = eq;
if ((eq->attr.wait_obj == FI_WAIT_FD) && (eq->wait_fd < 0))
sock_eq_openwait(eq, (char *)&pep->service);
return 0;
}
static int sock_pep_fi_close(fid_t fid)
{
struct sock_pep *pep;
pep = container_of(fid, struct sock_pep, pep.fid);
free(pep);
return 0;
}
static struct fi_ops sock_pep_fi_ops = {
.size = sizeof(struct fi_ops),
.close = sock_pep_fi_close,
.bind = sock_pep_fi_bind,
.control = fi_no_control,
.ops_open = fi_no_ops_open,
};
static int sock_pep_listen(struct fid_pep *pep)
{
return 0;
}
static int sock_pep_reject(struct fid_pep *pep, fi_connreq_t connreq,
const void *param, size_t paramlen)
{
struct sock_conn_req *req;
struct sockaddr_in *addr;
socklen_t addrlen;
struct sock_pep *_pep;
struct sock_eq *_eq;
_pep = container_of(pep, struct sock_pep, pep);
_eq = _pep->eq;
if (!_eq) {
SOCK_LOG_ERROR("no EQ bound with this pep\n");
return -FI_EINVAL;
}
req = (struct sock_conn_req *)connreq;
if (!req) {
SOCK_LOG_ERROR("invalid connreq for cm_accept\n");
return -FI_EINVAL;
}
addr = &req->src_addr;
addrlen = sizeof(struct sockaddr_in);
if (((struct sockaddr *)addr)->sa_family != AF_INET) {
SOCK_LOG_ERROR("invalid address type to connect: only IPv4 supported\n");
return -FI_EINVAL;
}
req->type = SOCK_REJECT;
req->s_fid = NULL;
if (sock_util_sendto(_eq->wait_fd, req, sizeof(req->type) +
sizeof(req->c_fid), addr, addrlen, 0))
return -errno;
free(req);
return 0;
}
static struct fi_ops_cm sock_pep_cm_ops = {
.size = sizeof(struct fi_ops_cm),
.getname = fi_no_getname,
.getpeer = fi_no_getpeer,
.connect = fi_no_connect,
.listen = sock_pep_listen,
.accept = fi_no_accept,
.reject = sock_pep_reject,
.shutdown = fi_no_shutdown,
};
int sock_msg_sep(struct fid_domain *domain, struct fi_info *info,
struct fid_sep **sep, void *context)
{
@ -508,12 +661,12 @@ int sock_msg_sep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*sep = &endpoint->sep;
*sep = &endpoint->fid.sep;
return 0;
}
int sock_msg_passive_ep(struct fid_fabric *fabric, struct fi_info *info,
struct fid_pep **pep, void *context)
int sock_msg_pep(struct fid_fabric *fabric, struct fi_info *info,
struct fid_pep **pep, void *context)
{
int ret;
struct sock_ep *endpoint;
@ -522,6 +675,91 @@ int sock_msg_passive_ep(struct fid_fabric *fabric, struct fi_info *info,
if (ret)
return ret;
*pep = &endpoint->pep;
*pep = &endpoint->fid.pep;
return 0;
}
int sock_msg_passive_ep(struct fid_fabric *fabric, struct fi_info *info,
struct fid_pep **pep, void *context)
{
struct sock_pep *_pep;
int ret;
if (info) {
ret = sock_verify_info(info);
if (ret) {
SOCK_LOG_INFO("Cannot support requested options!\n");
return -FI_EINVAL;
}
}
_pep = (struct sock_pep*)calloc(1, sizeof(*_pep));
if (!_pep)
return -FI_ENOMEM;
if(info) {
struct sockaddr *dest_addr = (struct sockaddr *)info->dest_addr;
struct sockaddr *src_addr = (struct sockaddr *)info->src_addr;
if (!dest_addr || !src_addr) {
SOCK_LOG_ERROR("invalid dest_addr or src_addr\n");
goto err;
}
if (!dest_addr->sa_family) {
if(getnameinfo(src_addr, sizeof(*src_addr), NULL, 0,
_pep->service,
sizeof(_pep->service),
NI_NUMERICSERV)) {
SOCK_LOG_ERROR("could not resolve src_addr\n");
goto err;
}
} else {
if(getnameinfo(dest_addr, sizeof(*dest_addr), NULL, 0,
_pep->service,
sizeof(_pep->service),
NI_NUMERICSERV)) {
SOCK_LOG_ERROR("could not resolve dest_addr\n");
goto err;
}
}
_pep->info = *info;
} else {
SOCK_LOG_ERROR("invalid fi_info\n");
goto err;
}
_pep->pep.fid.fclass = FI_CLASS_PEP;
_pep->pep.fid.context = context;
_pep->pep.fid.ops = &sock_pep_fi_ops;
_pep->pep.cm = &sock_pep_cm_ops;
_pep->pep.ops = NULL;
_pep->sock_fab = container_of(fabric, struct sock_fabric, fab_fid);
*pep = &_pep->pep;
return 0;
err:
free(_pep);
return -errno;
}
struct fi_info * sock_ep_msg_process_info(struct sock_conn_req *req)
{
req->info.src_addr = &req->src_addr;
req->info.dest_addr = &req->dest_addr;
req->info.tx_attr = &req->tx_attr;
req->info.rx_attr = &req->rx_attr;
req->info.ep_attr = &req->ep_attr;
req->info.domain_attr = &req->domain_attr;
req->info.fabric_attr = &req->fabric_attr;
if (sock_verify_info(&req->info)) {
SOCK_LOG_INFO("incoming conn_req not supported\n");
errno = EINVAL;
return NULL;
}
/* reverse src_addr and dest_addr */
return sock_fi_info(FI_EP_MSG, &req->info,
req->info.dest_addr, req->info.src_addr);
}

Просмотреть файл

@ -66,8 +66,8 @@ const struct fi_ep_attr sock_rdm_ep_attr = {
.max_order_waw_size = SOCK_EP_MAX_ORDER_WAW_SZ,
.mem_tag_format = SOCK_EP_MEM_TAG_FMT,
.msg_order = SOCK_EP_MSG_ORDER,
.tx_ctx_cnt = 0,
.rx_ctx_cnt = 0,
.tx_ctx_cnt = SOCK_EP_MAX_TX_CNT,
.rx_ctx_cnt = SOCK_EP_MAX_RX_CNT,
};
const struct fi_tx_attr sock_rdm_tx_attr = {
@ -205,14 +205,9 @@ static struct fi_info *sock_rdm_fi_info(struct fi_info *hints,
if (!hints->caps)
_info->caps = SOCK_EP_RDM_CAP;
if (!hints->tx_attr)
*(_info->tx_attr) = sock_rdm_tx_attr;
if (!hints->rx_attr)
*(_info->rx_attr) = sock_rdm_rx_attr;
if (!hints->ep_attr)
*(_info->ep_attr) = sock_rdm_ep_attr;
*(_info->tx_attr) = sock_rdm_tx_attr;
*(_info->rx_attr) = sock_rdm_rx_attr;
*(_info->ep_attr) = sock_rdm_ep_attr;
return _info;
}
@ -334,11 +329,20 @@ int sock_rdm_getinfo(uint32_t version, const char *node, const char *service,
ret = FI_ENODATA;
goto err;
}
close(udp_sock);
freeaddrinfo(result);
}
if (hints->src_addr) {
assert(hints->src_addrlen == sizeof(struct sockaddr_in));
memcpy(src_addr, hints->src_addr, hints->src_addrlen);
}
if (hints->dest_addr) {
assert(hints->dest_addrlen == sizeof(struct sockaddr_in));
memcpy(dest_addr, hints->dest_addr, hints->dest_addrlen);
}
if (dest_addr) {
memcpy(sa_ip, inet_ntoa(dest_addr->sin_addr), INET_ADDRSTRLEN);
SOCK_LOG_INFO("dest_addr: family: %d, IP is %s\n",
@ -422,12 +426,12 @@ int sock_rdm_ep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*ep = &endpoint->ep;
*ep = &endpoint->fid.ep;
return 0;
}
int sock_rdm_sep(struct fid_domain *domain, struct fi_info *info,
struct fid_sep **sep, void *context)
struct fid_sep **sep, void *context)
{
int ret;
struct sock_ep *endpoint;
@ -436,7 +440,7 @@ int sock_rdm_sep(struct fid_domain *domain, struct fi_info *info,
if (ret)
return ret;
*sep = &endpoint->sep;
*sep = &endpoint->fid.sep;
return 0;
}

Просмотреть файл

@ -208,6 +208,115 @@ static struct fi_ops_eq sock_eq_ops = {
.strerror = sock_eq_strerror,
};
ssize_t sock_eq_fd_sread(struct fid_eq *eq, uint32_t *event, void *buf,
size_t len, int timeout, uint64_t flags)
{
struct sock_eq *sock_eq;
struct fid_ep *fid_ep;
struct sock_ep *sock_ep;
int ret;
struct sock_conn_req *req;
socklen_t addrlen;
struct sockaddr_in addr;
struct fi_eq_cm_entry *entry;
struct fi_eq_err_entry err;
req = (struct sock_conn_req *)calloc(1, sizeof(struct sock_conn_req));
if (!req) {
SOCK_LOG_ERROR("calloc for conn_req failed\n");
errno = ENOMEM;
return 0;
}
sock_eq = container_of(eq, struct sock_eq, eq);
addrlen = sizeof(struct sockaddr_in);
ret = sock_util_recvfrom(sock_eq->wait_fd, req, sizeof *req, &addr, &addrlen,
timeout);
entry = (struct fi_eq_cm_entry *)buf;
switch (req->type) {
case SOCK_ACCEPT:
SOCK_LOG_INFO("received SOCK_ACCEPT\n");
if (ret != sizeof req->type + sizeof req->c_fid + sizeof req->s_fid) {
SOCK_LOG_ERROR("recvfrom value invalid: %d\n", ret);
return 0;
}
*event = FI_CONNECTED;
entry->info = NULL;
entry->fid = req->c_fid;
fid_ep = container_of(req->c_fid, struct fid_ep, fid);
sock_ep = container_of(fid_ep, struct sock_ep, fid.ep);
sock_ep->connected = 1;
req->type = SOCK_CONNECTED;
if (sock_util_sendto(sock_eq->wait_fd, req, sizeof(req->type) +
sizeof(req->c_fid) + sizeof(req->s_fid), &addr, addrlen, 0))
return 0;
free(req);
break;
case SOCK_CONNREQ:
SOCK_LOG_INFO("received SOCK_CONNREQ\n");
if (ret != sizeof *req) {
SOCK_LOG_ERROR("recvfrom value invalid: %d\n", ret);
return 0;
}
*event = FI_CONNREQ;
entry->info = sock_ep_msg_process_info(req);
entry->info->connreq = (fi_connreq_t)req;
if (!entry->info) {
SOCK_LOG_ERROR("failed create new info\n");
return -errno;
}
break;
case SOCK_REJECT:
SOCK_LOG_INFO("received SOCK_REJECT\n");
if (ret != sizeof req->type + sizeof req->c_fid) {
SOCK_LOG_ERROR("recvfrom value invalid: %d\n", ret);
return 0;
}
err.fid = req->c_fid;
err.context = NULL;
err.data = 0;
err.err = -FI_ECONNREFUSED;
err.prov_errno = 0;
err.err_data = NULL;
sock_eq_report_event(sock_eq, 0, &err, sizeof err, 0);
free(req);
break;
case SOCK_CONNECTED:
SOCK_LOG_INFO("received SOCK_CONNECTED\n");
*event = FI_CONNECTED;
entry->info = NULL;
entry->fid = req->s_fid;
fid_ep = container_of(req->s_fid, struct fid_ep, fid);
sock_ep = container_of(fid_ep, struct sock_ep, fid.ep);
sock_ep->connected = 1;
free(req);
break;
case SOCK_SHUTDOWN:
SOCK_LOG_INFO("received SOCK_SHUTDOWN\n");
*event = FI_SHUTDOWN;
entry->info = NULL;
entry->fid = req->s_fid;
free(req);
break;
default:
SOCK_LOG_ERROR("unexpected req to EQ\n");
free(req);
return 0;
}
return sizeof *entry ;
}
static struct fi_ops_eq sock_eq_fd_ops = {
.size = sizeof(struct fi_ops_eq),
.read = sock_eq_read,
.readerr = sock_eq_readerr,
.write = sock_eq_write,
.sread = sock_eq_fd_sread,
.strerror = sock_eq_strerror,
};
int sock_eq_fi_close(struct fid *fid)
{
struct sock_eq *sock_eq;
@ -295,6 +404,61 @@ static struct fi_eq_attr _sock_eq_def_attr ={
.wait_set = NULL,
};
int sock_eq_openwait(struct sock_eq *eq, char *service)
{
SOCK_LOG_INFO("enter\n");
struct addrinfo *s_res = NULL, *p;
struct addrinfo hints;
int optval;
if (eq->wait_fd > 0 && !strncmp((char *)&eq->service, service, NI_MAXSERV))
{
SOCK_LOG_INFO("eq already opened for the service %s\n", service);
return 0;
}
if (eq->wait_fd > 0)
close(eq->wait_fd);
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_PASSIVE;
hints.ai_protocol = IPPROTO_UDP;
if(getaddrinfo(NULL, service, &hints, &s_res)) {
SOCK_LOG_ERROR("no available AF_INET address\n");
perror("no available AF_INET address");
return -FI_EINVAL;
}
for (p=s_res; p; p=p->ai_next) {
eq->wait_fd = socket(p->ai_family, p->ai_socktype,
p->ai_protocol);
if (eq->wait_fd >= 0) {
optval = 1;
setsockopt(eq->wait_fd, SOL_SOCKET, SO_REUSEADDR, &optval,
sizeof optval);
if (!bind(eq->wait_fd, s_res->ai_addr, s_res->ai_addrlen))
break;
close(eq->wait_fd);
eq->wait_fd = -1;
}
}
freeaddrinfo(s_res);
if (eq->wait_fd < 0) {
SOCK_LOG_ERROR("failed to open udp sock on port: %s\n", service);
return -FI_EINVAL;
}
fcntl(eq->wait_fd, F_SETFL, O_NONBLOCK);
memcpy(&eq->service, service, NI_MAXSERV);
SOCK_LOG_INFO("open udp successfully\n");
return 0;
}
int sock_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
struct fid_eq **eq, void *context)
{
@ -338,16 +502,17 @@ int sock_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
case FI_WAIT_NONE:
case FI_WAIT_UNSPEC:
sock_eq->signal = 0;
break;
case FI_WAIT_FD:
sock_eq->signal = 0;
sock_eq->eq.ops = &sock_eq_fd_ops;
break;
case FI_WAIT_MUTEX_COND:
wait_attr.flags = 0;
wait_attr.wait_obj = FI_WAIT_MUTEX_COND;
/* FIXME: waitset is a domain object, but not EQ. This needs to be
updated based on #394 */
ret = sock_wait_open(NULL, &wait_attr, &sock_eq->waitset);
ret = sock_wait_open(fabric, &wait_attr, &sock_eq->waitset);
if (ret)
goto err2;
sock_eq->signal = 1;
@ -361,6 +526,9 @@ int sock_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
default:
break;
}
sock_eq->wait_fd = -1;
*eq = &sock_eq->eq;
return 0;
err2:

Просмотреть файл

@ -79,13 +79,26 @@ int sock_verify_info(struct fi_info *hints)
switch (hints->ep_type) {
case FI_EP_UNSPEC:
case FI_EP_MSG:
ret = sock_msg_verify_ep_attr(hints->ep_attr,
hints->tx_attr,
hints->rx_attr);
break;
case FI_EP_DGRAM:
ret = sock_dgram_verify_ep_attr(hints->ep_attr,
hints->tx_attr,
hints->rx_attr);
break;
case FI_EP_RDM:
ret = sock_rdm_verify_ep_attr(hints->ep_attr,
hints->tx_attr,
hints->rx_attr);
break;
default:
return -FI_ENODATA;
ret = -FI_ENODATA;
}
if (ret)
return ret;
switch (hints->addr_format) {
case FI_FORMAT_UNSPEC:
case FI_SOCKADDR:
@ -95,11 +108,6 @@ int sock_verify_info(struct fi_info *hints)
return -FI_ENODATA;
}
if (!sock_rdm_verify_ep_attr(hints->ep_attr, hints->tx_attr, hints->rx_attr) ||
!sock_dgram_verify_ep_attr(hints->ep_attr, hints->tx_attr, hints->rx_attr) ||
!sock_msg_verify_ep_attr(hints->ep_attr, hints->tx_attr, hints->rx_attr))
return 0;
ret = sock_verify_domain_attr(hints->domain_attr);
if (ret)
return ret;
@ -116,6 +124,7 @@ static struct fi_ops_fabric sock_fab_ops = {
.domain = sock_domain,
.passive_ep = sock_msg_passive_ep,
.eq_open = sock_eq_open,
.wait_open = sock_wait_open,
};
static int sock_fabric_close(fid_t fid)

Просмотреть файл

@ -67,7 +67,7 @@ static ssize_t sock_ep_recvmsg(struct fid_ep *ep, const struct fi_msg *msg,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
rx_ctx = sock_ep->rx_ctx;
break;
@ -157,12 +157,12 @@ static ssize_t sock_ep_sendmsg(struct fid_ep *ep, const struct fi_msg *msg,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
tx_ctx = sock_ep->tx_ctx;
break;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx);
sock_ep = tx_ctx->ep;
break;
@ -172,8 +172,11 @@ static ssize_t sock_ep_sendmsg(struct fid_ep *ep, const struct fi_msg *msg,
}
assert(tx_ctx->enabled && msg->iov_count <= SOCK_EP_MAX_IOV_LIMIT);
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
if (sock_ep->connected) {
conn = sock_ep_lookup_conn(sock_ep);
} else {
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
}
assert(conn);
SOCK_LOG_INFO("New sendmsg on TX: %p using conn: %p\n",
@ -326,7 +329,7 @@ static ssize_t sock_ep_trecvmsg(struct fid_ep *ep,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
rx_ctx = sock_ep->rx_ctx;
break;
@ -418,12 +421,12 @@ static ssize_t sock_ep_tsendmsg(struct fid_ep *ep,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
tx_ctx = sock_ep->tx_ctx;
break;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx);
sock_ep = tx_ctx->ep;
break;
@ -574,7 +577,7 @@ static ssize_t sock_ep_tsearch(struct fid_ep *ep, uint64_t *tag, uint64_t ignore
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
rx_ctx = sock_ep->rx_ctx;
break;
@ -588,6 +591,7 @@ static ssize_t sock_ep_tsearch(struct fid_ep *ep, uint64_t *tag, uint64_t ignore
return -FI_EINVAL;
}
ret = -FI_ENOMSG;
fastlock_acquire(&rx_ctx->lock);
for (entry = rx_ctx->rx_buffered_list.next;
entry != &rx_ctx->rx_buffered_list; entry = entry->next) {
@ -599,26 +603,26 @@ static ssize_t sock_ep_tsearch(struct fid_ep *ep, uint64_t *tag, uint64_t ignore
if (((rx_entry->tag & ~rx_entry->ignore) ==
(*tag & ~rx_entry->ignore)) &&
(rx_entry->addr == FI_ADDR_UNSPEC ||
rx_entry->addr == *src_addr)) {
(src_addr == NULL) ||
(src_addr &&
((*src_addr == FI_ADDR_UNSPEC) ||
(rx_entry->addr == *src_addr))))) {
if (flags & FI_CLAIM)
rx_entry->is_claimed = 1;
*tag = rx_entry->tag;
*src_addr = rx_entry->addr;
if (src_addr)
*src_addr = rx_entry->addr;
*len = rx_entry->used;
ret = 1;
break;
}
}
if (entry == &rx_ctx->rx_entry_list)
ret = -FI_ENOENT;
fastlock_release(&rx_ctx->lock);
return ret;
}
struct fi_ops_tagged sock_ep_tagged = {
.size = sizeof(struct fi_ops_tagged),
.recv = sock_ep_trecv,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -71,12 +71,12 @@ static ssize_t sock_ep_rma_readmsg(struct fid_ep *ep,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
tx_ctx = sock_ep->tx_ctx;
break;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx);
sock_ep = tx_ctx->ep;
break;
@ -214,12 +214,12 @@ static ssize_t sock_ep_rma_writemsg(struct fid_ep *ep,
switch (ep->fid.fclass) {
case FI_CLASS_EP:
sock_ep = container_of(ep, struct sock_ep, ep);
sock_ep = container_of(ep, struct sock_ep, fid.ep);
tx_ctx = sock_ep->tx_ctx;
break;
case FI_CLASS_TX_CTX:
tx_ctx = container_of(ep, struct sock_tx_ctx, ctx);
tx_ctx = container_of(ep, struct sock_tx_ctx, fid.ctx);
sock_ep = tx_ctx->ep;
break;
@ -231,8 +231,11 @@ static ssize_t sock_ep_rma_writemsg(struct fid_ep *ep,
assert(tx_ctx->enabled &&
msg->iov_count <= SOCK_EP_MAX_IOV_LIMIT &&
msg->rma_iov_count <= SOCK_EP_MAX_IOV_LIMIT);
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
if (sock_ep->connected) {
conn = sock_ep_lookup_conn(sock_ep);
} else {
conn = sock_av_lookup_addr(tx_ctx->av, msg->addr);
}
assert(conn);
flags |= tx_ctx->attr.op_flags;

Просмотреть файл

@ -116,8 +116,10 @@ struct sock_rx_entry *sock_rx_get_entry(struct sock_rx_ctx *rx_ctx,
if (((rx_entry->tag & ~rx_entry->ignore) ==
(tag & ~rx_entry->ignore)) &&
(rx_entry->addr == FI_ADDR_UNSPEC ||
addr == FI_ADDR_UNSPEC || rx_entry->addr == addr)) {
(rx_entry->addr == FI_ADDR_UNSPEC || addr == FI_ADDR_UNSPEC ||
rx_entry->addr == addr ||
(rx_ctx->av &&
!sock_av_compare_addr(rx_ctx->av, addr, rx_entry->addr)))) {
break;
}
}

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -55,3 +55,100 @@
#include "sock_util.h"
int sock_log_level = SOCK_ERROR;
char host[128] = {0};
#define SOCK_SENDTO_TIMEOUT 5
int sock_util_sendto(int fd, void *buf, size_t len, struct sockaddr_in *addr,
socklen_t addrlen, int timeout)
{
struct timeval tv;
fd_set writefds;
socklen_t optlen;
int optval;
if (sendto(fd, buf, len, 0, addr, addrlen) < 0) {
SOCK_LOG_ERROR("sendto failed with error %d - %s\n", errno,
strerror(errno));
return -errno;
}
if (timeout) {
tv.tv_sec = 0;
tv.tv_usec = timeout;
} else {
tv.tv_sec = SOCK_SENDTO_TIMEOUT;
tv.tv_usec = 0;
}
FD_ZERO(&writefds);
FD_SET(fd, &writefds);
if (select(fd+1, NULL, &writefds, NULL, &tv) > 0) {
optlen = sizeof(int);
getsockopt(fd, SOL_SOCKET, SO_ERROR, &optval, &optlen);
if (optval) {
SOCK_LOG_ERROR("failed to sendto %d - %s\n", optval,
strerror(optval));
close(fd);
return -errno;
}
} else {
SOCK_LOG_ERROR("Timeout or error to sendto %d - %s\n", optval,
strerror(optval));
close(fd);
errno = ETIMEDOUT;
return -FI_ETIMEDOUT;
}
return 0;
}
int sock_util_recvfrom(int fd, void *buf, size_t len, struct sockaddr_in *addr,
socklen_t *addrlen, int timeout)
{
struct timeval tv;
struct timeval *tv_ptr;
fd_set readfds;
socklen_t optlen;
int optval;
int ret;
if (timeout < 0) {
/* negative timeout means an infinite timeout */
tv_ptr = NULL;
} else {
tv.tv_sec = 0;
tv.tv_usec = timeout;
tv_ptr = &tv;
}
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
if (select(fd+1, &readfds, NULL, NULL, tv_ptr) > 0) {
optlen = sizeof(int);
getsockopt(fd, SOL_SOCKET, SO_ERROR, &optval, &optlen);
if (optval) {
SOCK_LOG_ERROR("failed to connect %d - %s\n", optval,
strerror(optval));
close(fd);
return 0;
}
} else {
SOCK_LOG_ERROR("Timeout or error to connect %d - %s\n", optval,
strerror(optval));
close(fd);
errno = ETIMEDOUT;
return 0;
}
/* read */
ret = recvfrom(fd, buf, len, 0, addr, addrlen);
if (ret < 0) {
SOCK_LOG_ERROR("error recvfrom for sread: %d - %s\n", errno,
strerror(errno));
return 0;
}
return ret;
}

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -68,3 +68,7 @@ extern int sock_log_level;
#endif
int sock_util_sendto(int fd, void *buf, size_t len, struct sockaddr_in *addr,
socklen_t addrlen, int timeout);
int sock_util_recvfrom(int fd, void *buf, size_t len, struct sockaddr_in *addr,
socklen_t *addrlen, int timeout);

Просмотреть файл

@ -55,12 +55,12 @@ int sock_wait_get_obj(struct fid_wait *fid, void *arg)
switch (wait->type) {
case FI_WAIT_FD:
memcpy(arg,&wait->fd[WAIT_READ_FD], sizeof(int));
memcpy(arg,&wait->wobj.fd[WAIT_READ_FD], sizeof(int));
break;
case FI_WAIT_MUTEX_COND:
mut_cond.mutex = &wait->mutex;
mut_cond.cond = &wait->cond;
mut_cond.mutex = &wait->wobj.mutex_cond.mutex;
mut_cond.cond = &wait->wobj.mutex_cond.cond;
memcpy(arg, &mut_cond, sizeof(mut_cond));
break;
@ -79,20 +79,20 @@ static int sock_wait_init(struct sock_wait *wait, enum fi_wait_obj type)
switch (type) {
case FI_WAIT_FD:
if (socketpair(AF_UNIX, SOCK_STREAM, 0, wait->fd))
if (socketpair(AF_UNIX, SOCK_STREAM, 0, wait->wobj.fd))
return -errno;
fcntl(wait->fd[WAIT_READ_FD], F_GETFL, &flags);
if (fcntl(wait->fd[WAIT_READ_FD], F_SETFL, flags | O_NONBLOCK)) {
close(wait->fd[WAIT_READ_FD]);
close(wait->fd[WAIT_WRITE_FD]);
fcntl(wait->wobj.fd[WAIT_READ_FD], F_GETFL, &flags);
if (fcntl(wait->wobj.fd[WAIT_READ_FD], F_SETFL, flags | O_NONBLOCK)) {
close(wait->wobj.fd[WAIT_READ_FD]);
close(wait->wobj.fd[WAIT_WRITE_FD]);
return -errno;
}
break;
case FI_WAIT_MUTEX_COND:
pthread_mutex_init(&wait->mutex, NULL);
pthread_cond_init(&wait->cond, NULL);
pthread_mutex_init(&wait->wobj.mutex_cond.mutex, NULL);
pthread_cond_init(&wait->wobj.mutex_cond.cond, NULL);
break;
default:
@ -114,42 +114,42 @@ static int sock_wait_wait(struct fid_wait *wait_fid, int timeout)
struct sock_fid_list *list_item;
wait = container_of(wait_fid, struct sock_wait, wait_fid);
if (wait->domain->progress_mode == FI_PROGRESS_MANUAL) {
if (timeout > 0) {
gettimeofday(&now, NULL);
start_ms = (double)now.tv_sec * 1000.0 +
(double)now.tv_usec / 1000.0;
}
if (timeout > 0) {
gettimeofday(&now, NULL);
start_ms = (double)now.tv_sec * 1000.0 +
(double)now.tv_usec / 1000.0;
}
head = &wait->fid_list;
for (p = head->next; p != head; p = p->next) {
list_item = container_of(p, struct sock_fid_list, entry);
switch (list_item->fid->fclass) {
case FI_CLASS_CQ:
cq = container_of(list_item->fid,
struct sock_cq, cq_fid);
head = &wait->fid_list;
for (p = head->next; p != head; p = p->next) {
list_item = container_of(p, struct sock_fid_list, entry);
switch (list_item->fid->fclass) {
case FI_CLASS_CQ:
cq = container_of(list_item->fid,
struct sock_cq, cq_fid);
if (cq->domain->progress_mode == FI_PROGRESS_MANUAL)
sock_cq_progress(cq);
break;
break;
case FI_CLASS_CNTR:
cntr = container_of(list_item->fid,
struct sock_cntr, cntr_fid);
case FI_CLASS_CNTR:
cntr = container_of(list_item->fid,
struct sock_cntr, cntr_fid);
if (cntr->domain->progress_mode == FI_PROGRESS_MANUAL)
sock_cntr_progress(cntr);
break;
}
}
if (timeout > 0) {
gettimeofday(&now, NULL);
end_ms = (double)now.tv_sec * 1000.0 +
(double)now.tv_usec / 1000.0;
timeout -= (end_ms - start_ms);
timeout = timeout < 0 ? 0 : timeout;
break;
}
}
if (timeout > 0) {
gettimeofday(&now, NULL);
end_ms = (double)now.tv_sec * 1000.0 +
(double)now.tv_usec / 1000.0;
timeout -= (end_ms - start_ms);
timeout = timeout < 0 ? 0 : timeout;
}
switch (wait->type) {
case FI_WAIT_FD:
err = fi_poll_fd(wait->fd[WAIT_READ_FD], timeout);
err = fi_poll_fd(wait->wobj.fd[WAIT_READ_FD], timeout);
if (err > 0)
err = 0;
else if (err == 0)
@ -157,8 +157,8 @@ static int sock_wait_wait(struct fid_wait *wait_fid, int timeout)
break;
case FI_WAIT_MUTEX_COND:
err = fi_wait_cond(&wait->cond,
&wait->mutex, timeout);
err = fi_wait_cond(&wait->wobj.mutex_cond.cond,
&wait->wobj.mutex_cond.mutex, timeout);
break;
default:
@ -177,11 +177,11 @@ void sock_wait_signal(struct fid_wait *wait_fid)
switch (wait->type) {
case FI_WAIT_FD:
write(wait->fd[WAIT_WRITE_FD], &c, 1);
write(wait->wobj.fd[WAIT_WRITE_FD], &c, 1);
break;
case FI_WAIT_MUTEX_COND:
pthread_cond_signal(&wait->cond);
pthread_cond_signal(&wait->wobj.mutex_cond.cond);
break;
default:
SOCK_LOG_ERROR("Invalid wait object type\n");
@ -226,11 +226,11 @@ int sock_wait_close(fid_t fid)
}
if (wait->type == FI_WAIT_FD) {
close(wait->fd[WAIT_READ_FD]);
close(wait->fd[WAIT_WRITE_FD]);
close(wait->wobj.fd[WAIT_READ_FD]);
close(wait->wobj.fd[WAIT_WRITE_FD]);
}
atomic_dec(&wait->domain->ref);
atomic_dec(&wait->fab->ref);
free(wait);
return 0;
}
@ -260,19 +260,18 @@ static int sock_verify_wait_attr(struct fi_wait_attr *attr)
return 0;
}
int sock_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
int sock_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset)
{
int err;
struct sock_wait *wait;
struct sock_domain *dom;
struct sock_fabric *fab;
enum fi_wait_obj wait_obj_type;
if(attr && sock_verify_wait_attr(attr))
if (attr && sock_verify_wait_attr(attr))
return -FI_EINVAL;
dom = container_of(domain, struct sock_domain, dom_fid);
fab = container_of(fabric, struct sock_fabric, fab_fid);
if (!attr || attr->wait_obj == FI_WAIT_UNSPEC)
wait_obj_type = FI_WAIT_FD;
@ -290,9 +289,9 @@ int sock_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
wait->wait_fid.fid.context = 0;
wait->wait_fid.fid.ops = &sock_wait_fi_ops;
wait->wait_fid.ops = &sock_wait_ops;
wait->domain = dom;
wait->fab = fab;
wait->type = wait_obj_type;
atomic_inc(&dom->ref);
atomic_inc(&fab->ref);
*waitset = &wait->wait_fid;
return 0;

Просмотреть файл

@ -1,5 +1,105 @@
dnl Configry specific to the libfabrics usNIC provider
dnl
dnl Check for libnl; prefer version 3 instead of version 1. Abort (i.e.,
dnl AC_MSG_ERROR) if neither libnl v1 or v3 can be found.
dnl
dnl Outputs:
dnl
dnl - Set $1 to the CPPFLAGS necessary to compile with libnl
dnl - Set $2 to the LIBS necessary to link with libnl
dnl - If $3 is 1, AC_MSG_ERROR (i.e., abort) if neither libnl or
dnl libnl3 can be found
dnl - Set HAVE_LIBNL3 to 1 if libnl3 will be used; 0 if libnl1 will be used
dnl - AC_SUBST $HAVE_LIBNL3
dnl - AC_DEFINE HAVE_LIBNL3
dnl
AC_DEFUN([CHECK_LIBNL3],[
# More libnl v1/v3 sadness: the two versions are not compatible
# and will not work correctly if simultaneously linked into the
# same applications. Unfortunately, they *will* link into the
# same image! On platforms like SLES 12, libibverbs depends on
# libnl-3.so.200 and friends, while a naive implementation of
# our configure logic would link libnl.so.1 to libdaplusnic,
# resulting in both versions in the dependency map at the same
# time. As a coarse fix, just check for libnl-3 first and use
# it if present on the system.
# GROSS: libnl wants us to either use pkg-config (which we
# can't assume is always present) or we need to look in a
# particular directory for the right libnl3 include files. For
# now, just hard code the special path into this logic.
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
$1="-I/usr/include/libnl3"
CPPFLAGS="$$1 $CPPFLAGS"
AC_MSG_CHECKING([for /usr/include/libnl3])
AS_IF([test -d "/usr/include/libnl3"],
[AC_MSG_RESULT([present])
AC_CHECK_HEADER(
[netlink/version.h],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <netlink/netlink.h>
#include <netlink/version.h>
#ifndef LIBNL_VER_MAJ
#error "LIBNL_VER_MAJ not defined!"
#endif
/* to the best of our knowledge, version.h only exists in libnl3 */
#if LIBNL_VER_MAJ < 3
#error "LIBNL_VER_MAJ < 3, this is very unusual"
#endif
]],[[/* empty body */]])],
[HAVE_LIBNL3=1], dnl our program compiled
[HAVE_LIBNL3=0])], dnl our program failed to compile
[HAVE_LIBNL3=0], dnl AC_CHECK_HEADER failed
[#include <netlink/netlink.h>
])],
[AC_MSG_RESULT([missing])
HAVE_LIBNL3=0]) dnl "/usr/include/libnl3" doesn't exist
# nl_recvmsgs_report is a symbol that is only present in v3
AS_IF([test "$HAVE_LIBNL3" -eq 1],
[AC_SEARCH_LIBS([nl_recvmsgs_report], [nl-3],
[# We also need libnl-route-3
AC_SEARCH_LIBS([nl_rtgen_request], [nl-route-3],
[$2="-lnl-3 -lnl-route-3"
HAVE_LIBNL3=1],
[HAVE_LIBNL3=0])],
[HAVE_LIBNL3=0])])
AS_IF([test "$HAVE_LIBNL3" -eq 1],
[AC_MSG_NOTICE([using libnl-3])],
[# restore $1 since we are falling back to libnl (v1)
$1=""
AC_SEARCH_LIBS([nl_connect], [nl],
[$2="-lnl"],
[AC_MSG_WARN([Cannot find libnl-3 nor libnl])
AS_IF([test "$3" = "1"],
[AC_MSG_ERROR([Cannot continue])])
])
AC_MSG_NOTICE([using libnl (v1)])])
# libnl_utils.h does not include configure-generated config.h,
# so it may not see the HAVE_LIBNL3 #define. Hence, we set
# HAVE_LIBNL3 as both a C preprocessor macro (in case some
# other file includes config.h before libnl_utils.h) and a
# Makefile macro (so that the app can set HAVE_LIBNL3 via
# CPPFLAGS). Also, this macro may be used in multiple
# different libraries; setting HAVE_LIBNL3 both ways lets the
# application choose which way to set it.
AC_SUBST([HAVE_LIBNL3])
AC_DEFINE_UNQUOTED([HAVE_LIBNL3],[$HAVE_LIBNL3],
[set to 1 if should use libnl v3, set to 0 for libnl v11])
LIBS=$save_LIBS
AS_UNSET([save_LIBS])
CPPFLAGS=$save_CPPFLAGS
AS_UNSET([save_CPPFLAGS])
])
dnl Called to configure this provider
dnl
dnl Arguments:
@ -13,10 +113,11 @@ AC_DEFUN([FI_USNIC_CONFIGURE],[
AS_IF([test "x$enable_usnic" != "xno"],
[usnic_happy=1
AC_CHECK_HEADER([infiniband/verbs.h], [], [usnic_happy=0])
AC_CHECK_HEADER([linux/netlink.h], [], [usnic_happy=0], [
#include <sys/types.h>
#include <net/if.h>
])
AC_CHECK_LIB([nl], [nl_connect], [], [usnic_happy=0])
CHECK_LIBNL3([USNIC_LIBNL_CPPFLAGS],
[USNIC_LIBNL_LIBS], [0])
AS_IF([test "$USNIC_LIBNL_LIBS" != ""],
[CPPFLAGS="$USNIC_LIBNL_CPPFLAGS $CPPFLAGS"
LIBS="$USNIC_LIBNL_LIBS $LIBS"],
[usnic_happy=0])
])
])

Просмотреть файл

@ -78,7 +78,7 @@ usdf_av_insert_async_complete(struct usdf_av_insert *insert)
entry.context = insert->avi_context;
entry.data = insert->avi_successes;
usdf_eq_write_internal(av->av_eq,
FI_COMPLETE, &entry, sizeof(entry), 0);
FI_AV_COMPLETE, &entry, sizeof(entry), 0);
pthread_spin_lock(&av->av_lock);

Просмотреть файл

@ -112,7 +112,7 @@ usdf_cm_msg_accept_complete(struct usdf_connreq *crp)
/* post EQ entry */
entry.fid = ep_utofid(ep);
entry.info = NULL;
ret = usdf_eq_write_internal(ep->ep_eq, FI_COMPLETE, &entry,
ret = usdf_eq_write_internal(ep->ep_eq, FI_CONNECTED, &entry,
sizeof(entry), 0);
if (ret != sizeof(entry)) {
usdf_cm_msg_connreq_failed(crp, ret);
@ -299,7 +299,7 @@ usdf_cm_msg_connect_cb_rd(void *v)
entry->fid = ep_utofid(ep);
entry->info = NULL;
memcpy(entry->data, reqp->creq_data, reqp->creq_datalen);
ret = usdf_eq_write_internal(ep->ep_eq, FI_COMPLETE, entry,
ret = usdf_eq_write_internal(ep->ep_eq, FI_CONNECTED, entry,
entry_len, 0);
free(entry);
if (ret != entry_len) {

Просмотреть файл

@ -592,8 +592,6 @@ static struct fi_ops_cm usdf_cm_msg_ops = {
.accept = usdf_cm_msg_accept,
.reject = fi_no_reject,
.shutdown = usdf_cm_msg_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
static struct fi_ops_msg usdf_msg_ops = {

Просмотреть файл

@ -649,8 +649,6 @@ static struct fi_ops_cm usdf_cm_rdm_ops = {
.accept = fi_no_accept,
.reject = fi_no_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
static struct fi_ops_msg usdf_rdm_ops = {

Просмотреть файл

@ -116,10 +116,6 @@ usdf_validate_hints(struct fi_info *hints, struct usd_device_attrs *dap)
fattrp->prov_version != USDF_PROV_VERSION) {
return -FI_ENODATA;
}
if (fattrp->prov_name != NULL &&
strcmp(fattrp->prov_name, USDF_PROV_NAME) != 0) {
return -FI_ENODATA;
}
if (fattrp->name != NULL &&
strcmp(fattrp->name, dap->uda_devname) != 0) {
return -FI_ENODATA;

Просмотреть файл

@ -437,8 +437,6 @@ static struct fi_ops_cm usdf_pep_cm_ops = {
.accept = fi_no_accept,
.reject = usdf_pep_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
int

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014-2015, Cisco Systems, Inc. All rights reserved.
*
* LICENSE_BEGIN
*
@ -43,7 +43,9 @@
#ifndef LIBNL_UTILS_H
#define LIBNL_UTILS_H
#if LIBNL3
#if !defined (HAVE_LIBNL3)
#error You must define HAVE_LIBNL3 to 0 or 1 before including libnl_utils.h
#elif HAVE_LIBNL3
#include "libnl3_utils.h"
#else
#include "libnl1_utils.h"

Просмотреть файл

@ -43,19 +43,22 @@
#ifndef __LINUX_TYPES_H__
#define __LINUX_TYPES_H__
#include <asm/byteorder.h>
typedef u_int8_t u8;
typedef u_int16_t u16;
typedef u_int32_t u32;
typedef u_int64_t u64;
#define cpu_to_le16 __cpu_to_le16
#define le16_to_cpu __le16_to_cpu
#define cpu_to_le32 __cpu_to_le32
#define le32_to_cpu __le32_to_cpu
#define cpu_to_le64 __cpu_to_le64
#define le64_to_cpu __le64_to_cpu
typedef u_int16_t __le16;
typedef u_int32_t __le32;
#define __le64 ___le64
typedef u_int64_t __le64;
#define le16_to_cpu
#define le32_to_cpu
#define le64_to_cpu
#define cpu_to_le16
#define cpu_to_le32
#define cpu_to_le64
#if !defined(__LIBUSNIC__)
#define rmb() asm volatile("" ::: "memory")

Просмотреть файл

@ -118,7 +118,7 @@ usd_desc_to_rq_comp(
comp->uc_status = USD_COMPSTAT_SUCCESS;
} else {
comp->uc_status = USD_COMPSTAT_ERROR_CRC;
}
}
} else {
comp->uc_status = USD_COMPSTAT_SUCCESS;
}

Просмотреть файл

@ -74,7 +74,7 @@ usd_post_send_one_udp_normal(
hdr->uh_udp.len = htons((sizeof(struct usd_udp_hdr) -
sizeof(struct ether_header) -
sizeof(struct iphdr)) + len);
hdr->uh_udp.source =
hdr->uh_udp.source =
qp->uq_attrs.uqa_local_addr.ul_addr.ul_udp.u_addr.sin_port;
last_post = _usd_post_send_two(wq, hdr, sizeof(*hdr), buf, len,
@ -117,7 +117,7 @@ usd_post_send_one_copy_udp_normal(
hdr->uh_udp.len = htons((sizeof(struct usd_udp_hdr) -
sizeof(struct ether_header) -
sizeof(struct iphdr)) + len);
hdr->uh_udp.source =
hdr->uh_udp.source =
qp->uq_attrs.uqa_local_addr.ul_addr.ul_udp.u_addr.sin_port;
last_post =
@ -210,7 +210,7 @@ usd_post_send_two_copy_udp_normal(
hdr->uh_udp.len = htons((sizeof(struct usd_udp_hdr) -
sizeof(struct ether_header) -
sizeof(struct iphdr)) + tot_ulen);
hdr->uh_udp.source =
hdr->uh_udp.source =
qp->uq_attrs.uqa_local_addr.ul_addr.ul_udp.u_addr.sin_port;
last_post =
@ -264,7 +264,7 @@ usd_post_send_iov_udp_normal(struct usd_qp *uqp,
memcpy(&send_iov[1], iov, sizeof(struct iovec) * iov_count);
last_post = _usd_post_send_iov(wq, send_iov, iov_count + 1,
USD_SF_ISSET(flags, SIGNAL));
USD_SF_ISSET(flags, SIGNAL));
info = &wq->uwq_post_info[last_post];
info->wp_context = context;
info->wp_len = len;
@ -272,7 +272,6 @@ usd_post_send_iov_udp_normal(struct usd_qp *uqp,
return 0;
}
struct usd_qp_ops usd_qp_ops_udp_normal = {
.qo_post_send_one = usd_post_send_one_udp_normal,
.qo_post_send_one_prefixed = usd_post_send_one_prefixed_udp_normal,

Просмотреть файл

@ -145,6 +145,15 @@ usd_map_vnic_res(struct usd_device *dev, struct usd_vf *vf,
err = usd_map_one_res(dev, vf, &vfip->barres[i]);
if (err)
return err;
} else {
/* Disable any other res not reported by kernel module */
struct vnic_dev_iomap_info iomap;
iomap.vaddr = 0;
iomap.bus_addr = vnic_dev_get_res_bus_addr(
vf->vf_vdev, i, 0);
iomap.len = vnic_dev_get_res_type_len(
vf->vf_vdev, i);
vnic_dev_upd_res_vaddr(vf->vf_vdev, &iomap);
}
}

Просмотреть файл

@ -618,6 +618,7 @@ usd_post_send_iov(struct usd_qp *qp, struct usd_dest *dest,
return qp->uq_ops.qo_post_send_iov(
qp, dest, iov, iov_count, flags, context);
}
/****************************************************************
* enum-to-string utility functions (for prettyprinting)
****************************************************************/

Просмотреть файл

@ -75,14 +75,14 @@ void vnic_cq_free(struct vnic_cq *cq)
int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
#ifdef ENIC_PMD
unsigned int socket_id,
unsigned int socket_id,
#endif
unsigned int desc_count, unsigned int desc_size)
{
int err;
#ifdef ENIC_PMD
char res_name[NAME_MAX];
static int instance = 0;
static int instance;
#endif
cq->index = index;
@ -96,7 +96,7 @@ int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
#ifdef ENIC_PMD
snprintf(res_name, sizeof(res_name), "%d-cq-%d", instance++, index);
err = vnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size,
err = vnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size,
socket_id, res_name);
#else
err = vnic_dev_alloc_desc_ring(vdev, &cq->ring, desc_count, desc_size);

Просмотреть файл

@ -80,8 +80,8 @@ struct vnic_cq_ctrl {
#ifdef ENIC_AIC
struct vnic_rx_bytes_counter {
unsigned int small_pkt_bytes_cnt;
unsigned int large_pkt_bytes_cnt;
unsigned int small_pkt_bytes_cnt;
unsigned int large_pkt_bytes_cnt;
};
#endif
@ -107,61 +107,60 @@ static inline unsigned int vnic_cq_service(struct vnic_cq *cq,
u8 type, u16 q_number, u16 completed_index, void *opaque),
void *opaque)
{
struct cq_desc *cq_desc;
unsigned int work_done = 0;
u16 q_number, completed_index;
u8 type, color;
struct cq_desc *cq_desc;
unsigned int work_done = 0;
u16 q_number, completed_index;
u8 type, color;
#ifdef ENIC_PMD
struct rte_mbuf **rx_pkts = opaque;
unsigned int ret;
unsigned int split_hdr_size = vnic_get_hdr_split_size(cq->vdev);
struct rte_mbuf **rx_pkts = opaque;
unsigned int ret;
#endif
cq_desc = (struct cq_desc *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
cq_desc_dec(cq_desc, &type, &color,
&q_number, &completed_index);
cq_desc = (struct cq_desc *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
cq_desc_dec(cq_desc, &type, &color,
&q_number, &completed_index);
while (color != cq->last_color) {
while (color != cq->last_color) {
#ifdef ENIC_PMD
if(opaque)
opaque = (void *)&(rx_pkts[work_done]);
if (opaque)
opaque = (void *)&(rx_pkts[work_done]);
ret = (*q_service)(cq->vdev, cq_desc, type,
q_number, completed_index, opaque);
ret = (*q_service)(cq->vdev, cq_desc, type,
q_number, completed_index, opaque);
#else
if ((*q_service)(cq->vdev, cq_desc, type,
q_number, completed_index, opaque))
break;
if ((*q_service)(cq->vdev, cq_desc, type,
q_number, completed_index, opaque))
break;
#endif
cq->to_clean++;
if (cq->to_clean == cq->ring.desc_count) {
cq->to_clean = 0;
cq->last_color = cq->last_color ? 0 : 1;
}
cq->to_clean++;
if (cq->to_clean == cq->ring.desc_count) {
cq->to_clean = 0;
cq->last_color = cq->last_color ? 0 : 1;
}
cq_desc = (struct cq_desc *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
cq_desc_dec(cq_desc, &type, &color,
&q_number, &completed_index);
cq_desc = (struct cq_desc *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
cq_desc_dec(cq_desc, &type, &color,
&q_number, &completed_index);
#ifdef ENIC_PMD
if(ret)
if (ret)
#endif
work_done++;
if (work_done >= work_to_do)
break;
}
work_done++;
if (work_done >= work_to_do)
break;
}
return work_done;
return work_done;
}
void vnic_cq_free(struct vnic_cq *cq);
int vnic_cq_alloc(struct vnic_dev *vdev, struct vnic_cq *cq, unsigned int index,
#ifdef ENIC_PMD
unsigned int socket_id,
unsigned int socket_id,
#endif
unsigned int desc_count, unsigned int desc_size);
void vnic_cq_init(struct vnic_cq *cq, unsigned int flow_control_enable,

Просмотреть файл

@ -62,14 +62,14 @@
#ifndef readq
static inline u64 readq(void __iomem *reg)
{
return ((u64)readl(reg + 0x4UL) << 32) |
return ((u64)readl((char *)reg + 0x4UL) << 32) |
(u64)readl(reg);
}
static inline void writeq(u64 val, void __iomem *reg)
{
writel(val & 0xffffffff, reg);
writel(val >> 32, reg + 0x4UL);
writel(val >> 32, (char *)reg + 0x4UL);
}
#endif
@ -117,6 +117,14 @@ struct vnic_stats;
void *vnic_dev_priv(struct vnic_dev *vdev);
unsigned int vnic_dev_get_res_count(struct vnic_dev *vdev,
enum vnic_res_type type);
#ifdef ENIC_PMD
void vnic_register_cbacks(struct vnic_dev *vdev,
void *(*alloc_consistent)(void *priv, size_t size,
dma_addr_t *dma_handle, u8 *name),
void (*free_consistent)(struct rte_pci_device *hwdev,
size_t size, void *vaddr,
dma_addr_t dma_handle));
#endif
void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,
unsigned int index);
dma_addr_t vnic_dev_get_res_bus_addr(struct vnic_dev *vdev,
@ -133,9 +141,11 @@ unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring,
#endif
void vnic_dev_clear_desc_ring(struct vnic_dev_ring *ring);
#ifdef ENIC_PMD
void vnic_set_hdr_split_size(struct vnic_dev *vdev, u16 size);
u16 vnic_get_hdr_split_size(struct vnic_dev *vdev);
int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
unsigned int desc_count, unsigned int desc_size, unsigned int socket_id,
char *z_name);
unsigned int desc_count, unsigned int desc_size, unsigned int socket_id,
char *z_name);
#else
int vnic_dev_alloc_desc_ring(struct vnic_dev *vdev, struct vnic_dev_ring *ring,
unsigned int desc_count, unsigned int desc_size);
@ -145,7 +155,7 @@ void vnic_dev_free_desc_ring(struct vnic_dev *vdev,
int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
u64 *a0, u64 *a1, int wait);
int vnic_dev_cmd_args(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
u64 *args, int nargs, int wait);
u64 *args, int nargs, int wait);
void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, u16 index);
#ifndef FOR_UPSTREAM_KERNEL
void vnic_dev_cmd_proxy_by_bdf_start(struct vnic_dev *vdev, u16 bdf);
@ -176,6 +186,7 @@ int vnic_dev_get_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
int vnic_dev_raise_intr(struct vnic_dev *vdev, u16 intr);
#endif
int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr);
void vnic_dev_set_reset_flag(struct vnic_dev *vdev, int state);
int vnic_dev_notify_unset(struct vnic_dev *vdev);
#ifndef FOR_UPSTREAM_KERNEL
int vnic_dev_notify_setcmd(struct vnic_dev *vdev,
@ -234,7 +245,8 @@ struct vnic_dev *vnic_dev_alloc_discover(struct vnic_dev *vdev,
struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
void *priv, struct pci_dev *pdev, struct vnic_dev_bar *bar,
unsigned int num_bars);
void vnic_dev_upd_res_vaddr(struct vnic_dev *vdev, struct vnic_dev_iomap_info *maps);
void vnic_dev_upd_res_vaddr(struct vnic_dev *vdev,
struct vnic_dev_iomap_info *maps);
struct pci_dev *vnic_dev_get_pdev(struct vnic_dev *vdev);
#endif
int vnic_dev_cmd_init(struct vnic_dev *vdev, int fallback);
@ -249,12 +261,15 @@ int vnic_dev_enable2(struct vnic_dev *vdev, int active);
int vnic_dev_enable2_done(struct vnic_dev *vdev, int *status);
int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status);
int vnic_dev_set_mac_addr(struct vnic_dev *vdev, u8 *mac_addr);
int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry, struct filter *data);
int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
struct filter *data);
#ifdef ENIC_VXLAN
int vnic_dev_overlay_offload_enable_disable(struct vnic_dev *vdev,
u8 overlay, u8 config);
int vnic_dev_overlay_offload_cfg(struct vnic_dev *vdev, u8 overlay,
u16 vxlan_udp_port_number);
#endif
#ifndef ENIC_PMD
int vnic_dev_init_devcmdorig(struct vnic_dev *vdev);
#endif
#endif /* _VNIC_DEV_H_ */

Просмотреть файл

@ -701,15 +701,15 @@ enum {
#define FILTER_MAX_BUF_SIZE 100 /* Maximum size of buffer to CMD_ADD_FILTER */
struct filter_tlv {
u_int32_t type;
u_int32_t length;
u_int32_t val[0];
uint32_t type;
uint32_t length;
uint32_t val[0];
};
enum {
CLSF_ADD = 0,
CLSF_DEL = 1,
};
};
/*
* Writing cmd register causes STAT_BUSY to get set in status register.
@ -766,7 +766,7 @@ struct devcmd2_result {
#define DEVCMD2_RESULTS_SIZE_MAX ((1 << 16) - 1)
// Overlay related definitions
/* Overlay related definitions */
/*
* This enum lists the flag associated with each of the overlay features

Просмотреть файл

@ -133,7 +133,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
int err;
#ifdef ENIC_PMD
char res_name[NAME_MAX];
static int instance = 0;
static int instance;
#endif
rq->index = index;
@ -150,7 +150,7 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
#ifdef ENIC_PMD
snprintf(res_name, sizeof(res_name), "%d-rq-%d", instance++, index);
err = vnic_dev_alloc_desc_ring(vdev, &rq->ring, desc_count, desc_size,
rq->socket_id, res_name);
rq->socket_id, res_name);
#else
err = vnic_dev_alloc_desc_ring(vdev, &rq->ring, desc_count, desc_size);
#endif

Просмотреть файл

@ -113,7 +113,7 @@ struct vnic_rq {
unsigned int pkts_outstanding;
#if defined(ENIC_NETQ)
unsigned int state;
#endif
#endif
#if defined(__VMKLNX__) && defined(ENIC_UPT)
int enabled;
unsigned int rxcons2;
@ -139,7 +139,7 @@ struct vnic_rq {
#endif /*CONFIG_NET_RX_BUSY_POLL*/
#ifdef ENIC_PMD
unsigned int socket_id;
struct rte_mempool *mp;
struct rte_mempool *mp;
#endif
};
@ -259,7 +259,7 @@ static inline void vnic_rq_service(struct vnic_rq *rq,
struct vnic_rq_buf *buf;
int skipped;
#ifdef ENIC_PMD
int eop = 0;
int eop = 0;
#endif
buf = rq->to_clean;
@ -268,8 +268,8 @@ static inline void vnic_rq_service(struct vnic_rq *rq,
skipped = (buf->index != completed_index);
#ifdef ENIC_PMD
if((*buf_service)(rq, cq_desc, buf, skipped, opaque))
eop++;
if ((*buf_service)(rq, cq_desc, buf, skipped, opaque))
eop++;
#else
(*buf_service)(rq, cq_desc, buf, skipped, opaque);
#endif
@ -285,7 +285,7 @@ static inline void vnic_rq_service(struct vnic_rq *rq,
buf = rq->to_clean;
}
#ifdef ENIC_PMD
return eop;
return eop;
#endif
}

Просмотреть файл

@ -71,12 +71,12 @@ int vnic_wq_alloc_ring(struct vnic_dev *vdev, struct vnic_wq *wq,
unsigned int desc_count, unsigned int desc_size)
{
#ifdef ENIC_PMD
char res_name[NAME_MAX];
static int instance = 0;
char res_name[NAME_MAX];
static int instance;
snprintf(res_name, sizeof(res_name), "%d-wq-%d", instance++, wq->index);
return vnic_dev_alloc_desc_ring(vdev, &wq->ring, desc_count, desc_size,
wq->socket_id, res_name);
wq->socket_id, res_name);
#else
return vnic_dev_alloc_desc_ring(vdev, &wq->ring, desc_count, desc_size);
#endif
@ -181,27 +181,28 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index,
return 0;
}
#ifndef ENIC_PMD
int vnic_wq_devcmd2_alloc(struct vnic_dev *vdev, struct vnic_wq *wq,
unsigned int desc_count, unsigned int desc_size)
{
int err;
wq->index = 0;
wq->vdev = vdev;
err = vnic_wq_get_ctrl(vdev, wq, 0, RES_TYPE_DEVCMD2);
if (err) {
pr_err("Failed to get devcmd2 resource\n");
return err;
}
vnic_wq_disable(wq);
err = vnic_wq_alloc_ring(vdev, wq, desc_count, desc_size);
if (err)
return err;
return 0;
}
#endif
#ifdef FOR_UPSTREAM_KERNEL
static void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
#else

Просмотреть файл

@ -111,9 +111,9 @@ struct vnic_wq {
struct vnic_wq_buf *to_use;
struct vnic_wq_buf *to_clean;
unsigned int pkts_outstanding;
#if defined(ENIC_NETQ)
#if defined(ENIC_NETQ)
unsigned int state;
#endif
#endif
#if defined(__VMKLNX__) && defined(ENIC_UPT)
int enabled;
#endif
@ -121,7 +121,7 @@ struct vnic_wq {
uint32_t qp_num;
#endif
#ifdef ENIC_PMD
unsigned int socket_id;
unsigned int socket_id;
#endif
};
@ -290,8 +290,10 @@ static inline void vnic_wq_service(struct vnic_wq *wq,
void vnic_wq_free(struct vnic_wq *wq);
int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index,
unsigned int desc_count, unsigned int desc_size);
#ifndef ENIC_PMD
int vnic_wq_devcmd2_alloc(struct vnic_dev *vdev, struct vnic_wq *wq,
unsigned int desc_count, unsigned int desc_size);
#endif
#ifndef FOR_UPSTREAM_KERNEL
void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index,
unsigned int fetch_index, unsigned int posted_index,

Просмотреть файл

@ -204,9 +204,6 @@ static int fi_ibv_check_fabric_attr(struct fi_fabric_attr *attr)
!strcmp(attr->name, VERBS_IWARP_FABRIC)))
return -FI_ENODATA;
if (attr->prov_name && strcmp(attr->prov_name, VERBS_PROV_NAME))
return -FI_ENODATA;
if (attr->prov_version > VERBS_PROV_VERS)
return -FI_ENODATA;
@ -218,7 +215,9 @@ static int fi_ibv_check_domain_attr(struct fi_domain_attr *attr)
switch (attr->threading) {
case FI_THREAD_UNSPEC:
case FI_THREAD_SAFE:
case FI_THREAD_PROGRESS:
case FI_THREAD_FID:
case FI_THREAD_DOMAIN:
case FI_THREAD_COMPLETION:
break;
default:
VERBS_WARN("Invalid threading model\n");
@ -1699,8 +1698,6 @@ static struct fi_ops_cm fi_ibv_msg_ep_cm_ops = {
.accept = fi_ibv_msg_ep_accept,
.reject = fi_no_reject,
.shutdown = fi_ibv_msg_ep_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
static int
@ -1883,7 +1880,7 @@ fi_ibv_eq_cm_process_event(struct fi_ibv_eq *eq, struct rdma_cm_event *cma_event
}
break;
case RDMA_CM_EVENT_ESTABLISHED:
*event = FI_COMPLETE;
*event = FI_CONNECTED;
entry->info = NULL;
break;
case RDMA_CM_EVENT_DISCONNECTED:
@ -2538,7 +2535,6 @@ static struct fi_ops_domain fi_ibv_domain_ops = {
.cq_open = fi_ibv_cq_open,
.endpoint = fi_ibv_open_ep,
.cntr_open = fi_no_cntr_open,
.wait_open = fi_no_wait_open,
.poll_open = fi_no_poll_open,
};
@ -2593,8 +2589,6 @@ static struct fi_ops_cm fi_ibv_pep_cm_ops = {
.accept = fi_no_accept,
.reject = fi_ibv_msg_ep_reject,
.shutdown = fi_no_shutdown,
.join = fi_no_join,
.leave = fi_no_leave,
};
static int fi_ibv_pep_bind(fid_t fid, struct fid *bfid, uint64_t flags)
@ -2685,6 +2679,7 @@ static struct fi_ops_fabric fi_ibv_ops_fabric = {
.domain = fi_ibv_domain,
.passive_ep = fi_ibv_passive_ep,
.eq_open = fi_ibv_eq_open,
.wait_open = fi_no_wait_open,
};
int fi_ibv_fabric(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context)

Просмотреть файл

@ -36,6 +36,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -129,3 +130,28 @@ uint64_t fi_tag_format(uint64_t tag_bits)
return FI_TAG_GENERIC >> (ffsll(htonll(tag_bits)) - 1);
}
static const size_t fi_datatype_size_table[] = {
[FI_INT8] = sizeof(int8_t),
[FI_UINT8] = sizeof(uint8_t),
[FI_INT16] = sizeof(int16_t),
[FI_UINT16] = sizeof(uint16_t),
[FI_INT32] = sizeof(int32_t),
[FI_UINT32] = sizeof(uint32_t),
[FI_INT64] = sizeof(int64_t),
[FI_UINT64] = sizeof(uint64_t),
[FI_FLOAT] = sizeof(float),
[FI_DOUBLE] = sizeof(double),
[FI_FLOAT_COMPLEX] = sizeof(float complex),
[FI_DOUBLE_COMPLEX] = sizeof(double complex),
[FI_LONG_DOUBLE] = sizeof(long double),
[FI_LONG_DOUBLE_COMPLEX] = sizeof(long double complex),
};
size_t fi_datatype_size(enum fi_datatype datatype)
{
if (datatype >= FI_DATATYPE_LAST) {
errno = FI_EINVAL;
return 0;
}
return fi_datatype_size_table[datatype];
}

Просмотреть файл

@ -69,6 +69,11 @@ int fi_no_eq_open(struct fid_fabric *fabric, struct fi_eq_attr *attr,
{
return -FI_ENOSYS;
}
int fi_no_wait_open(struct fid_fabric *fabric, struct fi_wait_attr *attr,
struct fid_wait **waitset)
{
return -FI_ENOSYS;
}
/*
* struct fi_ops_atomic
@ -196,16 +201,6 @@ int fi_no_shutdown(struct fid_ep *ep, uint64_t flags)
{
return -FI_ENOSYS;
}
int fi_no_join(struct fid_ep *ep, void *addr, fi_addr_t *fi_addr,
uint64_t flags, void *context)
{
return -FI_ENOSYS;
}
int fi_no_leave(struct fid_ep *ep, void *addr, fi_addr_t fi_addr,
uint64_t flags)
{
return -FI_ENOSYS;
}
/*
* struct fi_ops_av
@ -234,11 +229,6 @@ int fi_no_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
{
return -FI_ENOSYS;
}
int fi_no_wait_open(struct fid_domain *domain, struct fi_wait_attr *attr,
struct fid_wait **waitset)
{
return -FI_ENOSYS;
}
int fi_no_poll_open(struct fid_domain *domain, struct fi_poll_attr *attr,
struct fid_poll **pollset)
{

Просмотреть файл

@ -36,7 +36,6 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -126,6 +125,10 @@ static int lib_filter(const struct dirent *entry)
}
#endif
/*
* Initialize the sockets provider last. This will result in it being
* the least preferred provider.
*/
static void fi_ini(void)
{
pthread_mutex_lock(&ini_lock);
@ -135,41 +138,28 @@ static void fi_ini(void)
fi_register_provider(VERBS_INIT);
fi_register_provider(PSM_INIT);
fi_register_provider(SOCKETS_INIT);
fi_register_provider(USNIC_INIT);
#ifdef HAVE_LIBDL
struct dirent **liblist;
int n, want_warn = 0;
char *lib, *extdir = getenv("FI_EXTDIR");
int n;
char *lib, *provdir;
void *dlhandle;
struct fi_provider* (*inif)(void);
if (extdir) {
/* Warn if user specified $FI_EXTDIR, but there's a
* problem with the value */
want_warn = 1;
} else {
extdir = EXTDIR;
}
/* If dlopen fails, assume static linking and just return
without error */
if (dlopen(NULL, RTLD_NOW) == NULL) {
goto done;
}
n = scandir(extdir, &liblist, lib_filter, NULL);
if (n < 0) {
if (want_warn) {
FI_WARN("scandir error reading %s: %s\n",
extdir, strerror(errno));
}
provdir = PROVDLDIR;
n = scandir(provdir, &liblist, lib_filter, NULL);
if (n < 0)
goto done;
}
while (n--) {
if (asprintf(&lib, "%s/%s", extdir, liblist[n]->d_name) < 0) {
if (asprintf(&lib, "%s/%s", provdir, liblist[n]->d_name) < 0) {
FI_WARN("asprintf failed to allocate memory\n");
free(liblist[n]);
goto done;
@ -192,6 +182,7 @@ static void fi_ini(void)
free(liblist);
done:
#endif
fi_register_provider(SOCKETS_INIT);
init = 1;
unlock:
pthread_mutex_unlock(&ini_lock);
@ -231,6 +222,10 @@ int fi_getinfo_(uint32_t version, const char *node, const char *service,
if (!prov->provider->getinfo)
continue;
if (hints->fabric_attr && hints->fabric_attr->prov_name &&
strcmp(prov->provider->name, hints->fabric_attr->prov_name))
continue;
ret = prov->provider->getinfo(version, node, service, flags,
hints, &cur);
if (ret) {
@ -431,28 +426,4 @@ const char *fi_strerror_(int errnum)
}
default_symver(fi_strerror_, fi_strerror);
static const size_t fi_datatype_size_table[] = {
[FI_INT8] = sizeof(int8_t),
[FI_UINT8] = sizeof(uint8_t),
[FI_INT16] = sizeof(int16_t),
[FI_UINT16] = sizeof(uint16_t),
[FI_INT32] = sizeof(int32_t),
[FI_UINT32] = sizeof(uint32_t),
[FI_INT64] = sizeof(int64_t),
[FI_UINT64] = sizeof(uint64_t),
[FI_FLOAT] = sizeof(float),
[FI_DOUBLE] = sizeof(double),
[FI_FLOAT_COMPLEX] = sizeof(float complex),
[FI_DOUBLE_COMPLEX] = sizeof(double complex),
[FI_LONG_DOUBLE] = sizeof(long double),
[FI_LONG_DOUBLE_COMPLEX] = sizeof(long double complex),
};
size_t fi_datatype_size(enum fi_datatype datatype)
{
if (datatype >= FI_DATATYPE_LAST) {
errno = FI_EINVAL;
return 0;
}
return fi_datatype_size_table[datatype];
}

Просмотреть файл

@ -5,7 +5,7 @@
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
* BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
@ -146,7 +146,10 @@ static void fi_tostr_threading(char *buf, enum fi_threading threading)
switch (threading) {
CASEENUMSTR(FI_THREAD_UNSPEC);
CASEENUMSTR(FI_THREAD_SAFE);
CASEENUMSTR(FI_THREAD_PROGRESS);
CASEENUMSTR(FI_THREAD_FID);
CASEENUMSTR(FI_THREAD_DOMAIN);
CASEENUMSTR(FI_THREAD_COMPLETION);
CASEENUMSTR(FI_THREAD_ENDPOINT);
default:
strcatf(buf, "Unknown");
break;
@ -175,7 +178,6 @@ static void fi_tostr_caps(char *buf, uint64_t caps)
IFFLAGSTR(caps, FI_RMA);
IFFLAGSTR(caps, FI_TAGGED);
IFFLAGSTR(caps, FI_ATOMICS);
IFFLAGSTR(caps, FI_MULTICAST);
IFFLAGSTR(caps, FI_DYNAMIC_MR);
IFFLAGSTR(caps, FI_BUFFERED_RECV);
fi_tostr_flags(buf, caps);
@ -434,6 +436,57 @@ static void fi_tostr_av_type(char *buf, enum fi_av_type type)
}
}
static void fi_tostr_atomic_type(char *buf, enum fi_datatype type)
{
switch (type) {
CASEENUMSTR(FI_INT8);
CASEENUMSTR(FI_UINT8);
CASEENUMSTR(FI_INT16);
CASEENUMSTR(FI_UINT16);
CASEENUMSTR(FI_INT32);
CASEENUMSTR(FI_UINT32);
CASEENUMSTR(FI_INT64);
CASEENUMSTR(FI_UINT64);
CASEENUMSTR(FI_FLOAT);
CASEENUMSTR(FI_DOUBLE);
CASEENUMSTR(FI_FLOAT_COMPLEX);
CASEENUMSTR(FI_DOUBLE_COMPLEX);
CASEENUMSTR(FI_LONG_DOUBLE);
CASEENUMSTR(FI_LONG_DOUBLE_COMPLEX);
default:
strcatf(buf, "Unknown");
break;
}
}
static void fi_tostr_atomic_op(char *buf, enum fi_op op)
{
switch (op) {
CASEENUMSTR(FI_MIN);
CASEENUMSTR(FI_MAX);
CASEENUMSTR(FI_SUM);
CASEENUMSTR(FI_PROD);
CASEENUMSTR(FI_LOR);
CASEENUMSTR(FI_LAND);
CASEENUMSTR(FI_BOR);
CASEENUMSTR(FI_BAND);
CASEENUMSTR(FI_LXOR);
CASEENUMSTR(FI_BXOR);
CASEENUMSTR(FI_ATOMIC_READ);
CASEENUMSTR(FI_ATOMIC_WRITE);
CASEENUMSTR(FI_CSWAP);
CASEENUMSTR(FI_CSWAP_NE);
CASEENUMSTR(FI_CSWAP_LE);
CASEENUMSTR(FI_CSWAP_LT);
CASEENUMSTR(FI_CSWAP_GE);
CASEENUMSTR(FI_CSWAP_GT);
CASEENUMSTR(FI_MSWAP);
default:
strcatf(buf, "Unknown");
break;
}
}
__attribute__((visibility ("default")))
char *fi_tostr_(const void *data, enum fi_type datatype)
{
@ -501,6 +554,12 @@ char *fi_tostr_(const void *data, enum fi_type datatype)
case FI_TYPE_AV_TYPE:
fi_tostr_av_type(buf, enumval);
break;
case FI_TYPE_ATOMIC_TYPE:
fi_tostr_atomic_type(buf, enumval);
break;
case FI_TYPE_ATOMIC_OP:
fi_tostr_atomic_op(buf, enumval);
break;
default:
strcatf(buf, "Unknown type");
break;