summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ionic/ionic_ibdev.c
AgeCommit message (Collapse)Author
2026-09-30RDMA/ionic: implement SRQ event handling supportAmit Kumar
Introduce SRQ event types and associated events. Report these events through the SRQ event handler during event processing. Signed-off-by: Amit Kumar <a.k@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20260930092111.3176738-6-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-09-30RDMA/ionic: add Shared receive queue (SRQ) supportAmit Kumar
Implement device supported verb APIs for shared receive queue. SRQ is supported for userspace only. ionic_create_srq() returns -EOPNOTSUPP when there is no ucontext, so kernel ULPs cannot create an SRQ. Signed-off-by: Amit Kumar <a.k@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20260930092111.3176738-5-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-09-29RDMA/ionic: Fix XArray initialization to use XArray flagsAbhijit Gangurde
xa_init_flags() takes XArray flags (XA_FLAGS_*), not gfp flags, even though the parameter is typed gfp_t. Passing GFP_ATOMIC leaves both lock-type bits clear, so xa_lock_type() resolves to XA_LOCK_NORMAL for qp_tbl and cq_tbl. Both tables are used with the IRQ-safe accessors: xa_store_irq() with GFP_KERNEL from process context, and xa_lock_irqsave() from the event queue path. When a store needs to grow the tree, __xas_nomem() drops the lock using the recorded lock type before allocating: if (gfpflags_allow_blocking(gfp)) { xas_unlock_type(xas, lock_type); xas->xa_alloc = kmem_cache_alloc_lru(...); xas_lock_type(xas, lock_type); } With XA_LOCK_NORMAL that is a plain spin_unlock(), so the sleeping GFP_KERNEL allocation runs with interrupts still disabled by xa_store_irq(), and lockdep annotates the lock with the wrong class. GFP_ATOMIC also happens to set __GFP_HIGH (0x20), which collides with XA_FLAGS_ACCOUNT (32U) and silently enables memcg accounting of the XArray nodes. Use XA_FLAGS_LOCK_IRQ so the lock type matches how the tables are actually accessed. Fixes: e8521822c733 ("RDMA/ionic: Register device ops for control path") Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20260925093638.3032149-1-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-07-20RDMA/ionic: Add robust udata compatibility checks to all uapi verbsAbhijit Gangurde
Enable the robust udata contract by setting uverbs_robust_udata and adding proper input validation and output handling to all verbs that accept struct ib_udata. For verbs with no driver request or response struct, add ib_no_udata_io(). For create_ah, which already responds with ionic_ah_resp, add the missing input validation via ib_is_udata_in_empty(). Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20260717092345.2533564-1-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-07-20RDMA: Use ib_no_udata_io() in query_device callbacksLeon Romanovsky
The query_device callbacks that neither accept driver-specific input nor return a driver-specific response open-code the empty udata handling as ib_is_udata_in_empty() on entry and ib_respond_empty_udata() on exit. ib_no_udata_io() already combines both steps, so replace the entry check with it and simply return 0 on success. Unlike the create and destroy flows, query_device owns no uobject or HW resource - the extended path fills a stack ib_device_attr that the core discards on error - so clearing the empty response buffer on entry rather than on exit is a mechanical change with no functional difference. Link: https://patch.msgid.link/20260714-convert-to-noio-udata-v1-1-f1f6b6c7c988@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
2026-06-03RDMA: Update the query_device() opJason Gunthorpe
This op hasn't followed the normal pattern of passing NULL for udata when invoked by the kernel. Instead the kernel caller creates a dummy ib_udata on the stack and passes that in. It does not seem to currently be a bug, but this flow should be modernized to use the new API flow and in the process accept NULL as well. Only mlx4 uses an input request structure, have every other driver call ib_is_udata_in_empty() to enforce the lack of request structs. Use ib_respond_empty_udata() in every driver that does not use a response struct. Ensure a check for NULL udata before calling ib_respond_udata() in bnxt_re, efa, and mlx5. Make mlx4 safe to be called with NULL. Link: https://patch.msgid.link/r/2-v1-922fa8e828ba+f7-ib_udata_stack_jgg@nvidia.com Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2026-05-02RDMA/ionic: Fix typo in format stringJason Gunthorpe
Applying the corrupted patch by hand mangled the format string, put the s in the right place. Cc: stable@vger.kernel.org Fixes: 654a27f25530 ("RDMA/ionic: bound node_desc sysfs read with %.64s") Link: https://patch.msgid.link/r/1-v1-41f3135e5565+9d2-rdma_ai_fixes1_jgg@nvidia.com Reported-by: Brad Spengler <brad.spengler@opensrcsec.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2026-04-09RDMA/ionic: bound node_desc sysfs read with %.64sKai Zen
node_desc[64] in struct ib_device is not guaranteed to be NUL- terminated. The core IB sysfs handler uses "%.64s" for exactly this reason (drivers/infiniband/core/sysfs.c:1307), since node_desc_store() performs a raw memcpy of up to IB_DEVICE_NODE_DESC_MAX bytes with no NUL termination: memcpy(desc.node_desc, buf, min_t(int, count, IB_DEVICE_NODE_DESC_MAX)); If exactly 64 bytes are written via the node_desc sysfs file, the array contains no NUL byte. The ionic hca_type_show() handler uses unbounded "%s" and will read past the end of node_desc into adjacent fields of struct ib_device until it encounters a NUL. ionic supports IB_DEVICE_MODIFY_NODE_DESC, so this is triggerable by userspace. Match the core handler and bound the format specifier. Cc: stable@vger.kernel.org Fixes: 2075bbe8ef03 ("RDMA/ionic: Register device ops for miscellaneous functionality") Link: https://patch.msgid.link/r/CALynFi7NAbhDCt1tdaDbf6TnLvAqbaHa6-Wqf6OkzREbA_PAfg@mail.gmail.com Signed-off-by: Kai Aizen <kai.aizen.dev@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2026-02-24RDMA/ionic: Fix potential NULL pointer dereference in ionic_query_portKamal Heib
The function ionic_query_port() calls ib_device_get_netdev() without checking the return value which could lead to NULL pointer dereference, Fix it by checking the return value and return -ENODEV if the 'ndev' is NULL. Fixes: 2075bbe8ef03 ("RDMA/ionic: Register device ops for miscellaneous functionality") Signed-off-by: Kamal Heib <kheib@redhat.com> Link: https://patch.msgid.link/20260220222125.16973-2-kheib@redhat.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Implement device stats opsAbhijit Gangurde
Implement device stats operations for hw stats and qp stats. Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-14-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Register device ops for miscellaneous functionalityAbhijit Gangurde
Implement idbdev ops for device and port information. Co-developed-by: Andrew Boyer <andrew.boyer@amd.com> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com> Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-13-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Register device ops for datapathAbhijit Gangurde
Implement device supported verb APIs for datapath. Co-developed-by: Andrew Boyer <andrew.boyer@amd.com> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com> Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-12-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Register device ops for control pathAbhijit Gangurde
Implement device supported verb APIs for control path. Co-developed-by: Andrew Boyer <andrew.boyer@amd.com> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com> Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-11-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Create device queues to support admin operationsAbhijit Gangurde
Setup RDMA admin queues using device command exposed over auxiliary device and manage these queues using ida. Co-developed-by: Andrew Boyer <andrew.boyer@amd.com> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com> Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-10-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
2025-09-11RDMA/ionic: Register auxiliary module for ionic ethernet adapterAbhijit Gangurde
Register auxiliary module to create ibdevice for ionic ethernet adapter. Co-developed-by: Andrew Boyer <andrew.boyer@amd.com> Signed-off-by: Andrew Boyer <andrew.boyer@amd.com> Co-developed-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Allen Hubbe <allen.hubbe@amd.com> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com> Link: https://patch.msgid.link/20250903061606.4139957-9-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky <leon@kernel.org>