From patchwork Fri Aug 9 08:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liujian (CE)" X-Patchwork-Id: 13758543 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.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 C1449172777; Fri, 9 Aug 2024 08:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192445; cv=none; b=s6CadY7URLOQsfkGlkOtVaPjIvp+cfS3pqUi8uh9cUyP3vjPav0kwLCu3Nnrenb1biJ9XClqgOpCIUpszmVE4TGBdhAVUz/aNVTxiWHEHpbD133p2kmDWpA8dGL6RN8kvasotGXr3p+FIcIHDkP0hZ1rqvJzo3R7qw0bbMlVai4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192445; c=relaxed/simple; bh=TX3HGDVxWuOflDsmvz9im7nGaQb1U7mshaR7GJs95eY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D/n6D+h+TryUYsUllUkHdtxYjkSo68xKbqGMUE8noNN3LCGrtwBBew9EYoUhj5PmE4T4/XDdcqjoaWqhYLUtkfBxjQAnzh7NigtoJMrgYvctgT8PQlzIdxFUelQ7YNiY3HHSct+xK0Em7wBN9dp8a+eYNA2vZEahSbXw67sFur8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WgHBz0dnXzQnS1; Fri, 9 Aug 2024 16:29:31 +0800 (CST) Received: from kwepemg200003.china.huawei.com (unknown [7.202.181.30]) by mail.maildlp.com (Postfix) with ESMTPS id DAE3314022D; Fri, 9 Aug 2024 16:33:59 +0800 (CST) Received: from huawei.com (10.175.101.6) by kwepemg200003.china.huawei.com (7.202.181.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 9 Aug 2024 16:33:58 +0800 From: Liu Jian To: , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 1/4] rdma/device: export ib_device_get_netdev() Date: Fri, 9 Aug 2024 16:31:45 +0800 Message-ID: <20240809083148.1989912-2-liujian56@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809083148.1989912-1-liujian56@huawei.com> References: <20240809083148.1989912-1-liujian56@huawei.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemg200003.china.huawei.com (7.202.181.30) Many drivers do not implement the ib_device_ops.get_netdev callback function; for them, use the generic helper function ib_device_get_netdev() enough. Therefore, this patch exports ib_device_get_netdev() helper allows it to be used in other modules. Signed-off-by: Liu Jian --- drivers/infiniband/core/core_priv.h | 3 --- drivers/infiniband/core/device.c | 1 + include/rdma/ib_verbs.h | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index dd7715ba9fd1..693b3ded69e1 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -87,9 +87,6 @@ typedef void (*roce_netdev_callback)(struct ib_device *device, u32 port, typedef bool (*roce_netdev_filter)(struct ib_device *device, u32 port, struct net_device *idev, void *cookie); -struct net_device *ib_device_get_netdev(struct ib_device *ib_dev, - u32 port); - void ib_enum_roce_netdev(struct ib_device *ib_dev, roce_netdev_filter filter, void *filter_cookie, diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 0290aca18d26..d25923285447 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2263,6 +2263,7 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev, return res; } +EXPORT_SYMBOL(ib_device_get_netdev); /** * ib_device_get_by_netdev - Find an IB device associated with a netdev diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 6c5712ae559d..0fe252c32d60 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -4453,6 +4453,8 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u32 port, const struct sockaddr *addr); int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev, unsigned int port); +struct net_device *ib_device_get_netdev(struct ib_device *ib_dev, + u32 port); struct ib_wq *ib_create_wq(struct ib_pd *pd, struct ib_wq_init_attr *init_attr); int ib_destroy_wq_user(struct ib_wq *wq, struct ib_udata *udata); From patchwork Fri Aug 9 08:31:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liujian (CE)" X-Patchwork-Id: 13758544 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 1C80B175D2C; Fri, 9 Aug 2024 08:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192445; cv=none; b=rlOUyw8UWxjnEGGQhzt2xEVCQhLwxGaK3w2OnJFknGSAh9S5R3iKEQKBwXNLRUluepuAskQ3Q1QpdVEeES4ji9m4slz/d7OYIUttCw1nhjCXEz8XMRV1kHKoc1zFwOrJZp+C3t1NTzKQD7ayG6ri0XLkrti9DmpLn+FLtV2ry4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192445; c=relaxed/simple; bh=WL+Vpt1o1fRx+b+VsZXDsC+gUzZIpPPAMR8U539fikU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cVMrtDGRhYdLerrb9Z0JNxKNAKVFDL84IiqRBE41xGamZhpS7ybcTUDuIJFJI7i5l10S4MoQyOsMX3Eb+EomCT7Z3F3+VQAM3v3nrJKEbTYMD66QswhYK8JohbLSQ2Mij4T6LHmScg1sW7cWpAQg2/XC9TvBUYyhb4KR17Uo+Xo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WgHFy1MWxzfb7m; Fri, 9 Aug 2024 16:32:06 +0800 (CST) Received: from kwepemg200003.china.huawei.com (unknown [7.202.181.30]) by mail.maildlp.com (Postfix) with ESMTPS id EBC041400C9; Fri, 9 Aug 2024 16:34:00 +0800 (CST) Received: from huawei.com (10.175.101.6) by kwepemg200003.china.huawei.com (7.202.181.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 9 Aug 2024 16:33:59 +0800 From: Liu Jian To: , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 2/4] net/smc: use ib_device_get_netdev() helper to get netdev info Date: Fri, 9 Aug 2024 16:31:46 +0800 Message-ID: <20240809083148.1989912-3-liujian56@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809083148.1989912-1-liujian56@huawei.com> References: <20240809083148.1989912-1-liujian56@huawei.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemg200003.china.huawei.com (7.202.181.30) Currently, in the SMC protocol, network devices are obtained by calling ib_device_ops.get_netdev(). But for some drivers, this callback function is not implemented separately. Therefore, here I modified to use ib_device_get_netdev() to get net_device. For rdma devices that do not implement ib_device_ops.get_netdev(), one of the issues addressed is as follows: before: smcr device Net-Dev IB-Dev IB-P IB-State Type Crit #Links PNET-ID rxee 1 ACTIVE 0 No 0 after: smcr device Net-Dev IB-Dev IB-P IB-State Type Crit #Links PNET-ID enp1s0f1 rxee 1 ACTIVE 0 No 0 Signed-off-by: Liu Jian Reviewed-by: Dust Li --- net/smc/smc_ib.c | 8 +++----- net/smc/smc_pnet.c | 6 +----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index 9297dc20bfe2..382351ac9434 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -899,9 +899,7 @@ static void smc_copy_netdev_ifindex(struct smc_ib_device *smcibdev, int port) struct ib_device *ibdev = smcibdev->ibdev; struct net_device *ndev; - if (!ibdev->ops.get_netdev) - return; - ndev = ibdev->ops.get_netdev(ibdev, port + 1); + ndev = ib_device_get_netdev(ibdev, port + 1); if (ndev) { smcibdev->ndev_ifidx[port] = ndev->ifindex; dev_put(ndev); @@ -921,9 +919,9 @@ void smc_ib_ndev_change(struct net_device *ndev, unsigned long event) port_cnt = smcibdev->ibdev->phys_port_cnt; for (i = 0; i < min_t(size_t, port_cnt, SMC_MAX_PORTS); i++) { libdev = smcibdev->ibdev; - if (!libdev->ops.get_netdev) + lndev = ib_device_get_netdev(libdev, i + 1); + if (!lndev) continue; - lndev = libdev->ops.get_netdev(libdev, i + 1); dev_put(lndev); if (lndev != ndev) continue; diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c index 2adb92b8c469..a55a697a48de 100644 --- a/net/smc/smc_pnet.c +++ b/net/smc/smc_pnet.c @@ -1055,11 +1055,7 @@ static void smc_pnet_find_rdma_dev(struct net_device *netdev, continue; for (i = 1; i <= SMC_MAX_PORTS; i++) { - if (!rdma_is_port_valid(ibdev->ibdev, i)) - continue; - if (!ibdev->ibdev->ops.get_netdev) - continue; - ndev = ibdev->ibdev->ops.get_netdev(ibdev->ibdev, i); + ndev = ib_device_get_netdev(ibdev->ibdev, i); if (!ndev) continue; dev_put(ndev); From patchwork Fri Aug 9 08:31:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liujian (CE)" X-Patchwork-Id: 13758545 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 0C28D18FDB4; Fri, 9 Aug 2024 08:34:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192447; cv=none; b=jw5I76rBsXAgdBn/mFCqv/vXoCuvlTeoBc2YLVWojOpM3JFkgpdElaZHCo25Vor7d7AkEqMvINhyE8k+mNEq9NAiGomA44AOsqirqhSJEl9QlaN8gwq6TBzpjfgn9uZPXCD2ACbVk8RqanEQWPmH4XI6+EpcAhILhK0xFRMLuHg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192447; c=relaxed/simple; bh=o7zdzIMEvYJzAUMY8b9aGmbbDq1Bj6B6JV3A0LMKWTk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d16th4fZUqal1jP1GfAGxdOBDM5LWNDsHFYHQOpP510nlWVvnv61wwkilEEE6xpIAzVtATpy1+mnJV3vuqlvZCqZICm/Y9O2RXtL79VeXdJ8OOMGnyvtAwElg7oK7mwJMRcWHdBoAP7eWcJEy0hp9fJsbUkOtDJlt4vPUtHDxiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WgHC14zQgz20lHB; Fri, 9 Aug 2024 16:29:33 +0800 (CST) Received: from kwepemg200003.china.huawei.com (unknown [7.202.181.30]) by mail.maildlp.com (Postfix) with ESMTPS id 113DF1400F4; Fri, 9 Aug 2024 16:34:02 +0800 (CST) Received: from huawei.com (10.175.101.6) by kwepemg200003.china.huawei.com (7.202.181.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 9 Aug 2024 16:34:00 +0800 From: Liu Jian To: , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 3/4] net/smc: fix one NULL pointer dereference in smc_ib_is_sg_need_sync() Date: Fri, 9 Aug 2024 16:31:47 +0800 Message-ID: <20240809083148.1989912-4-liujian56@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809083148.1989912-1-liujian56@huawei.com> References: <20240809083148.1989912-1-liujian56@huawei.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemg200003.china.huawei.com (7.202.181.30) BUG: kernel NULL pointer dereference, address: 0000000000000238 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 3 PID: 289 Comm: kworker/3:1 Kdump: loaded Tainted: G OE Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Workqueue: smc_hs_wq smc_listen_work [smc] RIP: 0010:dma_need_sync+0x5/0x60 ... Call Trace: ? dma_need_sync+0x5/0x60 ? smc_ib_is_sg_need_sync+0x61/0xf0 [smc] smcr_buf_map_link+0x24a/0x380 [smc] __smc_buf_create+0x483/0xb10 [smc] smc_buf_create+0x21/0xe0 [smc] smc_listen_work+0xf11/0x14f0 [smc] ? smc_tcp_listen_work+0x364/0x520 [smc] process_one_work+0x18d/0x3f0 worker_thread+0x304/0x440 kthread+0xe4/0x110 ret_from_fork+0x47/0x70 ret_from_fork_asm+0x1a/0x30 If the software RoCE device is used, ibdev->dma_device is a null pointer. As a result, the problem occurs. Null pointer detection is added to prevent problems. Signed-off-by: Liu Jian Reviewed-by: Wen Gu Reviewed-by: Dust Li --- net/smc/smc_ib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index 382351ac9434..059822cc3fde 100644 --- a/net/smc/smc_ib.c +++ b/net/smc/smc_ib.c @@ -748,6 +748,8 @@ bool smc_ib_is_sg_need_sync(struct smc_link *lnk, buf_slot->sgt[lnk->link_idx].nents, i) { if (!sg_dma_len(sg)) break; + if (!lnk->smcibdev->ibdev->dma_device) + break; if (dma_need_sync(lnk->smcibdev->ibdev->dma_device, sg_dma_address(sg))) { ret = true; From patchwork Fri Aug 9 08:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liujian (CE)" X-Patchwork-Id: 13758546 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 2E337161314; Fri, 9 Aug 2024 08:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192448; cv=none; b=OXSH+HGzQ9M/sVVSFnHyHzHHWEPW82BnCKtv3SgHpO7ntX7Bk3dZmtXSSAbDaEqgkAezjRZpDcjNnHMYLV3yuAKUmhx57GwQe7E0YZazSAd5ywcrjq5WMZZFxCot9V2q/lFNzKQBUSD7AItPcXTL9fax3kX7us/yegWbx1OlC2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723192448; c=relaxed/simple; bh=EdHOUkQapbsYvW7Pa+mxJXDUYf7diS/nM8cKhTfa670=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G1JI/1UllCJFNKAevlZC8UTl5hexklUbcmiqzOILax4gKykwmAOvfN4dYda1HhcQOkfwITi4TYUGg9+Frlbtf23E9EGVRoDxMDW9LjNyqdOU/y9QESiPc78x65lFo8krjAA/hIAlXFsgyCKC+9Cu6zu2yygtgI7pIOnlrhvoH74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WgHBj6Yrcz1j6Nb; Fri, 9 Aug 2024 16:29:17 +0800 (CST) Received: from kwepemg200003.china.huawei.com (unknown [7.202.181.30]) by mail.maildlp.com (Postfix) with ESMTPS id 2DBFC1A0188; Fri, 9 Aug 2024 16:34:03 +0800 (CST) Received: from huawei.com (10.175.101.6) by kwepemg200003.china.huawei.com (7.202.181.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 9 Aug 2024 16:34:01 +0800 From: Liu Jian To: , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 4/4] RDMA/rxe: Set queue pair cur_qp_state when being queried Date: Fri, 9 Aug 2024 16:31:48 +0800 Message-ID: <20240809083148.1989912-5-liujian56@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240809083148.1989912-1-liujian56@huawei.com> References: <20240809083148.1989912-1-liujian56@huawei.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemg200003.china.huawei.com (7.202.181.30) Same with commit e375b9c92985 ("RDMA/cxgb4: Set queue pair state when being queried"). The API for ib_query_qp requires the driver to set cur_qp_state on return, add the missing set. Fixes: 8700e3e7c485 ("Soft RoCE driver") Signed-off-by: Liu Jian Reviewed-by: Zhu Yanjun --- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index 5c18f7e342f2..699b4b315336 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -634,6 +634,8 @@ static int rxe_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, rxe_qp_to_init(qp, init); rxe_qp_to_attr(qp, attr, mask); + attr->cur_qp_state = qp->attr.qp_state; + return 0; }