From patchwork Thu Sep 22 19:29:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 9346867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF14260757 for ; Thu, 22 Sep 2016 20:15:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF1082ACF1 for ; Thu, 22 Sep 2016 20:15:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B201A2ACF3; Thu, 22 Sep 2016 20:15:06 +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=-6.9 required=2.0 tests=BAYES_00,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 3EF7F2ACF1 for ; Thu, 22 Sep 2016 20:15:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933451AbcIVUPF (ORCPT ); Thu, 22 Sep 2016 16:15:05 -0400 Received: from smtp.opengridcomputing.com ([72.48.136.20]:58720 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbcIVUPE (ORCPT ); Thu, 22 Sep 2016 16:15:04 -0400 Received: from smtp.ogc.us (build2.ogc.int [10.10.0.32]) by smtp.opengridcomputing.com (Postfix) with ESMTP id 0F0B829E3F; Thu, 22 Sep 2016 15:15:04 -0500 (CDT) Received: by smtp.ogc.us (Postfix, from userid 503) id CFB88E08CA; Thu, 22 Sep 2016 15:15:03 -0500 (CDT) From: Steve Wise Date: Thu, 22 Sep 2016 12:29:55 -0700 Subject: [PATCH] libcxgb4: fix firmware version string To: dledford@redhat.com, leon@kernel.org Cc: linux-rdma@vger.kernel.org Message-Id: <20160922201503.CFB88E08CA@smtp.ogc.us> 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 c4iw_query_device() was incorrectly unpacking the 64b version number from the driver. This resulted in ibv_devinfo showing garbage fw verion strings. Signed-off-by: Steve Wise --- Testing out the new process. :) --- libcxgb4/src/verbs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libcxgb4/src/verbs.c b/libcxgb4/src/verbs.c index 3d46f0a..aed547d 100644 --- a/libcxgb4/src/verbs.c +++ b/libcxgb4/src/verbs.c @@ -52,7 +52,7 @@ int c4iw_query_device(struct ibv_context *context, struct ibv_device_attr *attr) { struct ibv_query_device cmd; uint64_t raw_fw_ver; - unsigned major, minor, sub_minor; + u8 major, minor, sub_minor, build; int ret; ret = ibv_cmd_query_device(context, attr, &raw_fw_ver, &cmd, @@ -60,12 +60,13 @@ int c4iw_query_device(struct ibv_context *context, struct ibv_device_attr *attr) if (ret) return ret; - major = (raw_fw_ver >> 32) & 0xffff; - minor = (raw_fw_ver >> 16) & 0xffff; - sub_minor = raw_fw_ver & 0xffff; + major = (raw_fw_ver >> 24) & 0xff; + minor = (raw_fw_ver >> 16) & 0xff; + sub_minor = (raw_fw_ver >> 8) & 0xff; + build = raw_fw_ver & 0xff; snprintf(attr->fw_ver, sizeof attr->fw_ver, - "%d.%d.%d", major, minor, sub_minor); + "%d.%d.%d.%d", major, minor, sub_minor, build); return 0; }