From owner-svn-src-all@freebsd.org Fri May 1 21:22:27 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1A212B0005; Fri, 1 May 2020 21:22:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DQFH4pbwz47py; Fri, 1 May 2020 21:22:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85F90EAE6; Fri, 1 May 2020 21:22:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041LMROA096035; Fri, 1 May 2020 21:22:27 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LMRec096034; Fri, 1 May 2020 21:22:27 GMT (envelope-from np@FreeBSD.org) Message-Id: <202005012122.041LMRec096034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 1 May 2020 21:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360548 - stable/12/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: np X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 360548 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:22:27 -0000 Author: np Date: Fri May 1 21:22:26 2020 New Revision: 360548 URL: https://svnweb.freebsd.org/changeset/base/360548 Log: MFC r360211: cxgbe/iw_cxgbe: Create a LinuxKPI pci device for an adapter and use it as the dma_device during RDMA registration. cxgbe's struct device cannot be used as-is because it's a native FreeBSD driver and ibcore is LinuxKPI based. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri May 1 20:29:51 2020 (r360547) +++ stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri May 1 21:22:26 2020 (r360548) @@ -261,6 +261,7 @@ out: struct c4iw_dev { struct ib_device ibdev; + struct pci_dev pdev; struct c4iw_rdev rdev; u32 device_cap_flags; struct idr cqidr; Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c ============================================================================== --- stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c Fri May 1 20:29:51 2020 (r360547) +++ stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c Fri May 1 21:22:26 2020 (r360548) @@ -434,6 +434,9 @@ c4iw_register_device(struct c4iw_dev *dev) CTR3(KTR_IW_CXGBE, "%s c4iw_dev %p, adapter %p", __func__, dev, sc); BUG_ON(!sc->port[0]); + ret = linux_pci_attach_device(sc->dev, NULL, NULL, &dev->pdev); + if (ret) + return (ret); strlcpy(ibdev->name, device_get_nameunit(sc->dev), sizeof(ibdev->name)); memset(&ibdev->node_guid, 0, sizeof(ibdev->node_guid)); memcpy(&ibdev->node_guid, sc->port[0]->vi[0].hw_addr, ETHER_ADDR_LEN); @@ -465,7 +468,7 @@ c4iw_register_device(struct c4iw_dev *dev) strlcpy(ibdev->node_desc, C4IW_NODE_DESC, sizeof(ibdev->node_desc)); ibdev->phys_port_cnt = sc->params.nports; ibdev->num_comp_vectors = 1; - ibdev->dma_device = NULL; + ibdev->dma_device = &dev->pdev.dev; ibdev->query_device = c4iw_query_device; ibdev->query_port = c4iw_query_port; ibdev->modify_port = c4iw_modify_port; @@ -517,8 +520,10 @@ c4iw_register_device(struct c4iw_dev *dev) ibdev->iwcm = iwcm; ret = ib_register_device(&dev->ibdev, NULL); - if (ret) + if (ret) { kfree(iwcm); + linux_pci_detach_device(&dev->pdev); + } return (ret); } @@ -531,6 +536,7 @@ c4iw_unregister_device(struct c4iw_dev *dev) dev->rdev.adap); ib_unregister_device(&dev->ibdev); kfree(dev->ibdev.iwcm); + linux_pci_detach_device(&dev->pdev); return; } #endif