History log of /freebsd-current/sys/ofed/drivers/infiniband/core/ib_cma.c
Revision Date Author Comments
# c7f73a15 22-Aug-2023 Bartosz Sobczak <bartosz.sobczak@intel.com>

ofed: mask seq_num identifier to occupy only 3 bytes

The seq_num among other things is used to assign rq_psn value, which is
a 24-bit identifier. When the seq_num is full 4-byte value, we are
usually receiving: '_ib_modify_qp rq_psn overflow, masking to 24 bits'
warning.

This is burdensome for running rdma traffic with large number of
connections, because the number of logs is growing fast.

Signed-off-by: Bartosz Sobczak <bartosz.sobczak@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by: kib@, erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D41531


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 3e142e07 08-Feb-2023 Justin Hibbits <jhibbits@FreeBSD.org>

ofed: Mechanically convert to IfAPI

Summary:
Because of the intricacies of this code it wasn't purely scripted, but
instead hand-mechanical.

Reviewed by: hselasky
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38560


# f5027467 30-Aug-2022 Hans Petter Selasky <hselasky@FreeBSD.org>

ibcore: The use of IN_LOOPBACK() now requires a valid VNET context.

Make sure the VNET is set before using this macro.

Fixes: efe58855f3ea2cfc24cb705aabce3bc0fe1fb6d5
PR: 266054
MFC after: 1 week
Sponsored by: NVIDIA Networking


# a11f080e 16-Jul-2022 Mike Karels <karels@FreeBSD.org>

ofed/infiniband: fix ifdefs for new INET changes, fixing LINT-NOIP

Some of the ofed/infiniband code has INET and INET6 address handling
code without using ifdefs. This failed with a recent change to INET,
in which IN_LOOPBACK() started using a VNET variable, and which is not
present if INET is not configured. Add #ifdef INET, and INET6 for good
measure, in cma_loopback_addr(), along with inclusion of the options
headers in ib_cma.c.

Reviewed by: hselasky rgrimes bz
Differential Revision: https://reviews.freebsd.org/D35835

(cherry picked from commit 752b7632776237f9c071783acdd1136ebf5f287d)


# 20fea7ac 16-Jun-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

ibcore: Define option to set ack timeout.

Define new option in 'rdma_set_option' to override calculated QP timeout
when requested to provide QP attributes to modify a QP.

At the same time, pack tos_set to be bitfield.

Linux commit:
2c1619edef61a03cb516efaa81750784c3071d10

MFC after: 1 week
Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking


# e2ae502d 16-Jun-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

ibcore: Use inline function to validate port

Linux commit:
24dc831b77eca9361cf835be59fa69ea0e471afc

MFC after: 1 week
Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking


# e25bcf8d 16-Jun-2021 Hans Petter Selasky <hselasky@FreeBSD.org>

ibcore: Add rdma_reject_msg() helper function.

rdma_reject_msg() returns a pointer to a string message associated with
the transport reject reason codes.

Linux commit:
77a5db13153906a7e00740b10b2730e53385c5a8

MFC after: 1 week
Reviewed by: kib
Sponsored by: Mellanox Technologies // NVIDIA Networking


# 1411f52f 04-Jun-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

mlx4/OFED: replace the struct net_device with struct ifnet

Given all the code does operate on struct ifnet, the last step in this
longer series of changes now is to rename struct net_device to
struct ifnet (that is what it was defined to in the LinuxKPi code).
While mlx4 and OFED are "shared" code the decision was made years ago
to not write it based on the netdevice KPI but the native ifnet KPI
for most of it. This commit simply spells this out and with that
frees "struct netdevice" to be re-done on LinuxKPI to become a more
native/mixed implementation over time as needed by, e.g., wireless
drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30515


# c35034b3 25-May-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI/OFED/mlx4: cleanup netdevice.h some more

This removes all unused bits from linux/netdevice.h and migrates two
inline functions into the mlx4 and ofed code respectively.

This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines
in netdevice.h.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days
Reviewed by: hselasky, kib
Differential Revision: https://reviews.freebsd.org/D30461


# 7069b4c6 26-Mar-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI/OFED: (re)move inetdevice.h implementation

The two functions in linux/inetdevice.h are highly FreeBSD/ifnet
specific. This is a result of struct net_device being mapped to
struct ifnet.

The only known consumer of these functions are two files in the
ofed/infiniband code.

As a first step of cleaning up copy linux/inetdevice.h to
rdma/ib_addr_freebsd.h. (It stayed a separate file to preserve
copyright and license of the original file; otherwise it could be
merged into ib_addr.h where more EPOCH/vnet/.. are already used).

Slightly rename the function to not conflict with LinuxKPI
in the future.

Remove the three last, now unneeded includes of inetdevice.h and
zap linux/inetdevice.h to an empty header file with only the forward
include to netdevice.h remaining.

