Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Eric Davis" <eric.davis@broadcom.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next 02/13] RDMA/core: add the UET GID types
Date: Wed, 14 Oct 2026 22:35:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-171976@kernel.org> (raw)
In-Reply-To: <20261014-uet-ib-core-v1-2-a0e626117113@broadcom.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] RDMA/core: Incomplete UET Address Handle initialization breaks incoming WC
- [High] RDMA/cma: UET paths incorrectly classified as InfiniBand, dropping DMAC
- [High] RDMA/cma: Missing netdev checks cause UET to fallback to InfiniBand logic
--

commit 7479c85e5472864148025ac811bf445ba1cec04d
Author: Eric Davis <eric.davis@broadcom.com>

RDMA/core: add the UET GID types

This commit introduces the UET GID types for UDP and IP encapsulations,
allowing a port to hold both UET and RoCE GIDs. It also adds
rdma_port_gids_from_netdev() to build the GID table from a netdev for
UET ports similarly to how it is done for RoCE.

> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index edf62652f9d3e..24db88e6d3fa0 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -862,6 +862,10 @@ int ib_init_ah_attr_from_wc(struct ib_device *device, u32 port_num,
>  
>  	might_sleep();
>  
> +	if (rdma_protocol_uet(device, port_num) &&
> +	    !rdma_protocol_roce(device, port_num))
> +		return -EPROTONOSUPPORT;
> +

[Severity: High]
Does this explicitly fail Address Handle initialization for UET-only ports?

Returning -EPROTONOSUPPORT here blocks Address Handle creation for incoming
packets on UET-only ports, preventing the host from responding to connections.

Additionally, for dual-mode ports, this function extracts the IP network
type and passes it to ib_network_to_gid_type(). Because ib_network_to_gid_type()
was not updated to handle UET, it unconditionally maps IPv4 and IPv6 to
IB_GID_TYPE_ROCE_UDP_ENCAP:

include/rdma/ib_verbs.h:ib_network_to_gid_type() {
    if (network_type == RDMA_NETWORK_IPV4 ||
        network_type == RDMA_NETWORK_IPV6)
        return IB_GID_TYPE_ROCE_UDP_ENCAP;
    ...
}

Could this cause incoming UET packets to be incorrectly mapped to a RoCEv2
GID index, breaking the UET transport response?

[ ... ]

> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index d6eaa3fee66e3..4e3a5c38cbe8b 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -145,6 +145,8 @@ enum ib_gid_type {
>  	IB_GID_TYPE_IB = IB_UVERBS_GID_TYPE_IB,
>  	IB_GID_TYPE_ROCE = IB_UVERBS_GID_TYPE_ROCE_V1,
>  	IB_GID_TYPE_ROCE_UDP_ENCAP = IB_UVERBS_GID_TYPE_ROCE_V2,
> +	IB_GID_TYPE_UET_UDP = IB_UVERBS_GID_TYPE_UET_UDP,
> +	IB_GID_TYPE_UET_IP = IB_UVERBS_GID_TYPE_UET_IP,
>  	IB_GID_TYPE_SIZE
>  };

[Severity: High]
When these new GID types are passed to the Subnet Administrator (SA) layer,
are they incorrectly classified as InfiniBand path records?

In sa_conv_gid_to_pathrec_type() in include/rdma/ib_sa.h, there are no cases
for the new UET GID types, causing them to fall through to the default case:

include/rdma/ib_sa.h:sa_conv_gid_to_pathrec_type() {
    ...
    default:
        return SA_PATH_REC_TYPE_IB;
}

Later, when CMA attempts to set the destination MAC address for the path record,
sa_path_set_dmac() checks if the path is RoCE:

include/rdma/ib_sa.h:sa_path_set_dmac() {
    if (sa_path_is_roce(rec))
        memcpy(rec->roce.dmac, dmac, ETH_ALEN);
    ...
}

Because the path is classified as IB rather than Ethernet/RoCE, this check
fails. Will this silently discard the destination MAC address, causing outgoing
packets to be dropped due to an uninitialized MAC?

[ ... ]

> @@ -3407,6 +3420,34 @@ static inline bool rdma_protocol_roce_eth_encap(const struct ib_device *device,
>  	       RDMA_CORE_CAP_PROT_ROCE;
>  }
>  
> +static inline bool rdma_protocol_uet(const struct ib_device *device,
> +				     u32 port_num)
> +{
> +	return device->port_data[port_num].immutable.core_cap_flags &
> +	       RDMA_CORE_CAP_PROT_UET;
> +}
> +
> +static inline bool rdma_protocol_uet_udp(const struct ib_device *device,
> +					 u32 port_num)
> +{
> +	return device->port_data[port_num].immutable.core_cap_flags &
> +	       RDMA_CORE_CAP_PROT_UET_UDP;
> +}
> +
> +static inline bool rdma_protocol_uet_ip(const struct ib_device *device,
> +					u32 port_num)
> +{
> +	return device->port_data[port_num].immutable.core_cap_flags &
> +	       RDMA_CORE_CAP_PROT_UET_IP;
> +}
> +
> +static inline bool rdma_port_gids_from_netdev(const struct ib_device *device,
> +					      u32 port_num)
> +{
> +	return rdma_protocol_roce(device, port_num) ||
> +	       rdma_protocol_uet(device, port_num);
> +}
> +

[Severity: High]
While this helper correctly abstracts the GID table logic for UET and RoCE,
are there missing netdev checks in the CMA and Multicast layers that still
explicitly check rdma_protocol_roce() instead of this new helper?

In cma_ib_acquire_dev(), UET-only ports fail the RoCE check and fall into the
else block intended for InfiniBand:

drivers/infiniband/core/cma.c:cma_ib_acquire_dev() {
    if (rdma_protocol_roce(req->device, req->port))
        rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr, &gid);
    else
        memcpy(&gid, dev_addr->src_dev_addr + rdma_addr_gid_offset(dev_addr), sizeof(gid));
    ...
}

