Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2462038rda; Wed, 25 Oct 2023 03:35:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzKo5ZKALhKvYfqWXJad1a67rEPpD9XT/ko8fYETrjyfqASKuQOS0g9k0KyWAznjh7BxXz X-Received: by 2002:a05:6808:2185:b0:3af:639d:ead6 with SMTP id be5-20020a056808218500b003af639dead6mr18164854oib.36.1698230107412; Wed, 25 Oct 2023 03:35:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698230107; cv=none; d=google.com; s=arc-20160816; b=UMN2tyb+QssPNR8zZjCdSEjQ46BskwGoLgrFonGAP8+sFN1n7vgwb0N4rnbSRsrZrO 6dTYZwkW5nGs/oWbrkcAbbHO7qpccQD5MHM4K2yx2AiotrNYIK7KQmGEzDc6jOu0yiKi kYyV1bBOVOtWz4Hf6pBQ44P2Try9VHxrqhVNQU2TbaPiT0+k1RCnMINnxlK6CgyO/uYK cUd/tnqV6DSN2YcKIaIxUg7/5WkfIbhIbU8XsO8E3/RdmphKC88/Lx1hAOjAVsmaE+Qu Vn4XVSXzM8Yo7OBVToyqgDCDpTOnaSdKa2JeRL61TrgVtaajm9jjFp186Ke8Jdymp9mh xaFw== 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=fDDPhLjS2qjyz2nQKfaq0QCWJpoL7NQX+WbUg4S1eIc=; fh=/BPY1uhhQzaGQiN4mzViRkOEuU2IGIhJKx0H3Gv+8ps=; b=0Jw/KeT/4jSN81NmjWi1PeTwBqwmslkess61/LiYq2Fw5Px5ktG8dHWxJmwYW7PcCu g2O82lrG6/8ePYAgGsCyYjo1KBRoTkd4fGKlbXEPVmkiRaWysKKBWxb9tPu8QQZv4sIM w1aY/+he/N5la9G9yfWfKJKTGmv8vXeZ370cNu1mZai/9uvlUYNpQwpfuTaZJf4LJ93i qDt2u5ecSpTaoDsqJFxOAWmpgfL5XXgEKaooh/aoQvjmoWRUvbrlo0TQ2kod8JHgQhmd QDKr1voDweb6rdQzL9VIkn/TktwYYsx4Cz+5IArUugzOvRm5o1VaUYebRk4s9wK+atMA YP9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TKk0KjJ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f5-20020a25b085000000b00d8942d8d1a5si10531149ybj.247.2023.10.25.03.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:35:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TKk0KjJ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id E817A80FE28D; Wed, 25 Oct 2023 03:35:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234790AbjJYKeT (ORCPT + 99 others); Wed, 25 Oct 2023 06:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234772AbjJYKeP (ORCPT ); Wed, 25 Oct 2023 06:34:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 584E2DD for ; Wed, 25 Oct 2023 03:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698230004; 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=fDDPhLjS2qjyz2nQKfaq0QCWJpoL7NQX+WbUg4S1eIc=; b=TKk0KjJ6z+r4RPF3zWwwNbthkBM1ANwkR6EXyAZRIqshPGu8KugHFjN9Gt2EiSGKOY11MM hDK1HcfGtvY40sSSveWUqgGPVvmlpcHq9RU7SoF39zgr076ph+9eQiyC2MMPKwhV9bb70i krpE5AUHci5VoCL8hT3q3HnE6YJvkxM= 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-681-n_Cdgp-6NaaVB16wf-rkEg-1; Wed, 25 Oct 2023 06:33:21 -0400 X-MC-Unique: n_Cdgp-6NaaVB16wf-rkEg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 C958F811E8E; Wed, 25 Oct 2023 10:33:20 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.225.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 381391121319; Wed, 25 Oct 2023 10:33:19 +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 , Wojciech Drewek Subject: [PATCH iwl-next 2/2] i40e: Move inline helpers to i40e_prototype.h Date: Wed, 25 Oct 2023 12:33:15 +0200 Message-ID: <20231025103315.1149589-3-ivecera@redhat.com> In-Reply-To: <20231025103315.1149589-1-ivecera@redhat.com> References: <20231025103315.1149589-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 25 Oct 2023 03:35:02 -0700 (PDT) Move version check helper functions from i40e_type.h to i40e_prototype.h as per discussion [1]. [1] https://lore.kernel.org/all/cdcd6b97-1138-4cd7-854f-b3faa1f475f8@intel.com/#t Cc: Wojciech Drewek Cc: Jacob Keller Signed-off-by: Ivan Vecera --- .../net/ethernet/intel/i40e/i40e_prototype.h | 70 +++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_type.h | 68 ------------------ 2 files changed, 70 insertions(+), 68 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h index 001162042050..af4269330581 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h +++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h @@ -501,4 +501,74 @@ i40e_add_pinfo_to_list(struct i40e_hw *hw, /* i40e_ddp */ int i40e_ddp_flash(struct net_device *netdev, struct ethtool_flash *flash); +/* Firmware and AdminQ version check helpers */ + +/** + * i40e_is_aq_api_ver_ge + * @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 greater/equal than provided. + **/ +static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) +{ + return (hw->aq.api_maj_ver > maj || + (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 inline bool 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 inline bool 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 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)); +} + #endif /* _I40E_PROTOTYPE_H_ */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 7eaf8b013125..e3d40630f689 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -586,74 +586,6 @@ struct i40e_hw { char err_str[16]; }; -/** - * i40e_is_aq_api_ver_ge - * @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 greater/equal than provided. - **/ -static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min) -{ - return (hw->aq.api_maj_ver > maj || - (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 inline bool 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 inline bool 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 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)); -} - struct i40e_driver_version { u8 major_version; u8 minor_version; -- 2.41.0