Sponsored-by: The FreeBSD Foundation
MFC-after: 2 weeks
Reviewed-by: hselasky, kib
X-D-R: D29366 (extracted as further cleanup)
Differential Revision: https://reviews.freebsd.org/D29434


# 536457e1 31-Aug-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

infiniband: Appease Coverty

Coverity claims the call to rdma_gid2ip in cma_igmp_send overwrites addr.
Use a consistent definition of sockaddr to prevent detections and code
changes in the future.

Submitted by: bret_ketchum@dell.com
Reported by: Coverity
Reviewed by: hselasky, kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26229


# 1866c98e 06-Jul-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Infiniband clients must be attached and detached in a specific order in ibcore.

Currently the linking order of the infiniband, IB, modules decide in which
order the clients are attached and detached. For example one IB client may
use resources from another IB client. This can lead to a potential deadlock
at shutdown. For example if the ipoib is unregistered after the ib_multicast
client is detached, then if ipoib is using multicast addresses a deadlock may
happen, because ib_multicast will wait for all its resources to be freed before
returning from the remove method.

Fix this by using module_xxx_order() instead of module_xxx().

Differential Revision: https://reviews.freebsd.org/D23973
MFC after: 1 week
Sponsored by: Mellanox Technologies


# 0f3bf682 15-Apr-2020 Alexander V. Chernikov <melifaro@FreeBSD.org>

Convert OFED rtable interactions to the new routing KPI.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24387


# 6b2f0171 17-Aug-2019 Conrad Meyer <cem@FreeBSD.org>

OFED: Unbreak SDP support in ibcore

This regression was introduced in the r326169 Linux v4.9 Infiniband upgrade.
Restore the functionality.

Reviewed by: hselasky
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21298


# a9c20af2 05-Dec-2018 Slava Shwartsman <slavash@FreeBSD.org>

ibcore: ip6_dev_find() needs to know the scope ID.

Else the wrong network device can be returned for link-local addresses.

Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies


# 02316694 05-Dec-2018 Slava Shwartsman <slavash@FreeBSD.org>

ibcore: Add missing unref of netdevice.

Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies


# ae8534ca 05-Dec-2018 Slava Shwartsman <slavash@FreeBSD.org>

ibcore: Fix loopback with rdma-cm.

Trying to validate loopback fails because rtalloc1() resolves system
local addresses to the loopback network interface, lo0. Fix this by
explicitly checking for loopback during validation of the source
and destination network address. If the source address belongs to
a local network interface and is equal to the destination address,
there is no need to run the destination address through rtalloc1().

Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies


# 475c8de7 05-Dec-2018 Slava Shwartsman <slavash@FreeBSD.org>

ibcore: Don't access invalid port.

The port number in the listen_id_priv has been observed to be zero which
means no port has been selected. The current code lacks a check for invalid
port number.

Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies


# 7877f593 09-Sep-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Introduce and use sgid_index in CM requests in ibcore.

For RoCE, when CM requests are received for RC and UD connections,
netdevice of the incoming request is unavailable. Because of that CM
requests are always forwarded to init_net namespace.

Now that we have the GID index available, introduce SGID index in
incoming CM requests and refer to the netdevice of it.

While at it fix some incorrect uses of init_net and make sure
the rdma_create_id() function stores the VNET it is passed.

Based on linux commit:
cee104334c98dd04e9dd4d9a4fa4784f7f6aada9

MFC after: 3 days
Approved by: re (gjb)
Sponsored by: Mellanox Technologies


# 86156495 07-Sep-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Implement get network interface by params function in ipoib.

Also fix the validate_ipv4_net_dev() and validate_ipv6_net_dev() functions
which had source and destination addresses swapped, and didn't set the
scope ID for IPv6 link-local addresses.

This allows applications like krping to work using IPoIB devices.

MFC after: 3 days
Approved by: re (gjb)
Sponsored by: Mellanox Technologies


# cda1e10c 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Use __FBSDID() for RCS tags in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 1bebf70f 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Add support for IPv6 multicast in ibcore.

This change allows us to join IPv6 multicast networks.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# e3e6820f 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Honor return status of ib_init_ah_from_mcmember() in ibcore.

The return status of ib_init_ah_from_mcmember() is ignored by
cma_ib_mc_handler(). Honor it and return error event if ah attribute
initialization failed.

Linux commit:
6d337179f28cc50ddd7e224f677b4cda70b275fc

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 56acbf09 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Set IPv4 TOS and IPv6 traffic class field for RoCEv2 traffic in ibcore.

The current implementation assumes a static mapping between
the TOS bits and the priority code point, PCP bits.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# f736cb92 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Check port number supplied by user verbs cmds in ibcore.

