From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2F9C378D70 for ; Fri, 6 Mar 2026 08:25:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772785554; cv=none; b=bd9hAkPdJ4bFu+WDaBZ9gQyrJaD/uuuFeE2+XZuI8ClllR4lNHgL+iILY7NTKlIbclkIcHTokLBxw3w4reKy5FnwUJbHe0gpHtzGNGM54pFk/0Nbucw0a+GBwVZE15nNQTrgaW2IIOE3UDSc9TBfcTQfoQWgtSsMBYxxMLSqr54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772785554; c=relaxed/simple; bh=vgs6OvFfhn6LgRJBXvD8e7DncJV6JvlCX+BURozjQ2k=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pF8gfPK5O9bj8NhwN1ZfG5oJiiXpWw4MXebUCnWxQwXctGUthI3JPmUuhOohrFzmm9HEB/Un39RdjAWqqc6vWPQJsDNCgdPtOHBAVx81JqLU2xukjH9ADfErc8rjwA+hD13nzwdlZjj3OK2lESVo8M/oTwCQtP8OvcKIOlXRHKI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=l3UIuYv1; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="l3UIuYv1" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772785551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AUMKZd8SUAnYq8W0a6TH01hT+Tx21DpSkFW2LXP37DM=; b=l3UIuYv106BuXj3MFtGh6JFLrKZW0zC22amxdMBfrKGuEkXyUSeccKXZnLRDraxfRGOwPs Llu1WysskJEwfJaRU64HoiNUIzBWTgWl+pekS504688Xn6HO9In9FuU0jGijc737bqnXPc X/aK5ivRtwZHZFtJJk3urmdQ5drvVY4= From: Zhu Yanjun To: jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com, yanjun.zhu@linux.dev, dsahern@kernel.org, linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 2/4] RDMA/nldev: Add dellink function pointer Date: Fri, 6 Mar 2026 00:24:50 -0800 Message-ID: <20260306082452.1822-3-yanjun.zhu@linux.dev> In-Reply-To: <20260306082452.1822-1-yanjun.zhu@linux.dev> References: <20260306082452.1822-1-yanjun.zhu@linux.dev> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT The newlink function pointer is added. And the sock listening on port 4791 is added in the newlink function. So the dellink function is needed to remove the sock. Signed-off-by: Zhu Yanjun --- drivers/infiniband/core/nldev.c | 6 ++++++ include/rdma/rdma_netlink.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index 2220a2dfab24..48684930660a 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -1824,6 +1824,12 @@ static int nldev_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, return -EINVAL; } + if (device->link_ops) { + err = device->link_ops->dellink(device); + if (err) + return err; + } + ib_unregister_device_and_put(device); return 0; } diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index 326deaf56d5d..2fd1358ea57d 100644 --- a/include/rdma/rdma_netlink.h +++ b/include/rdma/rdma_netlink.h @@ -5,6 +5,7 @@ #include #include +#include struct ib_device; @@ -126,6 +127,7 @@ struct rdma_link_ops { struct list_head list; const char *type; int (*newlink)(const char *ibdev_name, struct net_device *ndev); + int (*dellink)(struct ib_device *dev); }; void rdma_link_register(struct rdma_link_ops *ops); -- 2.52.0