From patchwork Sun Nov 1 20:15:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 315869 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 C1363C388F9 for ; Sun, 1 Nov 2020 20:16:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CB8E21527 for ; Sun, 1 Nov 2020 20:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604261806; bh=GknPAsGox6eqIGBWl7y4981lZX9Czt/oaEu2JVpxmpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=njAdbu33rmNmAxz02hHyMDGmqxaOE1shfPf4YAR5VQiNhk8r70Y/Go5sjwSPOtn3x t+rnkL1bpFosclWupEUQXtFpXbscJydYFiuUINlsCeN49O8vhjzGcuvTRKa+CCII0O pETfc+E5W5+/zvxM2BN3H+4iStoamVEEFsks4zc8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbgKAUQn (ORCPT ); Sun, 1 Nov 2020 15:16:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:57956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbgKAUQV (ORCPT ); Sun, 1 Nov 2020 15:16:21 -0500 Received: from localhost (host-213-179-129-39.customer.m-online.net [213.179.129.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A134B2224F; Sun, 1 Nov 2020 20:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604261780; bh=GknPAsGox6eqIGBWl7y4981lZX9Czt/oaEu2JVpxmpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVgRRFf+rDadTypKXvXbiQRFt49saePqDEzOMbaEdx7V75t4tKXpYiBb9yt3bT24N J5vtQ1VB75NiDsuG3P9Bkw5ut6X12hTaaheWu7DNsMIJkkp8Tra1FRReGs42C4zeyn 7A0gE9q++k4v0iX6jh1Bv2lmFqPZELPhLi4ixatk= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe , gregkh Cc: Leon Romanovsky , Jakub Kicinski , Jason Wang , linux-rdma@vger.kernel.org, "Michael S. Tsirkin" , netdev@vger.kernel.org, Parav Pandit , Roi Dayan , Saeed Mahameed , virtualization@lists.linux-foundation.org, alsa-devel@alsa-project.org, tiwai@suse.de, broonie@kernel.org, "David S . Miller" , ranjani.sridharan@linux.intel.com, pierre-louis.bossart@linux.intel.com, fred.oh@linux.intel.com, shiraz.saleem@intel.com, dan.j.williams@intel.com, kiran.patil@intel.com, linux-kernel@vger.kernel.org Subject: [PATCH mlx5-next v1 02/11] net/mlx5: Properly convey driver version to firmware Date: Sun, 1 Nov 2020 22:15:33 +0200 Message-Id: <20201101201542.2027568-3-leon@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201101201542.2027568-1-leon@kernel.org> References: <20201101201542.2027568-1-leon@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Leon Romanovsky mlx5 firmware expects driver version in specific format X.X.X, so make it always correct and based on real kernel version aligned with the driver. Fixes: 012e50e109fd ("net/mlx5: Set driver version into firmware") Signed-off-by: Leon Romanovsky Reviewed-by: Roi Dayan --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.28.0 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 8ff207aa1479..71e210f22f69 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -50,6 +50,7 @@ #ifdef CONFIG_RFS_ACCEL #include #endif +#include #include #include "mlx5_core.h" #include "lib/eq.h" @@ -233,7 +234,10 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) strncat(string, ",", remaining_size); remaining_size = max_t(int, 0, driver_ver_sz - strlen(string)); - strncat(string, DRIVER_VERSION, remaining_size); + + snprintf(string + strlen(string), remaining_size, "%u.%u.%u", + (u8)(LINUX_VERSION_CODE >> 16), (u8)(LINUX_VERSION_CODE >> 8), + (u16)(LINUX_VERSION_CODE & 0xff)); /*Send the command*/ MLX5_SET(set_driver_version_in, in, opcode,