RDMA/core: Ultra Ethernet transport verbs
v2 cover RDMA/core: Ultra Ethernet transport verbs
Ultra Ethernet defines a reliable unconnected transport. A queue pair sends to any peer in its job without a connection, incoming traffic is demultiplexed on a JobID rather than on a connection, and what a device orders is far weaker than IB or RoCE and varies between devices. None of that has a home in the current uverbs ABI.
This series adds the generic half. The objects, methods, and attributes any UET device implements. No driver is part of it, though two already exist against this ABI. A reference device model that implements all of it, and HPE's Slingshot driver implementing a large subset. That is the argument for ib_core carrying this. What is device specific should come from private interfaces per vendor.
Patch 1 widens the uverbs object key. The two new core objects would otherwise leave drivers no free object keys.
Patches 2-4 expose the transport. The two UET encapsulations as GID types, the capabilities and limits a device advertises, and IB_QPT_RU with its 32-bit queue pair number.
Patch 5 widens address handles, which an unconnected peer needs since it is named by both a network address and a queue pair number.
Patch 6 adds a query for what a queue pair type actually orders.
Patch 7 adds jobs and job keys, the objects an unconnected transport demultiplexes and authorizes on. A job can be exported to a file descriptor, so an unprivileged process can join one set up for it.
Patches 8-10 let a queue pair be created ready to send, since a transport with nothing to negotiate gains nothing from the modify sequence. Patch 8 is a no-functional-change refactor pulling the attribute copy out of modify_qp. Patch 9 lets create take those attributes. Patch 10 adds the attributes a reliable unconnected transport needs.
Patches 11-13 cover memory registration with a job binding, a chosen key, derived regions, 64-bit keys for devices whose keys do not fit in 32 bits, and attaching a region to one queue pair so the network reaches it only over that QP.
New attributes are optional, so existing userspace is unaffected and a device without a feature reports it absent rather than failing. The attributes that restrict access are sent mandatory by userspace, so a kernel that does not know one refuses the request rather than creating an object with less protection than was asked for.
Tested against a reference device implementing the ABI, and against rxe to confirm nothing already upstream regressed. The userspace half is a matching rdma-core series.
---
Changes in v2:
- Rebase on rdma for-next
- Refuse the write post_send and post_recv commands on an RU QP (4)
- Read the extended AH attribute with uverbs_copy_from_or_zero() (5, 7)
- Export a job as a uverbs FD object, import it through a raw fd, and
drop the job revoke on device removal (7)
- Drop the job and job key flags attributes, none was defined (7)
- Require the address table size at job allocation and check each
index against it (7)
- Use uverbs_finalize_uobj_create() in JKEY_CREATE and uverbs_copy_to_struct_or_zero() in JOB_ADDR_QUERY (7)
- Drop IS_ERR() checks on mandatory handles (5, 7)
- Simplify the REG_MR optional attribute handling (11, 12)
- Reword the commit messages of patches 1 and 6
- Link to v1: https://patch.msgid.link/[email protected]
To: Jason Gunthorpe <[email protected]>
To: Leon Romanovsky <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
Eric Davis (13):
RDMA/core: widen the uverbs object key
RDMA/core: add the UET GID types
RDMA/core: report the reliable unconnected device capabilities RDMA/core: add the reliable unconnected queue pair type RDMA/core: extended address handle attributes RDMA/core: query the semantics a queue pair type guarantees RDMA/core: job and job key objects
RDMA/uverbs: factor out the queue pair attribute copy RDMA/core: create a queue pair ready to send RDMA/core: queue pair attributes for unconnected transports RDMA/core: extended memory registration
RDMA/core: 64-bit memory keys
RDMA/core: attach a memory region to a queue pair
drivers/infiniband/core/Makefile | 3 +- drivers/infiniband/core/cache.c | 12 +- drivers/infiniband/core/cma.c | 4 + drivers/infiniband/core/device.c | 16 +- drivers/infiniband/core/nldev.c | 4 + drivers/infiniband/core/rdma_core.h | 2 + drivers/infiniband/core/restrack.c | 17 +- drivers/infiniband/core/roce_gid_mgmt.c | 6 +- drivers/infiniband/core/user_mad.c | 4 +- drivers/infiniband/core/uverbs.h | 15 + drivers/infiniband/core/uverbs_cmd.c | 275 ++++++---- drivers/infiniband/core/uverbs_std_types.c | 70 ++- drivers/infiniband/core/uverbs_std_types_device.c | 73 ++- drivers/infiniband/core/uverbs_std_types_job.c | 628 ++++++++++++++++++++++ drivers/infiniband/core/uverbs_std_types_mr.c | 218 +++++++- drivers/infiniband/core/uverbs_std_types_qp.c | 340 +++++++++++- drivers/infiniband/core/uverbs_uapi.c | 2 + drivers/infiniband/core/verbs.c | 108 +++- include/rdma/ib_verbs.h | 239 +++++++- include/rdma/restrack.h | 8 + include/rdma/uverbs_ioctl.h | 4 +- include/uapi/rdma/ib_user_ioctl_cmds.h | 115 ++++ include/uapi/rdma/ib_user_ioctl_verbs.h | 100 ++++ include/uapi/rdma/ib_user_verbs.h | 25 + 24 files changed, 2126 insertions(+), 162 deletions(-)
---
base-commit: 9dd8b9a337af844291edcd9139c927d0f7958dbe
change-id: 20260929-uet-ib-core-d82e941f5e52
Best regards,
Signature · 1 line
Eric Davis <[email protected]>
PATCH v2 1/13 RDMA/core: widen the uverbs object key
Three more core objects would leave drivers nine object keys, and mlx5 alone uses ten. Add a bit to the object key.
--- include/rdma/uverbs_ioctl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/rdma/uverbs_ioctl.h +1 -1
@@ -144,7 +144,7 @@ enum uapi_radix_data { UVERBS_API_METHOD_KEY_BITS + UVERBS_API_METHOD_KEY_SHIFT - 1, UVERBS_API_METHOD_KEY_SHIFT), -UVERBS_API_OBJ_KEY_BITS =5 , +UVERBS_API_OBJ_KEY_BITS =6 ,UVERBS_API_OBJ_KEY_SHIFT =UVERBS_API_METHOD_KEY_BITS +UVERBS_API_METHOD_KEY_SHIFT , UVERBS_API_OBJ_KEY_NUM_CORE = 20,
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 01/13] RDMA/core: widen the uverbs object key
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
From: Eric Davis <[email protected]>
Three more core objects would leave drivers nine object keys, and mlx5 alone uses ten. Add a bit to the object key.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/13 RDMA/core: add the UET GID types
In reply to Eric DavisUltra Ethernet runs over two encapsulations: UDP and IP. Each becomes a new GID type. A port can then hold both UET and RoCE GIDs, with the transport following from the GID a queue pair is given, the driver enforces that.
These UET ports build their GID table from a netdev, as RoCE does. Added rdma_port_gids_from_netdev() and use it where the code tested for RoCE alone.
--- drivers/infiniband/core/cache.c | 12 +++++---- drivers/infiniband/core/cma.c | 4 +++ drivers/infiniband/core/device.c | 2 +- drivers/infiniband/core/nldev.c | 2 ++ drivers/infiniband/core/roce_gid_mgmt.c | 6 +++-- drivers/infiniband/core/verbs.c | 4 +++ include/rdma/ib_verbs.h | 48 ++++++++++++++++++++++++++++++--- include/uapi/rdma/ib_user_ioctl_verbs.h | 2 ++ 8 files changed, 69 insertions(+), 11 deletions(-)
drivers/infiniband/core/cache.c +7 -5
@@ -139,6 +139,8 @@ static const char * const gid_type_str[] = { [IB_GID_TYPE_IB] = "IB/RoCE v1", [IB_GID_TYPE_ROCE] = "IB/RoCE v1", [IB_GID_TYPE_ROCE_UDP_ENCAP] = "RoCE v2", + [IB_GID_TYPE_UET_UDP] = "UET UDP", + [IB_GID_TYPE_UET_IP] = "UET IP", };const char *ib_cache_gid_type_str (enum ib_gid_type gid_type)
@@ -392,10 +394,10 @@ static void del_gid(struct ib_device *ib_dev, u32 port,write_lock_irq (&table->rwlock); entry = table->data_vec[ix]; entry->state =GID_TABLE_ENTRY_PENDING_DEL ; -/* -* For non RoCE protocol, GID entry slot is ready to use. +/* Where the GID table is not derived from a netdev, the entry slot is +* ready to use. */ -if (!rdma_protocol_roce (ib_dev, port)) +if (!rdma_port_gids_from_netdev (ib_dev, port)) table->data_vec[ix] =NULL ;write_unlock_irq (&table->rwlock);
@@ -447,7 +449,7 @@ static int add_modify_gid(struct ib_gid_table *table,if (!entry)return -ENOMEM ; -if (rdma_protocol_roce (attr->device, attr->port_num)) { +if (rdma_port_gids_from_netdev (attr->device, attr->port_num)) { ret =add_roce_gid (entry);if (ret) goto done;
@@ -1459,7 +1461,7 @@ ib_cache_update(struct ib_device *device, u32 port, bool update_gids, goto err; } -if (!rdma_protocol_roce (device, port) && update_gids) { +if (!rdma_port_gids_from_netdev (device, port) && update_gids) { ret =config_non_roce_gid_cache (device, port, tprops);if (ret)
drivers/infiniband/core/cma.c +4 -0
@@ -293,6 +293,10 @@ int cma_set_default_gid_type(struct cma_device *cma_dev,if (!rdma_is_port_valid (cma_dev->device, port))return -EINVAL ; +if (default_gid_type ==IB_GID_TYPE_UET_UDP || + default_gid_type ==IB_GID_TYPE_UET_IP ) +return -EINVAL ; +if (default_gid_type ==IB_GID_TYPE_IB &&rdma_protocol_roce_eth_encap (cma_dev->device, port)) default_gid_type =IB_GID_TYPE_ROCE ;
drivers/infiniband/core/device.c +1 -1
@@ -2567,7 +2567,7 @@ void ib_enum_roce_netdev(struct ib_device *ib_dev,u32 port; rdma_for_each_port (ib_dev, port) -if (rdma_protocol_roce (ib_dev, port)) { +if (rdma_port_gids_from_netdev (ib_dev, port)) {struct net_device *idev =ib_device_get_netdev (ib_dev, port);
drivers/infiniband/core/nldev.c +2 -0
@@ -350,6 +350,8 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device) ret =nla_put_string (msg,RDMA_NLDEV_ATTR_DEV_PROTOCOL ,"iw" ); else if (rdma_protocol_roce(device, port)) ret =nla_put_string (msg,RDMA_NLDEV_ATTR_DEV_PROTOCOL ,"roce" ); + else if (rdma_protocol_uet(device, port)) + ret =nla_put_string (msg,RDMA_NLDEV_ATTR_DEV_PROTOCOL ,"uet" ); else if (rdma_protocol_usnic(device, port)) ret =nla_put_string (msg,RDMA_NLDEV_ATTR_DEV_PROTOCOL ,"usnic" );
drivers/infiniband/core/roce_gid_mgmt.c +4 -2
@@ -75,6 +75,8 @@ static const struct { } PORT_CAP_TO_GID_TYPE[] = { {rdma_protocol_roce_eth_encap, IB_GID_TYPE_ROCE}, {rdma_protocol_roce_udp_encap, IB_GID_TYPE_ROCE_UDP_ENCAP}, + {rdma_protocol_uet_udp, IB_GID_TYPE_UET_UDP}, + {rdma_protocol_uet_ip, IB_GID_TYPE_UET_IP}, }; #define CAP_TO_GID_TABLE_SIZE ARRAY_SIZE(PORT_CAP_TO_GID_TYPE)
@@ -84,7 +86,7 @@ unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u32 port)int i;unsigned int ret_flags =0 ; -if (!rdma_protocol_roce (ib_dev, port)) +if (!rdma_port_gids_from_netdev (ib_dev, port))return 1UL <<IB_GID_TYPE_IB ;for (i =0 ; i <CAP_TO_GID_TABLE_SIZE ; i++)
@@ -526,7 +528,7 @@ void rdma_roce_rescan_port(struct ib_device *ib_dev, u32 port) {struct net_device *ndev =NULL ; -if (rdma_protocol_roce (ib_dev, port)) { +if (rdma_port_gids_from_netdev (ib_dev, port)) { ndev =ib_device_get_netdev (ib_dev, port);if (!ndev)return ;
drivers/infiniband/core/verbs.c +4 -0
@@ -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 ; +memset (ah_attr,0 ,sizeof *ah_attr); ah_attr->type =rdma_ah_find_type (device, port_num);if (rdma_cap_eth_ah (device, port_num)) {
include/rdma/ib_verbs.h +45 -3
87 lines not on this page · raw message
include/uapi/rdma/ib_user_ioctl_verbs.h +2 -0
@@ -263,6 +263,8 @@ enum ib_uverbs_gid_type {IB_UVERBS_GID_TYPE_IB ,IB_UVERBS_GID_TYPE_ROCE_V1 ,IB_UVERBS_GID_TYPE_ROCE_V2 , +IB_UVERBS_GID_TYPE_UET_UDP , + IB_UVERBS_GID_TYPE_UET_IP, }; struct ib_uverbs_gid_entry {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 02/13] RDMA/core: add the UET GID types
Sashiko has reviewed this patch and found no issues.
Quoted 7 lines
From: Eric Davis <[email protected]>
Ultra Ethernet runs over two encapsulations: UDP and IP. Each becomes a new GID type. A port can then hold both UET and RoCE GIDs, with the transport following from the GID a queue pair is given, the driver enforces that.
Quoted 5 lines
These UET ports build their GID table from a netdev, as RoCE does. Added
rdma_port_gids_from_netdev()and use it where the code tested for RoCE alone.Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v2 3/13 RDMA/core: report the reliable unconnected device capabilities
In reply to Eric DavisAdd the capability bits a device uses to advertise reliable unconnected support alongside additional features. The transport itself, 64-bit immediate data, 64-bit memory keys, caller-chosen keys, and the four memory region access restrictions.
Report the job, job key, and address table limits through the extended query_device response so userspace can size against them.
--- drivers/infiniband/core/uverbs_cmd.c | 3 +++ include/rdma/ib_verbs.h | 14 ++++++++++++++ include/uapi/rdma/ib_user_verbs.h | 25 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+)
drivers/infiniband/core/uverbs_cmd.c +3 -0
@@ -3597,6 +3597,9 @@ static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs) resp.cq_moderation_caps.max_cq_moderation_period = attr.cq_caps.max_cq_moderation_period; resp.max_dm_size = attr.max_dm_size; + resp.max_job_ids = attr.max_job_ids; + resp.max_job_keys = attr.max_job_keys; + resp.max_addr_entries = attr.max_addr_entries; resp.response_length =uverbs_response_length (attrs,sizeof (resp));return uverbs_response (attrs, &resp,sizeof (resp));
include/rdma/ib_verbs.h +14 -0
@@ -278,6 +278,14 @@ enum ib_device_cap_flags {IB_DEVICE_FLUSH_PERSISTENT =IB_UVERBS_DEVICE_FLUSH_PERSISTENT ,IB_DEVICE_ATOMIC_WRITE =IB_UVERBS_DEVICE_ATOMIC_WRITE ,IB_DEVICE_CC_DMA_BOUNCE =IB_UVERBS_DEVICE_CC_DMA_BOUNCE , +IB_DEVICE_RU =IB_UVERBS_DEVICE_RU , +IB_DEVICE_IMM64 =IB_UVERBS_DEVICE_IMM64 , +IB_DEVICE_KEY64 =IB_UVERBS_DEVICE_KEY64 , +IB_DEVICE_USER_RKEY =IB_UVERBS_DEVICE_USER_RKEY , +IB_DEVICE_MR_UNRESTRICTED =IB_UVERBS_DEVICE_MR_UNRESTRICTED , +IB_DEVICE_MR_JOB_RESTRICTED =IB_UVERBS_DEVICE_MR_JOB_RESTRICTED , +IB_DEVICE_MR_QP_RESTRICTED =IB_UVERBS_DEVICE_MR_QP_RESTRICTED , + IB_DEVICE_MR_QP_JOB_RESTRICTED = IB_UVERBS_DEVICE_MR_QP_JOB_RESTRICTED, }; enum ib_kernel_cap_flags {
@@ -456,6 +464,12 @@ struct ib_device_attr {u64 max_dm_size;/* Max entries for sgl for optimized performance per READ */ u32 max_sgl_rd; +/* Jobs allocated at once, not the largest JobID */ +u32 max_job_ids; +/* Job keys allocated at once */ +u32 max_job_keys; +/* Largest address table a single job may have */ +u32 max_addr_entries; };enum ib_mtu {
include/uapi/rdma/ib_user_verbs.h +25 -0
@@ -300,6 +300,10 @@ struct ib_uverbs_ex_query_device_resp {__aligned_u64 max_dm_size;__u32 xrc_odp_caps;__u32 reserved; +__u32 max_job_ids;/* jobs allocated at once, not a JobID */ +__u32 max_job_keys;/* job keys allocated at once */ +__u32 max_addr_entries;/* largest address table of one job */ +__u32 reserved2; };struct ib_uverbs_query_port {
@@ -1370,6 +1374,27 @@ enum ib_uverbs_device_cap_flags {IB_UVERBS_DEVICE_ATOMIC_WRITE =1ULL <<40 ,/* CoCo guest with DMA bounce buffering required */ IB_UVERBS_DEVICE_CC_DMA_BOUNCE =1ULL <<41 , +/* Reliable unconnected QPs, jobs, job keys and address tables */ +IB_UVERBS_DEVICE_RU =1ULL <<42 , +/* 64-bit immediate data */ +IB_UVERBS_DEVICE_IMM64 =1ULL <<43 , +/* An MR may carry 64-bit keys as a second name beside its 32-bit ones */ +IB_UVERBS_DEVICE_KEY64 =1ULL <<44 , +/* MR registration with a caller-chosen rkey */ +IB_UVERBS_DEVICE_USER_RKEY =1ULL <<45 , +/* +* MR access restrictions, meaningful only with IB_UVERBS_DEVICE_RU. +* Each names what an incoming request must match, and each is its own +* match: supporting two does not imply their combination. +*/ +/* PD: any QP */ +IB_UVERBS_DEVICE_MR_UNRESTRICTED =1ULL <<46 , +/* PD and JobID: any QP, one job */ +IB_UVERBS_DEVICE_MR_JOB_RESTRICTED =1ULL <<47 , +/* PD and QP: the QP the MR is attached to */ +IB_UVERBS_DEVICE_MR_QP_RESTRICTED =1ULL <<48 , +/* PD, QP and JobID: the attached QP, one job */ + IB_UVERBS_DEVICE_MR_QP_JOB_RESTRICTED = 1ULL << 49, }; enum ib_uverbs_raw_packet_caps {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 03/13] RDMA/core: report the reliable unconnected device capabilities
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines
From: Eric Davis <[email protected]>
Add the capability bits a device uses to advertise reliable unconnected support alongside additional features. The transport itself, 64-bit immediate data, 64-bit memory keys, caller-chosen keys, and the four memory region access restrictions.
Report the job, job key, and address table limits through the extended
query_deviceresponse so userspace can size against them.Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
PATCH v2 4/13 RDMA/core: add the reliable unconnected queue pair type
In reply to Eric DavisAdd IB_QPT_RU and its userspace counterpart, together with the field layout of a reliable unconnected queue pair number used by UET.
Such a number uses all 32 bits, unlike the 24-bit InfiniBand and RoCE one, so exempt it from the restrack assertion that no queue pair number sets the top byte.
--- drivers/infiniband/core/restrack.c | 13 ++++++++++++- drivers/infiniband/core/uverbs_cmd.c | 14 ++++++++++++++ include/rdma/ib_verbs.h | 1 + include/uapi/rdma/ib_user_ioctl_verbs.h | 16 ++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-)
drivers/infiniband/core/restrack.c +12 -1
@@ -241,7 +241,18 @@ void rdma_restrack_add(struct rdma_restrack_entry *res)/* Special case to ensure that LQPN points to right QP */ struct ib_qp *qp = container_of(res, struct ib_qp, res); -WARN_ONCE (qp->qp_num >>24 || qp->port >>8 , +/* An InfiniBand/RoCE QP number is 24 bits and the top byte is +* where the port is folded in for SMI and GSI. A reliable +* unconnected pair is an exception as its QP number is a +* full 32b wide, though of the top byte only the absolute bit +* may be set. An absolute number whose low bits are 0 or 1 +* still conflicts SMI/GSI on port 128, which takes a device +* with both RU and MADs on that many ports. +*/ +WARN_ONCE (qp->port >>8 || + (qp->qp_type !=IB_QPT_RU && qp->qp_num >>24 ) || + (qp->qp_type ==IB_QPT_RU && + qp->qp_num &IB_UVERBS_QPN_UET_RESERVED_MASK ),"QP number 0x%0X and port 0x%0X" , qp->qp_num, qp->port); res->id = qp->qp_num;
drivers/infiniband/core/uverbs_cmd.c +14 -0
@@ -2058,6 +2058,12 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) goto out; } +/* reliable unconnected work requests are posted by the provider */ +if (qp->qp_type ==IB_QPT_RU ) { + ret = -EOPNOTSUPP ; + goto out_put; + } + is_ud = qp->qp_type ==IB_QPT_UD ; sg_ind =0 ; last =NULL ;
@@ -2335,6 +2341,14 @@ static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs) goto out; } +/* reliable unconnected work requests are posted by the provider */ +if (qp->qp_type ==IB_QPT_RU ) { +rdma_lookup_put_uobject (&qp->uobject->uevent.uobject, +UVERBS_LOOKUP_READ ); + ret = -EOPNOTSUPP ; + goto out; + } + resp.bad_wr =0 ; ret = qp->device->ops.post_recv (qp->real_qp, wr, &bad_wr);
include/rdma/ib_verbs.h +1 -0
@@ -1188,6 +1188,7 @@ enum ib_qp_type {IB_QPT_RAW_PACKET =IB_UVERBS_QPT_RAW_PACKET ,IB_QPT_XRC_INI =IB_UVERBS_QPT_XRC_INI ,IB_QPT_XRC_TGT =IB_UVERBS_QPT_XRC_TGT , +IB_QPT_RU =IB_UVERBS_QPT_RU ,IB_QPT_MAX , IB_QPT_DRIVER = IB_UVERBS_QPT_DRIVER,/* Reserve a range for qp types internal to the low level driver.
include/uapi/rdma/ib_user_ioctl_verbs.h +16 -0
@@ -91,6 +91,7 @@ enum ib_uverbs_qp_type {IB_UVERBS_QPT_RAW_PACKET =8 ,IB_UVERBS_QPT_XRC_INI ,IB_UVERBS_QPT_XRC_TGT , +IB_UVERBS_QPT_RU , IB_UVERBS_QPT_DRIVER = 0xFF, };
@@ -302,6 +303,21 @@ struct ib_uverbs_buffer_desc {__aligned_u64 length; }; +/* A UET reliable unconnected queue pair number uses all 32 bits: +* +* [ absolute 1b | reserved 7b | resource index 12b | PIDonFEP 12b ] +* +* An absolute pair is named by its number alone. A relative one is named +* within a job, so it must carry a job key when it is created. The reserved +* bits are zero. +*/ +#define IB_UVERBS_QPN_UET_PID_ON_FEP_MASK 0x00000fff +#define IB_UVERBS_QPN_UET_PID_ON_FEP_SHIFT 0 +#define IB_UVERBS_QPN_UET_RI_MASK 0x00fff000 +#define IB_UVERBS_QPN_UET_RI_SHIFT 12 +#define IB_UVERBS_QPN_UET_RESERVED_MASK 0x7f000000 +#define IB_UVERBS_QPN_UET_ABSOLUTE_ADDR_BIT 0x80000000 +enum ib_uverbs_comp_cntr_entry {IB_UVERBS_COMP_CNTR_ENTRY_COMP ,IB_UVERBS_COMP_CNTR_ENTRY_ERR ,
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 04/13] RDMA/core: add the reliable unconnected queue pair type
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines
From: Eric Davis <[email protected]>
Add
IB_QPT_RUand its userspace counterpart, together with the field layout of a reliable unconnected queue pair number used by UET.Such a number uses all 32 bits, unlike the 24-bit InfiniBand and RoCE one, so exempt it from the restrack assertion that no queue pair number sets the top byte.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH v2 5/13 RDMA/core: extended address handle attributes
In reply to Eric DavisAn unconnected transport over UET resolves a peer by both its network address and its queue pair number. The write() create-AH command has no room for additional attributes. Add rdma_ah_attr_ex to carry new attributes, reach it through rdma_ah_init_attr, and add an ioctl method that supports it.
rdma_create_user_ah() now takes the init attributes rather than the address alone, so callers pass the wider set.
--- drivers/infiniband/core/user_mad.c | 4 +- drivers/infiniband/core/uverbs.h | 3 ++ drivers/infiniband/core/uverbs_cmd.c | 60 +++++++++++++++---------- drivers/infiniband/core/uverbs_std_types.c | 70 +++++++++++++++++++++++++++++- drivers/infiniband/core/verbs.c | 43 ++++++++++-------- include/rdma/ib_verbs.h | 20 +++++++-- include/uapi/rdma/ib_user_ioctl_cmds.h | 7 +++ include/uapi/rdma/ib_user_ioctl_verbs.h | 9 ++++ 8 files changed, 169 insertions(+), 47 deletions(-)
drivers/infiniband/core/user_mad.c +3 -1
@@ -512,6 +512,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,struct ib_umad_packet *packet;struct ib_mad_agent *agent;struct rdma_ah_attr ah_attr; +struct rdma_ah_init_attr init_attr = {};struct ib_ah *ah;__be64 *tid;int ret, hdr_len, copy_offset, rmpp_active;
@@ -569,7 +570,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,rdma_ah_set_dgid_raw (&ah_attr, packet->mad.hdr.gid); } - ah =rdma_create_user_ah (agent->qp->pd, &ah_attr,NULL ); + init_attr.ah_attr = &ah_attr; + ah =rdma_create_user_ah (agent->qp->pd, &init_attr,NULL );if (IS_ERR (ah)) { ret =PTR_ERR (ah); goto err_up;
drivers/infiniband/core/uverbs.h +3 -0
@@ -236,6 +236,9 @@ int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,int uverbs_dealloc_mw (struct ib_mw *mw);void ib_uverbs_detach_umcast (struct ib_qp *qp,struct ib_uqp_object *uobj); +int copy_ah_attr_from_uverbs_ah (struct ib_device *dev, +struct rdma_ah_attr *rdma_attr, +const struct ib_uverbs_ah_attr *uverb_attr);struct bundle_alloc_head { struct_group_tagged(bundle_alloc_head_hdr, hdr,
drivers/infiniband/core/uverbs_cmd.c +37 -23
85 lines not on this page · raw message
drivers/infiniband/core/uverbs_std_types.c +69 -1
82 lines not on this page · raw message
drivers/infiniband/core/verbs.c +25 -18
102 lines not on this page · raw message
include/rdma/ib_verbs.h +16 -4
@@ -974,10 +974,14 @@ struct ib_mr_status {*/ __attribute_const__ enum ib_rate mult_to_ib_rate(int mult); +struct rdma_ah_attr_ex ; +struct rdma_ah_init_attr {struct rdma_ah_attr *ah_attr;u32 flags;struct net_device *xmit_slave; +/* set to name a peer by both transport+network addresses */ +struct rdma_ah_attr_ex *ah_attr_ex; };enum rdma_ah_attr_type {
@@ -1016,6 +1020,11 @@ struct rdma_ah_attr { }; }; +struct rdma_ah_attr_ex { +struct rdma_ah_attr ah_attr; +u32 remote_qpn; +}; +enum ib_wc_status {IB_WC_SUCCESS ,IB_WC_LOC_LEN_ERR ,
@@ -3893,16 +3902,18 @@ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr,* rdma_create_user_ah - Creates an address handle for the given address vector. * It resolves destination mac address for ah attribute of RoCE type. * @pd: The protection domain associated with the address handle. -* @ah_attr: The attributes of the address vector. +* @init_attr: The address vector, and for an extended handle the +* attributes beyond it. * @udata: pointer to user's input output buffer information need by * provider driver. * -* It returns 0 on success and returns appropriate error code on error. * The address handle is used to reference a local or global destination * in all UD QP post sends. +* +* Return: the address handle, or an ERR_PTR on error. */ struct ib_ah *rdma_create_user_ah (struct ib_pd *pd, -struct rdma_ah_attr *ah_attr, +struct rdma_ah_init_attr *init_attr,struct ib_udata *udata);/** * ib_get_gids_from_rdma_hdr - Get sgid and dgid from GRH or IPv4 header
@@ -4981,7 +4992,8 @@ static inline struct ib_global_routereturn &attr->grh; } -static inline void rdma_ah_set_dgid_raw (struct rdma_ah_attr *attr,void *dgid) +static inline void rdma_ah_set_dgid_raw (struct rdma_ah_attr *attr, +const void *dgid) {struct ib_global_route *grh =rdma_ah_retrieve_grh (attr);
include/uapi/rdma/ib_user_ioctl_cmds.h +7 -0
@@ -410,6 +410,13 @@ enum uverbs_attrs_xrcd_destroy_ids {enum uverbs_methods_ah {UVERBS_METHOD_AH_DESTROY , +UVERBS_METHOD_AH_EX_CREATE , +}; + +enum uverbs_attrs_create_ah_ex_cmd_attr_ids { +UVERBS_ATTR_CREATE_AH_EX_HANDLE , +UVERBS_ATTR_CREATE_AH_EX_PD_HANDLE , +UVERBS_ATTR_CREATE_AH_EX_AH_ATTR_EX , };enum uverbs_attrs_ah_destroy_ids {
include/uapi/rdma/ib_user_ioctl_verbs.h +9 -0
@@ -318,6 +318,15 @@ struct ib_uverbs_buffer_desc {#define IB_UVERBS_QPN_UET_RESERVED_MASK 0x7f000000#define IB_UVERBS_QPN_UET_ABSOLUTE_ADDR_BIT 0x80000000 +/* An address handle that names a peer using both transport+network addresses. +* Used for reliable unconnected QPs in both work request address handles and +* a Job address table. +*/ +struct ib_uverbs_ah_attr_ex { +struct ib_uverbs_ah_attr ah_attr; +__u32 remote_qpn; +}; +enum ib_uverbs_comp_cntr_entry {IB_UVERBS_COMP_CNTR_ENTRY_COMP ,IB_UVERBS_COMP_CNTR_ENTRY_ERR ,
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 05/13] RDMA/core: extended address handle attributes
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] RDMA/uverbs: missing uverbs_finalize_uobj_create() in AH_EX_CREATE handler --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] RDMA/uverbs: missing uverbs_finalize_uobj_create() in AH_EX_CREATE handler --
commit 4cd859f734837412850e0706a926ea891c66f8a6
Author: Eric Davis <[email protected]>
RDMA/core: extended address handle attributes
This commit introduces struct rdma_ah_attr_ex to carry extended address handle attributes such as remote_qpn for UET transports, updates rdma_create_user_ah() to accept struct rdma_ah_init_attr, and adds the UVERBS_METHOD_AH_EX_CREATE ioctl method.
Quoted 18 lines
drivers/infiniband/core/uverbs_std_types.c +10
-0@@ -184,6 +184,73 @@ DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MW,UVERBS_TYPE_ALLOC_IDR (uverbs_free_mw), &UVERBS_METHOD(UVERBS_METHOD_MW_DESTROY)); +/* Creating an address handle is still a write() command whose request +* struct cannot grow. A transport (reliable unconnected) that resolves a +* peer using both transport and network addresses requires additional +* fields in the address handle. Here the address handle create command is +* made available as an ioctl method, where additional attributes can be +* carried. +*/ +static int UVERBS_HANDLER (UVERBS_METHOD_AH_EX_CREATE )( +struct uverbs_attr_bundle *attrs) +{
[ ... ]
drivers/infiniband/core/uverbs_std_types.c DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_MW, · line 236
Quoted 9 lines
drivers/infiniband/core/uverbs_std_types.c +9
-0+ ah =rdma_create_user_ah (pd, &init_attr, &attrs->driver_udata); +if (IS_ERR (ah)) +return PTR_ERR (ah); + + ah->uobject = uobj; + uobj->object = ah; + +return 0 ; +}
[Severity: High]
Should UVERBS_HANDLER(UVERBS_METHOD_AH_EX_CREATE) call uverbs_finalize_uobj_create(attrs, UVERBS_ATTR_CREATE_AH_EX_HANDLE) before returning 0?
Because UVERBS_METHOD_AH_EX_CREATE includes UVERBS_ATTR_UHW(), ib_uverbs_run_method() can call uverbs_set_output() for UVERBS_ATTR_UHW_OUT after the handler succeeds:
drivers/infiniband/core/uverbs_ioctl.c:ib_uverbs_run_method() {
ret = handler(bundle);
if (ret)
return ret;
if (!ret && bundle->method_elm->has_udata) {
const struct uverbs_attr *attr =
uverbs_attr_get(bundle, UVERBS_ATTR_UHW_OUT);
if (!IS_ERR(attr))
ret = uverbs_set_output(bundle, attr);
}
}If uverbs_set_output() fails with -EFAULT, ib_uverbs_cmd_verbs() aborts the command via bundle_destroy(pbundle, false) -> uverbs_finalize_object() -> rdma_alloc_abort_uobject():
drivers/infiniband/core/rdma_core.c:rdma_alloc_abort_uobject() {
if (hw_obj_valid) {
uverbs_get_cleared_udata(attrs);
ret = uobj->uapi_object->type_class->destroy_hw(
uobj, RDMA_REMOVE_ABORT, attrs);
...
}
}Without uverbs_finalize_uobj_create() setting the bit in pbundle->uobj_hw_obj_valid, hw_obj_valid is false on abort, so destroy_hw (uverbs_free_ah() -> rdma_destroy_ah_user()) is skipped. Does this leak the newly created struct ib_ah, its ah->sgid_attr reference, and its pd->usecnt reference?
[ ... ]
Quoted 15 lines
drivers/infiniband/core/uverbs_std_types.c +15
-0+DECLARE_UVERBS_NAMED_METHOD ( +UVERBS_METHOD_AH_EX_CREATE , +UVERBS_ATTR_IDR (UVERBS_ATTR_CREATE_AH_EX_HANDLE , +UVERBS_OBJECT_AH , +UVERBS_ACCESS_NEW , +UA_MANDATORY ), +UVERBS_ATTR_IDR (UVERBS_ATTR_CREATE_AH_EX_PD_HANDLE , +UVERBS_OBJECT_PD , +UVERBS_ACCESS_READ , +UA_MANDATORY ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_CREATE_AH_EX_AH_ATTR_EX , + UVERBS_ATTR_STRUCT(struct ib_uverbs_ah_attr_ex, + remote_qpn), +UA_MANDATORY ), +UVERBS_ATTR_UHW ());
[ ... ]
Quoted 3 lines
Signature · 1 line
2.51.2
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH rdma-next v2 05/13] RDMA/core: extended address handle attributes
Quoted 3 lines · On Tue, Oct 20, 2026 at 1:40 AM <[email protected]> wrote:
Should
UVERBS_HANDLER(UVERBS_METHOD_AH_EX_CREATE)calluverbs_finalize_uobj_create(attrs, UVERBS_ATTR_CREATE_AH_EX_HANDLE)before returning 0?
Yes, agreed. The method declares UVERBS_ATTR_UHW(), so the UHW_OUT write after the handler can fail and the abort then skips uverbs_free_ah(). v3 will call uverbs_finalize_uobj_create() once the AH is set up.
Quoted 2 lines
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Thanks,
- eric
PATCH v2 6/13 RDMA/core: query the semantics a queue pair type guarantees
In reply to Eric DavisAn unconnected transport orders far less than a connected one, and how much varies by device. Add a device method that reports, for a queue pair type, which operations it orders against which, the largest packet it puts on the wire, and how wide an immediate it carries.
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/uverbs_std_types_device.c | 73 ++++++++++++++++++++++- include/rdma/ib_verbs.h | 15 +++++ include/uapi/rdma/ib_user_ioctl_cmds.h | 6 ++ include/uapi/rdma/ib_user_ioctl_verbs.h | 63 +++++++++++++++++++ 5 files changed, 157 insertions(+), 1 deletion(-)
drivers/infiniband/core/device.c +1 -0
@@ -3011,6 +3011,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, query_port);SET_DEVICE_OP (dev_ops, query_port_speed);SET_DEVICE_OP (dev_ops, query_qp); +SET_DEVICE_OP (dev_ops, query_qp_semantics);SET_DEVICE_OP (dev_ops, query_srq);SET_DEVICE_OP (dev_ops, query_ucontext);SET_DEVICE_OP (dev_ops, rdma_netdev_get_params);
drivers/infiniband/core/uverbs_std_types_device.c +72 -1
85 lines not on this page · raw message
include/rdma/ib_verbs.h +15 -0
@@ -2496,6 +2496,18 @@ struct ib_counters {atomic_t usecnt; }; +/* what a queue pair of a given type guarantees (query_qp_semantics) */ +struct ib_qp_semantics { +u32 comp_mask;/* enum ib_uverbs_qp_semantics_mask */ +u32 msg_order;/* enum ib_uverbs_qp_msg_order */ +u32 max_rdma_raw_size; +u32 max_rdma_war_size; +u32 max_rdma_waw_size; +u32 max_pdu; +u32 usage_flags;/* enum ib_uverbs_qp_usage_flags */ +u8 imm_data_size;/* bits */ +}; +struct ib_counters_read_attr {u64 *counters_buff;u32 ncounters;
@@ -2751,6 +2763,9 @@ struct ib_device_ops { int mr_access_flags, struct ib_pd *pd, struct ib_udata *udata);int (*dereg_mr)(struct ib_mr *mr,struct ib_udata *udata); +int (*query_qp_semantics)(struct ib_device *device, +enum ib_qp_type qp_type, +struct ib_qp_semantics *sem);struct ib_mr *(*alloc_mr)(struct ib_pd *pd,enum ib_mr_type mr_type,u32 max_num_sg); struct ib_mr *(*alloc_mr_integrity)(struct ib_pd *pd,
include/uapi/rdma/ib_user_ioctl_cmds.h +6 -0
@@ -77,6 +77,12 @@ enum uverbs_methods_device {UVERBS_METHOD_QUERY_GID_ENTRY ,UVERBS_METHOD_QUERY_PORT_SPEED ,UVERBS_METHOD_QUERY_COMP_CNTR_CAPS , + UVERBS_METHOD_QUERY_QP_SEMANTICS, +}; + +enum uverbs_attrs_query_qp_semantics_attr_ids { +UVERBS_ATTR_QUERY_QP_SEMANTICS_QP_TYPE , +UVERBS_ATTR_QUERY_QP_SEMANTICS_RESP , }; enum uverbs_attrs_invoke_write_cmd_attr_ids {
include/uapi/rdma/ib_user_ioctl_verbs.h +63 -0
75 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 06/13] RDMA/core: query the semantics a queue pair type guarantees
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
From: Eric Davis <[email protected]>
An unconnected transport orders far less than a connected one, and how much varies by device. Add a device method that reports, for a queue pair type, which operations it orders against which, the largest packet it puts on the wire, and how wide an immediate it carries.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
PATCH v2 7/13 RDMA/core: job and job key objects
In reply to Eric DavisAn unconnected transport demultiplexes incoming traffic on a JobID rather than on a connection. Add two objects for it: a job, which owns that ID and a table of peer addresses, and a job key, which ties a job to a protection domain and authorizes a queue pair to act within it.
A job can be exported to a file descriptor and imported elsewhere, so an unprivileged process can join a job that was set up for it.
--- drivers/infiniband/core/Makefile | 3 +- drivers/infiniband/core/device.c | 10 + drivers/infiniband/core/nldev.c | 2 + drivers/infiniband/core/rdma_core.h | 2 + drivers/infiniband/core/restrack.c | 4 + drivers/infiniband/core/uverbs.h | 6 + drivers/infiniband/core/uverbs_std_types_job.c | 628 +++++++++++++++++++++++++ drivers/infiniband/core/uverbs_uapi.c | 2 + drivers/infiniband/core/verbs.c | 37 ++ include/rdma/ib_verbs.h | 67 +++ include/rdma/restrack.h | 8 + include/rdma/uverbs_ioctl.h | 2 +- include/uapi/rdma/ib_user_ioctl_cmds.h | 77 +++ 13 files changed, 846 insertions(+), 2 deletions(-)
drivers/infiniband/core/Makefile +2 -1
@@ -47,7 +47,8 @@ ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o \ uverbs_std_types_async_fd.o \ uverbs_std_types_srq.o \ uverbs_std_types_wq.o \ - uverbs_std_types_qp.o + uverbs_std_types_qp.o \ + uverbs_std_types_job.o ib_uverbs_support-y := rdma_core.o \ ucaps.o \
drivers/infiniband/core/device.c +10 -0
@@ -2915,6 +2915,14 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, counter_unbind_qp);SET_DEVICE_OP (dev_ops, counter_update_stats);SET_DEVICE_OP (dev_ops, create_ah); +SET_DEVICE_OP (dev_ops, alloc_job); +SET_DEVICE_OP (dev_ops, dealloc_job); +SET_DEVICE_OP (dev_ops, query_job); +SET_DEVICE_OP (dev_ops, job_addr_insert); +SET_DEVICE_OP (dev_ops, job_addr_remove); +SET_DEVICE_OP (dev_ops, job_addr_query); +SET_DEVICE_OP (dev_ops, create_jkey); +SET_DEVICE_OP (dev_ops, destroy_jkey);SET_DEVICE_OP (dev_ops, create_counters);SET_DEVICE_OP (dev_ops, create_cq);SET_DEVICE_OP (dev_ops, create_comp_cntr);
@@ -3031,6 +3039,8 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_OBJ_SIZE (dev_ops, ib_ah);SET_OBJ_SIZE (dev_ops, ib_counters); +SET_OBJ_SIZE (dev_ops, ib_job); +SET_OBJ_SIZE (dev_ops, ib_jkey);SET_OBJ_SIZE (dev_ops, ib_cq);SET_OBJ_SIZE (dev_ops, ib_comp_cntr);SET_OBJ_SIZE (dev_ops, ib_dmah);
drivers/infiniband/core/nldev.c +2 -0
@@ -454,6 +454,8 @@ static int fill_res_info(struct sk_buff *msg, struct ib_device *device, [RDMA_RESTRACK_CTX] = "ctx", [RDMA_RESTRACK_SRQ] = "srq", [RDMA_RESTRACK_COMP_CNTR] = "comp_cntr", + [RDMA_RESTRACK_JOB] = "job", + [RDMA_RESTRACK_JKEY] = "jkey", };struct ib_comp_cntr_caps comp_cntr_caps = {};
drivers/infiniband/core/rdma_core.h +2 -0
@@ -164,6 +164,8 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile);extern const struct uapi_definition uverbs_def_obj_async_fd[];extern const struct uapi_definition uverbs_def_obj_counters[]; +extern const struct uapi_definition uverbs_def_obj_job[]; +extern const struct uapi_definition uverbs_def_obj_jkey[];extern const struct uapi_definition uverbs_def_obj_comp_cntr[];extern const struct uapi_definition uverbs_def_obj_cq[];extern const struct uapi_definition uverbs_def_obj_device[];
drivers/infiniband/core/restrack.c +4 -0
@@ -106,6 +106,10 @@ static struct ib_device *res_to_dev(struct rdma_restrack_entry *res) return container_of(res, struct ib_dmah, res)->device;case RDMA_RESTRACK_COMP_CNTR : return container_of(res, struct ib_comp_cntr, res)->device; +case RDMA_RESTRACK_JOB : + return container_of(res, struct ib_job, res)->device; +case RDMA_RESTRACK_JKEY : + return container_of(res, struct ib_jkey, res)->device;default :WARN_ONCE (true,"Wrong resource tracking type %u\n" , res->type);return NULL ;
drivers/infiniband/core/uverbs.h +6 -0
@@ -183,6 +183,12 @@ struct ib_uxrcd_object {atomic_t refcnt; }; +struct ib_ujob_object { +struct ib_uobject uobject; +/* job keys created through this handle */ +atomic_t refcnt; +}; +struct ib_usrq_object {struct ib_uevent_object uevent;struct ib_uxrcd_object *uxrcd;
drivers/infiniband/core/uverbs_std_types_job.c new file +628 -0
628 lines not on this page · raw message
drivers/infiniband/core/uverbs_uapi.c +2 -0
@@ -636,6 +636,8 @@ static const struct uapi_definition uverbs_core_api[] = {UAPI_DEF_CHAIN (uverbs_def_obj_dmah),UAPI_DEF_CHAIN (uverbs_def_obj_flow_action),UAPI_DEF_CHAIN (uverbs_def_obj_intf), +UAPI_DEF_CHAIN (uverbs_def_obj_job), +UAPI_DEF_CHAIN (uverbs_def_obj_jkey),UAPI_DEF_CHAIN (uverbs_def_obj_mr),UAPI_DEF_CHAIN (uverbs_def_obj_qp), UAPI_DEF_CHAIN(uverbs_def_obj_srq),
drivers/infiniband/core/verbs.c +37 -0
@@ -690,6 +690,43 @@ struct ib_ah *rdma_create_user_ah(struct ib_pd *pd, }EXPORT_SYMBOL (rdma_create_user_ah); +/** +* rdma_job_addr_insert - Insert a peer into a job's address table +* @job: The job. +* @index: The entry in the job's address table. +* @ah_attr: The peer's address and queue pair. +* +* The address is resolved as rdma_create_user_ah() resolves an address +* handle's: the source GID attribute is filled in, and for an Ethernet +* address so is the destination MAC. +* +* Return: 0 on success, or a negative errno. +*/ +int rdma_job_addr_insert (struct ib_job *job,u32 index, +struct rdma_ah_attr_ex *ah_attr) +{ +struct rdma_ah_attr *attr = &ah_attr->ah_attr; +const struct ib_gid_attr *old_sgid_attr; +int ret; + + ret =rdma_fill_sgid_attr (job->device, attr, &old_sgid_attr); +if (ret) +return ret; + +if (attr->type ==RDMA_AH_ATTR_TYPE_ROCE ) { + ret =ib_resolve_eth_dmac (job->device, attr); +if (ret) + goto out; + } + + ret = job->device->ops.job_addr_insert (job, index, ah_attr); + +out: +rdma_unfill_sgid_attr (attr, old_sgid_attr); +return ret; +} +EXPORT_SYMBOL (rdma_job_addr_insert); +int ib_get_rdma_header_version (const union rdma_network_hdr *hdr) {const struct iphdr *ip4h = (struct iphdr *)&hdr->roce4grh;
include/rdma/ib_verbs.h +67 -0
91 lines not on this page · raw message
include/rdma/restrack.h +8 -0
@@ -64,6 +64,14 @@ enum rdma_restrack_type {* @RDMA_RESTRACK_COMP_CNTR: Completion Counter */ RDMA_RESTRACK_COMP_CNTR , +/** +* @RDMA_RESTRACK_JOB: Transport job +*/ +RDMA_RESTRACK_JOB , +/** +* @RDMA_RESTRACK_JKEY: Job key +*/ + RDMA_RESTRACK_JKEY,/** * @RDMA_RESTRACK_MAX: Last entry, used for array dclarations */
include/rdma/uverbs_ioctl.h +1 -1
@@ -147,7 +147,7 @@ enum uapi_radix_data {UVERBS_API_OBJ_KEY_BITS =6 ,UVERBS_API_OBJ_KEY_SHIFT =UVERBS_API_METHOD_KEY_BITS +UVERBS_API_METHOD_KEY_SHIFT , -UVERBS_API_OBJ_KEY_NUM_CORE =20 , +UVERBS_API_OBJ_KEY_NUM_CORE =23 ,UVERBS_API_OBJ_KEY_NUM_DRIVER = (1 <<UVERBS_API_OBJ_KEY_BITS ) -UVERBS_API_OBJ_KEY_NUM_CORE , UVERBS_API_OBJ_KEY_MASK = GENMASK(31, UVERBS_API_OBJ_KEY_SHIFT),
include/uapi/rdma/ib_user_ioctl_cmds.h +77 -0
87 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 07/13] RDMA/core: job and job key objects
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] RDMA/uverbs: missing uverbs_finalize_uobj_create() in job alloc and import --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] RDMA/uverbs: missing uverbs_finalize_uobj_create() in job alloc and import --
commit 5f0d9f9de261cb667b880d34e0c2d952d5a61944
Author: Eric Davis <[email protected]>
RDMA/core: job and job key objects
This commit introduces job and job key objects to RDMA core to support unconnected transports that demultiplex incoming traffic on a JobID. It also allows jobs to be exported to a file descriptor and imported into another context.
Quoted 5 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +0
-0
[ ... ]
Quoted 48 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +48
-0+static int UVERBS_HANDLER (UVERBS_METHOD_JOB_IMPORT )( +struct uverbs_attr_bundle *attrs) +{ +struct ib_uobject *uobj = +uverbs_attr_get_uobject (attrs,UVERBS_ATTR_IMPORT_JOB_HANDLE ); +struct ib_device *ib_dev = attrs->context->device; +struct ib_job *job; +int fd, ret; + + ret =uverbs_get_raw_fd (&fd, attrs,UVERBS_ATTR_IMPORT_JOB_FD ); +if (ret) +return ret; + + ret =ib_job_get_from_fd (fd, ib_dev, &job); +if (ret) +return ret; + + uobj->object = job; + +return 0 ; +} + +static int uverbs_free_job (struct ib_uobject *uobject, +enum rdma_remove_reason why, +struct uverbs_attr_bundle *attrs) +{ +struct ib_ujob_object *ujob = + container_of(uobject, struct ib_ujob_object, uobject); +struct ib_job *job = uobject->object; + +/* don't free if there are still references to this job */ +if (atomic_read (&ujob->refcnt)) +return -EBUSY ; + +kref_put (&job->ref, ib_job_release); + +return 0 ; +} + +static int UVERBS_HANDLER (UVERBS_METHOD_JOB_ALLOC )( +struct uverbs_attr_bundle *attrs) +{ +struct ib_uobject *uobj = +uverbs_attr_get_uobject (attrs,UVERBS_ATTR_ALLOC_JOB_HANDLE ); +struct ib_device *ib_dev = attrs->context->device; +struct ib_job_attr attr = {}; +struct ib_job *job; +int ret;
[ ... ]
Quoted 10 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +10
-0+ job =rdma_zalloc_drv_obj (ib_dev, ib_job); +if (!job) +return -ENOMEM ; + + job->device = ib_dev; + job->job_id = attr.job_id; + job->max_addr_entries = attr.max_addr_entries; +kref_init (&job->ref); + uobj->object = job; +
drivers/infiniband/core/uverbs_std_types_job.c line 229
Quoted 10 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +10
-0+rdma_restrack_new (&job->res,RDMA_RESTRACK_JOB ); +rdma_restrack_set_name (&job->res,NULL ); + + ret = ib_dev->ops.alloc_job (job, &attr, attrs); +if (ret) + goto err_free; + +rdma_restrack_add (&job->res); + +return 0 ;
[Severity: High]
Should UVERBS_HANDLER(UVERBS_METHOD_JOB_ALLOC) and UVERBS_HANDLER(UVERBS_METHOD_JOB_IMPORT) call uverbs_finalize_uobj_create() before returning 0?
UVERBS_METHOD_JOB_ALLOC declares UVERBS_ATTR_UHW(), which sets bundle->method_elm->has_udata = true. After the handler returns 0, ib_uverbs_run_method() updates UVERBS_ATTR_UHW_OUT when present:
drivers/infiniband/core/uverbs_ioctl.c:ib_uverbs_run_method() {
...
ret = handler(&pbundle->bundle);
if (!ret && bundle->method_elm->has_udata) {
const struct uverbs_attr *attr =
uverbs_attr_get(bundle, UVERBS_ATTR_UHW_OUT);
if (!IS_ERR(attr))
ret = uverbs_set_output(bundle, attr);
}
...
}If uverbs_set_output() fails with -EFAULT when writing to user_attrs, ib_uverbs_cmd_verbs() calls bundle_destroy(pbundle, false). Because uverbs_finalize_uobj_create() was not called to mark uobj_hw_obj_valid, uverbs_finalize_object() passes hw_obj_valid = false to rdma_alloc_abort_uobject():
drivers/infiniband/core/rdma_core.c:rdma_alloc_abort_uobject() {
...
if (hw_obj_valid) {
uverbs_get_cleared_udata(attrs);
ret = uobj->uapi_object->type_class->destroy_hw(
uobj, RDMA_REMOVE_ABORT, attrs);
...
}Without hw_obj_valid set, destroy_hw (uverbs_free_job()) is skipped on the abort path. Does this leak the struct ib_job allocation, the driver job resource from alloc_job(), and leave job->res in the RDMA_RESTRACK_JOB table?
[ ... ]
Quoted 9 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +9
-0+DECLARE_UVERBS_NAMED_METHOD( + UVERBS_METHOD_JOB_ALLOC, + UVERBS_ATTR_IDR(UVERBS_ATTR_ALLOC_JOB_HANDLE, + UVERBS_OBJECT_JOB, + UVERBS_ACCESS_NEW, + UA_MANDATORY), + UVERBS_ATTR_PTR_IN(UVERBS_ATTR_ALLOC_JOB_ID, + UVERBS_ATTR_TYPE(u32), + UA_MANDATORY),
drivers/infiniband/core/uverbs_std_types_job.c line 428
Quoted 10 lines
drivers/infiniband/core/uverbs_std_types_job.c new file +10
-0+UVERBS_ATTR_PTR_IN (UVERBS_ATTR_ALLOC_JOB_MAX_ADDR_ENTRIES , +UVERBS_ATTR_TYPE (u32), +UA_MANDATORY ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_ALLOC_JOB_PORT_NUM , +UVERBS_ATTR_TYPE (u32), +UA_OPTIONAL ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_ALLOC_JOB_SGID_INDEX , +UVERBS_ATTR_TYPE (u8), +UA_OPTIONAL ), + UVERBS_ATTR_UHW());
[ ... ]
完美结束,确保最后有一个空行。
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Re: [PATCH rdma-next v2 07/13] RDMA/core: job and job key objects
Quoted 3 lines · On Tue, Oct 20, 2026 at 2:00 AM <[email protected]> wrote:
Should
UVERBS_HANDLER(UVERBS_METHOD_JOB_ALLOC)andUVERBS_HANDLER(UVERBS_METHOD_JOB_IMPORT)calluverbs_finalize_uobj_create()before returning 0?
Agreed for JOB_ALLOC as it declares UVERBS_ATTR_UHW() and has the same abort path, so a failed UHW_OUT write leaks the job. Will be fixed in v3.
JOB_IMPORT has no UHW, and the new handle is copied out while the attributes are parsed (before the handler runs), so nothing after it can fail. v3 will add the call there, so that every handler in the file that creates an object follows the same rule.
Quoted 2 lines
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Thanks,
- eric
PATCH v2 8/13 RDMA/uverbs: factor out the queue pair attribute copy
In reply to Eric Davismodify_qp() validates a set of attributes that came from userspace and copies the ones its mask names into their kernel form. Queue pair creation needs the same work for a transport that is ready to send as soon as the pair exists, so move it into ib_uverbs_copy_qp_attr().
No functional change.
--- drivers/infiniband/core/uverbs.h | 6 ++ drivers/infiniband/core/uverbs_cmd.c | 191 ++++++++++++++++++----------------- 2 files changed, 105 insertions(+), 92 deletions(-)
drivers/infiniband/core/uverbs.h +6 -0
@@ -319,6 +319,12 @@ struct ib_uverbs_flow_spec { }; }; +int ib_uverbs_copy_qp_attr (struct uverbs_attr_bundle *attrs, +struct ib_device *device, +struct ib_qp_attr *attr, +const struct ib_uverbs_ex_modify_qp *src, +u32 mask); + int ib_uverbs_kern_spec_to_ib_spec_filter(enum ib_flow_spec_type type, const void *kern_spec_mask, const void *kern_spec_val,
drivers/infiniband/core/uverbs_cmd.c +99 -92
223 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 08/13] RDMA/uverbs: factor out the queue pair attribute copy
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines
From: Eric Davis <[email protected]>
modify_qp()validates a set of attributes that came from userspace and copies the ones its mask names into their kernel form. Queue pair creation needs the same work for a transport that is ready to send as soon as the pair exists, so move it intoib_uverbs_copy_qp_attr().No functional change.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
PATCH v2 9/13 RDMA/core: create a queue pair ready to send
In reply to Eric DavisSome transports have nothing to negotiate, so a queue pair can be ready to send the moment it exists and the modify sequence carries no useful information. Let a reliable unconnected queue pair be created with the attributes that sequence would have supplied, in the same form the modify command uses, and apply them as that modify to RTS once the queue pair exists, so its checks run. A queue pair whose modify fails is destroyed.
Note that the QP handle field is refused, since the create is what makes the handle.
--- drivers/infiniband/core/uverbs_std_types_qp.c | 80 +++++++++++++++++++++++++++ include/uapi/rdma/ib_user_ioctl_cmds.h | 1 + 2 files changed, 81 insertions(+)
drivers/infiniband/core/uverbs_std_types_qp.c +80 -0
@@ -79,6 +79,61 @@ static void set_caps(struct ib_qp_init_attr *attr, } } +/* what a reliable unconnected QP may be created ready to send with */ +#define CREATE_QP_ATTR_RU_MASK (IB_QP_STATE | IB_QP_PKEY_INDEX | \ + IB_QP_PORT | IB_QP_ACCESS_FLAGS | \ + IB_QP_PATH_MTU) + +/* The attributes the QP would be modified with via modify_qp calls. Used for +* implementations that support having QPs be in RTS immediately after QP +* creation. These attributes arrive in the same format the modify command +* uses so that converter serves both, and they are applied as that modify +* to RTS, once the QP exists. +*/ +static int create_qp_attr_set (struct uverbs_attr_bundle *attrs, +struct ib_device *device, +struct ib_qp_init_attr *attr, +struct ib_qp_attr *qp_attr,u32 *mask) +{ +struct ib_uverbs_ex_modify_qp uqpa = {}; +int ret; + + *mask =0 ; + +if (!uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_ATTR )) +return 0 ; + +if (attr->qp_type !=IB_QPT_RU || + !(device->attrs.device_cap_flags &IB_DEVICE_RU )) +return -EOPNOTSUPP ; + + ret =uverbs_copy_from_or_zero (&uqpa, attrs, +UVERBS_ATTR_CREATE_QP_ATTR ); +if (ret) +return ret; + +/* the create is what makes the handle, can't be one specified */ +if (uqpa.base.qp_handle) +return -EINVAL ; + +if (uqpa.reserved || uqpa.base.reserved[0 ] || uqpa.base.reserved[1 ]) +return -EINVAL ; + + ret =ib_uverbs_copy_qp_attr (attrs, device, qp_attr, &uqpa, + uqpa.base.attr_mask); +if (ret) +return ret; + +if ((uqpa.base.attr_mask & ~CREATE_QP_ATTR_RU_MASK ) || + ((uqpa.base.attr_mask &IB_QP_STATE ) && + uqpa.base.qp_state !=IB_QPS_RTS )) +return -EINVAL ; + + *mask = uqpa.base.attr_mask; + +return 0 ; +} +static int UVERBS_HANDLER (UVERBS_METHOD_QP_CREATE )(struct uverbs_attr_bundle *attrs) {
@@ -86,6 +141,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(uverbs_attr_get_uobject (attrs,UVERBS_ATTR_CREATE_QP_HANDLE ), typeof(*obj), uevent.uobject);struct ib_qp_init_attr attr = {}; +struct ib_qp_attr qp_attr = {}; +u32 qp_attr_mask;struct ib_uverbs_qp_cap cap = {};struct ib_rwq_ind_table *rwq_ind_tbl =NULL ;struct ib_qp *qp;
@@ -214,6 +271,11 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( attr.create_flags |=IB_QP_CREATE_SOURCE_QPN ; } + ret =create_qp_attr_set (attrs, device, &attr, &qp_attr, + &qp_attr_mask); +if (ret) +return ret; + srq =uverbs_attr_get_obj (attrs,UVERBS_ATTR_CREATE_QP_SRQ_HANDLE );if (!IS_ERR (srq)) {
@@ -264,6 +326,20 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( obj->uevent.uobject.object = qp;uverbs_finalize_uobj_create (attrs,UVERBS_ATTR_CREATE_QP_HANDLE ); +/* A reliable unconnected QP is ready to send once created. What the +* caller passed is applied as the modify to RTS it stands in for, so +* the modify's checks run. A failure here destroys the QP. +*/ +if (attr.qp_type ==IB_QPT_RU ) { + qp_attr.qp_state =IB_QPS_RTS ; +/* the driver's data was for create, there is none for this */ + ret =ib_modify_qp_with_udata (qp, &qp_attr, + qp_attr_mask |IB_QP_STATE , +uverbs_get_cleared_udata (attrs)); +if (ret) +return ret; + } +set_caps (&attr, &cap, false); ret = uverbs_copy_to_struct_or_zero(attrs, UVERBS_ATTR_CREATE_QP_RESP_CAP, &cap,
@@ -325,6 +401,10 @@ DECLARE_UVERBS_NAMED_METHOD(UVERBS_ATTR_FLAGS_IN (UVERBS_ATTR_CREATE_QP_FLAGS , enum ib_uverbs_qp_create_flags,UA_OPTIONAL ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_CREATE_QP_ATTR , + UVERBS_ATTR_STRUCT(struct ib_uverbs_ex_modify_qp, + reserved), +UA_OPTIONAL ),UVERBS_ATTR_PTR_IN (UVERBS_ATTR_CREATE_QP_SOURCE_QPN ,UVERBS_ATTR_TYPE (u32), UA_OPTIONAL),
include/uapi/rdma/ib_user_ioctl_cmds.h +1 -0
@@ -179,6 +179,7 @@ enum uverbs_attrs_create_qp_cmd_attr_ids {UVERBS_ATTR_CREATE_QP_BUF_UMEM ,UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM ,UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM , + UVERBS_ATTR_CREATE_QP_ATTR, }; enum uverbs_attrs_destroy_qp_cmd_attr_ids {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 09/13] RDMA/core: create a queue pair ready to send
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines
From: Eric Davis <[email protected]>
Some transports have nothing to negotiate, so a queue pair can be ready to send the moment it exists and the modify sequence carries no useful information. Let a reliable unconnected queue pair be created with the attributes that sequence would have supplied, in the same form the modify command uses, and apply them as that modify to RTS once the queue pair exists, so its checks run. A queue pair whose modify fails is destroyed.
Quoted 4 lines
Note that the QP handle field is refused, since the create is what makes the handle.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
PATCH v2 10/13 RDMA/core: queue pair attributes for unconnected transports
In reply to Eric DavisA queue pair on an unconnected transport is created with more than the connected attributes. A job key authorizing it to act within a job, the initiator identity it sends under, and the ordering guarantees the caller wants it to keep.
The QP holds a reference to its job key for as long as it lives, so the job cannot go away underneath it.
--- drivers/infiniband/core/uverbs_std_types_qp.c | 150 ++++++++++++++++++++++++++ drivers/infiniband/core/verbs.c | 5 + include/rdma/ib_verbs.h | 14 +++ include/uapi/rdma/ib_user_ioctl_cmds.h | 3 + 4 files changed, 172 insertions(+)
drivers/infiniband/core/uverbs_std_types_qp.c +150 -0
@@ -79,6 +79,139 @@ static void set_caps(struct ib_qp_init_attr *attr, } } +/* the semantics fields, ordering bits and usage flags uverbs knows of */ +#define QP_SEMANTICS_MASK_ALL ((IB_UVERBS_QP_SEMANTICS_MASK_USAGE << 1) - 1) +#define QP_ORDER_ALL ((IB_UVERBS_QP_ORDER_WAW << 1) - 1) +#define QP_USAGE_ALL IB_UVERBS_QP_USAGE_IMM_DATA_RQ + +/* A QP may relax what its type guarantees on this device, but not ask for +* more than the device advertises for it. +*/ +static int create_qp_semantics_check (struct ib_device *device, +const struct ib_qp_semantics *req) +{ +struct ib_qp_semantics adv = {}; +u32 m = req->comp_mask; +int ret; + +if (!device->ops.query_qp_semantics) +return -EOPNOTSUPP ; + + ret = device->ops.query_qp_semantics (device,IB_QPT_RU , &adv); +if (ret) +return ret; + +if (m & ~adv.comp_mask) +return -EINVAL ; + +if (((m &IB_UVERBS_QP_SEMANTICS_MASK_MSG_ORDER ) && + (req->msg_order & ~adv.msg_order)) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_RAW ) && + req->max_rdma_raw_size > adv.max_rdma_raw_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_WAR ) && + req->max_rdma_war_size > adv.max_rdma_war_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_WAW ) && + req->max_rdma_waw_size > adv.max_rdma_waw_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_PDU ) && + req->max_pdu > adv.max_pdu) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_IMM ) && + req->imm_data_size > adv.imm_data_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_USAGE ) && + (req->usage_flags & ~adv.usage_flags))) +return -EINVAL ; + +return 0 ; +} + +/* Process the optional creation attributes. A job to act within, a source +* identity, a set of ordering guarantees to ask for. They and the checks on +* a requested QP number belong to a reliable unconnected QP. +*/ +static int create_qp_opt_attrs (struct uverbs_attr_bundle *attrs, +struct ib_device *device,struct ib_pd *pd, +struct ib_qp_init_attr *attr, +struct ib_qp_semantics *sem) +{ +struct ib_uverbs_qp_semantics usem = {}; +struct ib_jkey *jkey; +bool has_semantics; +int ret; + + has_semantics =uverbs_attr_is_valid (attrs, +UVERBS_ATTR_CREATE_QP_SEMANTICS ); + +if (attr->qp_type !=IB_QPT_RU || + !(device->attrs.device_cap_flags &IB_DEVICE_RU )) { +if (has_semantics || +uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_SRC_ID ) || +uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_JOB_KEY )) +return -EOPNOTSUPP ; + +return 0 ; + } + +if (uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_SRC_ID )) { + ret =uverbs_copy_from (&attr->src_id, attrs, +UVERBS_ATTR_CREATE_QP_SRC_ID ); +if (ret) +return ret; + } + +if (uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_JOB_KEY )) { + jkey =uverbs_attr_get_obj (attrs, +UVERBS_ATTR_CREATE_QP_JOB_KEY ); +if (IS_ERR (jkey)) +return PTR_ERR (jkey); + +/* a key acts within the PD it was made on */ +if (jkey->pd != pd) +return -EINVAL ; + + attr->jkey = jkey; + } + +if (attr->create_flags &IB_QP_CREATE_SOURCE_QPN ) { +if (attr->source_qpn &IB_UVERBS_QPN_UET_RESERVED_MASK ) +return -EINVAL ; + +/* a relative QP is named within a job, so it needs a key */ +if (!(attr->source_qpn & +IB_UVERBS_QPN_UET_ABSOLUTE_ADDR_BIT ) && + !attr->jkey) +return -EINVAL ; + } + +if (has_semantics) { + ret =uverbs_copy_from_or_zero (&usem, attrs, +UVERBS_ATTR_CREATE_QP_SEMANTICS ); +if (ret) +return ret; + +if ((usem.comp_mask & ~QP_SEMANTICS_MASK_ALL ) || + (usem.msg_order & ~QP_ORDER_ALL ) || + (usem.usage_flags & ~QP_USAGE_ALL ) || +memchr_inv (usem.reserved,0 ,sizeof (usem.reserved))) +return -EINVAL ; + + sem->comp_mask = usem.comp_mask; + sem->msg_order = usem.msg_order; + sem->max_rdma_raw_size = usem.max_rdma_raw_size; + sem->max_rdma_war_size = usem.max_rdma_war_size; + sem->max_rdma_waw_size = usem.max_rdma_waw_size; + sem->max_pdu = usem.max_pdu; + sem->usage_flags = usem.usage_flags; + sem->imm_data_size = usem.imm_data_size; + + ret =create_qp_semantics_check (device, sem); +if (ret) +return ret; + + attr->qp_semantics = sem; + } + +return 0 ; +} +/* what a reliable unconnected QP may be created ready to send with */ #define CREATE_QP_ATTR_RU_MASK (IB_QP_STATE | IB_QP_PKEY_INDEX | \ IB_QP_PORT | IB_QP_ACCESS_FLAGS | \
@@ -143,6 +276,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(struct ib_qp_init_attr attr = {};struct ib_qp_attr qp_attr = {};u32 qp_attr_mask; +struct ib_qp_semantics qp_semantics = {};struct ib_uverbs_qp_cap cap = {};struct ib_rwq_ind_table *rwq_ind_tbl =NULL ;struct ib_qp *qp;
@@ -197,6 +331,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(case IB_UVERBS_QPT_UC :case IB_UVERBS_QPT_UD :case IB_UVERBS_QPT_XRC_INI : +case IB_UVERBS_QPT_RU :case IB_UVERBS_QPT_DRIVER : if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CREATE_QP_XRCD_HANDLE) ||
@@ -271,6 +406,10 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( attr.create_flags |=IB_QP_CREATE_SOURCE_QPN ; } + ret =create_qp_opt_attrs (attrs, device, pd, &attr, &qp_semantics); +if (ret) +return ret; + ret =create_qp_attr_set (attrs, device, &attr, &qp_attr, &qp_attr_mask);if (ret)
@@ -401,6 +540,17 @@ DECLARE_UVERBS_NAMED_METHOD(UVERBS_ATTR_FLAGS_IN (UVERBS_ATTR_CREATE_QP_FLAGS , enum ib_uverbs_qp_create_flags,UA_OPTIONAL ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_CREATE_QP_SRC_ID , +UVERBS_ATTR_TYPE (u32), +UA_OPTIONAL ), +UVERBS_ATTR_PTR_IN (UVERBS_ATTR_CREATE_QP_SEMANTICS , + UVERBS_ATTR_STRUCT(struct ib_uverbs_qp_semantics, + imm_data_size), +UA_OPTIONAL ), +UVERBS_ATTR_IDR (UVERBS_ATTR_CREATE_QP_JOB_KEY , +UVERBS_OBJECT_JKEY , +UVERBS_ACCESS_READ , +UA_OPTIONAL ), UVERBS_ATTR_PTR_IN(UVERBS_ATTR_CREATE_QP_ATTR, UVERBS_ATTR_STRUCT(struct ib_uverbs_ex_modify_qp, reserved),
drivers/infiniband/core/verbs.c +5 -0
@@ -1343,6 +1343,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd, qp->qp_type = attr->qp_type; qp->rwq_ind_tbl = attr->rwq_ind_tbl; qp->srq = attr->srq; + qp->jkey = attr->jkey; qp->event_handler = __ib_qp_event_handler; qp->registered_event_handler = attr->event_handler; qp->port = attr->port_num;
@@ -1438,11 +1439,15 @@ void ib_qp_usecnt_inc(struct ib_qp *qp)atomic_inc (&qp->srq->usecnt);if (qp->rwq_ind_tbl)atomic_inc (&qp->rwq_ind_tbl->usecnt); +if (qp->jkey) +atomic_inc (&qp->jkey->usecnt); }EXPORT_SYMBOL (ib_qp_usecnt_inc);void ib_qp_usecnt_dec (struct ib_qp *qp) { +if (qp->jkey) +atomic_dec (&qp->jkey->usecnt);if (qp->rwq_ind_tbl)atomic_dec (&qp->rwq_ind_tbl->usecnt);if (qp->srq)
include/rdma/ib_verbs.h +14 -0
@@ -1243,6 +1243,9 @@ enum ib_qp_create_flags {* callback to destroy the passed in QP. */ +struct ib_jkey ; +struct ib_qp_semantics ; +struct ib_qp_init_attr {/* This callback occurs in workqueue context */ void (*event_handler)(struct ib_event *,void *);
@@ -1263,6 +1266,15 @@ struct ib_qp_init_attr {u32 port_num;struct ib_rwq_ind_table *rwq_ind_tbl;u32 source_qpn; + +/* The initiator ID this QP sends with, the caller's rank in its job. +* UET lets the caller choose it; the JobID is what is trusted. +*/ +u32 src_id; +/* the job this QP belongs to */ +struct ib_jkey *jkey; +/* what the caller asked the QP to guarantee, NULL if it didn't ask */ +struct ib_qp_semantics *qp_semantics; };struct ib_qp_open_attr {
@@ -2009,6 +2021,8 @@ struct ib_qp {enum ib_qp_type qp_type;struct ib_rwq_ind_table *rwq_ind_tbl;struct ib_qp_security *qp_sec; +/* the job key this pair was created within, NULL if none */ +struct ib_jkey *jkey;u32 port;bool integrity_en;
include/uapi/rdma/ib_user_ioctl_cmds.h +3 -0
@@ -179,6 +179,9 @@ enum uverbs_attrs_create_qp_cmd_attr_ids {UVERBS_ATTR_CREATE_QP_BUF_UMEM ,UVERBS_ATTR_CREATE_QP_RQ_BUF_UMEM ,UVERBS_ATTR_CREATE_QP_SQ_BUF_UMEM , +UVERBS_ATTR_CREATE_QP_SRC_ID , +UVERBS_ATTR_CREATE_QP_SEMANTICS , +UVERBS_ATTR_CREATE_QP_JOB_KEY , UVERBS_ATTR_CREATE_QP_ATTR, };
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 10/13] RDMA/core: queue pair attributes for unconnected transports
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] RDMA/core: unmasked semantics fields used and copied in create_qp_opt_attrs() - [Medium]…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] RDMA/core: unmasked semantics fields used and copied in create_qp_opt_attrs()
- [Medium] RDMA/core: missing IB_DEVICE_RU check for IB_QPT_RU in create_qp_opt_attrs() --
commit 814ed695a9e745ffe7fb729da61fd57b0d746109
Author: Eric Davis <[email protected]>
RDMA/core: queue pair attributes for unconnected transports
This commit adds support for reliable unconnected (IB_QPT_RU) queue pair creation attributes in uverbs and ib_verbs, including source ID, job key (jkey), and ordering/usage semantics. It also tracks the jkey use count over the lifetime of the QP.
Quoted 68 lines
drivers/infiniband/core/uverbs_std_types_qp.c +60
-0@@ -79,6 +79,139 @@ static void set_caps(struct ib_qp_init_attr *attr, } } +/* the semantics fields, ordering bits and usage flags uverbs knows of */ +#define QP_SEMANTICS_MASK_ALL ((IB_UVERBS_QP_SEMANTICS_MASK_USAGE << 1) - 1) +#define QP_ORDER_ALL ((IB_UVERBS_QP_ORDER_WAW << 1) - 1) +#define QP_USAGE_ALL IB_UVERBS_QP_USAGE_IMM_DATA_RQ + +/* A QP may relax what its type guarantees on this device, but not ask for +* more than the device advertises for it. +*/ +static int create_qp_semantics_check (struct ib_device *device, +const struct ib_qp_semantics *req) +{ +struct ib_qp_semantics adv = {}; +u32 m = req->comp_mask; +int ret; + +if (!device->ops.query_qp_semantics) +return -EOPNOTSUPP ; + + ret = device->ops.query_qp_semantics (device,IB_QPT_RU , &adv); +if (ret) +return ret; + +if (m & ~adv.comp_mask) +return -EINVAL ; + +if (((m &IB_UVERBS_QP_SEMANTICS_MASK_MSG_ORDER ) && + (req->msg_order & ~adv.msg_order)) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_RAW ) && + req->max_rdma_raw_size > adv.max_rdma_raw_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_WAR ) && + req->max_rdma_war_size > adv.max_rdma_war_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_WAW ) && + req->max_rdma_waw_size > adv.max_rdma_waw_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_PDU ) && + req->max_pdu > adv.max_pdu) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_IMM ) && + req->imm_data_size > adv.imm_data_size) || + ((m &IB_UVERBS_QP_SEMANTICS_MASK_USAGE ) && + (req->usage_flags & ~adv.usage_flags))) +return -EINVAL ; + +return 0 ; +} + +/* Process the optional creation attributes. A job to act within, a source +* identity, a set of ordering guarantees to ask for. They and the checks on +* a requested QP number belong to a reliable unconnected QP. +*/ +static int create_qp_opt_attrs (struct uverbs_attr_bundle *attrs, +struct ib_device *device,struct ib_pd *pd, +struct ib_qp_init_attr *attr, +struct ib_qp_semantics *sem) +{ +struct ib_uverbs_qp_semantics usem = {}; +struct ib_jkey *jkey; +bool has_semantics; +int ret; + + has_semantics =uverbs_attr_is_valid (attrs, +UVERBS_ATTR_CREATE_QP_SEMANTICS );
drivers/infiniband/core/uverbs_std_types_qp.c static void set_caps(struct ib_qp_init_attr *attr, · line 151
Quoted 10 lines
drivers/infiniband/core/uverbs_std_types_qp.c +10
-0+ +if (attr->qp_type !=IB_QPT_RU || + !(device->attrs.device_cap_flags &IB_DEVICE_RU )) { +if (has_semantics || +uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_SRC_ID ) || +uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_JOB_KEY )) +return -EOPNOTSUPP ; + +return 0 ; + }
[Severity: Medium]
What happens in UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE) -> create_qp_opt_attrs() when userspace requests attr.qp_type == IB_QPT_RU on a device that does not advertise IB_DEVICE_RU, and omits the optional UVERBS_ATTR_CREATE_QP_SEMANTICS, UVERBS_ATTR_CREATE_QP_SRC_ID, and UVERBS_ATTR_CREATE_QP_JOB_KEY attributes?
Because UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE) adds IB_UVERBS_QPT_RU to the switch statement without checking IB_DEVICE_RU, and this check combines attr->qp_type != IB_QPT_RU with !(device->attrs.device_cap_flags & IB_DEVICE_RU), create_qp_opt_attrs() returns 0 instead of -EOPNOTSUPP.
Returning 0 early here also skips the IB_QP_CREATE_SOURCE_QPN validation below (checking attr->source_qpn against IB_UVERBS_QPN_UET_RESERVED_MASK and requiring attr->jkey for relative QPNs) and allows QP creation to proceed to ib_create_qp_user() on a device without IB_DEVICE_RU.
Should create_qp_opt_attrs() return -EOPNOTSUPP whenever attr->qp_type == IB_QPT_RU and !(device->attrs.device_cap_flags & IB_DEVICE_RU)?
Quoted 49 lines
drivers/infiniband/core/uverbs_std_types_qp.c +49
-0+ +if (uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_SRC_ID )) { + ret =uverbs_copy_from (&attr->src_id, attrs, +UVERBS_ATTR_CREATE_QP_SRC_ID ); +if (ret) +return ret; + } + +if (uverbs_attr_is_valid (attrs,UVERBS_ATTR_CREATE_QP_JOB_KEY )) { + jkey =uverbs_attr_get_obj (attrs, +UVERBS_ATTR_CREATE_QP_JOB_KEY ); +if (IS_ERR (jkey)) +return PTR_ERR (jkey); + +/* a key acts within the PD it was made on */ +if (jkey->pd != pd) +return -EINVAL ; + + attr->jkey = jkey; + } + +if (attr->create_flags &IB_QP_CREATE_SOURCE_QPN ) { +if (attr->source_qpn &IB_UVERBS_QPN_UET_RESERVED_MASK ) +return -EINVAL ; + +/* a relative QP is named within a job, so it needs a key */ +if (!(attr->source_qpn & +IB_UVERBS_QPN_UET_ABSOLUTE_ADDR_BIT ) && + !attr->jkey) +return -EINVAL ; + } + +if (has_semantics) { + ret =uverbs_copy_from_or_zero (&usem, attrs, +UVERBS_ATTR_CREATE_QP_SEMANTICS ); +if (ret) +return ret; + +if ((usem.comp_mask & ~QP_SEMANTICS_MASK_ALL ) || + (usem.msg_order & ~QP_ORDER_ALL ) || + (usem.usage_flags & ~QP_USAGE_ALL ) || +memchr_inv (usem.reserved,0 ,sizeof (usem.reserved))) +return -EINVAL ; + + sem->comp_mask = usem.comp_mask; + sem->msg_order = usem.msg_order; + sem->max_rdma_raw_size = usem.max_rdma_raw_size; + sem->max_rdma_war_size = usem.max_rdma_war_size; + sem->max_rdma_waw_size = usem.max_rdma_waw_size;
drivers/infiniband/core/uverbs_std_types_qp.c static void set_caps(struct ib_qp_init_attr *attr, · line 210
Quoted 10 lines
drivers/infiniband/core/uverbs_std_types_qp.c +10
-0+ sem->max_pdu = usem.max_pdu; + sem->usage_flags = usem.usage_flags; + sem->imm_data_size = usem.imm_data_size; + + ret =create_qp_semantics_check (device, sem); +if (ret) +return ret; + + attr->qp_semantics = sem; + }
[Severity: Medium]
Should the checks and assignments on the fields of usem in create_qp_opt_attrs() be gated by their corresponding bits in usem.comp_mask?
When UVERBS_ATTR_CREATE_QP_SEMANTICS is provided, individual fields in struct ib_uverbs_qp_semantics are gated by IB_UVERBS_QP_SEMANTICS_MASK_* bits in usem.comp_mask.
However, create_qp_opt_attrs() checks (usem.msg_order & ~QP_ORDER_ALL) and (usem.usage_flags & ~QP_USAGE_ALL) unconditionally even when IB_UVERBS_QP_SEMANTICS_MASK_MSG_ORDER or IB_UVERBS_QP_SEMANTICS_MASK_USAGE is not set in usem.comp_mask, which can reject valid requests with -EINVAL if unused fields in the user structure were not zeroed.
In addition, create_qp_opt_attrs() copies all fields from usem into sem regardless of usem.comp_mask, whereas create_qp_semantics_check() only validates the fields in sem whose bits are set in req->comp_mask. As a result, any field whose bit is clear in usem.comp_mask bypasses create_qp_semantics_check() and is passed with unvalidated user values in attr->qp_semantics to dev->ops.create_qp().
[ ... ]
Quoted 19 lines
drivers/infiniband/core/uverbs_std_types_qp.c +5
-0@@ -197,6 +331,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)(case IB_UVERBS_QPT_UC :case IB_UVERBS_QPT_UD :case IB_UVERBS_QPT_XRC_INI : +case IB_UVERBS_QPT_RU :case IB_UVERBS_QPT_DRIVER : if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CREATE_QP_XRCD_HANDLE) ||@@ -271,6 +406,10 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( attr.create_flags |=IB_QP_CREATE_SOURCE_QPN ; } + ret =create_qp_opt_attrs (attrs, device, pd, &attr, &qp_semantics); +if (ret) +return ret; + ret =create_qp_attr_set (attrs, device, &attr, &qp_attr, &qp_attr_mask);if (ret)
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
Re: [PATCH rdma-next v2 10/13] RDMA/core: queue pair attributes for unconnected transports
Quoted 2 lines · On Tue, Oct 20, 2026 at 2:53 AM <[email protected]> wrote:
Should
create_qp_opt_attrs()return-EOPNOTSUPPwheneverattr->qp_type==IB_QPT_RUand !(device->attrs.device_cap_flags &IB_DEVICE_RU)?
Yeah. Folding the two conditions into one test lets an RU create with no optional attributes through on a device without RU. v3 will refuse that with -EOPNOTSUPP before any attribute is looked at, so the source QPN checks can no longer be skipped either.
Quoted 3 lines
Should the checks and assignments on the fields of usem in
create_qp_opt_attrs()be gated by their corresponding bits in usem.comp_mask?
Agreed. v3 will check and copy only the fields comp_mask selects, so an unselected field reaches neither the range checks nor the driver.
Quoted 2 lines
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
Thanks,
- eric
PATCH v2 11/13 RDMA/core: extended memory registration
In reply to Eric DavisMemory registration for an unconnected transport may take more than an address and an access mask. A job to bind the region to, a key the caller chose, or a region carved out of another. None of it fits the write() command, so add a device method that takes the wider set of attributes and reach it when the ioctl carries any of these new fields.
A region bound to a job holds a reference to its job key until it is deregistered.
--- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/uverbs_cmd.c | 7 +- drivers/infiniband/core/uverbs_std_types_mr.c | 179 +++++++++++++++++++++++++- drivers/infiniband/core/verbs.c | 9 ++ include/rdma/ib_verbs.h | 43 +++++++ include/uapi/rdma/ib_user_ioctl_cmds.h | 5 + include/uapi/rdma/ib_user_ioctl_verbs.h | 10 ++ 7 files changed, 249 insertions(+), 5 deletions(-)
drivers/infiniband/core/device.c +1 -0
@@ -3028,6 +3028,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, reg_dm_mr);SET_DEVICE_OP (dev_ops, reg_user_mr);SET_DEVICE_OP (dev_ops, reg_user_mr_dmabuf); +SET_DEVICE_OP (dev_ops, reg_user_mr_ex);SET_DEVICE_OP (dev_ops, req_notify_cq);SET_DEVICE_OP (dev_ops, rereg_user_mr);SET_DEVICE_OP (dev_ops, resize_user_cq);
drivers/infiniband/core/uverbs_cmd.c +6 -1
@@ -731,6 +731,7 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) mr->type =IB_MR_TYPE_USER ; mr->dm =NULL ; mr->sig_attrs =NULL ; +ib_mr_init_core_refs (mr); mr->uobject = uobj;atomic_inc (&pd->usecnt); mr->iova = cmd.hca_va;
@@ -790,7 +791,10 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) mr = uobj->object; -if (mr->dm) { +/* A region bound to a job or to another region is re-created rather +* than re-registered, so those bindings can't be lost or bypassed. +*/ +if (mr->dm || mr->jkey || mr->parent ||atomic_read (&mr->usecnt)) { ret = -EINVAL ; goto put_uobjs; }
@@ -838,6 +842,7 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) new_mr->device = new_pd->device; new_mr->pd = new_pd; new_mr->type =IB_MR_TYPE_USER ; +ib_mr_init_core_refs (new_mr); new_mr->uobject = uobj;atomic_inc (&new_pd->usecnt); new_uobj->object = new_mr;
drivers/infiniband/core/uverbs_std_types_mr.c +175 -4
249 lines not on this page · raw message
drivers/infiniband/core/verbs.c +9 -0
@@ -2358,6 +2358,7 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, mr->type =IB_MR_TYPE_USER ; mr->pd = pd; mr->dm =NULL ; +ib_mr_init_core_refs (mr);atomic_inc (&pd->usecnt); mr->iova = virt_addr; mr->length = length;
@@ -2389,6 +2390,8 @@ int ib_dereg_mr_user(struct ib_mr *mr, struct ib_udata *udata)struct ib_pd *pd = mr->pd;struct ib_dm *dm = mr->dm;struct ib_dmah *dmah = mr->dmah; +struct ib_jkey *jkey = mr->jkey; +struct ib_mr *parent = mr->parent;struct ib_sig_attrs *sig_attrs = mr->sig_attrs;int ret;
@@ -2401,6 +2404,10 @@ int ib_dereg_mr_user(struct ib_mr *mr, struct ib_udata *udata)atomic_dec (&dm->usecnt);if (dmah)atomic_dec (&dmah->usecnt); +if (jkey) +atomic_dec (&jkey->usecnt); +if (parent) +atomic_dec (&parent->usecnt);kfree (sig_attrs); }
@@ -2448,6 +2455,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, mr->need_inval = false; mr->type = mr_type; mr->sig_attrs =NULL ; +ib_mr_init_core_refs (mr);rdma_restrack_new (&mr->res,RDMA_RESTRACK_MR );rdma_restrack_parent_name (&mr->res, &pd->res);
@@ -2509,6 +2517,7 @@ struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd, mr->need_inval = false; mr->type =IB_MR_TYPE_INTEGRITY ; mr->sig_attrs = sig_attrs; +ib_mr_init_core_refs (mr);rdma_restrack_new (&mr->res,RDMA_RESTRACK_MR );rdma_restrack_parent_name (&mr->res, &pd->res);
include/rdma/ib_verbs.h +43 -0
67 lines not on this page · raw message
include/uapi/rdma/ib_user_ioctl_cmds.h +5 -0
@@ -369,6 +369,11 @@ enum uverbs_attrs_reg_mr_cmd_attr_ids {UVERBS_ATTR_REG_MR_FD_OFFSET ,UVERBS_ATTR_REG_MR_RESP_LKEY ,UVERBS_ATTR_REG_MR_RESP_RKEY , +UVERBS_ATTR_REG_MR_FLAGS , +UVERBS_ATTR_REG_MR_JKEY_HANDLE , +UVERBS_ATTR_REG_MR_PARENT_MR_HANDLE , +UVERBS_ATTR_REG_MR_DERIVE_CNT , + UVERBS_ATTR_REG_MR_REQ_RKEY64, }; enum uverbs_attrs_create_counters_cmd_attr_ids {
include/uapi/rdma/ib_user_ioctl_verbs.h +10 -0
@@ -303,6 +303,16 @@ struct ib_uverbs_buffer_desc {__aligned_u64 length; }; +/* Extended memory registration, for devices whose memory keys are 64 bits +* wide and may be bound to a job. See UVERBS_ATTR_REG_MR_FLAGS. +*/ +enum ib_uverbs_reg_mr_flags { +/* REQ_RKEY64 carries the key, rather than the device assigning one */ +IB_UVERBS_REG_MR_USER_RKEY =1 <<0 , +/* the region tolerates a replayed idempotent operation */ +IB_UVERBS_REG_MR_IDEMPOTENT_SAFE =1 <<1 , +}; +/* A UET reliable unconnected queue pair number uses all 32 bits: * * [ absolute 1b | reserved 7b | resource index 12b | PIDonFEP 12b ]
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 11/13] RDMA/core: extended memory registration
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines
From: Eric Davis <[email protected]>
Memory registration for an unconnected transport may take more than an address and an access mask. A job to bind the region to, a key the caller chose, or a region carved out of another. None of it fits the
write()command, so add a device method that takes the wider set of attributes and reach it when the ioctl carries any of these new fields.
Quoted 4 lines
A region bound to a job holds a reference to its job key until it is deregistered.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH v2 12/13 RDMA/core: 64-bit memory keys
In reply to Eric DavisA device whose keys are wider than 32 bits has no way to name a region through lkey and rkey. Carry the wide pair on the region and return it from registration when userspace asks for it.
The attributes are optional in both directions, so a kernel that does not know them ignores the request, and a region without a wide key answers zero.
--- drivers/infiniband/core/uverbs_std_types_mr.c | 39 ++++++++++++++++++++++++++- include/rdma/ib_verbs.h | 12 +++++++-- include/uapi/rdma/ib_user_ioctl_cmds.h | 4 +++ 3 files changed, 52 insertions(+), 3 deletions(-)
drivers/infiniband/core/uverbs_std_types_mr.c +38 -1
@@ -185,6 +185,16 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_MR)( ret =uverbs_copy_to (attrs,UVERBS_ATTR_QUERY_MR_RESP_IOVA , &mr->iova,sizeof (mr->iova)); +if (IS_UVERBS_COPY_ERR (ret)) +return ret; + + ret =uverbs_copy_to (attrs,UVERBS_ATTR_QUERY_MR_RESP_LKEY64 , + &mr->lkey64,sizeof (mr->lkey64)); +if (IS_UVERBS_COPY_ERR (ret)) +return ret; + + ret =uverbs_copy_to (attrs,UVERBS_ATTR_QUERY_MR_RESP_RKEY64 , + &mr->rkey64,sizeof (mr->rkey64));return IS_UVERBS_COPY_ERR (ret) ? ret :0 ; }
@@ -364,6 +374,10 @@ static int reg_mr_ex_attr(struct uverbs_attr_bundle *attrs, struct ib_pd *pd,if (ret)return ret; +/* zero names no wide key, so it can't be one */ +if (!ex->req_rkey64) +return -EINVAL ; +if (ex->req_rkey64 >U32_MAX && !(caps &IB_DEVICE_KEY64 ))return -EOPNOTSUPP ; } else if (uverbs_attr_is_valid(attrs,
@@ -547,7 +561,18 @@ static int UVERBS_HANDLER(UVERBS_METHOD_REG_MR)( ret =uverbs_copy_to (attrs,UVERBS_ATTR_REG_MR_RESP_RKEY , &mr->rkey,sizeof (mr->rkey)); -return ret; +if (ret) +return ret; + + ret =uverbs_copy_to (attrs,UVERBS_ATTR_REG_MR_RESP_LKEY64 , + &mr->lkey64,sizeof (mr->lkey64)); +if (IS_UVERBS_COPY_ERR (ret)) +return ret; + + ret =uverbs_copy_to (attrs,UVERBS_ATTR_REG_MR_RESP_RKEY64 , + &mr->rkey64,sizeof (mr->rkey64)); + +return IS_UVERBS_COPY_ERR (ret) ? ret :0 ; } DECLARE_UVERBS_NAMED_METHOD(
@@ -583,6 +608,12 @@ DECLARE_UVERBS_NAMED_METHOD(UVERBS_ATTR_TYPE (u64), UA_MANDATORY),UVERBS_ATTR_PTR_OUT (UVERBS_ATTR_QUERY_MR_RESP_IOVA , +UVERBS_ATTR_TYPE (u64 ), +UA_OPTIONAL ), +UVERBS_ATTR_PTR_OUT (UVERBS_ATTR_QUERY_MR_RESP_LKEY64 , +UVERBS_ATTR_TYPE (u64 ), +UA_OPTIONAL ), +UVERBS_ATTR_PTR_OUT (UVERBS_ATTR_QUERY_MR_RESP_RKEY64 ,UVERBS_ATTR_TYPE (u64 ), UA_OPTIONAL));
@@ -700,6 +731,12 @@ DECLARE_UVERBS_NAMED_METHOD(UVERBS_ATTR_PTR_IN (UVERBS_ATTR_REG_MR_REQ_RKEY64 ,UVERBS_ATTR_TYPE (u64),UA_OPTIONAL ), +UVERBS_ATTR_PTR_OUT (UVERBS_ATTR_REG_MR_RESP_LKEY64 , +UVERBS_ATTR_TYPE (u64), +UA_OPTIONAL ), +UVERBS_ATTR_PTR_OUT (UVERBS_ATTR_REG_MR_RESP_RKEY64 , +UVERBS_ATTR_TYPE (u64), +UA_OPTIONAL ), UVERBS_ATTR_UHW()); DECLARE_UVERBS_NAMED_METHOD_DESTROY(
include/rdma/ib_verbs.h +10 -2
@@ -2084,6 +2084,9 @@ struct ib_mr {struct list_head qp_entry;/* FR */ }; +/* 64b keys, set by a driver reporting IB_DEVICE_KEY64, else zero */ +u64 lkey64; +u64 rkey64;/* the job this region is restricted to, NULL if it is unrestricted */ struct ib_jkey *jkey;/* the region this one was derived from, NULL if registered fresh */
@@ -4851,8 +4854,8 @@ static inline u32 ib_inc_rkey(u32 rkey)/** * ib_mr_init_core_refs - clears what core reads back when an MR is -* deregistered. -* @mr: struct ib_mr pointer to initialize. +* deregistered, and the wide keys of an MR on a device without them. +* @mr: struct ib_mr pointer to initialize, with its device set. * * A driver's MR need not be zeroed, so every path that makes an MR calls this. */
@@ -4861,6 +4864,11 @@ static inline void ib_mr_init_core_refs(struct ib_mr *mr) mr->jkey =NULL ; mr->parent =NULL ;atomic_set (&mr->usecnt,0 ); + +if (!(mr->device->attrs.device_cap_flags &IB_DEVICE_KEY64 )) { + mr->lkey64 =0 ; + mr->rkey64 =0 ; + } }/**
include/uapi/rdma/ib_user_ioctl_cmds.h +4 -0
@@ -343,6 +343,8 @@ enum uverbs_attrs_query_mr_cmd_attr_ids {UVERBS_ATTR_QUERY_MR_RESP_RKEY ,UVERBS_ATTR_QUERY_MR_RESP_LENGTH ,UVERBS_ATTR_QUERY_MR_RESP_IOVA , +UVERBS_ATTR_QUERY_MR_RESP_LKEY64 , + UVERBS_ATTR_QUERY_MR_RESP_RKEY64, }; enum uverbs_attrs_reg_dmabuf_mr_cmd_attr_ids {
@@ -374,6 +376,8 @@ enum uverbs_attrs_reg_mr_cmd_attr_ids {UVERBS_ATTR_REG_MR_PARENT_MR_HANDLE ,UVERBS_ATTR_REG_MR_DERIVE_CNT ,UVERBS_ATTR_REG_MR_REQ_RKEY64 , +UVERBS_ATTR_REG_MR_RESP_LKEY64 , + UVERBS_ATTR_REG_MR_RESP_RKEY64, }; enum uverbs_attrs_create_counters_cmd_attr_ids {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 12/13] RDMA/core: 64-bit memory keys
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines
From: Eric Davis <[email protected]>
A device whose keys are wider than 32 bits has no way to name a region through lkey and rkey. Carry the wide pair on the region and return it from registration when userspace asks for it.
The attributes are optional in both directions, so a kernel that does not know them ignores the request, and a region without a wide key answers zero.
Signed-off-by Eric Davis <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
PATCH v2 13/13 RDMA/core: attach a memory region to a queue pair
In reply to Eric DavisA region registered against a protection domain is reachable from every QP in it. When a device can narrow that, let a region be attached to one QP and detached again, so the network only reaches the MR over that QP.
Which restrictions a device supports is reported through the memory region access capability bits.
--- drivers/infiniband/core/device.c | 2 + drivers/infiniband/core/uverbs_std_types_mr.c | 2 +- drivers/infiniband/core/uverbs_std_types_qp.c | 110 +++++++++++++++++++++++++- drivers/infiniband/core/verbs.c | 10 +++ include/rdma/ib_verbs.h | 11 ++- include/uapi/rdma/ib_user_ioctl_cmds.h | 12 +++ 6 files changed, 144 insertions(+), 3 deletions(-)
drivers/infiniband/core/device.c +2 -0
@@ -3018,6 +3018,8 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)SET_DEVICE_OP (dev_ops, query_pkey);SET_DEVICE_OP (dev_ops, query_port);SET_DEVICE_OP (dev_ops, query_port_speed); +SET_DEVICE_OP (dev_ops, qp_attach_mr); +SET_DEVICE_OP (dev_ops, qp_detach_mr);SET_DEVICE_OP (dev_ops, query_qp);SET_DEVICE_OP (dev_ops, query_qp_semantics);SET_DEVICE_OP (dev_ops, query_srq);
drivers/infiniband/core/uverbs_std_types_mr.c +1 -1
@@ -42,7 +42,7 @@ static int uverbs_free_mr(struct ib_uobject *uobject, {struct ib_mr *mr = uobject->object; -/* regions derived from this one still use it */ +/* regions derived from this one, or the QP it is attached to, use it */ if (atomic_read (&mr->usecnt))return -EBUSY ;
drivers/infiniband/core/uverbs_std_types_qp.c +109 -1
121 lines not on this page · raw message
drivers/infiniband/core/verbs.c +10 -0
@@ -1351,6 +1351,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,spin_lock_init (&qp->mr_lock);xa_init (&qp->comp_cntrs); +xa_init_flags (&qp->attached_mrs,XA_FLAGS_ALLOC );INIT_LIST_HEAD (&qp->rdma_mrs);INIT_LIST_HEAD (&qp->sig_mrs);init_completion (&qp->srq_completion);
@@ -1385,6 +1386,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd, err_create:rdma_restrack_put (&qp->res);xa_destroy (&qp->comp_cntrs); +xa_destroy (&qp->attached_mrs);kfree (qp);return ERR_PTR (ret);
@@ -2212,6 +2214,7 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)struct ib_qp_security *sec;struct ib_comp_cntr *cc;unsigned long index; +struct ib_mr *mr;int ret;WARN_ON_ONCE (qp->mrs_used >0 );
@@ -2249,6 +2252,13 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)atomic_dec (&cc->usecnt);xa_destroy (&qp->comp_cntrs); +/* the driver ended the bindings with the QP, release the regions */ +xa_for_each (&qp->attached_mrs, index, mr) { +WRITE_ONCE (mr->attached_qp,NULL ); +atomic_dec (&mr->usecnt); + } +xa_destroy (&qp->attached_mrs); +ib_qp_usecnt_dec (qp);if (sec)ib_destroy_qp_security_end (sec);
include/rdma/ib_verbs.h +10 -1
@@ -2003,6 +2003,8 @@ struct ib_qp {struct list_head xrcd_list;struct xarray comp_cntrs;/* op_mask -> comp_cntr */ u32 comp_cntr_op_mask; +/* regions attached to this QP, each held until detach or destroy */ +struct xarray attached_mrs;/* count times opened, mcast attaches, flow attaches */ atomic_t usecnt;
@@ -2091,8 +2093,11 @@ struct ib_mr {struct ib_jkey *jkey;/* the region this one was derived from, NULL if registered fresh */ struct ib_mr *parent; -/* regions derived from this one that are still registered */ +/* regions derived from this one, and an attachment, that hold it */ atomic_t usecnt; +/* the QP this region is attached to, NULL if none */ +struct ib_qp *attached_qp; +u32 attach_id;/* index in attached_qp->attached_mrs */ struct ib_dm *dm;struct ib_sig_attrs *sig_attrs;/* only for IB_MR_TYPE_INTEGRITY MRs */
@@ -2844,6 +2849,9 @@ struct ib_device_ops {struct ib_mr_ex_attr *attr, struct ib_udata *udata);int (*dereg_mr)(struct ib_mr *mr,struct ib_udata *udata); +/* attach/detach a region so it is bound to single QP (restricted) */ +int (*qp_attach_mr)(struct ib_qp *qp,struct ib_mr *mr); +int (*qp_detach_mr)(struct ib_qp *qp,struct ib_mr *mr);int (*query_qp_semantics)(struct ib_device *device,enum ib_qp_type qp_type,struct ib_qp_semantics *sem);
@@ -4863,6 +4871,7 @@ static inline void ib_mr_init_core_refs(struct ib_mr *mr) { mr->jkey =NULL ; mr->parent =NULL ; + mr->attached_qp =NULL ;atomic_set (&mr->usecnt,0 );if (!(mr->device->attrs.device_cap_flags &IB_DEVICE_KEY64 )) {
include/uapi/rdma/ib_user_ioctl_cmds.h +12 -0
@@ -200,6 +200,18 @@ enum uverbs_methods_qp {UVERBS_METHOD_QP_CREATE ,UVERBS_METHOD_QP_DESTROY ,UVERBS_METHOD_QP_ATTACH_COMP_CNTR , +UVERBS_METHOD_QP_ATTACH_MR , + UVERBS_METHOD_QP_DETACH_MR, +}; + +enum uverbs_attrs_qp_attach_mr_cmd_attr_ids { +UVERBS_ATTR_QP_ATTACH_MR_QP_HANDLE , +UVERBS_ATTR_QP_ATTACH_MR_MR_HANDLE , +}; + +enum uverbs_attrs_qp_detach_mr_cmd_attr_ids { +UVERBS_ATTR_QP_DETACH_MR_QP_HANDLE , +UVERBS_ATTR_QP_DETACH_MR_MR_HANDLE , }; enum uverbs_attrs_create_srq_cmd_attr_ids {
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH rdma-next v2 13/13] RDMA/core: attach a memory region to a queue pair
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Critical] RDMA/core: UAF and race releasing mr->attached_qp in ib_destroy_qp_user() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] RDMA/core: UAF and race releasing mr->attached_qp in ib_destroy_qp_user() --
commit 42577e79697ce5d46b89cf9d6635da521b34d381
Author: Eric Davis <[email protected]>
RDMA/core: attach a memory region to a queue pair
This commit adds uverbs methods and driver callbacks to attach and detach a user memory region to a single queue pair, restricting access to that region to the bound queue pair.
Quoted 104 lines
drivers/infiniband/core/uverbs_std_types_mr.c +1
-1@@ -42,7 +42,7 @@ static int uverbs_free_mr(struct ib_uobject *uobject, {struct ib_mr *mr = uobject->object; -/* regions derived from this one still use it */ +/* regions derived from this one, or the QP it is attached to, use it */ if (atomic_read (&mr->usecnt))return -EBUSY ;drivers/infiniband/core/uverbs_std_types_qp.c +83
-0@@ -666,12 +666,120 @@ DECLARE_UVERBS_NAMED_METHOD( enum ib_uverbs_qp_attach_comp_cntr_op, UA_MANDATORY)); +/* bind a region to the QP that will use it */ +static int UVERBS_HANDLER (UVERBS_METHOD_QP_ATTACH_MR )( +struct uverbs_attr_bundle *attrs) +{ +struct ib_qp *qp = +uverbs_attr_get_obj (attrs,UVERBS_ATTR_QP_ATTACH_MR_QP_HANDLE ); +struct ib_mr *mr = +uverbs_attr_get_obj (attrs,UVERBS_ATTR_QP_ATTACH_MR_MR_HANDLE ); +u64 caps = qp->device->attrs.device_cap_flags; +u32 id; +int ret; + +if (!qp->device->ops.qp_attach_mr) +return -EOPNOTSUPP ; + +if (qp->real_qp != qp || qp->qp_type !=IB_QPT_RU ) +return -EINVAL ; + +if (mr->pd != qp->pd || mr->type !=IB_MR_TYPE_USER ) +return -EINVAL ; + +/* the device has to implement the access class the region asks for */ +if (!(caps & (mr->jkey ?IB_DEVICE_MR_QP_JOB_RESTRICTED : +IB_DEVICE_MR_QP_RESTRICTED ))) +return -EOPNOTSUPP ; + +/* a region restricted to a job serves a QP in that job */ +if (mr->jkey && (!qp->jkey || qp->jkey->job != mr->jkey->job)) +return -EINVAL ; + +/* one QP at a time */ +if (cmpxchg (&mr->attached_qp,NULL , qp)) +return -EBUSY ; + + ret =xa_alloc (&qp->attached_mrs, &id, mr, xa_limit_32b,GFP_KERNEL ); +if (ret) + goto err_claim; + + ret = qp->device->ops.qp_attach_mr (qp, mr); +if (ret) + goto err_xa; + +/* the QP holds the region until detach or its own destroy */ + mr->attach_id = id; +atomic_inc (&mr->usecnt); + +return 0 ; + +err_xa: +xa_erase (&qp->attached_mrs, id); +err_claim: +WRITE_ONCE (mr->attached_qp,NULL ); +return ret; +} + +static int UVERBS_HANDLER (UVERBS_METHOD_QP_DETACH_MR )( +struct uverbs_attr_bundle *attrs) +{ +struct ib_qp *qp = +uverbs_attr_get_obj (attrs,UVERBS_ATTR_QP_DETACH_MR_QP_HANDLE ); +struct ib_mr *mr = +uverbs_attr_get_obj (attrs,UVERBS_ATTR_QP_DETACH_MR_MR_HANDLE ); +int ret; + +if (!qp->device->ops.qp_detach_mr) +return -EOPNOTSUPP ; + +if (qp->real_qp != qp) +return -EINVAL ; + +if (READ_ONCE (mr->attached_qp) != qp) +return -EINVAL ; + + ret = qp->device->ops.qp_detach_mr (qp, mr); +if (ret) +return ret; + +xa_erase (&qp->attached_mrs, mr->attach_id); +WRITE_ONCE (mr->attached_qp,NULL ); +atomic_dec (&mr->usecnt); + +return 0 ; +}
[ ... ]
Quoted 4 lines
drivers/infiniband/core/verbs.c +0
-0
[ ... ]
drivers/infiniband/core/verbs.c int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata) · line 2260
Quoted 10 lines
drivers/infiniband/core/verbs.c +6
-0@@ -2249,6 +2252,13 @@ int ib_destroy_qp_user(struct ib_qp *qp, struct ib_udata *udata)atomic_dec (&cc->usecnt);xa_destroy (&qp->comp_cntrs); +/* the driver ended the bindings with the QP, release the regions */ +xa_for_each (&qp->attached_mrs, index, mr) { +WRITE_ONCE (mr->attached_qp,NULL ); +atomic_dec (&mr->usecnt); + } +xa_destroy (&qp->attached_mrs);
[Severity: Critical]
Can this sequence in ib_destroy_qp_user() cause a use-after-free write to mr->attached_qp or a race on mr->usecnt?
In ib_destroy_qp_user(), only the QP's ib_uobject is locked, and no lock is held on the attached MRs. If one thread destroys the QP while another thread concurrently destroys the MR via uverbs_free_mr():
CPU0 CPU1ib_destroy_qp_user() uverbs_free_mr()
WRITE_ONCE(mr->attached_qp, NULL);
atomic_dec(&mr->usecnt);
if (atomic_read(&mr->usecnt))
return -EBUSY;
ib_dereg_mr_user(mr, ...)
-> dereg_mr(mr, ...)
-> kfree(mr)Because non-value-returning atomic_dec() and atomic_read() are relaxed operations without release or acquire ordering, on weakly-ordered architectures atomic_dec(&mr->usecnt) can be reordered before WRITE_ONCE(mr->attached_qp, NULL) becomes visible. CPU1 can observe atomic_read(&mr->usecnt) == 0 and free mr before CPU0's store to mr->attached_qp completes.
Additionally, both ib_destroy_qp_user() and UVERBS_HANDLER(UVERBS_METHOD_QP_DETACH_MR) clear mr->attached_qp before calling atomic_dec(&mr->usecnt), while UVERBS_METHOD_QP_ATTACH_MR and UVERBS_METHOD_QP_DETACH_MR only hold a shared UVERBS_ACCESS_READ lock on the MR's uobject. Once mr->attached_qp is cleared to NULL, another thread can attach and detach the MR on a second QP via cmpxchg(&mr->attached_qp, NULL, qp2) and then call uverbs_free_mr() or ib_uverbs_rereg_mr() before the first thread runs atomic_dec(&mr->usecnt), causing a spurious -EBUSY or -EINVAL failure while mr->usecnt is still elevated.
Should mr->usecnt be decremented before clearing mr->attached_qp (or with proper ordering / exclusive uobject locking on the MR) so that mr cannot be freed or re-attached while the prior detach or QP teardown is still touching it?
Quoted 4 lines
drivers/infiniband/core/verbs.c +1
-0+ib_qp_usecnt_dec (qp);if (sec)ib_destroy_qp_security_end (sec);
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
Re: [PATCH rdma-next v2 13/13] RDMA/core: attach a memory region to a queue pair
Quoted 2 lines · On Tue, Oct 20, 2026 at 3:21 AM <[email protected]> wrote:
Can this sequence in
ib_destroy_qp_user()cause a use-after-free write tomr->attached_qpor a race onmr->usecnt?
The first part is real and will be fixed in v3. A relaxed atomic_dec() can become visible before the store to mr->attached_qp, and a concurrent uverbs_free_mr() can then free the region under it.
Quoted 1 line
Should
mr->usecntbe decremented before clearingmr->attached_qp
No, that opens the same window from the other side. Once usecnt is zero, uverbs_free_mr() can free the region before mr->attached_qp is cleared. v3 will keep the order and make the decrement a release, with smp_mb__before_atomic(), so the cleared pointer is visible before the count can read zero. uverbs_free_mr() frees only after it reads usecnt, so that side is ordered by the control dependency.
Quoted 4 lines
Once
mr->attached_qpis cleared to NULL, another thread can attach and detach the MR on a second QP [...] and then calluverbs_free_mr()orib_uverbs_rereg_mr()before the first thread runsatomic_dec(&mr->usecnt)
This cannot happen. Attach and detach take the MR handle with UVERBS_ACCESS_READ, and destroy and rereg need it exclusively, so neither can run while a detach is between clearing the pointer and dropping the count. A concurrent destroy gets -EBUSY from the uobject lock.
Quoted 2 lines
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
Thanks,
- eric