summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2026-05-18 17:52:06 -0700
committerJakub Kicinski <kuba@kernel.org>2026-05-20 17:13:18 -0700
commit5026c42d7f147fb6bc4e063abfa5b52bfd52ca35 (patch)
tree7a7fd0dde81e91eb777b61e265ebcdc4bbb22527 /net
parenta2b5e31b668fbd59b3d5bff634d923fe9d1ac8b4 (diff)
smc: Use flexible array for SMCD connections
Store the per-DMB connection pointers in the SMCD device allocation instead of allocating a separate connection array. This keeps the connection table tied to the SMCD device lifetime and simplifies the allocation and cleanup paths. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com> Link: https://patch.msgid.link/20260519005206.628071-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/smc/smc_ism.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index e0dba2c7b6e3..bde938c5eb39 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -467,17 +467,14 @@ static struct smcd_dev *smcd_alloc_dev(const char *name, int max_dmbs)
{
struct smcd_dev *smcd;
- smcd = kzalloc_obj(*smcd);
+ smcd = kzalloc_flex(*smcd, conn, max_dmbs);
if (!smcd)
return NULL;
- smcd->conn = kzalloc_objs(struct smc_connection *, max_dmbs);
- if (!smcd->conn)
- goto free_smcd;
smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)",
WQ_MEM_RECLAIM, name);
if (!smcd->event_wq)
- goto free_conn;
+ goto free_smcd;
spin_lock_init(&smcd->lock);
spin_lock_init(&smcd->lgr_lock);
@@ -486,8 +483,6 @@ static struct smcd_dev *smcd_alloc_dev(const char *name, int max_dmbs)
init_waitqueue_head(&smcd->lgrs_deleted);
return smcd;
-free_conn:
- kfree(smcd->conn);
free_smcd:
kfree(smcd);
return NULL;
@@ -557,7 +552,6 @@ static void smcd_unregister_dev(struct dibs_dev *dibs)
list_del_init(&smcd->list);
mutex_unlock(&smcd_dev_list.mutex);
destroy_workqueue(smcd->event_wq);
- kfree(smcd->conn);
kfree(smcd);
}