Since Ethernet MAC addresses are only 6 bytes, does copying 16 bytes from
dev_addr->src_dev_addr lead to an out-of-bounds read and a malformed GID?

Similarly, in rdma_resolve_route(), UET fails the protocol checks and falls
through to return -ENOSYS:

drivers/infiniband/core/cma.c:rdma_resolve_route() {
    ...
    else if (rdma_protocol_roce(id->device, id->port_num)) {
        ret = cma_resolve_iboe_route(id_priv);
    ...
}

Finally, in ib_init_ah_from_mcmember(), UET ports fail the !rdma_protocol_roce
check and return -EINVAL:

drivers/infiniband/core/multicast.c:ib_init_ah_from_mcmember() {
    ...
    else if (!rdma_protocol_roce(device, port_num))
        return -EINVAL;
    ...
}

Will these missing updates break route resolution and multicast joins for UET
devices?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-uet-ib-core-v1-0-a0e626117113@broadcom.com?part=2

  reply	other threads:[~2026-10-14 22:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 22:21 [PATCH rdma-next 00/13] RDMA/core: Ultra Ethernet transport verbs Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 01/13] RDMA/core: widen the uverbs object key Eric Davis via B4 Relay
2026-10-14 22:29   ` sashiko-bot
2026-10-14 22:21 ` [PATCH rdma-next 02/13] RDMA/core: add the UET GID types Eric Davis via B4 Relay
2026-10-14 22:35   ` sashiko-bot [this message]
2026-10-14 22:21 ` [PATCH rdma-next 03/13] RDMA/core: report the reliable unconnected device capabilities Eric Davis via B4 Relay
2026-10-14 22:30   ` sashiko-bot
2026-10-14 22:21 ` [PATCH rdma-next 04/13] RDMA/core: add the reliable unconnected queue pair type Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 05/13] RDMA/core: extended address handle attributes Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 06/13] RDMA/core: query the semantics a queue pair type guarantees Eric Davis via B4 Relay
2026-10-14 22:34   ` sashiko-bot
2026-10-14 22:21 ` [PATCH rdma-next 07/13] RDMA/core: job and job key objects Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 08/13] RDMA/uverbs: factor out the queue pair attribute copy Eric Davis via B4 Relay
2026-10-14 22:30   ` sashiko-bot
2026-10-14 22:21 ` [PATCH rdma-next 09/13] RDMA/core: create a queue pair ready to send Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 10/13] RDMA/core: queue pair attributes for unconnected transports Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 11/13] RDMA/core: extended memory registration Eric Davis via B4 Relay
2026-10-14 22:21 ` [PATCH rdma-next 12/13] RDMA/core: 64-bit memory keys Eric Davis via B4 Relay
2026-10-14 22:32   ` sashiko-bot
2026-10-14 22:21 ` [PATCH rdma-next 13/13] RDMA/core: attach a memory region to a queue pair Eric Davis via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-171976@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eric.davis@broadcom.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox