Skip to content

Commit

Permalink
ibacm: major rework to align with linux AF_IB changes
Browse files Browse the repository at this point in the history
Simplified service's socket interface, and updated code to share
data structure definitions from libibverbs.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
  • Loading branch information
shefty committed Apr 1, 2010
1 parent 4e826b4 commit a0aaa50
Show file tree
Hide file tree
Showing 13 changed files with 3,651 additions and 3,768 deletions.
29 changes: 3 additions & 26 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,42 +1,19 @@
INCLUDES = -I$(srcdir)/include -I$(srcdir)/linux

lib_LTLIBRARIES = linux/libibacm.la

AM_CFLAGS = -g -Wall -D_GNU_SOURCE

linux_libibacm_la_CFLAGS = $(AM_CFLAGS)

if HAVE_LD_VERSION_SCRIPT
libibacm_version_script = -Wl,--version-script=$(srcdir)/linux/libibacm.map
else
libibacm_version_script =
endif

linux_libibacm_la_SOURCES = src/libacm.c linux/libacm_linux.c
linux_libibacm_la_LDFLAGS = -version-info 0 -export-dynamic \
$(libibacm_version_script)
linux_libibacm_la_DEPENDENCIES = $(srcdir)/linux/libibacm.map

bin_PROGRAMS = svc/ib_acm util/ib_acme
svc_ib_acm_SOURCES = src/acm.c
util_ib_acme_SOURCES = src/acme.c linux/acme_linux.c
util_ib_acme_LDADD = $(top_builddir)/linux/libibacm.la
util_ib_acme_SOURCES = src/acme.c linux/acme_linux.c src/libacm.c linux/libacm_linux.c
svc_ib_acm_CFLAGS = $(AM_CFLAGS)
util_ib_acme_CFLAGS = $(AM_CFLAGS)

libibacmincludedir = $(includedir)/infiniband
ib_acmincludedir = $(includedir)/infiniband

libibacminclude_HEADERS = include/infiniband/ib_acm.h include/infiniband/acm.h
ib_acminclude_HEADERS = include/infiniband/acm.h

man_MANS = \
man/ib_acm_resolve_name.3 \
man/ib_acm_resolve_ip.3 \
man/ib_acm_resolve_path.3 \
man/ib_acme.1 \
man/ib_acm.1 \
man/ib_acm.7

EXTRA_DIST = linux/libibacm.map libibacm.spec.in $(man_MANS)

dist-hook: libibacm.spec
cp libibacm.spec $(distdir)
15 changes: 15 additions & 0 deletions acm_opts.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ log_file stdout

log_level 0

# addr_prot:
# Default resolution protocol to resolve IP addresses into IB GIDs.
# Supported protocols are:
# acm - Use ACM multicast protocol, which is similar to ARP.

addr_prot acm

# route_prot:
# Default resolution protocol to resolve IB routing information.
# Supported protocols are:
# sa - Query SA for path record data and cache results.
# acm - Use ACM multicast protocol.

route_prot acm

# server_port:
# TCP port number that the server listens on.
# If this value is changed, then a corresponding change is required for
Expand Down
10 changes: 5 additions & 5 deletions configure.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(ib_acm, 0.0.1, general@lists.openfabrics.org)
AC_CONFIG_SRCDIR([src/libacm.c])
AC_INIT(ib_acm, 0.0.2, linux-rdma@vger.kernel.org)
AC_CONFIG_SRCDIR([src/acm.c])
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libibacm, 0.0.1)
AM_INIT_AUTOMAKE(ib_acm, 0.0.2)

AM_PROG_LIBTOOL

