From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB910C433EF for ; Mon, 9 Sep 2019 09:07:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E39B21924 for ; Mon, 9 Sep 2019 09:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389623AbfIIJHY (ORCPT ); Mon, 9 Sep 2019 05:07:24 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:48369 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389617AbfIIJHT (ORCPT ); Mon, 9 Sep 2019 05:07:19 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noaos@mellanox.com) with ESMTPS (AES256-SHA encrypted); 9 Sep 2019 12:07:16 +0300 Received: from reg-l-vrt-059-007.mtl.labs.mlnx (reg-l-vrt-059-007.mtl.labs.mlnx [10.135.59.7]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x8997Fp0028426; Mon, 9 Sep 2019 12:07:16 +0300 From: Noa Osherovich To: dledford@redhat.com, jgg@mellanox.com, leonro@mellanox.com Cc: linux-rdma@vger.kernel.org, Maxim Chicherin Subject: [PATCH rdma-core 02/12] pyverbs: Fix CQ and PD assignment in QPAttr Date: Mon, 9 Sep 2019 12:07:02 +0300 Message-Id: <20190909090712.11029-3-noaos@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190909090712.11029-1-noaos@mellanox.com> References: <20190909090712.11029-1-noaos@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Maxim Chicherin Fixed CQs assignment in QPInitAttr, QPInitAttrEx and QP objects: Receive cq parameter was assigned to send_cq attribute in InitAttr objects, and in QP rcq and scq attributes was not initialized properly. Fixed PD assignment in QPInitAttrEx object: In QPInitAttrEx pd pointer was not initialized with PD.pd pointer. Signed-off-by: Maxim Chicherin --- pyverbs/qp.pyx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) mode change 100644 => 100755 pyverbs/qp.pyx diff --git a/pyverbs/qp.pyx b/pyverbs/qp.pyx old mode 100644 new mode 100755 index ad89c94c002e..732ef5094b6b --- a/pyverbs/qp.pyx +++ b/pyverbs/qp.pyx @@ -104,9 +104,9 @@ cdef class QPInitAttr(PyverbsObject): self.attr.qp_context = qp_context if scq is not None: if type(scq) is CQ: - self.attr.send_cq = (rcq).cq + self.attr.send_cq = (scq).cq elif type(scq) is CQEX: - self.attr.send_cq = (rcq).ibv_cq + self.attr.send_cq = (scq).ibv_cq else: raise PyverbsUserError('Expected CQ/CQEX, got {t}'.\ format(t=type(scq))) @@ -221,9 +221,9 @@ cdef class QPInitAttrEx(PyverbsObject): _copy_caps(cap, self) if scq is not None: if type(scq) is CQ: - self.attr.send_cq = (rcq).cq + self.attr.send_cq = (scq).cq elif type(scq) is CQEX: - self.attr.send_cq = (rcq).ibv_cq + self.attr.send_cq = (scq).ibv_cq else: raise PyverbsUserError('Expected CQ/CQEX, got {t}'.\ format(t=type(scq))) @@ -251,6 +251,7 @@ cdef class QPInitAttrEx(PyverbsObject): self.attr.comp_mask = comp_mask if pd is not None: self.pd = pd + self.attr.pd = pd.pd self.attr.create_flags = create_flags self.attr.max_tso_header = max_tso_header self.attr.source_qpn = source_qpn @@ -814,18 +815,20 @@ cdef class QP(PyverbsCM): if type(init_attr.send_cq) == CQ: cq = init_attr.send_cq cq.add_ref(self) + self.scq = cq else: cqex = init_attr.send_cq cqex.add_ref(self) - self.scq = cq + self.scq = cqex if init_attr.send_cq != init_attr.recv_cq and init_attr.recv_cq is not None: if type(init_attr.recv_cq) == CQ: cq = init_attr.recv_cq cq.add_ref(self) + self.rcq = cq else: cqex = init_attr.recv_cq cqex.add_ref(self) - self.rcq = cq + self.rcq = cqex def _create_qp(self, PD pd, QPInitAttr attr): self.qp = v.ibv_create_qp(pd.pd, &attr.attr) -- 2.21.0