summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-12 08:31:12 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-12 08:31:12 -0800
commitd53f4d93f3d686fd64513abb3977c9116bbfdaf8 (patch)
tree0e321b1b2c23ff74cfdc3d3f17c1f9b4f92640e4 /drivers/infiniband
parent2831fa8b8bcf1083f9526aa0c41fafb0796cf874 (diff)
parent8f7df60fe063b6b8f039af1042a4b99214347dd1 (diff)
Merge tag 'v7.0-rc-part1-ksmbd-and-smbdirect-fixes' of git://git.samba.org/ksmbd
Pull smb server and smbdirect updates from Steve French: - Fix tcp connection leak - Fix potential use after free when freeing multichannel - Fix locking problem in showing channel list - Locking improvement for tree connection - Fix infinite loop when signing errors - Add /proc interface for monitoring server state - Fixes to avoid mixing iWarp and InfiniBand/RoCEv1/RoCEv2 port ranges used for smbdirect - Fixes for smbdirect credit handling problems, these make the connections more reliable * tag 'v7.0-rc-part1-ksmbd-and-smbdirect-fixes' of git://git.samba.org/ksmbd: (32 commits) ksmbd: fix non-IPv6 build ksmbd: convert tree_conns_lock to rw_semaphore ksmbd: fix missing chann_lock while iterating session channel list ksmbd: add chann_lock to protect ksmbd_chann_list xarray smb: server: correct value for smb_direct_max_fragmented_recv_size smb: client: correct value for smbd_max_fragmented_recv_size smb: server: fix leak of active_num_conn in ksmbd_tcp_new_connection() ksmbd: add procfs interface for runtime monitoring and statistics ksmbd: fix infinite loop caused by next_smb2_rcv_hdr_off reset in error paths smb: server: make use of rdma_restrict_node_type() smb: client: make use of rdma_restrict_node_type() RDMA/core: introduce rdma_restrict_node_type() smb: client: let send_done handle a completion without IB_SEND_SIGNALED smb: client: let smbd_post_send_negotiate_req() use smbd_post_send() smb: client: fix last send credit problem causing disconnects smb: client: make use of smbdirect_socket.send_io.bcredits smb: client: use smbdirect_send_batch processing smb: client: introduce and use smbd_{alloc, free}_send_io() smb: client: split out smbd_ib_post_send() smb: client: port and use the wait_for_credits logic used by server ...
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c30
-rw-r--r--drivers/infiniband/core/cma_priv.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index f00f1d3fbd9c..0ee855a71ed4 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -793,6 +793,9 @@ static int cma_acquire_dev_by_src_ip(struct rdma_id_private *id_priv)
mutex_lock(&lock);
list_for_each_entry(cma_dev, &dev_list, list) {
+ if (id_priv->restricted_node_type != RDMA_NODE_UNSPECIFIED &&
+ id_priv->restricted_node_type != cma_dev->device->node_type)
+ continue;
rdma_for_each_port (cma_dev->device, port) {
gidp = rdma_protocol_roce(cma_dev->device, port) ?
&iboe_gid : &gid;
@@ -1015,6 +1018,7 @@ __rdma_create_id(struct net *net, rdma_cm_event_handler event_handler,
return ERR_PTR(-ENOMEM);
id_priv->state = RDMA_CM_IDLE;
+ id_priv->restricted_node_type = RDMA_NODE_UNSPECIFIED;
id_priv->id.context = context;
id_priv->id.event_handler = event_handler;
id_priv->id.ps = ps;
@@ -4177,6 +4181,32 @@ err:
}
EXPORT_SYMBOL(rdma_resolve_addr);
+int rdma_restrict_node_type(struct rdma_cm_id *id, u8 node_type)
+{
+ struct rdma_id_private *id_priv =
+ container_of(id, struct rdma_id_private, id);
+ int ret = 0;
+
+ switch (node_type) {
+ case RDMA_NODE_UNSPECIFIED:
+ case RDMA_NODE_IB_CA:
+ case RDMA_NODE_RNIC:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ mutex_lock(&lock);
+ if (id_priv->cma_dev)
+ ret = -EALREADY;
+ else
+ id_priv->restricted_node_type = node_type;
+ mutex_unlock(&lock);
+
+ return ret;
+}
+EXPORT_SYMBOL(rdma_restrict_node_type);
+
int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
{
struct rdma_id_private *id_priv =
diff --git a/drivers/infiniband/core/cma_priv.h b/drivers/infiniband/core/cma_priv.h
index c604b601f4d9..04332eb82668 100644
--- a/drivers/infiniband/core/cma_priv.h
+++ b/drivers/infiniband/core/cma_priv.h
@@ -72,6 +72,7 @@ struct rdma_id_private {
int internal_id;
enum rdma_cm_state state;
+ u8 restricted_node_type;
spinlock_t lock;
struct mutex qp_mutex;