Hello community,

here is the log from the commit of package libibverbs for openSUSE:Factory 
checked in at 2014-07-04 09:34:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libibverbs (Old)
 and      /work/SRC/openSUSE:Factory/.libibverbs.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libibverbs"

Changes:
--------
New Changes file:

--- /dev/null   2014-06-12 08:28:52.960034756 +0200
+++ /work/SRC/openSUSE:Factory/.libibverbs.new/libibverbs.changes       
2014-07-04 09:34:27.000000000 +0200
@@ -0,0 +1,198 @@
+-------------------------------------------------------------------
+Thu Jun 26 12:45:56 CEST 2014 - p...@suse.de
+
+- Do not build & package the static lib.
+- Add baselibs.conf as source.
+
+-------------------------------------------------------------------
+Tue Jun  3 11:24:34 CEST 2014 - p...@suse.de
+
+- Update to OFED 3.12 final.
+
+-------------------------------------------------------------------
+Thu Apr 10 15:16:13 UTC 2014 - stefan.f...@suse.com
+
+- removed unneeded patches for new version:
+    libibverbs-Infrastructure_to_support_verbs_extensions.patch
+    libibverbs-XRC_man_pages.patch
+    libibverbs-Add_support_for_XRC_SRQs.patch
+    libibverbs-Introduce_XRC_domains_XRCDs.patch
+    libibverbs-Use-IBV_SEND_INLINE-in-example-pingpong-programs.patch
+    libibverbs-Add_ibv_open_qp_for_XRC_receive_QPs.patch
+    libibverbs-Add_support_for_XRC_QPs.patch
+    libibverbs-Add_XRC_sample_application.patch
+    libibverbs-Add-general-definitions-to-support-uverbs-extensions.patch
+    libibverbs-Fix_XRC_sample_application_ibv_xsrq_pingpong_issues.patch
+
+-------------------------------------------------------------------
+Thu Apr  3 11:41:39 CEST 2014 - p...@suse.de
+
+- Fix underquoting and change AC_HELP_MESSAGE to AS_HELP_MESSAGE
+  in libibverbs-Use-neighbour-lookup-for-RoCE-UD-QPs-Eth-L2-resoluti.patch
+- Add libibverbs-autotools.patch that correctly quotes another
+  AS_HELP_MESSGE call and a use of AC_MSG_ERROR.
+
+-------------------------------------------------------------------
+Mon Mar 31 18:52:02 CEST 2014 - p...@suse.de
+
+- Add patches from Mellanox (bnc#871161):
+  * libibverbs-Add-ibv_port_cap_flags.patch
+    Add ibv_port_cap_flag
+  * libibverbs-Use-neighbour-lookup-for-RoCE-UD-QPs-Eth-L2-resoluti.patch
+    Use neighbour lookup for RoCE UD QPs Eth L2 resolution.
+  * libibverbs-Add-ibv_query_port_ex-support.patch
+    Add extended support for ibv_query_port.
+  * libibverbs-Add-receive-flow-steering-support.patch
+    Add support to steer receiving flows.
+
+-------------------------------------------------------------------
+Mon Mar 31 15:43:20 CEST 2014 - p...@suse.de
+
+- Fix libibverbs-s390.patch to not make header unusable.
+
+-------------------------------------------------------------------
+Fri Mar 28 18:33:34 CET 2014 - p...@suse.de
+
+- Fix spec file to get ibdev2netdev installed in the rigth place.
+- Adapt libibverbs-s390.patch to changed sources.
+
+-------------------------------------------------------------------
+Thu Mar 27 15:41:54 CET 2014 - p...@suse.de
+
+- On request from Mellanox add the ibdev2netdev script from
+  the compat-rdma package in OFED. This script shows which IB
+  device is attached to which network device (bnc#870419).
+
+-------------------------------------------------------------------
+Thu Mar 20 00:21:09 CET 2014 - r...@suse.de
+
+- fix arch.h to be usable on s390 additional to s390x
+
+------------------------------------------------------------------
+Tue Feb 11 14:13:09 CET 2014 - p...@suse.de
+
+- Add and adapt patches from Mellanox that add XRC support
+  (bnc#858729):
+
+  libibverbs-Add_ibv_open_qp_for_XRC_receive_QPs.patch
+  libibverbs-Add_support_for_XRC_QPs.patch
+  libibverbs-Add_support_for_XRC_SRQs.patch
+  libibverbs-Add_XRC_sample_application.patch
+  libibverbs-Fix_XRC_sample_application_ibv_xsrq_pingpong_issues.patch
+  libibverbs-Infrastructure_to_support_verbs_extensions.patch
+  libibverbs-Introduce_XRC_domains_XRCDs.patch
+  libibverbs-Use-IBV_SEND_INLINE-in-example-pingpong-programs.patch
+  libibverbs-XRC_man_pages.patch
+
+-------------------------------------------------------------------
+Tue Feb 11 13:48:00 CET 2014 - p...@suse.de
+
+- Fix source URI.
+
+-------------------------------------------------------------------
+Mon Feb 10 22:11:03 CET 2014 - p...@suse.de
+
+- Fix baselibs.conf.
+
+-------------------------------------------------------------------
+Mon Feb  3 14:56:20 CET 2014 - p...@suse.de
+
+- Readd baselibs.conf.
+
+-------------------------------------------------------------------
+Thu Jan 30 18:08:20 CET 2014 - p...@suse.de
+
+- License is GPL-2.0 or BSD-2-Clause
+- Add COPYING to package documentation.
+
+-------------------------------------------------------------------
+Fri Jan 17 17:54:30 CET 2014 - p...@suse.de
+
+- Update to 1.1.7 from OFED 3.12
+- Add libibverbs-s390.patch for s390 support.
+
+-------------------------------------------------------------------
+Mon Aug 12 12:13:52 UTC 2013 - klein...@mpip-mainz.mpg.de
+
+- Re-added accidentlly removed ntohl() in examples/pingping.c.
+
+-------------------------------------------------------------------
+Tue Sep 18 12:21:59 CEST 2012 - p...@suse.de
+
+- Simplify spec file a bit by using a define for the library name.
+
+-------------------------------------------------------------------
+Fri Aug 31 19:15:16 CEST 2012 - p...@suse.de
+
+- update to 1.1.4-1.24.gb89d4d7 from OFED 1.5.4.1.
+- Rename configure.patch to libibverbs-no_silent_rules.patch.
+- Pass V=1 to make in case silent rules were added.
+
+-------------------------------------------------------------------
+Sun Aug 26 19:27:18 UTC 2012 - jeng...@inai.de
+
+- Remove redundant tags/sections from specfile
+- Kill configure.patch: absence of AM_SILENT_RULES is no problem
+- Redo libibverbs-fix_aliasing.patch with proper approach
+- Parallel build with %_smp_mflags
+
+-------------------------------------------------------------------
+Thu Jun 28 13:58:06 CEST 2012 - p...@suse.de
+
+- Fix aliasing issue in example program.
+
+-------------------------------------------------------------------
+Tue May  8 18:07:36 CEST 2012 - p...@suse.de
+
+- BuildRequire automake, autoconf and libtool.
+
+-------------------------------------------------------------------
+Wed Dec 15 15:37:47 CET 2010 - p...@suse.de
+
+- Add a runtime package with tools and their man pages.
+- Split off the dynamic library into its own versioned sub package.
+- Split off the static library into its own sub package.
+- Clean up the spec file.
+
+-------------------------------------------------------------------
+Thu Oct 21 16:18:23 UTC 2010 - stefan.f...@novell.com
+
+- update to v1.1.4-0.14.gb6c138b for OFED 1.5.2 
+
+-------------------------------------------------------------------
+Sun May 23 20:48:20 CEST 2010 - jjo...@novell.com
+
+- Same tarball, different name.  Leaving the postfix
+  -0.6.g932f1a2 on the tarball to identify it for future updates
+
+-------------------------------------------------------------------
+Sun May 23 18:48:55 CEST 2010 - jjo...@novell.com
+
+- Updated to v1.1.3 from OFED 1.5.1
+
+-------------------------------------------------------------------
+Sat Jul 11 02:34:52 CEST 2009 - jjo...@suse.de
+
+- Updated to v1.1.2 from OFED 1.4.1 release
+
+-------------------------------------------------------------------
+Wed Oct 15 21:49:34 CEST 2008 - jjo...@suse.de
+
+- Updated to release from OFED 1.3.1
+
+-------------------------------------------------------------------
+Thu Feb 28 19:10:47 CET 2008 - jjo...@suse.de
+
+- Updated to release from OFED 1.3 GA
+- Added man7 to devel files list
+
+-------------------------------------------------------------------
+Tue Jan 29 15:18:53 CET 2008 - jjo...@suse.de
+
+- Updated to release from OFED 1.3 rc2
+
+-------------------------------------------------------------------
+Wed Jun 20 11:58:35 CEST 2007 - hvo...@suse.de
+
+- Initial Package, Version 1.1.1 
++++ 1 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:Factory/.libibverbs.new/libibverbs.changes

New:
----
  baselibs.conf
  ibdev2netdev
  libibverbs-1.1.4-fix-deleted-ntohl.patch
  libibverbs-1.1.7.tar.gz
  libibverbs-Add-ibv_port_cap_flags.patch
  libibverbs-Add-ibv_query_port_ex-support.patch
  libibverbs-Add-receive-flow-steering-support.patch
  libibverbs-Use-neighbour-lookup-for-RoCE-UD-QPs-Eth-L2-resoluti.patch
  libibverbs-autotools.patch
  libibverbs-fix_aliasing.patch
  libibverbs-s390.patch
  libibverbs.changes
  libibverbs.spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libibverbs.spec ++++++
#
# spec file for package libibverbs (Version 1.1.4)
#
# Copyright (c) 2010-2014 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           libibverbs
Summary:        Infiniband verbs library
Version:        1.1.7
Release:        1
License:        GPL-2.0 or BSD-2-Clause
Group:          System/Libraries
# For the time being no source URL as the tarball available there differs
Source0:        %{name}-%{version}.tar.gz
Source1:        ibdev2netdev
Source2:        baselibs.conf
#
Patch1:         libibverbs-fix_aliasing.patch
Patch2:         libibverbs-1.1.4-fix-deleted-ntohl.patch
Patch3:         libibverbs-s390.patch
Patch6:         libibverbs-Add-ibv_port_cap_flags.patch
Patch7:         
libibverbs-Use-neighbour-lookup-for-RoCE-UD-QPs-Eth-L2-resoluti.patch
Patch8:         libibverbs-Add-ibv_query_port_ex-support.patch
Patch9:         libibverbs-Add-receive-flow-steering-support.patch
Patch10:        libibverbs-autotools.patch
#
BuildRequires:  automake autoconf libtool
BuildRequires:  pkg-config
BuildRequires:  libnl3-devel
URL:            http://www.openfabrics.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%define so_major 1
%define lname %{name}%{so_major}

%description
libibverbs is a library that allows userspace processes to use
InfiniBand "verbs" as described in the InfiniBand Architecture
Specification.  This includes direct hardware access for fast path
operations.

%package     -n %{lname}
Summary:        Infiniband verbs library
Group:          System/Libraries

%description -n %{lname}
libibverbs is a library that allows userspace processes to use
InfiniBand "verbs" as described in the InfiniBand Architecture
Specification.  This includes direct hardware access for fast path
operations.

This package contains the runtime library.

%package        runtime
Group:          Productivity/Networking/System
Summary:        Tools for the Infiniband Verbs library and manpages

%description    runtime
This package contains the Infiniband verbs tools and their man pages.

%package        devel
Group:          Development/Libraries/C and C++
Summary:        Development files for the libibverbs library
Requires:       %{name}-runtime = %{version}

%description    devel
Static libraries and header files for the Infiniband verbs library.

%prep
%setup -q
%patch1
%patch2 -p1
%patch3 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10

%build
autoreconf -fi
%configure --disable-silent-rules --disable-static
make %{?_smp_mflags}

%post -n %{lname} -p /sbin/ldconfig

%postun -n %{lname} -p /sbin/ldconfig

%install
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}/%_sysconfdir/libibverbs.d
install -m 755 %{S:1} %{buildroot}%{_bindir}
rm -f %{buildroot}%_libdir/libibverbs.la 

%files runtime
%defattr(-, root, root)
%doc COPYING
%_sysconfdir/libibverbs.d
%_bindir/*
%_mandir/man1/*

%files -n %{lname}
%defattr(-, root, root)
%_libdir/libibverbs.so.*

%files devel
%defattr(-,root,root)
%_includedir/infiniband
%_libdir/libibverbs.so
%_mandir/man3/*

%changelog
++++++ baselibs.conf ++++++
libibverbs1
libibverbs-devel
++++++ ibdev2netdev ++++++
#! /bin/bash

usage()
{
        echo "$(basename $0) <options>"
        echo "-h, --help                print help message"
        echo "-v, --verbose             print more info"
}

case $1 in
        "-h" | "--help")
                usage
                exit 0
                ;;
esac

if (( $# > 1 )); then
        usage
        exit -1
fi

if (( $# == 1 )) && [ "$1" != "-v" ]; then
        usage
        exit -1
fi

ibdevs=$(ls /sys/class/infiniband/)

devs=$(ls /sys/class/net/ | grep ^[ei])
if [ "x$devs" == "x" ]; then
        # no relevant devices - quit immediately
        exit
fi

for d in $devs; do
        if [ -f /sys/class/net/$d/dev_id ]; then
                oldstyle=n
                break
        fi
done

if [ "x$oldstyle" == "xn" ]; then
        for d in $ibdevs; do
                ibrsc=$(cat /sys/class/infiniband/$d/device/resource)
                eths=$(ls /sys/class/net/)
                for eth in $eths; do
                        if [ -f /sys/class/net/$eth/device/resource ]; then
                                ethrsc=$(cat 
/sys/class/net/$eth/device/resource)
                                if [ "x$ethrsc" == "x$ibrsc" ]; then
                                        if [ -f /sys/class/net/$eth/dev_id ]; 
then
                                                port=$(cat 
/sys/class/net/$eth/dev_id)
                                                port=$(printf "%d" $port)
                                                port=$(( port + 1 ))
                                                if [ "$1" == "-v" ]; then
                                                        ibstate=$(printf "%-6s" 
$(cat /sys/class/infiniband/$d/ports/$port/state | gawk '{print $2}'))
                                                        devid=$(printf "MT%d" 
$(cat /sys/class/infiniband/$d/device/device))
                                                        fwver=$(cat 
/sys/class/infiniband/$d/fw_ver)
                                                        tmp=$IFS
                                                        IFS=":"
                                                        devdesc=$(printf 
"%-15s" $(strings /sys/class/infiniband/$d/device/vpd | head -1))
                                                        partid=$(printf "%-11s" 
$(strings /sys/class/infiniband/$d/device/vpd | head -4 | tail -1 | gawk 
'{print $1}'))
                                                        IFS=$tmp
                                                fi
                                                if [ -f 
/sys/class/net/$eth/carrier ]; then
                                                        link_state=$(cat 
/sys/class/net/$eth/carrier 2> /dev/null)
                                                        if (( link_state == 1 
)); then
                                                                link_state="Up"
                                                        else
                                                                
link_state="Down"
                                                        fi
                                                else
                                                        link_state="NA"
                                                fi
                                                if [ "$1" == "-v" ]; then
                                                        echo "$d ($devid - 
$partid) $devdesc fw $fwver port $port ($ibstate) ==> $eth ($link_state)"
                                                else
                                                        echo "$d port $port ==> 
$eth ($link_state)"
                                                fi
                                        fi
                                fi
                        fi
                done
        done
else
##########################
### old style
##########################

function print_line()
{
        echo "$1 port $2 <===> $3"
}

function find_guid()
{
        ibdevs=$(ls /sys/class/infiniband/)
        for ibdev in $ibdevs; do
                ports=$(ls /sys/class/infiniband/$ibdev/ports/)
                for port in $ports; do
                        gids=$(ls /sys/class/infiniband/$ibdev/ports/$port/gids)
                        for gid in $gids; do
                                pguid=$(cat 
/sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 
's/://g')
                                if [ x$pguid == x$1 ]; then
                                        print_line $ibdev $port $2
                                fi
                        done
                done
        done
}

function find_mac()
{
        ibdevs=$(ls /sys/class/infiniband/)
        for ibdev in $ibdevs; do
                type=$(cat /sys/class/infiniband/$ibdev/node_type|cut -d ' ' -f 
2)
                ports=$(ls /sys/class/infiniband/$ibdev/ports/)
                for port in $ports; do
                        gids=$(ls /sys/class/infiniband/$ibdev/ports/$port/gids)
                        for gid in $gids; do
                                if [[ "$type" = "RNIC" ]]; then
                                        pmac=$(cat 
/sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 1-14|sed -e 
's/://g')
                                else
                                        first=$(cat 
/sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21-22)
                                        first=$(( first ^ 2 ))
                                        first=$(printf "%02x" $first)
                                        second=$(cat 
/sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 
's/://g' | cut -b 3-6)
                                        third=$(cat 
/sys/class/infiniband/$ibdev/ports/$port/gids/$gid | cut -b 21- | sed -e 
's/://g' | cut -b 11-)
                                        pmac=$first$second$third
                                fi
                                if [ x$pmac == x$1 ]; then
                                        print_line $ibdev $port $2
                                fi
                        done
                done
        done
}

ifcs=$(ifconfig -a | egrep '^eth|^ib' | gawk '{print $1}')

for ifc in $ifcs; do
        len=$(cat /sys/class/net/$ifc/addr_len)
        if (( len == 20 )); then
                guid=$(cat /sys/class/net/$ifc/address | cut -b 37- | sed -e 
's/://g')
                find_guid $guid $ifc
        elif (( len == 6)); then
                mac=$(cat /sys/class/net/$ifc/address | sed -e 's/://g')        
                find_mac $mac $ifc
        fi
done
fi

++++++ libibverbs-1.1.4-fix-deleted-ntohl.patch ++++++
Name: Robert Klein <klein...@mpip-mainz.mpg.de>
Date: 2012-08-12 12:00:00 +0200
Subject: add accidentally removed ntohl

Jan Engelhardts strict-aliasing patch accidentally removed an ntohl.
this patch reintroduces it.

---

---
 examples/pingpong.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: libibverbs-1.1.7/examples/pingpong.c
===================================================================
--- libibverbs-1.1.7.orig/examples/pingpong.c   2014-01-17 18:40:47.915091677 
+0100
+++ libibverbs-1.1.7/examples/pingpong.c        2014-01-17 18:44:07.357475561 
+0100
@@ -72,9 +72,9 @@ void wire_gid_to_gid(const char *wgid, u
 
        for (tmp[8] = 0, i = 0; i < 4; ++i) {
                memcpy(tmp, wgid + i * 8, 8);
-               sscanf(tmp, "%x", &v32);
-               v32n = ntohl(v32);
-               memcpy(&gid->raw[i*4], &v32n, sizeof(v32n));
+               sscanf(tmp, "%x", &v32n);
+               v32 = ntohl(v32n);
+               memcpy(&gid->raw[i*4], &v32, sizeof(v32));
        }
 }
 
++++++ libibverbs-Add-ibv_port_cap_flags.patch ++++++
>From 26de70dc2ff34a66a5c6785d29ffbdbd71ad7287 Mon Sep 17 00:00:00 2001
From: Matan Barak <mat...@mellanox.com>
Date: Wed, 29 Jan 2014 11:55:15 +0200
Subject: [PATCH 3/6] Add ibv_port_cap_flags

Add an enum that describes ibv_port_cap_flags that complies
with the respective kernel enum.

This value could be fetched when using ibv_query_port in
port_cap_flags.

Signed-off-by: Matan Barak <mat...@mellanox.com>
Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
---
 include/infiniband/verbs.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 3696495..18c4dd5 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -190,6 +190,28 @@ enum {
        IBV_LINK_LAYER_ETHERNET,
 };
 
+enum ibv_port_cap_flags {
+       IBV_PORT_SM                             = 1 <<  1,
+       IBV_PORT_NOTICE_SUP                     = 1 <<  2,
+       IBV_PORT_TRAP_SUP                       = 1 <<  3,
+       IBV_PORT_OPT_IPD_SUP                    = 1 <<  4,
+       IBV_PORT_AUTO_MIGR_SUP                  = 1 <<  5,
+       IBV_PORT_SL_MAP_SUP                     = 1 <<  6,
+       IBV_PORT_MKEY_NVRAM                     = 1 <<  7,
+       IBV_PORT_PKEY_NVRAM                     = 1 <<  8,
+       IBV_PORT_LED_INFO_SUP                   = 1 <<  9,
+       IBV_PORT_SYS_IMAGE_GUID_SUP             = 1 << 11,
+       IBV_PORT_PKEY_SW_EXT_PORT_TRAP_SUP      = 1 << 12,
+       IBV_PORT_EXTENDED_SPEEDS_SUP            = 1 << 14,
+       IBV_PORT_CM_SUP                         = 1 << 16,
+       IBV_PORT_SNMP_TUNNEL_SUP                = 1 << 17,
+       IBV_PORT_REINIT_SUP                     = 1 << 18,
+       IBV_PORT_DEVICE_MGMT_SUP                = 1 << 19,
+       IBV_PORT_VENDOR_CLASS                   = 1 << 24,
+       IBV_PORT_CLIENT_REG_SUP                 = 1 << 25,
+       IBV_PORT_IP_BASED_GIDS                  = 1 << 26,
+};
+
 struct ibv_port_attr {
        enum ibv_port_state     state;
        enum ibv_mtu            max_mtu;
-- 
1.7.8.2

++++++ libibverbs-Add-ibv_query_port_ex-support.patch ++++++
>From 2f314d77bcf0d6cd0922f908bf077f05c906a83d Mon Sep 17 00:00:00 2001
From: Matan Barak <mat...@mellanox.com>
Date: Thu, 16 Jan 2014 19:09:18 +0200
Subject: [PATCH 5/6] Add ibv_query_port_ex support

This patch adds extended support for ibv_query_port.

This allows to request fields that aren't availible by the current
ibv_query_port API and avoid fetching from vendor library fields that
the user doesn't need, which gives more room for optimizations.

Signed-off-by: Matan Barak <mat...@mellanox.com>
Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
---
 include/infiniband/verbs.h |  102 ++++++++++++++++++++++++++++++++++++++++++++
 src/device.c               |    2 +
 src/verbs.c                |    7 ++-
 3 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 5eac403..97898a0 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -491,6 +491,69 @@ struct ibv_ah_attr_ex {
        uint16_t                vid;
 };
 
+enum {
+       IBV_QUERY_PORT_EX_STATE                 = 1 << 0,
+       IBV_QUERY_PORT_EX_MAX_MTU               = 1 << 1,
+       IBV_QUERY_PORT_EX_ACTIVE_MTU            = 1 << 2,
+       IBV_QUERY_PORT_EX_GID_TBL_LEN           = 1 << 3,
+       IBV_QUERY_PORT_EX_CAP_FLAGS             = 1 << 4,
+       IBV_QUERY_PORT_EX_MAX_MSG_SZ            = 1 << 5,
+       IBV_QUERY_PORT_EX_BAD_PKEY_CNTR         = 1 << 6,
+       IBV_QUERY_PORT_EX_QKEY_VIOL_CNTR        = 1 << 7,
+       IBV_QUERY_PORT_EX_PKEY_TBL_LEN          = 1 << 8,
+       IBV_QUERY_PORT_EX_LID                   = 1 << 9,
+       IBV_QUERY_PORT_EX_SM_LID                = 1 << 10,
+       IBV_QUERY_PORT_EX_LMC                   = 1 << 11,
+       IBV_QUERY_PORT_EX_MAX_VL_NUM            = 1 << 12,
+       IBV_QUERY_PORT_EX_SM_SL                 = 1 << 13,
+       IBV_QUERY_PORT_EX_SUBNET_TIMEOUT        = 1 << 14,
+       IBV_QUERY_PORT_EX_INIT_TYPE_REPLY       = 1 << 15,
+       IBV_QUERY_PORT_EX_ACTIVE_WIDTH          = 1 << 16,
+       IBV_QUERY_PORT_EX_ACTIVE_SPEED          = 1 << 17,
+       IBV_QUERY_PORT_EX_PHYS_STATE            = 1 << 18,
+       IBV_QUERY_PORT_EX_LINK_LAYER            = 1 << 19,
+       /* mask of the fields that exists in the standard query_port_command */
+       IBV_QUERY_PORT_EX_STD_MASK              = (1 << 20) - 1,
+       /* mask of all supported fields */
+       IBV_QUERY_PORT_EX_MASK                  = IBV_QUERY_PORT_EX_STD_MASK,
+};
+
+enum ibv_query_port_ex_attr_mask {
+       IBV_QUERY_PORT_EX_ATTR_MASK1            = 1 << 0,
+       IBV_QUERY_PORT_EX_ATTR_MASKS            = (1 << 1) - 1
+};
+
+struct ibv_port_attr_ex {
+       union {
+               struct {
+                       enum ibv_port_state     state;
+                       enum ibv_mtu            max_mtu;
+                       enum ibv_mtu            active_mtu;
+                       int                     gid_tbl_len;
+                       uint32_t                port_cap_flags;
+                       uint32_t                max_msg_sz;
+                       uint32_t                bad_pkey_cntr;
+                       uint32_t                qkey_viol_cntr;
+                       uint16_t                pkey_tbl_len;
+                       uint16_t                lid;
+                       uint16_t                sm_lid;
+                       uint8_t                 lmc;
+                       uint8_t                 max_vl_num;
+                       uint8_t                 sm_sl;
+                       uint8_t                 subnet_timeout;
+                       uint8_t                 init_type_reply;
+                       uint8_t                 active_width;
+                       uint8_t                 active_speed;
+                       uint8_t                 phys_state;
+                       uint8_t                 link_layer;
+                       uint8_t                 reserved;
+               };
+               struct ibv_port_attr            port_attr;
+       };
+       uint32_t                comp_mask;
+       uint32_t                mask1;
+};
+
 
 enum ibv_srq_attr_mask {
        IBV_SRQ_MAX_WR  = 1 << 0,
@@ -904,6 +967,10 @@ enum verbs_context_mask {
 
 struct verbs_context {
        /*  "grows up" - new fields go here */
+       int (*drv_query_port_ex)(struct ibv_context *context, uint8_t port_num,
+                                struct ibv_port_attr_ex *port_attr);
+       int (*lib_query_port_ex)(struct ibv_context *context, uint8_t port_num,
+                                 struct ibv_port_attr_ex *port_attr);
        struct ibv_ah * (*drv_ibv_create_ah_ex)(struct ibv_pd *pd,
                                                struct ibv_ah_attr_ex *attr);
        struct ibv_qp *(*open_qp)(struct ibv_context *context,
@@ -1032,6 +1099,41 @@ static inline int ___ibv_query_port(struct ibv_context 
*context,
 #define ibv_query_port(context, port_num, port_attr) \
        ___ibv_query_port(context, port_num, port_attr)
 
+static inline int ibv_query_port_ex(struct ibv_context *context,
+                                   uint8_t port_num,
+                                   struct ibv_port_attr_ex *port_attr)
+{
+       struct verbs_context *vctx;
+
+       if (0 == port_attr->comp_mask)
+               return ibv_query_port(context, port_num,
+                                     &port_attr->port_attr);
+
+       /* Check that only valid flags were given */
+       if ((!port_attr->comp_mask & IBV_QUERY_PORT_EX_ATTR_MASK1) ||
+           (port_attr->comp_mask & ~IBV_QUERY_PORT_EX_ATTR_MASKS) ||
+           (port_attr->mask1 & ~IBV_QUERY_PORT_EX_MASK)) {
+               errno = EINVAL;
+               return -errno;
+       }
+
+       vctx = verbs_get_ctx_op(context, lib_query_port_ex);
+
+       if (!vctx) {
+               /* Fallback to legacy mode */
+               if (port_attr->comp_mask == IBV_QUERY_PORT_EX_ATTR_MASK1 &&
+                   !(port_attr->mask1 & ~IBV_QUERY_PORT_EX_STD_MASK))
+                       return ibv_query_port(context, port_num,
+                                             &port_attr->port_attr);
+
+               /* Unsupported field was requested */
+               errno = ENOSYS;
+               return -errno;
+       }
+
+       return vctx->lib_query_port_ex(context, port_num, port_attr);
+}
+
 /**
  * ibv_query_gid - Get a GID table entry
  */
diff --git a/src/device.c b/src/device.c
index beb7b3c..29ad726 100644
--- a/src/device.c
+++ b/src/device.c
@@ -169,6 +169,8 @@ struct ibv_context *__ibv_open_device(struct ibv_device 
*device)
                 * context_ex->lib_new_func1 = __verbs_new_func1;
                 * context_ex->lib_new_func2 = __verbs_new_func2;
                 */
+                context_ex->lib_query_port_ex =
+                        context_ex->drv_query_port_ex;
        }
 
        context->device = device;
diff --git a/src/verbs.c b/src/verbs.c
index e7343a9..f8245b0 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -550,7 +550,7 @@ struct ibv_ah *__ibv_create_ah(struct ibv_pd *pd, struct 
ibv_ah_attr *attr)
        int err;
        struct ibv_ah *ah = NULL;
 #ifndef NRESOLVE_NEIGH
-       struct ibv_port_attr port_attr;
+       struct ibv_port_attr_ex port_attr;
        int dst_family;
        int src_family;
        int oif;
@@ -570,7 +570,10 @@ struct ibv_ah *__ibv_create_ah(struct ibv_pd *pd, struct 
ibv_ah_attr *attr)
                goto return_ah;
        }
 
-       err = ibv_query_port(pd->context, attr->port_num, &port_attr);
+       port_attr.comp_mask = IBV_QUERY_PORT_EX_ATTR_MASK1;
+       port_attr.mask1 = IBV_QUERY_PORT_EX_LINK_LAYER |
+                         IBV_QUERY_PORT_EX_CAP_FLAGS;
+       err = ibv_query_port_ex(pd->context, attr->port_num, &port_attr);
 
        if (err) {
                fprintf(stderr, PFX "ibv_create_ah failed to query port.\n");
-- 
1.7.8.2

++++++ libibverbs-Add-receive-flow-steering-support.patch ++++++
>From db47da4a0b79fb3c20a744db2f70ab6b32c8a7eb Mon Sep 17 00:00:00 2001
From: Matan Barak <mat...@mellanox.com>
Date: Thu, 6 Feb 2014 14:20:33 +0200
Subject: [PATCH 6/6] Add receive flow steering support

The RDMA stack allows for applications to create IB_QPT_RAW_PACKET
QPs, which receive plain Ethernet packets, specifically packets that
don't carry any QPN to be matched by the receiving side. Applications
using these QPs must be provided with a method to program some steering
rule with the HW so packets arriving at the local port can be routed to them.

In a similar manner, when the device supports flow streeing, IB UD QPs
created by IPoIB allow user-space applications to steer specific TCP/IP
flows to their QPs.

This patch adds ibv_create_flow(), which allow providing a flow specification
for a QP.  When there's a match between the specification and a received packet,
the packet is forwarded to that QP, in a the same way one uses 
ibv_attach_mcast()
for IB UD multicast handling.

Flow specifications are provided as instances of struct ibv_flow_spec_yyy,
which describes L2, L3 and L4 headers.  Currently specs for Ethernet, IPv4,
TCP and UDP are defined.  Flow specs are made of values and masks.

The input to ib_create_flow() is a struct ib_flow_attr, which contains
a few mandatory control elements and optional flow specs.

 struct ibv_flow_attr {
        uint32_t comp_mask;
        enum ibv_flow_attr_type type;
        uint16_t size;
        uint16_t priority;
        uint8_t  num_of_specs;
        uint8_t  port;
        uint32_t flags;
        /* Following are the optional layers according to user request
         * struct ibv_flow_spec_xxx [L2]
         * struct ibv_flow_spec_yyy [L3/L4]
         */
 };

These flow specs are defined and used in a way which allows adding new spec
types without kernel/user ABI change, just with a little API enhancement which
defines the newly added spec.

The flow spec structures are defined with TLV (Type-Length-Value) entries, which
allows calling ib_create_flow() with a list of variable length of optional 
specs.

For the actual processing of ibv_flow_attr the kernel uses the number
of specs and the size mandatory fields along with the TLV nature of
the specs.

The returned value from ibv_create_flow() is a struct ibv_flow, which contains
a handle provided by the kernel to be used when calling ibv_destroy_flow().

The ib_flow_attr enum type supports usage of flow steering for promiscuous
and sniffer purposes:

    IBV_FLOW_ATTR_NORMAL - "regular" rule, steering according to rule 
specification

    IBV_FLOW_ATTR_ALL_DEFAULT - default unicast and multicast rule, receive
        all Ethernet traffic which isn't steered to any QP

    IBV_FLOW_ATTR_MC_DEFAULT - same as IB_FLOW_ATTR_ALL_DEFAULT but only for 
multicast

ALL_DEFAULT and MC_DEFAULT rules options are valid only for Ethernet link type.

Signed-off-by: Hadar Hen Zion <had...@mellanox.com>
Signed-off-by: Or Gerlitz <ogerl...@mellanox.com>
Signed-off-by: Matan Barak <mat...@mellanox.com>
---
 include/infiniband/driver.h   |    4 +
 include/infiniband/kern-abi.h |   99 ++++++++++++++++++++++++++++++++
 include/infiniband/verbs.h    |  128 +++++++++++++++++++++++++++++++++++++++++-
 src/cmd.c                     |  105 ++++++++++++++++++++++++++++++++++
 src/device.c                  |    4 +
 src/libibverbs.map            |    2 
 6 files changed, 340 insertions(+), 2 deletions(-)

Index: libibverbs-1.1.7/include/infiniband/driver.h
===================================================================
--- libibverbs-1.1.7.orig/include/infiniband/driver.h   2014-03-05 
10:36:36.000000000 +0100
+++ libibverbs-1.1.7/include/infiniband/driver.h        2014-03-31 
18:49:19.376994127 +0200
@@ -194,6 +194,10 @@ int ibv_cmd_destroy_ah(struct ibv_ah *ah
 int ibv_cmd_attach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t 
lid);
 int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t 
lid);
 
+struct ibv_flow *ibv_cmd_create_flow(struct ibv_qp *qp,
+                                    struct ibv_flow_attr *flow_attr);
+int ibv_cmd_destroy_flow(struct ibv_flow *flow_id);
+
 int ibv_dontfork_range(void *base, size_t size);
 int ibv_dofork_range(void *base, size_t size);
 
Index: libibverbs-1.1.7/include/infiniband/kern-abi.h
===================================================================
--- libibverbs-1.1.7.orig/include/infiniband/kern-abi.h 2014-03-31 
18:49:19.331995166 +0200
+++ libibverbs-1.1.7/include/infiniband/kern-abi.h      2014-03-31 
18:50:51.914859071 +0200
@@ -103,6 +103,13 @@ enum {
 #define IB_USER_VERBS_CMD_FLAG_EXTENDED                0x80ul
 
 
+enum {
+       IB_USER_VERBS_CMD_CREATE_FLOW = (IB_USER_VERBS_CMD_FLAG_EXTENDED <<
+                                        IB_USER_VERBS_CMD_FLAGS_SHIFT) +
+                                       IB_USER_VERBS_CMD_THRESHOLD,
+       IB_USER_VERBS_CMD_DESTROY_FLOW
+};
+
 /*
  * Make sure that all structs defined in this file remain laid out so
  * that they pack the same way on 32-bit and 64-bit architectures (to
@@ -677,6 +684,76 @@ struct ibv_kern_send_wr {
        } qp_type;
 };
 
+struct ibv_kern_eth_filter {
+       __u8  dst_mac[6];
+       __u8  src_mac[6];
+       __u16  ether_type;
+       __u16  vlan_tag;
+};
+
+struct ibv_kern_spec_eth {
+       __u32 type;
+       __u16  size;
+       __u16 reserved;
+       struct ibv_kern_eth_filter val;
+       struct ibv_kern_eth_filter mask;
+};
+
+struct ibv_kern_ipv4_filter {
+       __u32 src_ip;
+       __u32 dst_ip;
+};
+
+struct ibv_kern_spec_ipv4 {
+       __u32  type;
+       __u16  size;
+       __u16 reserved;
+       struct ibv_kern_ipv4_filter val;
+       struct ibv_kern_ipv4_filter mask;
+};
+
+struct ibv_kern_tcp_udp_filter {
+       __u16 dst_port;
+       __u16 src_port;
+};
+
+struct ibv_kern_spec_tcp_udp {
+       __u32  type;
+       __u16  size;
+       __u16 reserved;
+       struct ibv_kern_tcp_udp_filter val;
+       struct ibv_kern_tcp_udp_filter mask;
+};
+
+
+struct ibv_kern_spec {
+       union {
+               struct {
+                       __u32 type;
+                       __u16 size;
+                       __u16 reserved;
+               } hdr;
+               struct ibv_kern_spec_eth eth;
+               struct ibv_kern_spec_ipv4 ipv4;
+               struct ibv_kern_spec_tcp_udp tcp_udp;
+       };
+
+};
+
+struct ibv_kern_flow_attr {
+       __u32 type;
+       __u16 size;
+       __u16 priority;
+       __u8 num_of_specs;
+       __u8 reserved[2];
+       __u8 port;
+       __u32 flags;
+       /* Following are the optional layers according to user request
+        * struct ibv_kern_flow_spec_xxx
+        * struct ibv_kern_flow_spec_yyy
+        */
+};
+
 struct ibv_post_send {
        __u32 command;
        __u16 in_words;
@@ -764,6 +841,24 @@ struct ibv_attach_mcast {
        __u64 driver_data[0];
 };
 
+struct ibv_create_flow  {
+       struct ex_hdr hdr;
+       __u32 comp_mask;
+       __u32 qp_handle;
+       struct ibv_kern_flow_attr flow_attr;
+};
+
+struct ibv_create_flow_resp {
+       __u32 comp_mask;
+       __u32 flow_handle;
+};
+
+struct ibv_destroy_flow  {
+       struct ex_hdr hdr;
+       __u32 comp_mask;
+       __u32 flow_handle;
+};
+
 struct ibv_detach_mcast {
        __u32 command;
        __u16 in_words;
@@ -906,7 +1001,9 @@ enum {
        IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1,
        IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
        IB_USER_VERBS_CMD_OPEN_QP_V2 = -1,
-       IB_USER_VERBS_CMD_KWRITE_MMIO_V2 = -1
+       IB_USER_VERBS_CMD_KWRITE_MMIO_V2 = -1,
+       IB_USER_VERBS_CMD_CREATE_FLOW_V2 = -1,
+       IB_USER_VERBS_CMD_DESTROY_FLOW_V2 = -1
 };
 
 struct ibv_modify_srq_v3 {
Index: libibverbs-1.1.7/include/infiniband/verbs.h
===================================================================
--- libibverbs-1.1.7.orig/include/infiniband/verbs.h    2014-03-31 
18:49:19.367994335 +0200
+++ libibverbs-1.1.7/include/infiniband/verbs.h 2014-03-31 18:49:19.377994104 
+0200
@@ -115,7 +115,8 @@ enum ibv_device_cap_flags {
        IBV_DEVICE_RC_RNR_NAK_GEN       = 1 << 12,
        IBV_DEVICE_SRQ_RESIZE           = 1 << 13,
        IBV_DEVICE_N_NOTIFY_CQ          = 1 << 14,
-       IBV_DEVICE_XRC                  = 1 << 20
+       IBV_DEVICE_XRC                  = 1 << 20,
+       IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29
 };
 
 enum ibv_atomic_cap {
@@ -965,8 +966,113 @@ enum verbs_context_mask {
        VERBS_CONTEXT_RESERVED  = 1 << 4
 };
 
+enum ibv_flow_flags {
+       IBV_FLOW_ATTR_FLAGS_ALLOW_LOOP_BACK = 1,
+};
+
+enum ibv_flow_attr_type {
+       /* steering according to rule specifications */
+       IBV_FLOW_ATTR_NORMAL            = 0x0,
+       /* default unicast and multicast rule -
+        * receive all Eth traffic which isn't steered to any QP
+        */
+       IBV_FLOW_ATTR_ALL_DEFAULT       = 0x1,
+       /* default multicast rule -
+        * receive all Eth multicast traffic which isn't steered to any QP
+        */
+       IBV_FLOW_ATTR_MC_DEFAULT        = 0x2,
+};
+
+enum ibv_flow_spec_type {
+       IBV_FLOW_SPEC_ETH       = 0x20,
+       IBV_FLOW_SPEC_IPV4      = 0x30,
+       IBV_FLOW_SPEC_TCP       = 0x40,
+       IBV_FLOW_SPEC_UDP       = 0x41,
+};
+
+struct ibv_flow_eth_filter {
+       uint8_t         dst_mac[6];
+       uint8_t         src_mac[6];
+       uint16_t        ether_type;
+       /*
+        * same layout as 802.1q: prio 3, cfi 1, vlan id 12
+        */
+       uint16_t        vlan_tag;
+};
+
+struct ibv_flow_spec_eth {
+       enum ibv_flow_spec_type  type;
+       uint16_t  size;
+       struct ibv_flow_eth_filter val;
+       struct ibv_flow_eth_filter mask;
+};
+
+struct ibv_flow_ipv4_filter {
+       uint32_t src_ip;
+       uint32_t dst_ip;
+};
+
+struct ibv_flow_spec_ipv4 {
+       enum ibv_flow_spec_type  type;
+       uint16_t  size;
+       struct ibv_flow_ipv4_filter val;
+       struct ibv_flow_ipv4_filter mask;
+};
+
+struct ibv_flow_tcp_udp_filter {
+       uint16_t dst_port;
+       uint16_t src_port;
+};
+
+struct ibv_flow_spec_tcp_udp {
+       enum ibv_flow_spec_type  type;
+       uint16_t  size;
+       struct ibv_flow_tcp_udp_filter val;
+       struct ibv_flow_tcp_udp_filter mask;
+};
+
+struct ibv_flow_spec {
+       union {
+               struct {
+                       enum ibv_flow_spec_type type;
+                       uint16_t                size;
+               } hdr;
+               struct ibv_flow_spec_eth eth;
+               struct ibv_flow_spec_ipv4 ipv4;
+               struct ibv_flow_spec_tcp_udp tcp_udp;
+       };
+};
+
+struct ibv_flow_attr {
+       uint32_t comp_mask;
+       enum ibv_flow_attr_type type;
+       uint16_t size;
+       uint16_t priority;
+       uint8_t num_of_specs;
+       uint8_t port;
+       uint32_t flags;
+       /* Following are the optional layers according to user request
+        * struct ibv_flow_spec_xxx [L2]
+        * struct ibv_flow_spec_yyy [L3/L4]
+        */
+};
+
+struct ibv_flow {
+       uint32_t           comp_mask;
+       struct ibv_context *context;
+       uint32_t           handle;
+};
+
 struct verbs_context {
        /*  "grows up" - new fields go here */
+       int (*drv_ibv_destroy_flow) (struct ibv_flow *flow);
+       int (*lib_ibv_destroy_flow) (struct ibv_flow *flow);
+       struct ibv_flow * (*drv_ibv_create_flow) (struct ibv_qp *qp,
+                                                 struct ibv_flow_attr
+                                                 *flow_attr);
+       struct ibv_flow * (*lib_ibv_create_flow) (struct ibv_qp *qp,
+                                                 struct ibv_flow_attr
+                                                 *flow_attr);
        int (*drv_query_port_ex)(struct ibv_context *context, uint8_t port_num,
                                 struct ibv_port_attr_ex *port_attr);
        int (*lib_query_port_ex)(struct ibv_context *context, uint8_t port_num,
@@ -1156,6 +1262,26 @@ struct ibv_pd *ibv_alloc_pd(struct ibv_c
  */
 int ibv_dealloc_pd(struct ibv_pd *pd);
 
+static inline struct ibv_flow *ibv_create_flow(struct ibv_qp *qp,
+                                              struct ibv_flow_attr *flow)
+{
+       struct verbs_context *vctx = verbs_get_ctx_op(qp->context,
+                                                     lib_ibv_create_flow);
+       if (!vctx || !vctx->lib_ibv_create_flow)
+               return NULL;
+
+       return vctx->lib_ibv_create_flow(qp, flow);
+}
+
+static inline int ibv_destroy_flow(struct ibv_flow *flow_id)
+{
+       struct verbs_context *vctx = verbs_get_ctx_op(flow_id->context,
+                                                     lib_ibv_destroy_flow);
+       if (!vctx || !vctx->lib_ibv_destroy_flow)
+               return -ENOSYS;
+       return vctx->lib_ibv_destroy_flow(flow_id);
+}
+
 /**
  * ibv_open_xrcd - Open an extended connection domain
  */
Index: libibverbs-1.1.7/src/cmd.c
===================================================================
--- libibverbs-1.1.7.orig/src/cmd.c     2014-03-05 10:36:36.000000000 +0100
+++ libibverbs-1.1.7/src/cmd.c  2014-03-31 18:49:19.377994104 +0200
@@ -1268,3 +1268,108 @@ int ibv_cmd_detach_mcast(struct ibv_qp *
 
        return 0;
 }
+
+static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
+                               struct ibv_kern_spec *kern_spec)
+{
+       kern_spec->hdr.type = ib_spec->hdr.type;
+
+       switch (ib_spec->hdr.type) {
+       case IBV_FLOW_SPEC_ETH:
+               kern_spec->eth.size = sizeof(struct ibv_kern_spec_eth);
+               memcpy(&kern_spec->eth.val, &ib_spec->eth.val,
+                      sizeof(struct ibv_flow_eth_filter));
+               memcpy(&kern_spec->eth.mask, &ib_spec->eth.mask,
+                      sizeof(struct ibv_flow_eth_filter));
+               break;
+       case IBV_FLOW_SPEC_IPV4:
+               kern_spec->ipv4.size = sizeof(struct ibv_kern_spec_ipv4);
+               memcpy(&kern_spec->ipv4.val, &ib_spec->ipv4.val,
+                      sizeof(struct ibv_flow_ipv4_filter));
+               memcpy(&kern_spec->ipv4.mask, &ib_spec->ipv4.mask,
+                      sizeof(struct ibv_flow_ipv4_filter));
+               break;
+       case IBV_FLOW_SPEC_TCP:
+       case IBV_FLOW_SPEC_UDP:
+               kern_spec->tcp_udp.size = sizeof(struct ibv_kern_spec_tcp_udp);
+               memcpy(&kern_spec->tcp_udp.val, &ib_spec->tcp_udp.val,
+                      sizeof(struct ibv_flow_ipv4_filter));
+               memcpy(&kern_spec->tcp_udp.mask, &ib_spec->tcp_udp.mask,
+                      sizeof(struct ibv_flow_tcp_udp_filter));
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
+}
+
+struct ibv_flow *ibv_cmd_create_flow(struct ibv_qp *qp,
+                                    struct ibv_flow_attr *flow_attr)
+{
+       struct ibv_create_flow *cmd;
+       struct ibv_create_flow_resp resp;
+       struct ibv_flow *flow_id;
+       size_t cmd_size;
+       size_t written_size;
+       int i, err;
+       void *kern_spec;
+       void *ib_spec;
+
+       cmd_size = sizeof(*cmd) + (flow_attr->num_of_specs *
+                                 sizeof(struct ibv_kern_spec));
+       cmd = alloca(cmd_size);
+       flow_id = malloc(sizeof(*flow_id));
+       if (!flow_id)
+               return NULL;
+       memset(cmd, 0, cmd_size);
+
+       cmd->qp_handle = qp->handle;
+
+       cmd->flow_attr.type = flow_attr->type;
+       cmd->flow_attr.priority = flow_attr->priority;
+       cmd->flow_attr.num_of_specs = flow_attr->num_of_specs;
+       cmd->flow_attr.port = flow_attr->port;
+       cmd->flow_attr.flags = flow_attr->flags;
+
+       kern_spec = cmd + 1;
+       ib_spec = flow_attr + 1;
+       for (i = 0; i < flow_attr->num_of_specs; i++) {
+               err = ib_spec_to_kern_spec(ib_spec, kern_spec);
+               if (err)
+                       goto err;
+               cmd->flow_attr.size +=
+                       ((struct ibv_kern_spec *)kern_spec)->hdr.size;
+               kern_spec += ((struct ibv_kern_spec *)kern_spec)->hdr.size;
+               ib_spec += ((struct ibv_flow_spec *)ib_spec)->hdr.size;
+       }
+
+       written_size = sizeof(*cmd) + cmd->flow_attr.size;
+       IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size, written_size, CREATE_FLOW,
+                                 &resp, sizeof(resp));
+       if (write(qp->context->cmd_fd, cmd, written_size) != written_size)
+               goto err;
+
+       VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof(resp));
+
+       flow_id->context = qp->context;
+       flow_id->handle = resp.flow_handle;
+       return flow_id;
+err:
+       free(flow_id);
+       return NULL;
+}
+
+int ibv_cmd_destroy_flow(struct ibv_flow *flow_id)
+{
+       struct ibv_destroy_flow cmd;
+       int ret = 0;
+
+       memset(&cmd, 0, sizeof(cmd));
+       IBV_INIT_CMD_EX(&cmd, sizeof(cmd), DESTROY_FLOW);
+       cmd.flow_handle = flow_id->handle;
+
+       if (write(flow_id->context->cmd_fd, &cmd, sizeof(cmd)) != sizeof(cmd))
+               ret = errno;
+       free(flow_id);
+       return ret;
+}
Index: libibverbs-1.1.7/src/device.c
===================================================================
--- libibverbs-1.1.7.orig/src/device.c  2014-03-31 18:49:19.367994335 +0200
+++ libibverbs-1.1.7/src/device.c       2014-03-31 18:49:19.378994081 +0200
@@ -171,6 +171,10 @@ struct ibv_context *__ibv_open_device(st
                 */
                 context_ex->lib_query_port_ex =
                         context_ex->drv_query_port_ex;
+                context_ex->lib_ibv_create_flow =
+                        context_ex->drv_ibv_create_flow;
+                context_ex->lib_ibv_destroy_flow =
+                        context_ex->drv_ibv_destroy_flow;
        }
 
        context->device = device;
Index: libibverbs-1.1.7/src/libibverbs.map
===================================================================
--- libibverbs-1.1.7.orig/src/libibverbs.map    2014-03-05 10:36:36.000000000 
+0100
+++ libibverbs-1.1.7/src/libibverbs.map 2014-03-31 18:49:19.378994081 +0200
@@ -64,6 +64,8 @@ IBVERBS_1.0 {
                ibv_cmd_destroy_ah;
                ibv_cmd_attach_mcast;
                ibv_cmd_detach_mcast;
+               ibv_cmd_create_flow;
+               ibv_cmd_destroy_flow;
                ibv_copy_qp_attr_from_kern;
                ibv_copy_path_rec_from_kern;
                ibv_copy_path_rec_to_kern;
++++++ libibverbs-Use-neighbour-lookup-for-RoCE-UD-QPs-Eth-L2-resoluti.patch 
++++++
++++ 1453 lines (skipped)

++++++ libibverbs-autotools.patch ++++++
---
 configure.ac |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: configure.ac
===================================================================
--- configure.ac.orig   2014-04-03 11:43:26.659194576 +0200
+++ configure.ac        2014-04-03 15:36:29.279084919 +0200
@@ -10,14 +10,15 @@ AM_INIT_AUTOMAKE([foreign subdir-objects
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 dnl Checks for programs
-AC_PROG_CC
-AC_USE_SYSTEM_EXTENSIONS
-AC_PROG_LN_S
-LT_INIT
+AC_PROG_CC()
+AC_USE_SYSTEM_EXTENSIONS()
+AC_PROG_LN_S()
+LT_INIT()
+
 
 AC_ARG_WITH([valgrind],
-    AS_HELP_STRING([--with-valgrind],
-        [Enable Valgrind annotations (small runtime overhead, default NO)]))
+  [AS_HELP_STRING([--with-valgrind],
+       [Enable Valgrind annotations (small runtime overhead, default NO)])])
 if test x$with_valgrind = x || test x$with_valgrind = xno; then
     want_valgrind=no
     AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])
++++++ libibverbs-fix_aliasing.patch ++++++
From: Jan Engelhardt <jeng...@inai.de>
Date: 2012-08-26 21:34:11.356459793 +0200

src: fix breakage of alignment constraints and strict aliasing

src/verbs.c: In function 'is_link_local_gid':
src/verbs.c:689:2: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]
src/verbs.c:690:2: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]
examples/pingpong.c: In function 'wire_gid_to_gid':
examples/pingpong.c:76:3: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]
examples/pingpong.c: In function 'gid_to_wire_gid':
examples/pingpong.c:85:3: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]

---
 examples/pingpong.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Index: examples/pingpong.c
===================================================================
--- examples/pingpong.c.orig    2014-01-17 17:56:03.555235512 +0100
+++ examples/pingpong.c 2014-01-17 18:00:03.448680268 +0100
@@ -67,21 +67,24 @@ int pp_get_port_info(struct ibv_context
 void wire_gid_to_gid(const char *wgid, union ibv_gid *gid)
 {
        char tmp[9];
-       uint32_t v32;
+       uint32_t v32, v32n;
        int i;
 
        for (tmp[8] = 0, i = 0; i < 4; ++i) {
                memcpy(tmp, wgid + i * 8, 8);
                sscanf(tmp, "%x", &v32);
-               *(uint32_t *)(&gid->raw[i * 4]) = ntohl(v32);
+               v32n = ntohl(v32);
+               memcpy(&gid->raw[i*4], &v32n, sizeof(v32n));
        }
 }
 
 void gid_to_wire_gid(const union ibv_gid *gid, char wgid[])
 {
        int i;
+       uint32_t v32;
 
-       for (i = 0; i < 4; ++i)
-               sprintf(&wgid[i * 8], "%08x",
-                       htonl(*(uint32_t *)(gid->raw + i * 4)));
+       for (i = 0; i < 4; ++i) {
+               memcpy(&v32, gid->raw + i * 4, sizeof(v32));
+               sprintf(&wgid[i * 8], "%08x", htonl(v32));
+       }
 }
++++++ libibverbs-s390.patch ++++++
Cc: alexey_ishc...@ru.ibm.com
Subject: DAPL support for Linux on System z

s390: Add DAPL support for Linux on System z in libibverbs

Changes required to support the OFED stack on the System z platform. These
changes include:
        * mb, rmb, wmb, and wc_wmb macro definitions for the System z platform;
        * new Infiniband verb command identifier.
The new Infiniband verb command was added to allow data transfer from user
space applications to infiniband devices on System z.


---
 include/infiniband/arch.h     |    7 +++++++
 include/infiniband/kern-abi.h |    6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

Index: libibverbs-1.1.7/include/infiniband/arch.h
===================================================================
--- libibverbs-1.1.7.orig/include/infiniband/arch.h     2014-03-05 
10:36:36.000000000 +0100
+++ libibverbs-1.1.7/include/infiniband/arch.h  2014-03-31 14:20:50.479614972 
+0200
@@ -115,6 +115,13 @@ static inline uint64_t ntohll(uint64_t x
 #define wmb()   mb()
 #define wc_wmb() wmb()
 
+#elif defined(__s390x__) || defined(__s390__)
+
+#define mb()    asm volatile("" ::: "memory")
+#define rmb()   mb()
+#define wmb()   mb()
+#define wc_wmb() wmb()
+
 #else
 
 #warning No architecture specific defines found.  Using generic implementation.
Index: libibverbs-1.1.7/include/infiniband/kern-abi.h
===================================================================
--- libibverbs-1.1.7.orig/include/infiniband/kern-abi.h 2014-03-05 
10:36:36.000000000 +0100
+++ libibverbs-1.1.7/include/infiniband/kern-abi.h      2014-03-31 
14:20:50.480614949 +0200
@@ -91,7 +91,8 @@ enum {
        IB_USER_VERBS_CMD_OPEN_XRCD,
        IB_USER_VERBS_CMD_CLOSE_XRCD,
        IB_USER_VERBS_CMD_CREATE_XSRQ,
-       IB_USER_VERBS_CMD_OPEN_QP
+       IB_USER_VERBS_CMD_OPEN_QP,
+       IB_USER_VERBS_CMD_KWRITE_MMIO=52
 };
 
 #define IB_USER_VERBS_CMD_COMMAND_MASK         0xff
@@ -904,7 +905,8 @@ enum {
        IB_USER_VERBS_CMD_OPEN_XRCD_V2 = -1,
        IB_USER_VERBS_CMD_CLOSE_XRCD_V2 = -1,
        IB_USER_VERBS_CMD_CREATE_XSRQ_V2 = -1,
-       IB_USER_VERBS_CMD_OPEN_QP_V2 = -1
+       IB_USER_VERBS_CMD_OPEN_QP_V2 = -1,
+       IB_USER_VERBS_CMD_KWRITE_MMIO_V2 = -1
 };
 
 struct ibv_modify_srq_v3 {
-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to