Message ID | 20240228172603.29177-1-ivecera@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3494188dyb; Wed, 28 Feb 2024 09:27:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgGziIKem8gz+RMNyJx7J2+FcLy0frs2+da6gEagWRZlb9x3my1pe8k2zMsqjyVvz6eTxb7iMdccFY6svfs09F1p9CJA== X-Google-Smtp-Source: AGHT+IFcEVLJjmoXQCqTS41VBbXfwe7vgYyk4SSoKJlI7O2rpWJ3dytHbkA2SgCqGktswpRNRVB7 X-Received: by 2002:a05:622a:14c:b0:42e:80ed:79f5 with SMTP id v12-20020a05622a014c00b0042e80ed79f5mr12684448qtw.39.1709141222095; Wed, 28 Feb 2024 09:27:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709141222; cv=pass; d=google.com; s=arc-20160816; b=S3B3ITR27auq4AYGSKr4StJ2J9p6Yq4Wmt6DiHtNtp11p0TGrWyoECcBrSZdHpCsy0 IeDeh8mMnm5Uv7wGE/Zv4ES0YPa4pV+7wAkg+MBdh4cSEu6dZpeXemAzEz1RtJNVx+Gd f3GFbRHnLC34gmcRi1m7TccHgQAUiZ0ffhjunZaxH2LmGa09nh7C1cXP6gWeZ1AWAwhM c1pvRDcVyiEuUMuzkau7d7z8H3QiIrdBdp3Y9KdWX15N1vI/YuTKecgrqi9NtxtNNQp1 fWa91aNTthRNY+3crvvojwhKGnLNZi59J0xby+sZca7TBEQD62B3KA2U4X3NZ+3x/ZjH n+8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=YgXfPN35ycGcFyeX+4qkDfjzG1MG71vQIh7801xexLs=; fh=3s7WQnzTMqUoh+MCuSLtwVNSQSs+RKxThD2IvksCguQ=; b=ICHD1uwV9I47OmuImuX7GkK7LRkRX1P4XXBqLGXnzZXrOFnh2ZNkHwBSZ3s4hOyJnf fzDYGgTugBvmwuEXq5vik0k0X2la9u9V6Jbablftl2y6oX+kvd+K/KwN7XaJyM20oMp1 j6cSC2bbK+8dnYNckgXvb87wZQJWjJ1E4LlKVUQz28EUbM+BXJZmQjoMdqZ4nlASUHRt WHFxefWK/DW2tjufDRSzfEjwSA9XZe5+6bePB49OfkGnTOIZVxb9QWA9xmlAu1MaMu6e uoOFaZs6xK90cC+IDD+F1LlcRazh4X8ItDofRBxkTQInxXh0BxcKJeIwfAfiy1xp3vQq hEUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AWFGDJXF; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e20-20020ac845d4000000b0042e5bf8bd26si9578410qto.519.2024.02.28.09.27.01 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 09:27:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AWFGDJXF; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85437-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DAFC11C231C6 for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 17:27:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A60C15DBCC; Wed, 28 Feb 2024 17:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AWFGDJXF" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB07915D5DE for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 17:26:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709141176; cv=none; b=J8wsgDFtb07Vt/it3ebQ/3EO/h/EgdE7o6+I69lP5FlTqo1KhUETZ3AFAIHV/fGcnlNk6Gsf6i0yR9auZYGD8kJnC2Z/mNjwK89YPYKfT9hpjSSJL/IjgP5Rcsk9dvL3+Dr9L6IZdAOAzTy6E4Y7mXqT+ykxaMiIAXbOP9o/YLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709141176; c=relaxed/simple; bh=s9KEvw5LismBgwzZoMZ54Q3M6nRheAXuApxY6BCD3AU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GeM4lSBe/ha99NaUqOAHjiQ7gQTHnghX/gsS0oSJ7kxRdgvbvWNbsQ5pbJXXGcGFWbsmRiJs6XRlOXboqzPx820lS3yIWPWIywnerhbu92rEQKK8OcRlXSBlc9RE2qIrPpBupAC5lLilYhVyJng1qWmVHQ5dLSTbtCEQ2uaRZzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AWFGDJXF; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709141173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=YgXfPN35ycGcFyeX+4qkDfjzG1MG71vQIh7801xexLs=; b=AWFGDJXFErCrX8GqA9bxepkviDvKaqU4T4McAq5BqsIEnAe1HJNumilP9hPN10xdDZVyEz f2FG85on1M1i5y/kMozIuwXgx+ca0GFljxYpGxoh1vAnF0P/yU5C5G6fZu7NqfsXGTsI0/ EREkb+0fIq4oc4B+vVRLEe6KOnA8VuI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-g0jyi1mVM6CIheHSWRPE6g-1; Wed, 28 Feb 2024 12:26:11 -0500 X-MC-Unique: g0jyi1mVM6CIheHSWRPE6g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E29183B827; Wed, 28 Feb 2024 17:26:06 +0000 (UTC) Received: from p1.luc.com (unknown [10.45.225.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4A67401CB78; Wed, 28 Feb 2024 17:26:04 +0000 (UTC) From: Ivan Vecera <ivecera@redhat.com> To: netdev@vger.kernel.org Cc: mschmidt@redhat.com, Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net] i40e: Fix firmware version comparison function Date: Wed, 28 Feb 2024 18:26:03 +0100 Message-ID: <20240228172603.29177-1-ivecera@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792164466084605096 X-GMAIL-MSGID: 1792164466084605096 |
Series |
[net] i40e: Fix firmware version comparison function
|
|
Commit Message
Ivan Vecera
Feb. 28, 2024, 5:26 p.m. UTC
Helper i40e_is_fw_ver_eq() compares incorrectly given firmware version
as it returns true when the major version of running firmware is
greater than the given major version that is wrong and results in
failure during getting of DCB configuration where this helper is used.
Fix the check and return true only if the running FW version is exactly
equals to the given version.
Reproducer:
1. Load i40e driver
2. Check dmesg output
[root@host ~]# modprobe i40e
[root@host ~]# dmesg | grep 'i40e.*DCB'
[ 74.750642] i40e 0000:02:00.0: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[ 74.759770] i40e 0000:02:00.0: DCB init failed -5, disabled
[ 74.966550] i40e 0000:02:00.1: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL
[ 74.975683] i40e 0000:02:00.1: DCB init failed -5, disabled
Fixes: cf488e13221f ("i40e: Add other helpers to check version of running firmware and AQ API")
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
Dear Ivan, Thank you for your patch. Am 28.02.24 um 18:26 schrieb Ivan Vecera: > Helper i40e_is_fw_ver_eq() compares incorrectly given firmware version > as it returns true when the major version of running firmware is > greater than the given major version that is wrong and results in … version. That … > failure during getting of DCB configuration where this helper is used. > Fix the check and return true only if the running FW version is exactly > equals to the given version. is … equal > Reproducer: > 1. Load i40e driver > 2. Check dmesg output > > [root@host ~]# modprobe i40e > [root@host ~]# dmesg | grep 'i40e.*DCB' > [ 74.750642] i40e 0000:02:00.0: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL > [ 74.759770] i40e 0000:02:00.0: DCB init failed -5, disabled > [ 74.966550] i40e 0000:02:00.1: Query for DCB configuration failed, err -EIO aq_err I40E_AQ_RC_EINVAL > [ 74.975683] i40e 0000:02:00.1: DCB init failed -5, disabled > > Fixes: cf488e13221f ("i40e: Add other helpers to check version of running firmware and AQ API") > Signed-off-by: Ivan Vecera <ivecera@redhat.com> > --- > drivers/net/ethernet/intel/i40e/i40e_prototype.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h > index af4269330581..ce1f11b8ad65 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h > +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h > @@ -567,8 +567,7 @@ static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) > **/ > static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min) > { > - return (hw->aq.fw_maj_ver > maj || > - (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min)); > + return (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min); > } > > #endif /* _I40E_PROTOTYPE_H_ */ With the nits in the commit message addressed, this is Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> Kind regards, Paul
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index af4269330581..ce1f11b8ad65 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h @@ -567,8 +567,7 @@ static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) **/ static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min) { - return (hw->aq.fw_maj_ver > maj || - (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min)); + return (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min); } #endif /* _I40E_PROTOTYPE_H_ */