The ib_uverbs_create_ah() ind ib_uverbs_modify_qp() calls receive
the port number from user input as part of its attributes and assumes
it is valid. Down on the stack, that parameter is used to access kernel
data structures. If the value is invalid, the kernel accesses memory
it should not. To prevent this, verify the port number before using it.

Linux commit:
5ecce4c9b17bed4dc9cb58bfb10447307569b77b
a62ab66b13a0f9bcb17b7b761f6670941ed5cd62
5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3

MFC after: 1 week
Sponsored by: Mellanox Technologies


# ed222171 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix access to non-initialized CM_ID object in ibcore.

The attempt to join multicast group without ensuring that CMA device
exists will lead to the following crash reported by syzkaller.

Linux commit:
7688f2c3bbf55e52388e37ac5d63ca471a7712e1

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 682bd3fe 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Set default GID type as RoCE when resolving RoCE route in ibcore.

cma_iboe_set_mgid() is updated to reflect the RoCEv2 GID check.

Linux commit:
5c181bda77f409d89ad513528eccac5f3a416474

MFC after: 1 week
Sponsored by: Mellanox Technologies


# b70db327 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Set RoCEv2 MGID according to spec in ibcore.

RoCEv2 Annex states that for RoCEv2 over IPv4, the corresponding
IPv4 address is encoded into the GID according to the following rule:
GID= :ffff:<IPv4 address>

Remove the 0xff0e prefix for RoCEv2 packets with IPv4 and leave it
zeroed and change rdma_is_multicast_addr() to consider the new logic.

Linux commit:
be1d325a335840a86c133a56c6a911c368bac0fd
1c3aea2bc8f0b2e5b57375ead40457ff75a3a2ec

MFC after: 1 week
Sponsored by: Mellanox Technologies


# fed17c58 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix for RDMA loopback over VLAN in ibcore.

Implement a more generic solution for detecting loopback.
The problem was that the default netdevice was resolved
for loopback also when VLAN was used. Use real network
device instead of loopback device for bound device
interface.

How to test:
ucmatose -b 127.0.0.1 -p 20090
ucmatose -s 5.6.5.1 -p 20090

Note that RDMA treats the IPv4 and IPv6 loopback
addresses like any address.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# f9899e45 17-Jul-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Add native FreeBSD support for multicast in ibcore.

This change adds support for registering multicast addresses,
both IPv4 and IPv6.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# d4eeed42 07-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Make sure VNET is set when calling sa6_recoverscope() in ibcore.

Else panic will occur when VIMAGE is enabled.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# c131a223 07-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Recover IPv6 scope ID for multicast link-local addresses as well as
unicast link-local addresses.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# d0a9dbc7 06-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Make sure the IPv6 scope ID gets properly masked in ibcore.

When exchanging CM messages the IPv6 scope ID should be ignored
for link local addresses when doing comparisons. Make sure the
scope ID is always set to zero for link local addresses.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# bf8641fe 05-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Get correct network device when accepting incoming RDMA connections in ibcore.

This patch ensures the GID index is always used as a basis of resolving
incoming RDMA connections, as compared to the GID value itself.

Background:
On a per infiniband port basis, the GID identifier is not a unique identifier!
This assumption falls apart when VLAN ID, IPv6 scope ID and RoCE type,
as supported by RoCE v2, is taken into account. This additional
information is stored in the so-called GID attributes and is needed to
correctly identify the destination network interface for an incoming
connection.

Different VLANs are allowed to define the same IPv4 addresses and especially
for the default IPv6 link-local addresses or when using so-called containers
or jails, this is true.

The VNET information for the destination network interface is needed in
order to perform the L2 address lookup in the right Virtual Network Stack
context.

Consequently old functions previously used by RoCE v1, like
rdma_addr_find_smac_by_sgid() are impossible to support, because
there can be multiple identical GIDs associated with the same
infiniband port, and the answer to such a request becomes undefined.
This function has been removed.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 891538ab 04-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Need to check for IPv6 linklocal address inside rdma_resolve_addr() in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 6d36a2c7 05-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Map type of service, TOS, to IB or VLAN service level 1:1 in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 5b94bd8a 05-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Select RoCEv2 by default in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 09938b21 05-Mar-2018 Hans Petter Selasky <hselasky@FreeBSD.org>

Add missing FreeBSD tags and SVN properties to ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 526f5961 16-Sep-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Embedding the scope ID is no longer needed for IPv6.

Sponsored by: Mellanox Technologies


# e02ecc60 16-Sep-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Set length field of socket address.

Sponsored by: Mellanox Technologies


# 6af166cc 16-Sep-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix for refcount leak.

Sponsored by: Mellanox Technologies


# d18b4113 16-Sep-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Make sure the socket address length field gets set.

Sponsored by: Mellanox Technologies


# 9f715dc1 03-Jul-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

ibcore: Delete old files and add new ones missed in the initial commit
for this projects branch.

Sponsored by: Mellanox Technologies