AC_ARG_ENABLE(libcheck, [ --disable-libcheck do not test for presence of ib libraries],
AC_ARG_ENABLE(libcheck, [ --disable-libcheck do not test for presence of ib libraries],
[ if test "$enableval" = "no"; then
disable_libcheck=yes
fi
Expand Down Expand Up @@ -48,5 +48,5 @@ AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,

AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")

AC_CONFIG_FILES([Makefile libibacm.spec])
AC_CONFIG_FILES([Makefile ibacm.spec])
AC_OUTPUT
27 changes: 5 additions & 22 deletions libibacm.spec.in → ibacm.spec.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%define ver @VERSION@

Name: libibacm
Version: 0.0.1
Name: ib_acm
Version: 0.0.2
Release: 1%{?dist}
Summary: InfiniBand Communication Manager Assistant

Expand All @@ -14,15 +14,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libibverbs-devel >= 1.1-1

%description
libibacm assists with establishing communication over Infiniband.

%package devel
Summary: Development files for the libibacm library
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
Development files for the libibacm library.
ib_acm assists with establishing communication over Infiniband.

%package svc
Summary: IB CM pre-connection service application
Expand All @@ -42,8 +34,6 @@ make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
%makeinstall
# remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT
Expand All @@ -53,20 +43,13 @@ rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_libdir}/libibacm*.so.*
%doc AUTHORS COPYING README

%files devel
%defattr(-,root,root)
%{_libdir}/lib*.so
%{_libdir}/*.a
%{_includedir}/*
%{_mandir}/man3/*
%{_mandir}/man7/*

%files svc
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/man3/*
%{_mandir}/man7/*

%changelog
223 changes: 109 additions & 114 deletions include/infiniband/acm.h
Original file line number Diff line number Diff line change
@@ -1,114 +1,109 @@
/*
* Copyright (c) 2009 Intel Corporation. All rights reserved.
*
* This software is available to you under the OpenFabrics.org BSD license
* below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#if !defined(ACM_H)
#define ACM_H

#include <infiniband/ib_acm.h>

#define ACM_VERSION 1

#define ACM_OP_MASK 0x0F
#define ACM_OP_RESOLVE 0x01
#define ACM_OP_ACK 0x80

#define ACM_STATUS_SUCCESS 0
#define ACM_STATUS_ENOMEM 1
#define ACM_STATUS_EINVAL 2
#define ACM_STATUS_ENODATA 3
#define ACM_STATUS_ENOTCONN 5
#define ACM_STATUS_ETIMEDOUT 6
#define ACM_STATUS_ESRCADDR 7
#define ACM_STATUS_ESRCTYPE 8
#define ACM_STATUS_EDESTADDR 9
#define ACM_STATUS_EDESTTYPE 10

#define ACM_FLAGS_QUERY_SA (1<<31)

#define ACM_MSG_HDR_LENGTH 16
#define ACM_MAX_ADDRESS 64
#define ACM_MSG_EP_LENGTH 72
/*
* Support up to 6 path records (primary and alternate CM paths,
* inbound and outbound primary and alternate data paths), plus CM data.
*/
#define ACM_MSG_DATA_LENGTH (ACM_MSG_EP_LENGTH * 8)

struct acm_hdr
{
uint8_t version;
uint8_t opcode;
uint8_t status;
uint8_t reserved[3];
uint16_t length;
uint64_t tid;
};

#define ACM_EP_INFO_NAME 0x0001
#define ACM_EP_INFO_ADDRESS_IP 0x0002
#define ACM_EP_INFO_ADDRESS_IP6 0x0003
#define ACM_EP_INFO_PATH 0x0010
#define ACM_EP_INFO_CM 0x0100

struct acm_cm_data
{
uint8_t init_depth;
uint8_t resp_resources;
uint8_t reserved2[62];
};

union acm_ep_info
{
uint8_t addr[ACM_MAX_ADDRESS];
uint8_t name[ACM_MAX_ADDRESS];
struct acm_cm_data cm;
struct ib_path_record path;
};

struct acm_ep_addr_data
{
uint32_t flags;
uint16_t type;
uint16_t reserved;
union acm_ep_info info;
};

struct acm_resolve_msg
{
struct acm_hdr hdr;
struct acm_ep_addr_data data[0];
};

struct acm_msg
{
struct acm_hdr hdr;
uint8_t data[ACM_MSG_DATA_LENGTH];
};

#endif /* ACM_H */
/*
* Copyright (c) 2009 Intel Corporation. All rights reserved.
*
* This software is available to you under the OpenFabrics.org BSD license
* below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#if !defined(ACM_H)
#define ACM_H

#include <infiniband/verbs.h>
#include <infiniband/sa.h>

#define ACM_VERSION 1

#define ACM_OP_MASK 0x0F
#define ACM_OP_RESOLVE 0x01
#define ACM_OP_ACK 0x80

#define ACM_STATUS_SUCCESS 0
#define ACM_STATUS_ENOMEM 1
#define ACM_STATUS_EINVAL 2
#define ACM_STATUS_ENODATA 3
#define ACM_STATUS_ENOTCONN 5
#define ACM_STATUS_ETIMEDOUT 6
#define ACM_STATUS_ESRCADDR 7
#define ACM_STATUS_ESRCTYPE 8
#define ACM_STATUS_EDESTADDR 9
#define ACM_STATUS_EDESTTYPE 10

#define ACM_FLAGS_QUERY_SA (1<<31)

#define ACM_MSG_HDR_LENGTH 16
#define ACM_MAX_ADDRESS 64
#define ACM_MSG_EP_LENGTH 72
/*
* Support up to 6 path records (primary and alternate CM paths,
* inbound and outbound primary and alternate data paths), plus CM data.
*/
#define ACM_MSG_DATA_LENGTH (ACM_MSG_EP_LENGTH * 8)

struct acm_hdr
{
uint8_t version;
uint8_t opcode;
uint8_t status;
uint8_t reserved[3];
uint16_t length;
uint64_t tid;
};

#define ACM_EP_INFO_NAME 0x0001
#define ACM_EP_INFO_ADDRESS_IP 0x0002
#define ACM_EP_INFO_ADDRESS_IP6 0x0003
#define ACM_EP_INFO_PATH 0x0010

union acm_ep_info
{
uint8_t addr[ACM_MAX_ADDRESS];
uint8_t name[ACM_MAX_ADDRESS];
struct ib_path_record path;
};

#define ACM_EP_FLAG_SOURCE (1<<0)
#define ACM_EP_FLAG_DEST (1<<1)

struct acm_ep_addr_data
{
uint32_t flags;
uint16_t type;
uint16_t reserved;
union acm_ep_info info;
};

struct acm_resolve_msg
{
struct acm_hdr hdr;
struct acm_ep_addr_data data[0];
};

struct acm_msg
{
struct acm_hdr hdr;
uint8_t data[ACM_MSG_DATA_LENGTH];
};

#endif /* ACM_H */

0 comments on commit a0aaa50

Please sign in to comment.