[iwl-next,2/3] i40e: Add other helpers to check version of running firmware and AQ API
Message ID | 20231023162928.245583-3-ivecera@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1413006vqx; Mon, 23 Oct 2023 09:31:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwBh5u8286ch6xRPfzviUkjIjMJH/rJEyJEf0Bm6tgtU/Tl1LXiY7PZuupmK8gkHBsqP1p X-Received: by 2002:a17:902:ea02:b0:1c5:6f43:9502 with SMTP id s2-20020a170902ea0200b001c56f439502mr13469395plg.14.1698078676349; Mon, 23 Oct 2023 09:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078676; cv=none; d=google.com; s=arc-20160816; b=tYlR+SoRPwta3zqYV7I6WqVUTvHf29gkeLs3Pjg4JyIRUswn5Mm4c6LF67zlEIomcW nrZofJILBy/LKOm4HZSo36/hEY2EJLHZviZWbWvFPuJtGU8RXS8ObunDPcBH3R4qr3dn h1DfhFj2Ix0ZOpLF46Gev5qAR/WFHqvzCHczNYfExQviuX4Uia5Wq7TMfA1GjqIFWA9s wD3uJmAkoPLp5FMl26HCjvEjkbVqr045/HjAbjXPxRBo7l/jTCMafCTpceAFiTsdnmn9 0rYp8r5fTpjMs2ylziOanbdt02wQ+GryeXm30BEPRW1I0DyKL1JpsJ0uYZRMetRRJCrP h/iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R3ZRVRPYlzLKSEwVSMpWF6MYksG9m8/cnJFghvaOFDE=; fh=TBqWIXs8FIbUacMHlyq40e9cES7/5hSGWTWgMJKbBl4=; b=zPDBpMCQJmoqtA/uaXOUWUlm/A8pPg1u5Xed+xcBkR0GEnyV/5a3+Pkae8Lb1swwMK Rx04RohEFdqe3+2eESAjxeJjh59Ny2VjxAD0mLECoFeiQZH6F9hCA2cztreNGXFAspSr uwhuuz2sGZU4eiqW1651U+P4ATYH92diBB0yhArysaLGmSeIrc7QRw0YVHuKiOWNOxE3 0tNvQW7PTXERQJpO/Af/dX8r3Y0UHdGuVzBPQ86JOz8c1mW3JQWmS9Fci8ZX/pwyy7x4 WhMAEAOidrCW5rbKi84um4msNxAaD/rPg7hac1yPHdPm+MpnMaHL/tGMcX28TvPQsDb9 VEGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LjpUOCqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id e4-20020a170902d38400b001c724f99800si6506818pld.44.2023.10.23.09.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:31:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LjpUOCqk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4908F80B26B7; Mon, 23 Oct 2023 09:31:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233843AbjJWQa7 (ORCPT <rfc822;aposhian.dev@gmail.com> + 27 others); Mon, 23 Oct 2023 12:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbjJWQag (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 12:30:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5090D7A for <linux-kernel@vger.kernel.org>; Mon, 23 Oct 2023 09:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698078581; 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: in-reply-to:in-reply-to:references:references; bh=R3ZRVRPYlzLKSEwVSMpWF6MYksG9m8/cnJFghvaOFDE=; b=LjpUOCqkESYv3dWDs6xdAjksCdZcQ2oGGKl4Le/eAzMWzIoMVWjsKu60/S7hZgudsJ0K4i JHWUpHY/I1sF0MveoP9CLBCIORaRqA9ypg0D9ydcs/iY3fN6qG3vQNu5PHGaTy8R9gn6f9 1pl6JT1y9m7S9I77WFOMJVurziAy2vE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-54-PBYY7xKIOQSo5EZ1aDcToA-1; Mon, 23 Oct 2023 12:29:38 -0400 X-MC-Unique: PBYY7xKIOQSo5EZ1aDcToA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7747D185AD0A; Mon, 23 Oct 2023 16:29:36 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.224.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 922AC25C0; Mon, 23 Oct 2023 16:29:34 +0000 (UTC) From: Ivan Vecera <ivecera@redhat.com> To: netdev@vger.kernel.org Cc: 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, linux-kernel@vger.kernel.org, Jacob Keller <jacob.e.keller@intel.com>, mschmidt@redhat.com, dacampbe@redhat.com, poros@redhat.com Subject: [PATCH iwl-next 2/3] i40e: Add other helpers to check version of running firmware and AQ API Date: Mon, 23 Oct 2023 18:29:27 +0200 Message-ID: <20231023162928.245583-3-ivecera@redhat.com> In-Reply-To: <20231023162928.245583-1-ivecera@redhat.com> References: <20231023162928.245583-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:31:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780564546077772627 X-GMAIL-MSGID: 1780564546077772627 |
Series |
i40e: Add and use version check helpers
|
|
Commit Message
Ivan Vecera
Oct. 23, 2023, 4:29 p.m. UTC
Add another helper functions that will be used by subsequent
patch to refactor existing open-coded checks whether the version
of running firmware and AdminQ API is recent enough to provide
certain capabilities.
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
drivers/net/ethernet/intel/i40e/i40e_type.h | 54 +++++++++++++++++++++
1 file changed, 54 insertions(+)
Comments
Hi Ivan, kernel test robot noticed the following build warnings: [auto build test WARNING on tnguy-next-queue/dev-queue] url: https://github.com/intel-lab-lkp/linux/commits/Ivan-Vecera/i40e-Move-i40e_is_aq_api_ver_ge-helper/20231024-003221 base: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue patch link: https://lore.kernel.org/r/20231023162928.245583-3-ivecera%40redhat.com patch subject: [PATCH iwl-next 2/3] i40e: Add other helpers to check version of running firmware and AQ API config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20231024/202310240231.6eF5YKB4-lkp@intel.com/config) compiler: alpha-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231024/202310240231.6eF5YKB4-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202310240231.6eF5YKB4-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/net/ethernet/intel/i40e/i40e_dcb.h:7, from drivers/net/ethernet/intel/i40e/i40e.h:15, from drivers/net/ethernet/intel/i40e/i40e_main.c:13: >> drivers/net/ethernet/intel/i40e/i40e_type.h:632:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 632 | static bool inline i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ drivers/net/ethernet/intel/i40e/i40e_type.h:646:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 646 | static bool inline i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ drivers/net/ethernet/intel/i40e/i40e_type.h:659:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 659 | static bool inline i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ -- In file included from drivers/net/ethernet/intel/i40e/i40e_dcb.h:7, from drivers/net/ethernet/intel/i40e/i40e.h:15, from drivers/net/ethernet/intel/i40e/i40e_ptp.c:6: >> drivers/net/ethernet/intel/i40e/i40e_type.h:632:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 632 | static bool inline i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ drivers/net/ethernet/intel/i40e/i40e_type.h:646:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 646 | static bool inline i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ drivers/net/ethernet/intel/i40e/i40e_type.h:659:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 659 | static bool inline i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min) | ^~~~~~ drivers/net/ethernet/intel/i40e/i40e_ptp.c: In function 'i40e_ptp_init': drivers/net/ethernet/intel/i40e/i40e_ptp.c:1353:27: warning: '%s' directive output may be truncated writing up to 287 bytes into a region of size 64 [-Wformat-truncation=] 1353 | "%s", sdp_desc[i].name); | ^~ In function 'i40e_init_pin_config', inlined from 'i40e_ptp_create_clock' at drivers/net/ethernet/intel/i40e/i40e_ptp.c:1392:13, inlined from 'i40e_ptp_init' at drivers/net/ethernet/intel/i40e/i40e_ptp.c:1497:8: drivers/net/ethernet/intel/i40e/i40e_ptp.c:1351:17: note: 'snprintf' output between 1 and 288 bytes into a destination of size 64 1351 | snprintf(pf->ptp_caps.pin_config[i].name, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1352 | sizeof(pf->ptp_caps.pin_config[i].name), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1353 | "%s", sdp_desc[i].name); | ~~~~~~~~~~~~~~~~~~~~~~~ vim +/inline +632 drivers/net/ethernet/intel/i40e/i40e_type.h 623 624 /** 625 * i40e_is_fw_ver_ge 626 * @hw: pointer to i40e_hw structure 627 * @maj: API major value to compare 628 * @min: API minor value to compare 629 * 630 * Assert whether current firmware version is greater/equal than provided. 631 **/ > 632 static bool inline i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) 633 { 634 return (hw->aq.fw_maj_ver > maj || 635 (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min)); 636 } 637
On 10/23/2023 9:29 AM, Ivan Vecera wrote: > Add another helper functions that will be used by subsequent > patch to refactor existing open-coded checks whether the version > of running firmware and AdminQ API is recent enough to provide > certain capabilities. > > Signed-off-by: Ivan Vecera <ivecera@redhat.com> > --- > drivers/net/ethernet/intel/i40e/i40e_type.h | 54 +++++++++++++++++++++ > 1 file changed, 54 insertions(+) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h > index 050d479aeed3..bb62c14aa3d4 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_type.h > +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h > @@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) > (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)); > } > This has a bunch of checkpatch.pl warnings if you wouldn't mind fixing them: > ERROR: inline keyword should sit between storage class and type > #47: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:632: > +static bool inline i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) > > ERROR: code indent should use tabs where possible > #49: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:634: > + return (hw->aq.fw_maj_ver > maj ||$ > > WARNING: please, no spaces at the start of a line > #49: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:634: > + return (hw->aq.fw_maj_ver > maj ||$ > > ERROR: code indent should use tabs where possible > #50: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:635: > + (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));$ > > WARNING: please, no spaces at the start of a line > #50: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:635: > + (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));$ > > ERROR: inline keyword should sit between storage class and type > #61: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:646: > +static bool inline i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) > > ERROR: inline keyword should sit between storage class and type > #74: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:659: > +static bool inline i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min) > > ERROR: code indent should use tabs where possible > #76: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:661: > + return (hw->aq.fw_maj_ver > maj ||$ > > WARNING: please, no spaces at the start of a line > #76: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:661: > + return (hw->aq.fw_maj_ver > maj ||$ > > ERROR: code indent should use tabs where possible > #77: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:662: > + (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));$ > > WARNING: please, no spaces at the start of a line > #77: FILE: drivers/net/ethernet/intel/i40e/i40e_type.h:662: > + (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min));$ > > total: 7 errors, 4 warnings, 0 checks, 60 lines checked > Thanks, Jake
On 23.10.2023 18:29, Ivan Vecera wrote: > Add another helper functions that will be used by subsequent > patch to refactor existing open-coded checks whether the version > of running firmware and AdminQ API is recent enough to provide > certain capabilities. > > Signed-off-by: Ivan Vecera <ivecera@redhat.com> > --- > drivers/net/ethernet/intel/i40e/i40e_type.h | 54 +++++++++++++++++++++ > 1 file changed, 54 insertions(+) > > diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h > index 050d479aeed3..bb62c14aa3d4 100644 > --- a/drivers/net/ethernet/intel/i40e/i40e_type.h > +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h > @@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) > (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)); > } > > +/** > + * i40e_is_aq_api_ver_lt > + * @hw: pointer to i40e_hw structure > + * @maj: API major value to compare > + * @min: API minor value to compare > + * > + * Assert whether current HW API version is less than provided. > + **/ > +static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) > +{ > + return !i40e_is_aq_api_ver_ge(hw, maj, min); > +} It feels a bit off to have those helpers in i40e_type.h. We don't have i40e_common.h though so I'd move them to i40e_prototype.h or i40e.h. Same comment regarding 1st patch (I know I gave it my tag but I spotted the issue while reading the 2nd patch). > + > +/** > + * i40e_is_fw_ver_ge > + * @hw: pointer to i40e_hw structure > + * @maj: API major value to compare > + * @min: API minor value to compare > + * > + * Assert whether current firmware version is greater/equal than provided. > + **/ > +static bool inline i40e_is_fw_ver_ge(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)); > +} > + > +/** > + * i40e_is_fw_ver_lt > + * @hw: pointer to i40e_hw structure > + * @maj: API major value to compare > + * @min: API minor value to compare > + * > + * Assert whether current firmware version is less than provided. > + **/ > +static bool inline i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) > +{ > + return !i40e_is_fw_ver_ge(hw, maj, min); > +} > + > +/** > + * i40e_is_fw_ver_eq > + * @hw: pointer to i40e_hw structure > + * @maj: API major value to compare > + * @min: API minor value to compare > + * > + * Assert whether current firmware version is equal to provided. > + **/ > +static bool inline 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)); > +} > + > struct i40e_driver_version { > u8 major_version; > u8 minor_version;
On 24. 10. 23 12:24, Wojciech Drewek wrote: > On 23.10.2023 18:29, Ivan Vecera wrote: >> Add another helper functions that will be used by subsequent >> patch to refactor existing open-coded checks whether the version >> of running firmware and AdminQ API is recent enough to provide >> certain capabilities. >> >> Signed-off-by: Ivan Vecera<ivecera@redhat.com> >> --- >> drivers/net/ethernet/intel/i40e/i40e_type.h | 54 +++++++++++++++++++++ >> 1 file changed, 54 insertions(+) >> >> diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h >> index 050d479aeed3..bb62c14aa3d4 100644 >> --- a/drivers/net/ethernet/intel/i40e/i40e_type.h >> +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h >> @@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) >> (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)); >> } >> >> +/** >> + * i40e_is_aq_api_ver_lt >> + * @hw: pointer to i40e_hw structure >> + * @maj: API major value to compare >> + * @min: API minor value to compare >> + * >> + * Assert whether current HW API version is less than provided. >> + **/ >> +static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) >> +{ >> + return !i40e_is_aq_api_ver_ge(hw, maj, min); >> +} > It feels a bit off to have those helpers in i40e_type.h. > We don't have i40e_common.h though so I'd move them to i40e_prototype.h or i40e.h. > Same comment regarding 1st patch (I know I gave it my tag but I spotted the issue > while reading the 2nd patch). I'm sorry I already submitted v2 and helpers are present i40e_type.h. I would submit v3 but there is also i40e_is_vf() inline function already present in i40e_type. Would you be OK with a follow-up that would move all these inlines into i40e_prototype.h? Btw i40e.h is not a good idea as this would bring a dependency on i40e.h into i40e_adminq.c, i40e_common.c and i40e_dcb.c. Regards, Ivan
On 24.10.2023 15:01, Ivan Vecera wrote: > > > On 24. 10. 23 12:24, Wojciech Drewek wrote: >> On 23.10.2023 18:29, Ivan Vecera wrote: >>> Add another helper functions that will be used by subsequent >>> patch to refactor existing open-coded checks whether the version >>> of running firmware and AdminQ API is recent enough to provide >>> certain capabilities. >>> >>> Signed-off-by: Ivan Vecera<ivecera@redhat.com> >>> --- >>> drivers/net/ethernet/intel/i40e/i40e_type.h | 54 +++++++++++++++++++++ >>> 1 file changed, 54 insertions(+) >>> >>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h >>> index 050d479aeed3..bb62c14aa3d4 100644 >>> --- a/drivers/net/ethernet/intel/i40e/i40e_type.h >>> +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h >>> @@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) >>> (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)); >>> } >>> +/** >>> + * i40e_is_aq_api_ver_lt >>> + * @hw: pointer to i40e_hw structure >>> + * @maj: API major value to compare >>> + * @min: API minor value to compare >>> + * >>> + * Assert whether current HW API version is less than provided. >>> + **/ >>> +static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) >>> +{ >>> + return !i40e_is_aq_api_ver_ge(hw, maj, min); >>> +} >> It feels a bit off to have those helpers in i40e_type.h. >> We don't have i40e_common.h though so I'd move them to i40e_prototype.h or i40e.h. >> Same comment regarding 1st patch (I know I gave it my tag but I spotted the issue >> while reading the 2nd patch). > > I'm sorry I already submitted v2 and helpers are present i40e_type.h. > I would submit v3 but there is also i40e_is_vf() inline function already present in i40e_type. Would you be OK with a follow-up that would move all these inlines into i40e_prototype.h? Sounds good > > Btw i40e.h is not a good idea as this would bring a dependency on i40e.h into i40e_adminq.c, i40e_common.c and i40e_dcb.c. Got it > > Regards, > Ivan > >
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 050d479aeed3..bb62c14aa3d4 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -608,6 +608,60 @@ static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) (hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min)); } +/** + * i40e_is_aq_api_ver_lt + * @hw: pointer to i40e_hw structure + * @maj: API major value to compare + * @min: API minor value to compare + * + * Assert whether current HW API version is less than provided. + **/ +static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) +{ + return !i40e_is_aq_api_ver_ge(hw, maj, min); +} + +/** + * i40e_is_fw_ver_ge + * @hw: pointer to i40e_hw structure + * @maj: API major value to compare + * @min: API minor value to compare + * + * Assert whether current firmware version is greater/equal than provided. + **/ +static bool inline i40e_is_fw_ver_ge(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)); +} + +/** + * i40e_is_fw_ver_lt + * @hw: pointer to i40e_hw structure + * @maj: API major value to compare + * @min: API minor value to compare + * + * Assert whether current firmware version is less than provided. + **/ +static bool inline i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min) +{ + return !i40e_is_fw_ver_ge(hw, maj, min); +} + +/** + * i40e_is_fw_ver_eq + * @hw: pointer to i40e_hw structure + * @maj: API major value to compare + * @min: API minor value to compare + * + * Assert whether current firmware version is equal to provided. + **/ +static bool inline 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)); +} + struct i40e_driver_version { u8 major_version; u8 minor_version;