Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1339080rda; Mon, 23 Oct 2023 09:31:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWtf0IRi2hPafqOoKfrtbAm5G+JPhcv1lLVCgeMsyEs4njywnGy9s516G77CB22nGPgDog X-Received: by 2002:a17:90a:be16:b0:27d:2949:9e05 with SMTP id a22-20020a17090abe1600b0027d29499e05mr16821391pjs.11.1698078667733; Mon, 23 Oct 2023 09:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078667; cv=none; d=google.com; s=arc-20160816; b=Gh/iv1wIA7IpOU6PJAqrrV4ip0HyrxPE6TWl/1gGLsjP7DNXJpSnX3FRznh2qwJBEd /4lz9OTgLY+xubcl0PK+v8DqoZbZ6e0zuouI4UevoEy3ObxPdVgU1tSRb3GyZO0/25xg F+f2WGzgzo/zyEPN9v5KWWsIGvMiRtI0VuROKAIa5lyllOgsZANo5XC+dNONREVw7cc5 m5mRr/mltodIlXK12Regf+XAbUJrEHCachKIFthH4TtYbKO7mMtpfoBhfjfxHsygZbdP cP7xy9FvjRRNKfnu4z3O5w5f8uqzRqaTseyS5+Jm6IGoDus/TURb5ErINVj9GrepObvb QGFA== 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.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id f5-20020a17090ab94500b00278f58e6bbcsi9314685pjw.181.2023.10.23.09.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:31:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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.35 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 groat.vger.email (Postfix) with ESMTP id 970BA8087E2B; Mon, 23 Oct 2023 09:31:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbjJWQa6 (ORCPT + 99 others); Mon, 23 Oct 2023 12:30:58 -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 ); 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 ; 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 To: netdev@vger.kernel.org Cc: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, Jacob Keller , 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:31:05 -0700 (PDT) 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 --- 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); +} + +/** + * 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; -- 2.41.0