Kaike Wan [Fri, 13 Jun 2014 19:28:25 +0000 (12:28 -0700)]
ibacm: enumerate endpoint
This patch enables a consumer application to enumerate all
local endpoints at a host served by the ibacm daemon. An endpoint
index will be provided to the ibacm core for each query. If the
index is out of range, an error will be returned.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Thu, 12 Jun 2014 16:19:22 +0000 (09:19 -0700)]
ibacm: remove unnecessary locking
Since the event handler is not an independent thread anymore,
there is no need to lock when adding/removing an address
to/from an endpoint or adding/removing an endpoint to/from a port.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Tue, 10 Jun 2014 20:04:02 +0000 (13:04 -0700)]
ibacm/prov: Call provider remove_address with address context only
This patch enables the core to call remove_address() with only
provider address context so that this interface call is similar
to those for closing endpoint/port/device.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Mon, 9 Jun 2014 23:52:47 +0000 (16:52 -0700)]
ibacm: Add support for endpoint performance query
Add support for to query endpoint-specific counters with a
source address. We currently support querying by IPv4/6
addressing. Endpoint specific queries are useful for analyzing
and debugging different provider performance.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Mon, 9 Jun 2014 22:43:27 +0000 (15:43 -0700)]
ibacm: Handle pkey/lid/gid change
When pkey/lid/gid changes, the endpoint and their addresses will be affected.
As a result, all endpoints will be removed and then added again.
Theoretically, it could selectively modify only those affected endpoints when
key changes. However, since pkey index, which is associated with a QP, may be
changed, the implementation could be very complicated.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Mon, 9 Jun 2014 21:38:19 +0000 (14:38 -0700)]
ibacm/prov: Change the provider to use the core SA access functions
This patch enables the default provider to access the SA through
helper functions in the core instead of the verbs interface.
Major changes:
(1) Join the multicast group through the new core SA interface;
(2) Get path record through the new core SA interface;
(3) Remove the code to open umad interface in the default provider;
(4) Remove the sa_depth option in the default provider.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Sean Hefty [Wed, 4 Jun 2014 18:39:36 +0000 (11:39 -0700)]
ibacm: Centralize provider SA access in core.
This patch is the first of a series to centralize the SA access for all
providers.
Here is the description of the approach:
(1) A provider will call the core to allocate a request and initialize
the request (including the callback function);
(2) Provider calls the core to send the SA request;
(3) The core SA handler thread will poll for any SA response;
(4) When a SA response is received, the core SA handler will find the
matching request and call the corresponding provider callback
function;
(5) The provider callback will handle the SA response and free the
SA request.
The approach has the following advantages:
(1) No code duplication in the provider for SA access;
(2) No need for a separate thread in the provider to wait for SA response.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Tue, 3 Jun 2014 22:44:52 +0000 (15:44 -0700)]
ibacm: Assign a provider to a port.
The assignment is based on a port's subnet_prefix. It is
assumed that all ports on a subnet partition should be
managed by one provider. The assignment is done through
the configuration file.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Tue, 3 Jun 2014 18:46:22 +0000 (11:46 -0700)]
ibacm: Define config, bin, and prov lib path in configure.ac file.
The reason behind this change is to make the ibacm
module works properly under normal build (./autogen.sh, ./configure,
make, make
install) and rpm build (./autogen.sh, ./configure, make dist, rpmbuild).
Without this change, the rpmbuild will not work properly:
(1) For normal build, the files will be installed under:
/usr/local/sbin: ibacm
/usr/local/bin: ib_acme
/usr/local/etc/rdma/: configuration files.
(2) For rpmbuild, the files will be installed under:
The configure.ac will be used in both cases to set up the path correctly.
This is necessary when we need to load the provider library from the
appropriate path.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Sean Hefty [Thu, 15 May 2014 21:08:04 +0000 (14:08 -0700)]
ibacm: Change acm_query_response to take the response message
acm_query_response should take as input the actual response
message to send, not the request message. The provider may have
already formatted a response message, and the core should not
override it.
Kaike Wan [Wed, 14 May 2014 00:21:46 +0000 (17:21 -0700)]
ibacm: Separate device/port/ep init/shutdown paths for core and provider.
The provider device and port will not be opened until the core port is up.
When a core ep is added, a corresponding provider ep will be opened.
Name/address addition/deletion should be addressed next.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Wed, 14 May 2014 00:12:49 +0000 (17:12 -0700)]
ibacm: port/ep cleanup after shutdown
This patch adds functions to close provider port and endpoint after the core
port and endpoint are closed. The default provider resources are not freed to
avoid synchronization issues with the provider completion thread and the retry
handler.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Tue, 13 May 2014 23:50:45 +0000 (16:50 -0700)]
ibacm: Open a provider ep only if an address is assigned to the core ep.
The function acm_assign_ep_names() should not return 0 when there is no valid
address assigned to the core ep. In this case, the provider's
ep should not be up (or acmp_ep_up() should not be called). However, when
there is at least one address assigned, 0 should be returned so that the
core endpoint and the provider endpoint should be created.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Kaike Wan [Wed, 16 Apr 2014 05:18:53 +0000 (22:18 -0700)]
ibacm: Eliminate device event handler thread.
The event handler thread creates synchronization issues
with the client request, especially when address/endpoint/port
is removed or shut down. This patch moves the device event
handling code into acm_server() so that event and client
reqest are serialized to avoid any potential synchronization
issues. We also lose the overhead of an additional thread.
Signed-off-by: Kaike Wan <kaike.wan@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Sean Hefty [Tue, 15 Apr 2014 22:25:12 +0000 (15:25 -0700)]
ibacm: Provide correct addr_len for IPv6
When reading in addresses from the address file, the
address string is converted into either an IPv4, IPv6,
or hostname 'address'. In the case of IPv6, the length
of the address is set to the maximum supported value.
This can result in extra bytes being set beyond the
actual IPv6 address, which are then copied into the
endpoint address. Fix this by setting the size
of the IPv6 correctly. When the address is copied into
the endpoint address, the extra bytes are then ignored.
Problem reported by: Kaike Wan <kaike.wan@intel.com>
Sean Hefty [Fri, 21 Mar 2014 08:21:01 +0000 (01:21 -0700)]
ibacm: Define separate structures for acm ports
Define a port structure for use by the ibacm core layer.
The core endpoints will be linked to this port structure.
Link struct acm_ep off struct acm_port and struct acmp_ep
off struct acmp_port. Separate the code accessing the
port structures into core or provider specific sections,
and have the functions reference the correct port
structure.
Sean Hefty [Fri, 21 Mar 2014 07:33:14 +0000 (00:33 -0700)]
ibacm: Convert ibacm server code to use acm_ep
The acm server code is part of the acm core. It should
only use the core struct acm_ep and not the provider
acmp_ep. This removes most uses of the provider ep
structure from the core server processing.
Sean Hefty [Sat, 22 Mar 2014 07:07:40 +0000 (00:07 -0700)]
ibacm: Convert acm_addr_index call to return address
Rename acm_addr_index to acm_addr_lookup and have it
return the acm_address that matches the source address,
rather than the index that the address is located.
The index is an internal limitation of the acm core
and the acm_address is usable by the providers.
Change acm_addr_lookup to take the endpoint as input
in place of the provider ep. acm_addr_lookup is
intended to be exported by the acm core.
Sean Hefty [Mon, 24 Mar 2014 05:27:28 +0000 (22:27 -0700)]
ibacm: Add basic provider framework
Define the provider interface for handling path record query
and route resolution requests. This will define the boundary
between the provider and the core layer.
Update the core functions to invoke the provider interfaces
used for processing client requests.
Sean Hefty [Mon, 24 Mar 2014 06:24:54 +0000 (23:24 -0700)]
ibacm: Define provider endpoint identifier
Introduce a header file that will be included by providers that
will define the interface between the ibacm core layer and the
providers.
Define an endpoint identifier that is associated with a set of
addresses. Providers will be given this structure in requests.
The endpoint is defined as a <device, port, pkey> tuple, though
it may be used with "any" values in order to identify any
port on a device and/or any pkey on a port.
Sean Hefty [Mon, 24 Mar 2014 05:11:58 +0000 (22:11 -0700)]
ibacm: Change client parameter to req id in resp calls
The ibacm core will manage the client connection. Providers
should not interact with clients directly. Instead, the core
will give providers a request id with each request that will be
returned to the core layer when the request has completed.
Change the client field in struct acm_request to an id field,
and update the provider identified functions to use the id
in place of accesing the client directly.
Sean Hefty [Mon, 24 Mar 2014 04:49:13 +0000 (21:49 -0700)]
ibacm: Rename data structures
Provider support will require separate definitions for the
device, port, and endpoint structures between the acm
core and the existing provider. The current struct
acm_port and struct acm_ep contain fields that are
mainly used by what will become the provider. Rename
these structures to have an acmp prefix to indicate
that the provider will own their use.
Sean Hefty [Mon, 24 Mar 2014 01:19:29 +0000 (18:19 -0700)]
ibacm: Function renames
Supporting providers will require existing functionality
to become part of the acm core function or a provider
operation.
Any functionality that will migrate into the provider code
is renamed with the 'acmp' prefix. A couple of core
functions are also renamed to indicate that they will
become callback handlers and exposed directly to the
providers.
Sean Hefty [Wed, 9 Apr 2014 19:04:19 +0000 (12:04 -0700)]
ibacm: Fix invalid memory dereference in acm_process_join_resp
If a join request fails, the dest pointer may not be initialized.
This can result in the ibacm daemon crashing. Fix the crash and
ensure that the multicast state is set correctly in case the
join fails by initializing the state to ACM_INIT before sending
the join request.
Problem reported by: Kaike Wan <kaike.wan@intel.com>
Sean Hefty [Fri, 21 Mar 2014 06:23:06 +0000 (23:23 -0700)]
ibacm: Reset endpoint state on error
An endpoint will be set to the ACM_READY state after
joining its multicast group. If we later receive a
reregister event or port down followed by port up and
try to join the group again but fail, we will leave the
endpoint state as READY, rather than reset it back to INIT.
To fix, always set the mc_dest state to ACM_INIT on
any failure.
Sean Hefty [Fri, 21 Mar 2014 03:59:58 +0000 (20:59 -0700)]
ibacm: Change base endpoint name
Endpoints are given a string identifer (base name) that matches
the first address assigned to the endpoint. Store the endpoint
string identifier separately from the address name, and identify
the endpoint using the device name, port, and pkey.
The endpoint identifier is only used for logging purposes.
Sean Hefty [Wed, 19 Mar 2014 22:45:48 +0000 (15:45 -0700)]
ibacm: Record index for source and destination addresses
When processing a resolve route message, record what
index the source and destination addresses were located
at directly into the message. This replaces returning
pointers to the source and destination address that must
then be passed around.
When provider plug-in support is added in subsequent
patches, this will avoid pointer exchanges between the
core and provider code.
Fix a minor issue where the src_out field may be
uninitialized (value read from client message). Src_out
now becomes a boolean value, rather than an index. The
actual location for the output is specified as an index.
This change cleanups the call to acm_svr_select_src,
which selects a source address. It is only called when
a source is needed, which is explicitly determined by
seeing if src_out is set, rather than relying on a zero
src type field.
Sean Hefty [Thu, 20 Mar 2014 05:14:31 +0000 (22:14 -0700)]
ibacm: Relocate client refcnt
Adjust when we take a reference on the client connection.
Increment the client reference when we begin processing
the client's request, and release it when the response
has been sent.
The client reference will no longer be associated with the
lifetime of any underlying acm_request structure. This change
will allow the acm core to control the client reference
count when we move to a provider plug-in model in subsequent
patches.
Ira Weiny [Tue, 25 Mar 2014 03:17:37 +0000 (23:17 -0400)]
ibacm: Move calling of helper functions out of get_devaddr
Again this is in prep for sharing this code with ibacm and ib_acme
get_devaddr uses globals which are specific to ib_acme. Move toward this
function being ib_acme specific while the code in get_addr_ip becomes generic.
Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Hal Rosenstock [Thu, 1 Aug 2013 21:10:00 +0000 (14:10 -0700)]
acm: Save endpoint pkey in host order
acm_ep stores and uses a pkey value, assuming that it is in
host order. However, ibv_query_pkey returns the pkey in network
order. We need to byte swap the pkey when saving it.
Signed-off-by: Hal Rosenstock <hal@mellanox.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com>