git: d8afb9b13f41 - main - sys/ofed: don't stop removing stale RoCE GIDs at the first hole

Konstantin Belousov <[email protected]> Mon, 03 Aug 2026 20:45:31 +0000
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a70fdeb.36a95.12915ee7__26525.4514453531$1785789952$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8afb9b13f4141dc42fb1eb1c7c6a45bd2cd0bc4

commit d8afb9b13f4141dc42fb1eb1c7c6a45bd2cd0bc4
Author:     Ariel Ehrenberg <[email protected]>
AuthorDate: 2026-07-23 07:32:05 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2026-08-03 20:38:49 +0000

    sys/ofed: don't stop removing stale RoCE GIDs at the first hole
    
    When cleaning up stale GIDs the scan stopped as soon as
    rdma_get_gid_attr() failed. But that can also happen for empty entries
    in the middle of the table, so a single gap left everything after it
    behind and the GID entries could eventually run out.
    
    Now the whole table is scanned and the empty slots are simply skipped.
    
    Reviewed by:  kib, jhb
    Sponsored by: Nvidia networking
    Fixes:        6a75471dbcf0 ("OFED: Various changes from Linux 4.19")
    Differential revision: https://reviews.freebsd.org/D58510
---
 sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
index e24a6645e8e4..d6d882dd59b3 100644
--- a/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
+++ b/sys/ofed/drivers/infiniband/core/ib_roce_gid_mgmt.c
@@ -213,6 +213,7 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port,
 	union ib_gid gid;
 	if_t ifp;
 	int default_gids;
+	int gid_tbl_len;
 	int i;
 
 	struct ipx_queue ipx_head;
@@ -271,13 +272,15 @@ roce_gid_update_addr_callback(struct ib_device *device, u8 port,
 		update_gid(GID_ADD, device, port, &gid, entry->ndev);
 	}
 
+	gid_tbl_len = device->port_immutable[port].gid_tbl_len;
+
 	/* remove stale GIDs, if any */
-	for (i = default_gids;; i++) {
+	for (i = default_gids; i < gid_tbl_len; i++) {
 		union ipx_addr ipx;
 
 		sgid_attr = rdma_get_gid_attr(device, port, i);
 		if (IS_ERR(sgid_attr))
-			break;
+			continue;
 
 		ndev = sgid_attr->ndev;
 		gid = sgid_attr->gid;