From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 435DE2FFF94 for ; Tue, 10 Mar 2026 02:05:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773108344; cv=none; b=Uz5lc9ARIR4Tyn1Q4MVux7wCeOuquSkcsCsbHhqCIVJLIWQipSeGnJtUVw57qyyKmJbAhBCXB7yDtXpG6DdkaVmvzaJywu52rhqOQxMjwhHgJqwr5W9pnCcJ3PklxRV6hP35VGaCoSipgHB/nqnYKOZZX8xCYawEJQvQ3HYiwo0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773108344; c=relaxed/simple; bh=LIdkEGBWo9mZ6u+HWblbI00HwBK7dNvIAibOfxHGI+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=br9A+SdwLU4NIYPa1NNs6VcZGIggeGPo2Rev1gw8aBseNS6jTyerDmbvA+pwHX5jdxrmsDGltwx+UmXz+EaoinS7O1qIG+7BYZD3bwG8fZhrg8ZX7AtshA6Gxu2j4TEQP9n2oBcPnVZay8c0ZBJ3dQ1K1rFntgXqZKIfAzw1/CE= 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=GuWdX+0/; arc=none smtp.client-ip=91.218.175.180 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="GuWdX+0/" 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=1773108340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ln2krVl2jzEJNwnoVRufgqLx/4bxUV/txyd9CDOh+dU=; b=GuWdX+0/mD2hqXX+eFB/CgGAkfKRRI2SFzxseM5Dr3WYEXQ8X3/JmaJdngFLzHOpBC6RHr aYYDhpzqHK12BY4B2X7+OeACBqZP+VUod3AK9SxKT7s+2R33UL4+S593baqm9IC221lGYg DX+NZIjn6odce9HtfEdg1rhqOKAmD2s= From: Zhu Yanjun To: jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com, shuah@kernel.org, linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org, dsahern@kernel.org Cc: Zhu Yanjun Subject: [PATCH v5 1/4] RDMA/nldev: Add dellink function pointer Date: Tue, 10 Mar 2026 03:05:15 +0100 Message-ID: <20260310020519.101415-2-yanjun.zhu@linux.dev> In-Reply-To: <20260310020519.101415-1-yanjun.zhu@linux.dev> References: <20260310020519.101415-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.53.0