From patchwork Thu Jul 25 17:48:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potnuri Bharat Teja X-Patchwork-Id: 11059521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EDC014DB for ; Thu, 25 Jul 2019 17:48:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F66928585 for ; Thu, 25 Jul 2019 17:48:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 334A8288F8; Thu, 25 Jul 2019 17:48:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 411EB28585 for ; Thu, 25 Jul 2019 17:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403890AbfGYRsx (ORCPT ); Thu, 25 Jul 2019 13:48:53 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:58956 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403879AbfGYRsx (ORCPT ); Thu, 25 Jul 2019 13:48:53 -0400 Received: from localhost (mehrangarh.blr.asicdesigners.com [10.193.185.169]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id x6PHmnri007746; Thu, 25 Jul 2019 10:48:50 -0700 From: Potnuri Bharat Teja To: jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, bharat@chelsio.com, nirranjan@chelsio.com Subject: [PATCH rdma-core 1/2] cxgb4: fix chipversion initialization Date: Thu, 25 Jul 2019 23:18:41 +0530 Message-Id: <20190725174841.26794-1-bharat@chelsio.com> X-Mailer: git-send-email 2.18.0.232.gb7bd9486b055 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With Commit `0c3cecfe04d5a`, device and vendor members of structure verbs_match_ent are left unintialised. This causes c4iw_alloc_context() failure due to incorrect chipversion. This patch reorders the code to fetch chipversion from ib device attributes. Signed-off-by: Potnuri Bharat Teja --- providers/cxgb4/dev.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c index ce3e7757699f..84711993ea32 100644 --- a/providers/cxgb4/dev.c +++ b/providers/cxgb4/dev.c @@ -144,22 +144,6 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev, verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops); - switch (rhp->chip_version) { - case CHELSIO_T6: - PDBG("%s T6/T5/T4 device\n", __FUNCTION__); - case CHELSIO_T5: - PDBG("%s T5/T4 device\n", __FUNCTION__); - case CHELSIO_T4: - PDBG("%s T4 device\n", __FUNCTION__); - verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_t4_ops); - break; - default: - PDBG("%s unknown hca type %d\n", __FUNCTION__, - rhp->chip_version); - goto err_unmap; - break; - } - if (!rhp->mmid2ptr) { int ret; @@ -196,6 +180,23 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev, context->status_page->write_cmpl_supported; } + rhp->chip_version = CHELSIO_CHIP_VERSION(attr.vendor_part_id >> 8); + switch (rhp->chip_version) { + case CHELSIO_T6: + PDBG("%s T6/T5/T4 device\n", __FUNCTION__); + case CHELSIO_T5: + PDBG("%s T5/T4 device\n", __FUNCTION__); + case CHELSIO_T4: + PDBG("%s T4 device\n", __FUNCTION__); + verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_t4_ops); + break; + default: + PDBG("%s unknown hca type %d\n", __FUNCTION__, + rhp->chip_version); + goto err_unmap; + break; + } + return &context->ibv_ctx; err_unmap: @@ -456,7 +457,6 @@ static struct verbs_device *c4iw_device_alloc(struct verbs_sysfs_dev *sysfs_dev) pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE); c4iw_abi_version = sysfs_dev->abi_ver; - dev->chip_version = CHELSIO_CHIP_VERSION(sysfs_dev->match->device >> 8); dev->abi_version = sysfs_dev->abi_ver; list_node_init(&dev->list); From patchwork Thu Jul 25 17:49:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potnuri Bharat Teja X-Patchwork-Id: 11059523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA79413AC for ; Thu, 25 Jul 2019 17:49:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9F1828585 for ; Thu, 25 Jul 2019 17:49:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE482288C3; Thu, 25 Jul 2019 17:49:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6092F28585 for ; Thu, 25 Jul 2019 17:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403897AbfGYRth (ORCPT ); Thu, 25 Jul 2019 13:49:37 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:23464 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730025AbfGYRte (ORCPT ); Thu, 25 Jul 2019 13:49:34 -0400 Received: from localhost (mehrangarh.blr.asicdesigners.com [10.193.185.169]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id x6PHnVia007752; Thu, 25 Jul 2019 10:49:31 -0700 From: Potnuri Bharat Teja To: jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, bharat@chelsio.com, nirranjan@chelsio.com Subject: [PATCH rdma-core 2/2] cxgb4: remove unused c4iw_match_device Date: Thu, 25 Jul 2019 23:19:28 +0530 Message-Id: <20190725174928.26863-1-bharat@chelsio.com> X-Mailer: git-send-email 2.18.0.232.gb7bd9486b055 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP match_device handler is no longer needed after latest device binding changes. Signed-off-by: Potnuri Bharat Teja --- providers/cxgb4/dev.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c index 84711993ea32..b6f991529bdb 100644 --- a/providers/cxgb4/dev.c +++ b/providers/cxgb4/dev.c @@ -403,46 +403,6 @@ void dump_state(void) */ int c4iw_abi_version = 1; -static bool c4iw_device_match(struct verbs_sysfs_dev *sysfs_dev) -{ - char value[32], *cp; - unsigned int fw_maj, fw_min; - - /* Rely on the core code to match PCI devices */ - if (!sysfs_dev->match) - return false; - - /* - * Verify that the firmware major number matches. Major number - * mismatches are fatal. Minor number mismatches are tolerated. - */ - if (ibv_get_fw_ver(value, sizeof(value), sysfs_dev)) - return false; - - cp = strtok(value+1, "."); - sscanf(cp, "%i", &fw_maj); - cp = strtok(NULL, "."); - sscanf(cp, "%i", &fw_min); - - if ((signed int)fw_maj < FW_MAJ) { - fprintf(stderr, "libcxgb4: Fatal firmware version mismatch. " - "Firmware major number is %u and libcxgb4 needs %u.\n", - fw_maj, FW_MAJ); - fflush(stderr); - return false; - } - - DBGLOG("libcxgb4"); - - if ((signed int)fw_min < FW_MIN) { - PDBG("libcxgb4: non-fatal firmware version mismatch. " - "Firmware minor number is %u and libcxgb4 needs %u.\n", - fw_min, FW_MIN); - fflush(stderr); - } - return true; -} - static struct verbs_device *c4iw_device_alloc(struct verbs_sysfs_dev *sysfs_dev) { struct c4iw_dev *dev; @@ -498,7 +458,6 @@ static const struct verbs_device_ops c4iw_dev_ops = { .match_min_abi_version = 0, .match_max_abi_version = INT_MAX, .match_table = hca_table, - .match_device = c4iw_device_match, .alloc_device = c4iw_device_alloc, .uninit_device = c4iw_uninit_device, .alloc_context = c4iw_alloc_context,