History log of /freebsd-head/sys/ofed/drivers/infiniband/core/ib_cma.c
Revision Date Author Comments
8b9d2898268a1ad6e73442acbb5c271125d0747b 31-Aug-2020 vangyzen <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
ae68c844b6b7bb05f20546ad68f2ac512ae58b4e 06-Jul-2020 hselasky <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
60042730d62e0f3d377ee60c2437b22fea4fb971 15-Apr-2020 melifaro <melifaro@FreeBSD.org> Convert OFED rtable interactions to the new routing KPI.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24387
f1b5552611a84659b08c65816d37396dbf8cf43a 17-Aug-2019 cem <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
5413daa1a0268094815c248f4da063012224f1e4 05-Dec-2018 slavash <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
cc6a289dfb2c2da42b990e8eed0f5dfc7f2a3f3f 05-Dec-2018 slavash <slavash@FreeBSD.org> ibcore: Add missing unref of netdevice.

Submitted by: hselasky@
Approved by: hselasky (mentor)
MFC after: 1 week
Sponsored by: Mellanox Technologies
36bca24c90c9654a425f653f748a6c9211030cca 05-Dec-2018 slavash <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
c11489eef8689212448a5a7c4e2f35facdebade2 05-Dec-2018 slavash <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
c89337929b987c166c26287e8f17353fa7a36cf7 09-Sep-2018 hselasky <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
14eba6b1212a0bbcc8422b21e84daa6359ade1ec 07-Sep-2018 hselasky <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
2692d5038b20cfdecb5a182f4afeac6beadde2a1 17-Jul-2018 hselasky <hselasky@FreeBSD.org> Use __FBSDID() for RCS tags in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies
7582d55530bf8e7c72b92fd21e74d36a2251f88f 17-Jul-2018 hselasky <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
e60398fa558a281795d83814771f76c372c4dea3 17-Jul-2018 hselasky <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
3c382743d594e0007fbf9b966a1566ab58a67243 17-Jul-2018 hselasky <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
9498114d8c3c75f5cd288ae7d6028fdc5131d58d 17-Jul-2018 hselasky <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
81f62709764d1769d58a5c084ae367e2dd75aa77 17-Jul-2018 hselasky <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
22ad2d6d8d8f89880379ea4668b758609358aa93 17-Jul-2018 hselasky <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
aab495f4dc5afbb9d64153b1893a6a78dbe43003 17-Jul-2018 hselasky <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
22afd65b52dda6e9d74a18d5e155e5d37b2b9229 17-Jul-2018 hselasky <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
88533a8acf0d3bfdfca85651a9d144830ee3b57d 17-Jul-2018 hselasky <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
57ecb463eed6e819a71c074273d52545bd7d9bb9 07-Mar-2018 hselasky <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
638909cdbe859ff01ff6deb32cda6d51d099ae5d 07-Mar-2018 hselasky <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
1f96ecc8c30c94b1bea2001f8da31d854f773a59 07-Mar-2018 hselasky <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
1a0dfe658290aae2f787318c82f9bd86bed2125e 05-Mar-2018 hselasky <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
5d1e7279d74a45403c1a9b9362b2c3bcf693af12 05-Mar-2018 hselasky <hselasky@FreeBSD.org> Need to check for IPv6 linklocal address inside rdma_resolve_addr() in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies
790d7753c2413bbc210e8d56200851e90c509faf 05-Mar-2018 hselasky <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
1f4402b8375b9f3f4efef1c152b98a4c369b57e0 05-Mar-2018 hselasky <hselasky@FreeBSD.org> Select RoCEv2 by default in ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies
a0fcf1645dc17f0f143379cb1a90cca452d98cab 05-Mar-2018 hselasky <hselasky@FreeBSD.org> Add missing FreeBSD tags and SVN properties to ibcore.

MFC after: 1 week
Sponsored by: Mellanox Technologies
2fc764b2e92f95dcfc5b5450d19b18088cd8b50b 16-Sep-2017 hselasky <hselasky@FreeBSD.org> Embedding the scope ID is no longer needed for IPv6.

Sponsored by: Mellanox Technologies
6c898cf89354bce07394c040a9cbd40f790c86ee 16-Sep-2017 hselasky <hselasky@FreeBSD.org> Set length field of socket address.

Sponsored by: Mellanox Technologies
bd785e42809f68a5eec238499d073f45c2faa6c4 16-Sep-2017 hselasky <hselasky@FreeBSD.org> Fix for refcount leak.

Sponsored by: Mellanox Technologies
b00a0b4b47b9734b96ffde11a1a0517818c529f6 16-Sep-2017 hselasky <hselasky@FreeBSD.org> Make sure the socket address length field gets set.

Sponsored by: Mellanox Technologies
b877b0cf03217693463c694d5604c46b1821c837 03-Jul-2017 hselasky <hselasky@FreeBSD.org> ibcore: Delete old files and add new ones missed in the initial commit
for this projects branch.

Sponsored by: Mellanox Technologies