Hello community,
here is the log from the commit of package ibacm for openSUSE:Factory checked in at 2015-02-16 21:14:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ibacm (Old)
and /work/SRC/openSUSE:Factory/.ibacm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ibacm"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ibacm/ibacm.changes 2014-09-06 12:18:16.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ibacm.new/ibacm.changes 2015-02-16 21:14:27.000000000 +0100
@@ -1,0 +2,9 @@
+Fri Feb 13 14:20:55 UTC 2015 - p.drouand@gmail.com
+
+- Update to version 1.0.9
+ * Empty changelog
+- Remove obsolete ibacm-no_type_punning.patch
+- Remove unused sysvinit script
+- Use download Url as source
+
+-------------------------------------------------------------------
Old:
----
ibacm-1.0.8.tar.gz
ibacm-no_type_punning.patch
New:
----
ibacm-1.0.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ibacm.spec ++++++
--- /var/tmp/diff_new_pack.K2EyZu/_old 2015-02-16 21:14:28.000000000 +0100
+++ /var/tmp/diff_new_pack.K2EyZu/_new 2015-02-16 21:14:28.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package ibacm
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,15 +17,13 @@
Name: ibacm
-Version: 1.0.8
+Version: 1.0.9
Release: 0
Summary: InfiniBand Communication Manager Assistant
License: GPL-2.0 or BSD-2-Clause
Group: Productivity/Networking/System
Url: http://www.openfabrics.org/
-Source: %{name}-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM ibacm-no_type_punning.patch
-Patch0: ibacm-no_type_punning.patch
+Source: https://www.openfabrics.org/downloads/rdmacm/%{name}-%{version}.tar.gz
BuildRequires: libibumad-devel
BuildRequires: libibverbs-devel >= 1.1-1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -44,7 +42,6 @@
%prep
%setup -q
-%patch0
%build
export AM_LDFLAGS=-pthread
@@ -54,11 +51,12 @@
%install
%makeinstall
+# Remove sysvinit script, as it's not used anyway
+rm -rf %{buildroot}%{_sysconfdir}
%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
-%{_sysconfdir}/init.d/ibacm
%{_bindir}/ib_acme
%{_sbindir}/ibacm
%{_mandir}/man1/*
++++++ ibacm-1.0.8.tar.gz -> ibacm-1.0.9.tar.gz ++++++
++++ 1826 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/Makefile.am new/ibacm-1.0.9/Makefile.am
--- old/ibacm-1.0.8/Makefile.am 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/Makefile.am 2014-06-23 19:44:45.000000000 +0200
@@ -1,13 +1,13 @@
-AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/linux
+AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/linux -I$(srcdir)/src
AM_CFLAGS = -g -Wall -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)\" -DBINDIR=\"$(bindir)\" -DRDMADIR=\"@rdmadir@\"
bin_PROGRAMS = util/ib_acme
sbin_PROGRAMS = svc/ibacm
-svc_ibacm_SOURCES = src/acm.c
-util_ib_acme_SOURCES = src/acme.c linux/acme_linux.c src/libacm.c linux/libacm_linux.c src/parse.c
+svc_ibacm_SOURCES = src/acm.c src/acm_util.c
+util_ib_acme_SOURCES = src/acme.c src/libacm.c linux/libacm_linux.c src/parse.c
svc_ibacm_CFLAGS = $(AM_CFLAGS)
-util_ib_acme_CFLAGS = $(AM_CFLAGS)
+util_ib_acme_CFLAGS = $(AM_CFLAGS) -DACME_PRINTS
ibacmincludedir = $(includedir)/infiniband
@@ -18,7 +18,7 @@
man/ibacm.1 \
man/ibacm.7
-EXTRA_DIST = src/acm_mad.h src/libacm.h ibacm.init.in \
+EXTRA_DIST = src/acm_util.h src/acm_mad.h src/libacm.h ibacm.init.in \
linux/osd.h linux/dlist.h ibacm.spec.in $(man_MANS) ibacm_hosts.data
install-exec-hook:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/configure.ac new/ibacm-1.0.9/configure.ac
--- old/ibacm-1.0.8/configure.ac 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/configure.ac 2014-06-23 19:44:46.000000000 +0200
@@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
-AC_INIT([ibacm], [1.0.8], [linux-rdma@vger.kernel.org])
+AC_INIT([ibacm], [1.0.9], [linux-rdma@vger.kernel.org])
AC_CONFIG_SRCDIR([src/acm.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADERS([config.h])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/ibacm.init.in new/ibacm-1.0.9/ibacm.init.in
--- old/ibacm-1.0.8/ibacm.init.in 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/ibacm.init.in 2014-06-23 19:44:45.000000000 +0200
@@ -15,48 +15,78 @@
# Should-Stop:
# Short-Description: Starts and stops the InfiniBand ACM service
# Description: The InfiniBand ACM service provides a user space implementation
-# of someting resembling an ARP cache for InfiniBand SA queries and
+# of something resembling an ARP cache for InfiniBand SA queries and
# host route lookups.
### END INIT INFO
pidfile=/var/run/ibacm.pid
subsys=/var/lock/subsys/ibacm
-. /etc/rc.d/init.d/functions
+daemon() { /sbin/daemon ${1+"$@"}; }
+
+if [ -s /etc/init.d/functions ]; then
+ # RHEL / CentOS / SL / Fedora
+ . /etc/init.d/functions
+ _daemon() { daemon ${1+"$@"}; }
+ _checkpid() { checkpid `cat $pidfile`; }
+ _success() { success; echo; }
+ _failure() { failure; echo; }
+elif [ -s /lib/lsb/init-functions ]; then
+ # SLES / OpenSuSE / Debian
+ . /lib/lsb/init-functions
+ _daemon() { /sbin/start_daemon ${1+"$@"}; }
+ _checkpid() { checkproc -p $pidfile @prefix@/sbin/ibacm; }
+ _success() { log_success_msg; }
+ _failure() { log_failure_msg; }
+elif [ -s /etc/rc.status ]; then
+ # Older SuSE
+ . /etc/rc.status
+ _daemon() { /sbin/start_daemon ${1+"$@"}; }
+ _checkpid() { checkproc -p $pidfile @prefix@/sbin/ibacm; }
+ _success() { rc_status -v; }
+ _failure() { rc_status -v; }
+fi
start()
{
echo -n "Starting ibacm daemon:"
-
- daemon @prefix@/sbin/ibacm
- RC=$?
- [ $RC -eq 0 ] && touch $subsys
- echo
- return $RC
+ _daemon @prefix@/sbin/ibacm
+ if [[ $RETVAL -eq 0 ]]; then
+ _success
+ else
+ _failure
+ fi
}
stop()
{
echo -n "Stopping ibacm daemon:"
-
killproc -p $pidfile ibacm
- RC=$?
+ if [[ $RETVAL -eq 0 ]]; then
+ _success
+ else
+ _failure
+ fi
rm -f $subsys
- echo
- return $RC
}
status()
{
+ echo -n "Checking for ibacm service "
if [ ! -f $subsys -a ! -f $pidfile ]; then
- return 3
- fi
- if [ -f $pidfile ]; then
- checkpid `cat $pidfile`
- return $?
+ RETVAL=3
+ elif [ -f $pidfile ]; then
+ _checkpid
+ RETVAL=$?
+ elif [ -f $subsys ]; then
+ RETVAL=2
+ else
+ RETVAL=0
fi
- if [ -f $subsys ]; then
- return 2
+ if [[ $RETVAL -eq 0 ]]; then
+ _success
+ else
+ _failure
fi
}
@@ -85,15 +115,24 @@
esac
case $1 in
- start) start; RC=$? ;;
- stop) stop; RC=$? ;;
- restart) restart; RC=$? ;;
- reload) RC=3 ;;
- condrestart) condrestart; RC=$? ;;
- try-restart) condrestart; RC=$? ;;
- force-reload) condrestart; RC=$? ;;
- status) status; RC=$? ;;
- *) usage; RC=$? ;;
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart | reload)
+ restart
+ ;;
+ condrestart | try-restart | force-reload)
+ condrestart
+ ;;
+ status)
+ status
+ ;;
+ *)
+ usage
+ ;;
esac
-exit $RC
+exit $RETVAL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/ibacm.spec new/ibacm-1.0.9/ibacm.spec
--- old/ibacm-1.0.8/ibacm.spec 2013-07-26 06:29:42.000000000 +0200
+++ new/ibacm-1.0.9/ibacm.spec 2014-06-23 20:40:53.000000000 +0200
@@ -1,5 +1,5 @@
Name: ibacm
-Version: 1.0.8
+Version: 1.0.9
Release: 1%{?dist}
Summary: InfiniBand Communication Manager Assistant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/ibacm.spec.in new/ibacm-1.0.9/ibacm.spec.in
--- old/ibacm-1.0.8/ibacm.spec.in 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/ibacm.spec.in 2014-06-23 19:44:45.000000000 +0200
@@ -1,5 +1,5 @@
Name: ibacm
-Version: 1.0.8
+Version: 1.0.9
Release: 1%{?dist}
Summary: InfiniBand Communication Manager Assistant
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/linux/acme_linux.c new/ibacm-1.0.9/linux/acme_linux.c
--- old/ibacm-1.0.8/linux/acme_linux.c 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/linux/acme_linux.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,217 +0,0 @@
-/*
- * Copyright (c) 2009 Intel Corporation. All rights reserved.
- *
- * This software is available to you under the OpenIB.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.
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-extern struct ibv_context **verbs;
-extern int dev_cnt;
-extern int verbose;
-
-
-static int
-get_pkey(struct ifreq *ifreq, uint16_t *pkey)
-{
- char buf[128], *end;
- FILE *f;
- int ret;
-
- snprintf(buf, sizeof buf, "//sys//class//net//%s//pkey", ifreq->ifr_name);
- f = fopen(buf, "r");
- if (!f) {
- printf("failed to open %s\n", buf);
- return -1;
- }
-
- if (fgets(buf, sizeof buf, f)) {
- *pkey = strtol(buf, &end, 16);
- ret = 0;
- } else {
- printf("failed to read pkey\n");
- ret = -1;
- }
-
- fclose(f);
- return ret;
-}
-
-static int
-get_sgid(struct ifreq *ifr, union ibv_gid *sgid)
-{
- char buf[128], *end;
- FILE *f;
- int i, p, ret;
-
- snprintf(buf, sizeof buf, "//sys//class//net//%s//address", ifr->ifr_name);
- f = fopen(buf, "r");
- if (!f) {
- printf("failed to open %s\n", buf);
- return -1;
- }
-
- if (fgets(buf, sizeof buf, f)) {
- for (i = 0, p = 12; i < 16; i++, p += 3) {
- buf[p + 2] = '\0';
- sgid->raw[i] = (uint8_t) strtol(buf + p, &end, 16);
- }
- ret = 0;
- } else {
- printf("failed to read sgid\n");
- ret = -1;
- }
-
- fclose(f);
- return ret;
-}
-
-static int
-get_devaddr(int s, struct ifreq *ifr,
- int *dev_index, uint8_t *port, uint16_t *pkey)
-{
- struct ibv_device_attr dev_attr;
- struct ibv_port_attr port_attr;
- union ibv_gid sgid, gid;
- int ret, i;
-
- ret = get_sgid(ifr, &sgid);
- if (ret) {
- printf("unable to get sgid\n");
- return ret;
- }
-
- ret = get_pkey(ifr, pkey);
- if (ret) {
- printf("unable to get pkey\n");
- return ret;
- }
-
- for (*dev_index = 0; *dev_index < dev_cnt; (*dev_index)++) {
- ret = ibv_query_device(verbs[*dev_index], &dev_attr);
- if (ret)
- continue;
-
- for (*port = 1; *port <= dev_attr.phys_port_cnt; (*port)++) {
- ret = ibv_query_port(verbs[*dev_index], *port, &port_attr);
- if (ret)
- continue;
-
- for (i = 0; i < port_attr.gid_tbl_len; i++) {
- ret = ibv_query_gid(verbs[*dev_index], *port, i, &gid);
- if (ret || !gid.global.interface_id)
- break;
-
- if (!memcmp(sgid.raw, gid.raw, sizeof gid))
- return 0;
- }
- }
- }
- return -1;
-}
-
-int gen_addr_ip(FILE *f)
-{
- struct ifconf *ifc;
- struct ifreq *ifr;
- char ip[INET6_ADDRSTRLEN];
- int s, ret, dev_index, i, len;
- uint16_t pkey;
- uint8_t port;
-
- s = socket(AF_INET6, SOCK_DGRAM, 0);
- if (!s)
- return -1;
-
- len = sizeof(*ifc) + sizeof(*ifr) * 64;
- ifc = malloc(len);
- if (!ifc) {
- ret = -1;
- goto out1;
- }
-
- memset(ifc, 0, len);
- ifc->ifc_len = len;
- ifc->ifc_req = (struct ifreq *) (ifc + 1);
-
- ret = ioctl(s, SIOCGIFCONF, ifc);
- if (ret < 0) {
- printf("ioctl ifconf error %d\n", ret);
- goto out2;
- }
-
- ifr = ifc->ifc_req;
- for (i = 0; i < ifc->ifc_len / sizeof(struct ifreq); i++) {
- switch (ifr[i].ifr_addr.sa_family) {
- case AF_INET:
- inet_ntop(ifr[i].ifr_addr.sa_family,
- &((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr, ip, sizeof ip);
- break;
- case AF_INET6:
- inet_ntop(ifr[i].ifr_addr.sa_family,
- &((struct sockaddr_in6 *) &ifr[i].ifr_addr)->sin6_addr, ip, sizeof ip);
- break;
- default:
- continue;
- }
-
- ret = ioctl(s, SIOCGIFHWADDR, &ifr[i]);
- if (ret) {
- printf("failed to get hw address %d\n", ret);
- continue;
- }
-
- if (ifr[i].ifr_hwaddr.sa_family != ARPHRD_INFINIBAND)
- continue;
-
- ret = get_devaddr(s, &ifr[i], &dev_index, &port, &pkey);
- if (ret)
- continue;
-
- if (verbose)
- printf("%s %s %d 0x%x\n", ip, verbs[dev_index]->device->name, port, pkey);
- fprintf(f, "%s %s %d 0x%x\n", ip, verbs[dev_index]->device->name, port, pkey);
- }
- ret = 0;
-
-out2:
- free(ifc);
-out1:
- close(s);
- return ret;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/man/ib_acme.1 new/ibacm-1.0.9/man/ib_acme.1
--- old/ibacm-1.0.8/man/ib_acme.1 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/man/ib_acme.1 2014-06-23 19:44:46.000000000 +0200
@@ -55,8 +55,7 @@
\-A [addr_file]
With this option, the ib_acme utility automatically generates the address
configuration file ibacm_addr.cfg. The generated file is
-constructed using the system host name and any IP addresses that are
-assigned to IPoIB device instances.
+constructed using the system host name.
.TP
\-O [opt_file]
With this option, the ib_acme utility automatically generates the option
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/src/acm.c new/ibacm-1.0.9/src/acm.c
--- old/ibacm-1.0.8/src/acm.c 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/src/acm.c 2014-06-23 19:44:45.000000000 +0200
@@ -46,7 +46,14 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "acm_mad.h"
+#include "acm_util.h"
#define src_out data[0]
@@ -120,7 +127,7 @@
enum ibv_rate rate;
int subnet_timeout;
int gid_cnt;
- uint16_t pkey_cnt;
+ uint16_t default_pkey_ix;
uint16_t lid;
uint16_t lid_mask;
uint8_t port_num;
@@ -210,7 +217,8 @@
static atomic_t wait_cnt;
static SOCKET listen_socket;
-static struct acm_client client[FD_SETSIZE - 1];
+static SOCKET ip_mon_socket;
+static struct acm_client client_array[FD_SETSIZE - 1];
static FILE *flog;
static lock_t log_lock;
@@ -244,11 +252,9 @@
static uint8_t min_rate = IBV_RATE_10_GBPS;
static enum acm_route_preload route_preload;
static enum acm_addr_preload addr_preload;
+static int support_ips_in_addr_cfg = 0;
-#define acm_log(level, format, ...) \
- acm_write(level, "%s: "format, __func__, ## __VA_ARGS__)
-
-static void acm_write(int level, const char *format, ...)
+void acm_write(int level, const char *format, ...)
{
va_list args;
struct timeval tv;
@@ -452,7 +458,7 @@
acm_free_req(struct acm_request *req)
{
acm_log(2, "%p\n", req);
- (void) atomic_dec(&client->refcnt);
+ (void) atomic_dec(&req->client->refcnt);
free(req);
}
@@ -791,6 +797,27 @@
lock_release(&ep->lock);
}
+static void acm_mark_addr_invalid(struct acm_ep *ep,
+ struct acm_ep_addr_data *data)
+{
+ int i;
+
+ lock_acquire(&ep->lock);
+ for (i = 0; i < MAX_EP_ADDR; i++) {
+ if (ep->addr_type[i] != data->type)
+ continue;
+
+ if ((data->type == ACM_ADDRESS_NAME &&
+ !strnicmp((char *) ep->addr[i].name,
+ (char *) data->info.addr, ACM_MAX_ADDRESS)) ||
+ !memcmp(ep->addr[i].addr, data->info.addr, ACM_MAX_ADDRESS)) {
+ ep->addr_type[i] = ACM_ADDRESS_INVALID;
+ break;
+ }
+ }
+ lock_release(&ep->lock);
+}
+
static int acm_addr_index(struct acm_ep *ep, uint8_t *addr, uint8_t addr_type)
{
int i;
@@ -839,7 +866,7 @@
mad->mgmt_class = IB_MGMT_CLASS_SA;
mad->class_version = 2;
mad->method = IB_METHOD_GET;
- mad->tid = (uint64_t) atomic_inc(&tid);
+ mad->tid = htonll((uint64_t) atomic_inc(&tid));
mad->attr_id = IB_SA_ATTR_PATH_REC;
}
@@ -1483,7 +1510,7 @@
mad->mgmt_class = IB_MGMT_CLASS_SA;
mad->class_version = 2;
mad->method = IB_METHOD_SET;
- mad->tid = (uint64_t) atomic_inc(&tid);
+ mad->tid = htonll((uint64_t) atomic_inc(&tid));
mad->attr_id = IB_SA_ATTR_MC_MEMBER_REC;
mad->comp_mask =
IB_COMP_MASK_MC_MGID | IB_COMP_MASK_MC_PORT_GID |
@@ -1493,9 +1520,9 @@
IB_COMP_MASK_MC_SCOPE | IB_COMP_MASK_MC_JOIN_STATE;
mc_rec = (struct ib_mc_member_rec *) mad->data;
- acm_format_mgid(&mc_rec->mgid, pkey, tos, rate, mtu);
+ acm_format_mgid(&mc_rec->mgid, pkey | 0x8000, tos, rate, mtu);
mc_rec->port_gid = *port_gid;
- mc_rec->qkey = ACM_QKEY;
+ mc_rec->qkey = htonl(ACM_QKEY);
mc_rec->mtu = 0x80 | mtu;
mc_rec->tclass = tclass;
mc_rec->pkey = htons(pkey);
@@ -1523,8 +1550,7 @@
port = ep->port;
umad->addr.qpn = htonl(port->sa_dest.remote_qpn);
- umad->addr.qkey = htonl(ACM_QKEY);
- umad->addr.pkey_index = ep->pkey_index;
+ umad->addr.pkey_index = port->default_pkey_ix;
umad->addr.lid = htons(port->sa_dest.av.dlid);
umad->addr.sl = port->sa_dest.av.sl;
umad->addr.path_bits = port->sa_dest.av.src_path_bits;
@@ -1599,13 +1625,15 @@
DLIST_ENTRY *entry;
struct acm_send_msg *msg;
struct acm_resolve_rec *rec;
+ struct acm_mad *mad;
while (!DListEmpty(&timeout_list)) {
entry = timeout_list.Next;
DListRemove(entry);
msg = container_of(entry, struct acm_send_msg, entry);
- rec = (struct acm_resolve_rec *) ((struct acm_mad *) msg->data)->data;
+ mad = (struct acm_mad *) &msg->data[0];
+ rec = (struct acm_resolve_rec *) mad->data;
acm_format_name(0, log_data, sizeof log_data,
rec->dest_type, rec->dest, sizeof rec->dest);
@@ -1691,10 +1719,10 @@
int i;
for (i = 0; i < FD_SETSIZE - 1; i++) {
- lock_init(&client[i].lock);
- client[i].index = i;
- client[i].sock = INVALID_SOCKET;
- atomic_init(&client[i].refcnt);
+ lock_init(&client_array[i].lock);
+ client_array[i].index = i;
+ client_array[i].sock = INVALID_SOCKET;
+ atomic_init(&client_array[i].refcnt);
}
if (!(f = fopen("/var/run/ibacm.port", "w"))) {
@@ -1759,7 +1787,7 @@
}
for (i = 0; i < FD_SETSIZE - 1; i++) {
- if (!atomic_get(&client[i].refcnt))
+ if (!atomic_get(&client_array[i].refcnt))
break;
}
@@ -1769,8 +1797,8 @@
return;
}
- client[i].sock = s;
- atomic_set(&client[i].refcnt, 1);
+ client_array[i].sock = s;
+ atomic_set(&client_array[i].refcnt, 1);
acm_log(2, "assigned client %d\n", i);
}
@@ -1953,7 +1981,7 @@
mad->class_version = 1;
mad->method = IB_METHOD_GET;
mad->control = ACM_CTRL_RESOLVE;
- mad->tid = (uint64_t) atomic_inc(&tid);
+ mad->tid = htonll((uint64_t) atomic_inc(&tid));
rec = (struct acm_resolve_rec *) mad->data;
rec->src_type = (uint8_t) saddr->type;
@@ -2389,6 +2417,251 @@
acm_disconnect_client(client);
}
+static struct acm_device *
+acm_get_device_from_gid(union ibv_gid *sgid, uint8_t *port);
+static struct acm_ep *acm_find_ep(struct acm_port *port, uint16_t pkey);
+static int
+acm_ep_insert_addr(struct acm_ep *ep, uint8_t *addr, size_t addr_len, uint8_t addr_type);
+
+static int acm_nl_to_addr_data(struct acm_ep_addr_data *ad,
+ int af_family, uint8_t *addr, size_t addr_len)
+{
+ if (addr_len > ACM_MAX_ADDRESS)
+ return EINVAL;
+
+ /* find the ep associated with this address "if any" */
+ switch (af_family) {
+ case AF_INET:
+ ad->type = ACM_ADDRESS_IP;
+ break;
+ case AF_INET6:
+ ad->type = ACM_ADDRESS_IP6;
+ break;
+ default:
+ return EINVAL;
+ }
+ memcpy(&ad->info.addr, addr, addr_len);
+ return 0;
+}
+
+static void acm_add_ep_ip(struct acm_ep_addr_data *data, char *ifname)
+{
+ struct acm_ep *ep;
+ struct acm_device *dev;
+ uint8_t port_num;
+ uint16_t pkey;
+ union ibv_gid sgid;
+
+ ep = acm_get_ep(data);
+ if (ep) {
+ acm_format_name(1, log_data, sizeof log_data,
+ data->type, data->info.addr, sizeof data->info.addr);
+ acm_log(1, "Address '%s' already available\n", log_data);
+ return;
+ }
+
+ if (acm_if_get_sgid(ifname, &sgid))
+ return;
+
+ dev = acm_get_device_from_gid(&sgid, &port_num);
+ if (!dev)
+ return;
+
+ if (acm_if_get_pkey(ifname, &pkey))
+ return;
+
+ acm_format_name(0, log_data, sizeof log_data,
+ data->type, data->info.addr, sizeof data->info.addr);
+ acm_log(0, " %s\n", log_data);
+
+ ep = acm_find_ep(&dev->port[port_num-1], pkey);
+ if (ep) {
+ if (acm_ep_insert_addr(ep, data->info.addr, sizeof data->info.addr, data->type))
+ acm_log(0, "Failed to add '%s' to EP\n", log_data);
+ } else {
+ acm_log(0, "Failed to add '%s' no EP for pkey\n", log_data);
+ }
+}
+
+static void acm_rm_ep_ip(struct acm_ep_addr_data *data)
+{
+ struct acm_ep *ep;
+
+ ep = acm_get_ep(data);
+ if (ep) {
+ acm_format_name(0, log_data, sizeof log_data,
+ data->type, data->info.addr, sizeof data->info.addr);
+ acm_log(0, " %s\n", log_data);
+ acm_mark_addr_invalid(ep, data);
+ }
+}
+
+static int acm_ipnl_create(void)
+{
+ struct sockaddr_nl addr;
+
+ if ((ip_mon_socket = socket(PF_NETLINK, SOCK_RAW | SOCK_NONBLOCK, NETLINK_ROUTE)) == -1) {
+ acm_log(0, "Failed to open NETLINK_ROUTE socket");
+ return EIO;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ addr.nl_family = AF_NETLINK;
+ addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR;
+
+ if (bind(ip_mon_socket, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+ acm_log(0, "Failed to bind NETLINK_ROUTE socket");
+ return EIO;
+ }
+
+ return 0;
+}
+
+static void acm_ip_iter_cb(char *ifname, union ibv_gid *gid, uint16_t pkey,
+ uint8_t addr_type, uint8_t *addr, size_t addr_len,
+ char *addr_name, void *ctx)
+{
+ int ret = EINVAL;
+ struct acm_device *dev = NULL;
+ struct acm_ep *ep = NULL;
+ uint8_t port_num;
+ char gid_str[INET6_ADDRSTRLEN];
+
+ dev = acm_get_device_from_gid(gid, &port_num);
+ if (dev)
+ ep = acm_find_ep(&dev->port[port_num-1], pkey);
+
+ if (ep)
+ ret = acm_ep_insert_addr(ep, addr, addr_len, addr_type);
+
+ if (ret) {
+ acm_format_name(2, log_data, sizeof log_data,
+ addr_type, addr, addr_len);
+ inet_ntop(AF_INET6, gid->raw, gid_str, sizeof(gid_str));
+ acm_log(0, "Failed to add '%s' (gid %s; pkey 0x%x)\n",
+ log_data, gid_str, pkey);
+ }
+}
+
+/* Netlink updates have indicated a failure which means we are no longer in
+ * sync. This should be a rare condition so we handle this with a "big
+ * hammer" by clearing and re-reading all the system IP's.
+ */
+static int resync_system_ips(void)
+{
+ DLIST_ENTRY *dev_entry;
+ struct acm_device *dev;
+ int cnt;
+
+ acm_log(0, "Resyncing all IP's\n");
+
+ /* mark all IP's invalid */
+ for (dev_entry = dev_list.Next; dev_entry != &dev_list;
+ dev_entry = dev_entry->Next) {
+ struct acm_ep *ep = NULL;
+ DLIST_ENTRY *entry;
+
+ dev = container_of(dev_entry, struct acm_device, entry);
+
+ for (cnt = 0; cnt < dev->port_cnt; cnt++) {
+ struct acm_port *port = &dev->port[cnt];
+
+ for (entry = port->ep_list.Next; entry != &port->ep_list;
+ entry = entry->Next) {
+ int i;
+
+ ep = container_of(entry, struct acm_ep, entry);
+ for (i = 0; i < MAX_EP_ADDR; i++) {
+ if (ep->addr_type[i] == ACM_ADDRESS_IP
+ || ep->addr_type[i] == ACM_ADDRESS_IP6)
+ ep->addr_type[i] = ACM_ADDRESS_INVALID;
+ }
+ }
+ }
+ }
+
+ return acm_if_iter_sys(acm_ip_iter_cb, NULL);
+}
+
+#define NL_MSG_BUF_SIZE 4096
+static void acm_ipnl_handler(void)
+{
+ int len;
+ char buffer[NL_MSG_BUF_SIZE];
+ struct nlmsghdr *nlh;
+ char name[IFNAMSIZ];
+ char ip_str[INET6_ADDRSTRLEN];
+ struct acm_ep_addr_data ad;
+
+ while ((len = recv(ip_mon_socket, buffer, NL_MSG_BUF_SIZE, 0)) > 0) {
+ nlh = (struct nlmsghdr *)buffer;
+ while ((NLMSG_OK(nlh, len)) && (nlh->nlmsg_type != NLMSG_DONE)) {
+ struct ifaddrmsg *ifa = (struct ifaddrmsg *) NLMSG_DATA(nlh);
+ struct ifinfomsg *ifi = (struct ifinfomsg *) NLMSG_DATA(nlh);
+ struct rtattr *rth = IFA_RTA(ifa);
+ int rtl = IFA_PAYLOAD(nlh);
+
+ switch (nlh->nlmsg_type) {
+ case RTM_NEWADDR:
+ {
+ if_indextoname(ifa->ifa_index, name);
+ while (rtl && RTA_OK(rth, rtl)) {
+ if (rth->rta_type == IFA_LOCAL) {
+ acm_log(1, "New system address available %s : %s\n",
+ name, inet_ntop(ifa->ifa_family, RTA_DATA(rth),
+ ip_str, sizeof(ip_str)));
+ if (!acm_nl_to_addr_data(&ad, ifa->ifa_family,
+ RTA_DATA(rth),
+ RTA_PAYLOAD(rth))) {
+ acm_add_ep_ip(&ad, name);
+ }
+ }
+ rth = RTA_NEXT(rth, rtl);
+ }
+ break;
+ }
+ case RTM_DELADDR:
+ {
+ if_indextoname(ifa->ifa_index, name);
+ while (rtl && RTA_OK(rth, rtl)) {
+ if (rth->rta_type == IFA_LOCAL) {
+ acm_log(1, "System address removed %s : %s\n",
+ name, inet_ntop(ifa->ifa_family, RTA_DATA(rth),
+ ip_str, sizeof(ip_str)));
+ if (!acm_nl_to_addr_data(&ad, ifa->ifa_family,
+ RTA_DATA(rth),
+ RTA_PAYLOAD(rth))) {
+ acm_rm_ep_ip(&ad);
+ }
+ }
+ rth = RTA_NEXT(rth, rtl);
+ }
+ break;
+ }
+ case RTM_NEWLINK:
+ {
+ acm_log(2, "Link added : %s\n", if_indextoname(ifi->ifi_index, name));
+ break;
+ }
+ case RTM_DELLINK:
+ {
+ acm_log(2, "Link removed : %s\n", if_indextoname(ifi->ifi_index, name));
+ break;
+ }
+ default:
+ acm_log(2, "unknown netlink message\n");
+ break;
+ }
+ nlh = NLMSG_NEXT(nlh, len);
+ }
+ }
+
+ if (len < 0 && errno == ENOBUFS) {
+ acm_log(0, "ENOBUFS returned from netlink...\n");
+ resync_system_ips();
+ }
+}
+
static void acm_server(void)
{
fd_set readfds;
@@ -2407,10 +2680,13 @@
FD_ZERO(&readfds);
FD_SET(listen_socket, &readfds);
+ n = max(n, (int) ip_mon_socket);
+ FD_SET(ip_mon_socket, &readfds);
+
for (i = 0; i < FD_SETSIZE - 1; i++) {
- if (client[i].sock != INVALID_SOCKET) {
- FD_SET(client[i].sock, &readfds);
- n = max(n, (int) client[i].sock);
+ if (client_array[i].sock != INVALID_SOCKET) {
+ FD_SET(client_array[i].sock, &readfds);
+ n = max(n, (int) client_array[i].sock);
}
}
@@ -2423,11 +2699,14 @@
if (FD_ISSET(listen_socket, &readfds))
acm_svr_accept();
+ if (FD_ISSET(ip_mon_socket, &readfds))
+ acm_ipnl_handler();
+
for (i = 0; i < FD_SETSIZE - 1; i++) {
- if (client[i].sock != INVALID_SOCKET &&
- FD_ISSET(client[i].sock, &readfds)) {
+ if (client_array[i].sock != INVALID_SOCKET &&
+ FD_ISSET(client_array[i].sock, &readfds)) {
acm_log(2, "receiving from client %d\n", i);
- acm_svr_receive(&client[i]);
+ acm_svr_receive(&client_array[i]);
}
}
}
@@ -2648,7 +2927,7 @@
char s[128];
char *p, *ptr, *p_guid, *p_lid;
uint64_t guid;
- uint16_t lid, dlid;
+ uint16_t lid, dlid, net_dlid;
int sl, mtu, rate;
int ret = 1, i;
uint8_t addr[ACM_MAX_ADDRESS];
@@ -2711,6 +2990,7 @@
break;
dlid = strtoul(p, NULL, 0);
+ net_dlid = htons(dlid);
p = strtok_r(NULL, ":", &ptr);
if (!p)
@@ -2741,7 +3021,7 @@
memset(addr, 0, ACM_MAX_ADDRESS);
if (i == 0) {
addr_type = ACM_ADDRESS_LID;
- *((uint16_t *) addr) = htons(dlid);
+ memcpy(addr, &net_dlid, sizeof net_dlid);
} else {
addr_type = ACM_ADDRESS_GID;
memcpy(addr, &dgid, sizeof(dgid));
@@ -2755,7 +3035,7 @@
dest->path.sgid = sgid;
dest->path.slid = htons(ep->port->lid);
dest->path.dgid = dgid;
- dest->path.dlid = htons(dlid);
+ dest->path.dlid = net_dlid;
dest->path.reversible_numpath = IBV_PATH_RECORD_REVERSIBLE;
dest->path.pkey = htons(ep->pkey);
dest->path.mtu = (uint8_t) mtu;
@@ -2878,6 +3158,114 @@
fclose(f);
}
+static int
+acm_ep_insert_addr(struct acm_ep *ep, uint8_t *addr, size_t addr_len, uint8_t addr_type)
+{
+ int i;
+ int ret = ENOMEM;
+ uint8_t tmp[ACM_MAX_ADDRESS];
+ char name_str[INET6_ADDRSTRLEN];
+
+ if (addr_len > ACM_MAX_ADDRESS)
+ return EINVAL;
+
+ memset(tmp, 0, sizeof tmp);
+ memcpy(tmp, addr, addr_len);
+
+ lock_acquire(&ep->lock);
+ if (acm_addr_index(ep, tmp, addr_type) < 0) {
+ for (i = 0; i < MAX_EP_ADDR; i++) {
+ if (ep->addr_type[i] == ACM_ADDRESS_INVALID) {
+
+ ep->addr_type[i] = addr_type;
+ memcpy(ep->addr[i].addr, tmp, ACM_MAX_ADDRESS);
+
+ switch (addr_type) {
+ case ACM_ADDRESS_IP:
+ inet_ntop(AF_INET, addr, name_str, sizeof name_str);
+ strncpy(ep->name[i], name_str, ACM_MAX_ADDRESS);
+ break;
+ case ACM_ADDRESS_IP6:
+ inet_ntop(AF_INET6, addr, name_str, sizeof name_str);
+ strncpy(ep->name[i], name_str, ACM_MAX_ADDRESS);
+ break;
+ case ACM_ADDRESS_NAME:
+ strncpy(ep->name[i], (const char *)addr, ACM_MAX_ADDRESS);
+ break;
+ }
+
+ ret = 0;
+ break;
+ }
+ }
+ } else {
+ ret = 0;
+ }
+ lock_release(&ep->lock);
+ return ret;
+}
+
+static struct acm_device *
+acm_get_device_from_gid(union ibv_gid *sgid, uint8_t *port)
+{
+ DLIST_ENTRY *dev_entry;
+ struct acm_device *dev;
+ struct ibv_device_attr dev_attr;
+ struct ibv_port_attr port_attr;
+ union ibv_gid gid;
+ int ret, i;
+
+ for (dev_entry = dev_list.Next; dev_entry != &dev_list;
+ dev_entry = dev_entry->Next) {
+
+ dev = container_of(dev_entry, struct acm_device, entry);
+
+ ret = ibv_query_device(dev->verbs, &dev_attr);
+ if (ret)
+ continue;
+
+ for (*port = 1; *port <= dev_attr.phys_port_cnt; (*port)++) {
+ ret = ibv_query_port(dev->verbs, *port, &port_attr);
+ if (ret)
+ continue;
+
+ for (i = 0; i < port_attr.gid_tbl_len; i++) {
+ ret = ibv_query_gid(dev->verbs, *port, i, &gid);
+ if (ret || !gid.global.interface_id)
+ break;
+
+ if (!memcmp(sgid->raw, gid.raw, sizeof gid))
+ return dev;
+ }
+ }
+ }
+ return NULL;
+}
+
+static void acm_ep_ip_iter_cb(char *ifname, union ibv_gid *gid, uint16_t pkey,
+ uint8_t addr_type, uint8_t *addr, size_t addr_len,
+ char *addr_name, void *ctx)
+{
+ uint8_t port_num;
+ struct acm_device *dev;
+ struct acm_ep *ep = (struct acm_ep *)ctx;
+
+ dev = acm_get_device_from_gid(gid, &port_num);
+ if (dev && ep->port->dev == dev
+ && ep->port->port_num == port_num && ep->pkey == pkey) {
+ if (!acm_ep_insert_addr(ep, addr, addr_len, addr_type)) {
+ acm_log(0, "Added %s %s %d 0x%x from %s\n", addr_name,
+ dev->verbs->device->name, port_num, pkey,
+ ifname);
+ }
+ }
+}
+
+static int acm_get_system_ips(struct acm_ep *ep)
+{
+ return acm_if_iter_sys(acm_ep_ip_iter_cb, (void *)ep);
+}
+
static int acm_assign_ep_names(struct acm_ep *ep)
{
FILE *faddr;
@@ -2886,13 +3274,16 @@
char dev[32], addr[INET6_ADDRSTRLEN], pkey_str[8];
uint16_t pkey;
uint8_t type;
- int port, index = 0;
+ int port, ret = 0;
struct in6_addr ip_addr;
+ size_t addr_len;
dev_name = ep->port->dev->verbs->device->name;
acm_log(1, "device %s, port %d, pkey 0x%x\n",
dev_name, ep->port->port_num, ep->pkey);
+ acm_get_system_ips(ep);
+
if (!(faddr = acm_open_addr_file())) {
acm_log(0, "ERROR - address file not found\n");
return -1;
@@ -2906,12 +3297,24 @@
continue;
acm_log(2, "%s", s);
- if (inet_pton(AF_INET, addr, &ip_addr) > 0)
+ if (inet_pton(AF_INET, addr, &ip_addr) > 0) {
+ if (!support_ips_in_addr_cfg) {
+ acm_log(0, "ERROR - IP's are not configured to be read from ibacm_addr.cfg\n");
+ continue;
+ }
type = ACM_ADDRESS_IP;
- else if (inet_pton(AF_INET6, addr, &ip_addr) > 0)
+ addr_len = 4;
+ } else if (inet_pton(AF_INET6, addr, &ip_addr) > 0) {
+ if (!support_ips_in_addr_cfg) {
+ acm_log(0, "ERROR - IP's are not configured to be read from ibacm_addr.cfg\n");
+ continue;
+ }
type = ACM_ADDRESS_IP6;
- else
+ addr_len = ACM_MAX_ADDRESS;
+ } else {
type = ACM_ADDRESS_NAME;
+ addr_len = strlen(addr);
+ }
if (stricmp(pkey_str, "default")) {
if (sscanf(pkey_str, "%hx", &pkey) != 1) {
@@ -2925,17 +3328,8 @@
if (!stricmp(dev_name, dev) && (ep->port->port_num == (uint8_t) port) &&
(ep->pkey == pkey)) {
- ep->addr_type[index] = type;
acm_log(1, "assigning %s\n", addr);
- strncpy(ep->name[index], addr, ACM_MAX_ADDRESS);
- if (type == ACM_ADDRESS_IP)
- memcpy(ep->addr[index].addr, &ip_addr, 4);
- else if (type == ACM_ADDRESS_IP6)
- memcpy(ep->addr[index].addr, &ip_addr, sizeof ip_addr);
- else
- strncpy((char *) ep->addr[index].addr, addr, ACM_MAX_ADDRESS);
-
- if (++index == MAX_EP_ADDR) {
+ if ((ret = acm_ep_insert_addr(ep, (uint8_t *)&ip_addr, addr_len, type)) != 0) {
acm_log(1, "maximum number of names assigned to EP\n");
break;
}
@@ -2943,7 +3337,7 @@
}
fclose(faddr);
- return !index;
+ return ret;
}
/*
@@ -3068,6 +3462,7 @@
if (ret)
return;
+ pkey = ntohs(pkey); /* ibv_query_pkey returns pkey in network order */
if (acm_find_ep(port, pkey)) {
acm_log(2, "endpoint for pkey 0x%x already exists\n", pkey);
return;
@@ -3080,7 +3475,7 @@
ret = acm_assign_ep_names(ep);
if (ret) {
- acm_log(0, "ERROR - unable to assign EP name\n");
+ acm_log(0, "ERROR - unable to assign EP name for pkey 0x%x\n", pkey);
goto err0;
}
@@ -3169,6 +3564,7 @@
union ibv_gid gid;
uint16_t pkey;
int i, ret;
+ int is_full_default_pkey_set = 0;
acm_log(1, "%s %d\n", port->dev->verbs->device->name, port->port_num);
ret = ibv_query_port(port->dev->verbs, port->port_num, &attr);
@@ -3191,11 +3587,6 @@
break;
}
- for (port->pkey_cnt = 0;; port->pkey_cnt++) {
- ret = ibv_query_pkey(port->dev->verbs, port->port_num, port->pkey_cnt, &pkey);
- if (ret || !pkey)
- break;
- }
port->lid = attr.lid;
port->lid_mask = 0xffff - ((1 << attr.lmc) - 1);
@@ -3213,8 +3604,22 @@
return;
atomic_set(&port->sa_dest.refcnt, 1);
- for (i = 0; i < port->pkey_cnt; i++)
- acm_ep_up(port, (uint16_t) i);
+ for (i = 0; i < attr.pkey_tbl_len; i++) {
+ ret = ibv_query_pkey(port->dev->verbs, port->port_num, i, &pkey);
+ if (ret)
+ continue;
+ pkey = ntohs(pkey);
+ if (!(pkey & 0x7fff))
+ continue;
+
+ /* Determine pkey index for default partition with preference for full membership */
+ if (!is_full_default_pkey_set && (pkey & 0x7fff) == 0x7fff) {
+ port->default_pkey_ix = i;
+ if (pkey & 0x8000)
+ is_full_default_pkey_set = 1;
+ }
+ acm_ep_up(port, (uint16_t) i);
+ }
acm_port_join(port);
port->state = IBV_PORT_ACTIVE;
@@ -3281,6 +3686,13 @@
if (dev->port[i].state == IBV_PORT_ACTIVE)
acm_port_down(&dev->port[i]);
break;
+ case IBV_EVENT_CLIENT_REREGISTER:
+ if (dev->port[i].state == IBV_PORT_ACTIVE) {
+ acm_port_join(&dev->port[i]);
+ acm_log(1, "%s %d has reregistered\n",
+ dev->verbs->device->name, i + 1);
+ }
+ break;
default:
break;
}
@@ -3473,6 +3885,8 @@
addr_preload = acm_convert_addr_preload(value);
else if (!stricmp("addr_data_file", opt))
strcpy(addr_data_file, value);
+ else if (!stricmp("support_ips_in_addr_cfg", opt))
+ support_ips_in_addr_cfg = atoi(value);
}
fclose(f);
@@ -3500,6 +3914,7 @@
acm_log(0, "route data file %s\n", route_data_file);
acm_log(0, "address preload %d\n", addr_preload);
acm_log(0, "address data file %s\n", addr_data_file);
+ acm_log(0, "support IP's in ibacm_addr.cfg %d\n", support_ips_in_addr_cfg);
}
static FILE *acm_open_log(void)
@@ -3622,6 +4037,9 @@
return -1;
}
+ acm_log(1, "creating IP Netlink socket\n");
+ acm_ipnl_create();
+
acm_activate_devices();
acm_log(1, "starting timeout/retry thread\n");
beginthread(acm_retry_handler, NULL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/src/acm_util.c new/ibacm-1.0.9/src/acm_util.c
--- old/ibacm-1.0.8/src/acm_util.c 1970-01-01 01:00:00.000000000 +0100
+++ new/ibacm-1.0.9/src/acm_util.c 2014-06-23 19:44:45.000000000 +0200
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2014 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenFabrics.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include "acm_mad.h"
+#include "acm_util.h"
+
+int acm_if_is_ib(char *ifname)
+{
+ unsigned type;
+ char buf[128];
+ FILE *f;
+ int ret;
+
+ snprintf(buf, sizeof buf, "//sys//class//net//%s//type", ifname);
+ f = fopen(buf, "r");
+ if (!f) {
+ acm_log(0, "failed to open %s\n", buf);
+ return 0;
+ }
+
+ if (fgets(buf, sizeof buf, f)) {
+ type = strtol(buf, NULL, 0);
+ ret = (type == ARPHRD_INFINIBAND);
+ } else {
+ acm_log(0, "failed to read interface type\n");
+ ret = 0;
+ }
+
+ fclose(f);
+ return ret;
+}
+
+int acm_if_get_pkey(char *ifname, uint16_t *pkey)
+{
+ char buf[128], *end;
+ FILE *f;
+ int ret;
+
+ snprintf(buf, sizeof buf, "//sys//class//net//%s//pkey", ifname);
+ f = fopen(buf, "r");
+ if (!f) {
+ acm_log(0, "failed to open %s\n", buf);
+ return -1;
+ }
+
+ if (fgets(buf, sizeof buf, f)) {
+ *pkey = strtol(buf, &end, 16);
+ ret = 0;
+ } else {
+ acm_log(0, "failed to read pkey\n");
+ ret = -1;
+ }
+
+ fclose(f);
+ return ret;
+}
+
+int acm_if_get_sgid(char *ifname, union ibv_gid *sgid)
+{
+ char buf[128], *end;
+ FILE *f;
+ int i, p, ret;
+
+ snprintf(buf, sizeof buf, "//sys//class//net//%s//address", ifname);
+ f = fopen(buf, "r");
+ if (!f) {
+ acm_log(0, "failed to open %s\n", buf);
+ return -1;
+ }
+
+ if (fgets(buf, sizeof buf, f)) {
+ for (i = 0, p = 12; i < 16; i++, p += 3) {
+ buf[p + 2] = '\0';
+ sgid->raw[i] = (uint8_t) strtol(buf + p, &end, 16);
+ }
+ ret = 0;
+ } else {
+ acm_log(0, "failed to read sgid\n");
+ ret = -1;
+ }
+
+ fclose(f);
+ return ret;
+}
+
+int acm_if_iter_sys(acm_if_iter_cb cb, void *ctx)
+{
+ struct ifconf *ifc;
+ struct ifreq *ifr;
+ char ip[INET6_ADDRSTRLEN];
+ int s, ret, i, len;
+ uint16_t pkey;
+ union ibv_gid sgid;
+ uint8_t addr_type;
+ uint8_t addr[ACM_MAX_ADDRESS];
+ size_t addr_len;
+ char *alias_sep;
+
+ s = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (!s)
+ return -1;
+
+ len = sizeof(*ifc) + sizeof(*ifr) * 64;
+ ifc = malloc(len);
+ if (!ifc) {
+ ret = -1;
+ goto out1;
+ }
+
+ memset(ifc, 0, len);
+ ifc->ifc_len = len;
+ ifc->ifc_req = (struct ifreq *) (ifc + 1);
+
+ ret = ioctl(s, SIOCGIFCONF, ifc);
+ if (ret < 0) {
+ acm_log(0, "ioctl ifconf error %d\n", ret);
+ goto out2;
+ }
+
+ ifr = ifc->ifc_req;
+ for (i = 0; i < ifc->ifc_len / sizeof(struct ifreq); i++) {
+ switch (ifr[i].ifr_addr.sa_family) {
+ case AF_INET:
+ addr_type = ACM_ADDRESS_IP;
+ memcpy(&addr, &((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr, sizeof addr);
+ addr_len = 4;
+ inet_ntop(ifr[i].ifr_addr.sa_family,
+ &((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr, ip, sizeof ip);
+ break;
+ case AF_INET6:
+ addr_type = ACM_ADDRESS_IP6;
+ memcpy(&addr, &((struct sockaddr_in6 *) &ifr[i].ifr_addr)->sin6_addr, sizeof addr);
+ addr_len = ACM_MAX_ADDRESS;
+ inet_ntop(ifr[i].ifr_addr.sa_family,
+ &((struct sockaddr_in6 *) &ifr[i].ifr_addr)->sin6_addr, ip, sizeof ip);
+ break;
+ default:
+ continue;
+ }
+
+ acm_log(2, "%s\n", ifr[i].ifr_name);
+
+ alias_sep = strchr(ifr[i].ifr_name, ':');
+ if (alias_sep)
+ *alias_sep = '\0';
+
+ if (!acm_if_is_ib(ifr[i].ifr_name))
+ continue;
+
+ ret = acm_if_get_sgid(ifr[i].ifr_name, &sgid);
+ if (ret)
+ continue;
+
+ ret = acm_if_get_pkey(ifr[i].ifr_name, &pkey);
+ if (ret)
+ continue;
+
+ cb(ifr[i].ifr_name, &sgid, pkey, addr_type, addr, addr_len, ip, ctx);
+ }
+ ret = 0;
+
+out2:
+ free(ifc);
+out1:
+ close(s);
+ return ret;
+
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/src/acm_util.h new/ibacm-1.0.9/src/acm_util.h
--- old/ibacm-1.0.8/src/acm_util.h 1970-01-01 01:00:00.000000000 +0100
+++ new/ibacm-1.0.9/src/acm_util.h 2014-06-23 19:44:45.000000000 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014 Intel Corporation. All rights reserved.
+ *
+ * This software is available to you under the OpenFabrics.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#if !defined(ACM_IF_H)
+#define ACM_IF_H
+
+#include
+
+#ifdef ACME_PRINTS
+
+#define acm_log(level, format, ...) \
+ printf(format, ## __VA_ARGS__)
+
+#else /* !ACME_PRINTS */
+#define acm_log(level, format, ...) \
+ acm_write(level, "%s: "format, __func__, ## __VA_ARGS__)
+
+void acm_write(int level, const char *format, ...);
+#endif /* ACME_PRINTS */
+
+int acm_if_is_ib(char *ifname);
+int acm_if_get_pkey(char *ifname, uint16_t *pkey);
+int acm_if_get_sgid(char *ifname, union ibv_gid *sgid);
+
+typedef void (*acm_if_iter_cb)(char *ifname, union ibv_gid *gid, uint16_t pkey,
+ uint8_t addr_type, uint8_t *addr, size_t addr_len,
+ char *addr_name, void *ctx);
+int acm_if_iter_sys(acm_if_iter_cb cb, void *ctx);
+
+#endif /* ACM_IF_H */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/src/acme.c new/ibacm-1.0.9/src/acme.c
--- old/ibacm-1.0.8/src/acme.c 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/src/acme.c 2014-06-23 19:44:45.000000000 +0200
@@ -43,6 +43,7 @@
#include
#include
#include "libacm.h"
+#include "acm_util.h"
static char *dest_dir = ACM_CONF_DIR;
static char *addr_file = ACM_ADDR_FILE;
@@ -279,6 +280,10 @@
fprintf(f, "# Default is ACM_CONF_DIR/ibacm_hosts.data\n");
fprintf(f, "# addr_data_file /etc/rdma/ibacm_hosts.data\n");
fprintf(f, "\n");
+ fprintf(f, "# support_ips_in_addr_cfg:\n");
+ fprintf(f, "# If 1 continue to read IP addresses from ibacm_addr.cfg\n");
+ fprintf(f, "# Default is 0 \"no\"\n");
+ fprintf(f, "# support_ips_in_addr_cfg 0\n");
}
static int open_dir(void)
@@ -316,9 +321,11 @@
fprintf(f, "# Entry format is:\n");
fprintf(f, "# address device port pkey\n");
fprintf(f, "#\n");
+ fprintf(f, "# NOTE: IP addresses are now automatically read and monitored on the system.\n");
+ fprintf(f, "# Therefore they are no longer required in this file.\n");
+ fprintf(f, "#\n");
fprintf(f, "# The address may be one of the following:\n");
fprintf(f, "# host_name - ascii character string, up to 31 characters\n");
- fprintf(f, "# address - IPv4 or IPv6 formatted address\n");
fprintf(f, "#\n");
fprintf(f, "# device name - struct ibv_device name\n");
fprintf(f, "# port number - valid port number on device (numbering starts at 1)\n");
@@ -330,8 +337,6 @@
fprintf(f, "# node31 ibv_device0 1 default\n");
fprintf(f, "# node31-1 ibv_device0 1 0x00FF\n");
fprintf(f, "# node31-2 ibv_device0 2 0x00FF\n");
- fprintf(f, "# 192.168.0.1 ibv_device0 1 0xFFFF\n");
- fprintf(f, "# 192.168.0.2 ibv_device0 2 default\n");
}
static int open_verbs(void)
@@ -353,7 +358,7 @@
for (i = 0; i < dev_cnt; i++) {
verbs[i] = ibv_open_device(dev_array[i]);
- if (!verbs) {
+ if (!verbs[i]) {
printf("ibv_open_device - failed to open device\n");
ret = -1;
goto err2;
@@ -448,12 +453,6 @@
goto out2;
}
- ret = gen_addr_ip(f);
- if (ret) {
- printf("Failed to auto generate IP addresses in config file\n");
- goto out2;
- }
-
out2:
close_verbs();
out1:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/ibacm-1.0.8/src/libacm.c new/ibacm-1.0.9/src/libacm.c
--- old/ibacm-1.0.8/src/libacm.c 2013-07-26 06:27:59.000000000 +0200
+++ new/ibacm-1.0.9/src/libacm.c 2014-06-23 19:44:45.000000000 +0200
@@ -40,21 +40,6 @@
#include
#include
-struct acm_port {
- uint8_t port_num;
- uint16_t lid;
- union ibv_gid gid;
- int pkey_cnt;
- uint16_t pkey[4];
-};
-
-struct acm_device {
- struct ibv_context *verbs;
- uint64_t guid;
- int port_cnt;
- struct acm_port *ports;
-};
-
extern lock_t lock;
static SOCKET sock = INVALID_SOCKET;
static short server_port = 6125;
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org