From patchwork Tue Oct 24 08:12:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Vecera X-Patchwork-Id: 157282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1790192vqx; Tue, 24 Oct 2023 01:13:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9IACf3LSARlpoMWYuCkBl/TIM3NYKTz1IZpSwkCX/2mOoi4GH3vDNvPRK5nwmCioXbjYG X-Received: by 2002:a17:90a:6096:b0:27d:46e5:2d7c with SMTP id z22-20020a17090a609600b0027d46e52d7cmr8658085pji.26.1698135202351; Tue, 24 Oct 2023 01:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698135202; cv=none; d=google.com; s=arc-20160816; b=gc3U5EirBKrPYUIMqjGNCb+fq92aD68zElCVGHzCd7rekUlSovg2xdgmXQtxEWkvc1 Z5bHIxFSptEPm+AmejGNITYsgnkOjJi00wV/11wZUPx55I8zLG31mTzMfKj1jEjM6Fa+ GUmLDC97SwgpeCbaeG+Q7bM2z/ilaKus82AsZmmyMsSr5mkLIclLqy0riuduEEuXzxx2 jxMdMA2/gp40hr84Nybk21GngO3PhdyLHzt094ABeWM8G8MdiGOgOid0Z25g9wD1AGPt J2Q4g1/B+YEdCoWQ7rnIo9omwQFL/cKHoJIioRR6NnJrYu9aWuq2wMcBn5K7tgwloDcv 9u6g== 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=eYX4ieLYLS9vnBYSPGWi+1qAffL00yE5OYVTrAGUBLU=; fh=TBqWIXs8FIbUacMHlyq40e9cES7/5hSGWTWgMJKbBl4=; b=XpEGGjkis0AlNo7J8cjdlHncI/6GMH662Ngm2dPWl5yXF0NMA57z6SwL+DgGC2kanQ 6nuXMEuA6tgti6St40h/sgSgH8+Ia/xH1YJK2xwsVIuxU3YnQqhXrU6YyI3lOKFIoeR9 K74K5LOuXBV6TXeejcJVJsaHsTrFGjD7Niu4VuRc/kYoJ8U5cf8n+VBtgBJkLX/SqLu9 Oua2D7G8iV1xSPVuDenspwHxB0pnwBHNOZK3aHMlnHtj0pz1dVRpOjKR/FR28NB9UlVW tofvDeb/quf/1JlQygLwTSxsC/gN/RwZ17rBG78UUqNpDC4TCF+OFgCNCAvakkmyLYKA qqJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QfplfSkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id nu1-20020a17090b1b0100b002773b1bf75fsi7989498pjb.23.2023.10.24.01.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 01:13:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QfplfSkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 221DB8031AE7; Tue, 24 Oct 2023 01:13:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbjJXINR (ORCPT + 26 others); Tue, 24 Oct 2023 04:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232799AbjJXINQ (ORCPT ); Tue, 24 Oct 2023 04:13:16 -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 218BEE9 for ; Tue, 24 Oct 2023 01:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698135148; 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=eYX4ieLYLS9vnBYSPGWi+1qAffL00yE5OYVTrAGUBLU=; b=QfplfSknpKytj0JOBriL5cJW8hDeS39nlUrRcgs4E++SFB8riENGvI/XR+L6cTkVue3VVM ++YaVjvdNTw7PH100warE0z+KzTNpKWJh1tzZZKpUmhs8ruxm6SWzx2xIYTkTurFF5Bfgg ZRtD2KBOIGrn6c52FdGBuDFWt5W4VVk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134--7Al3Y6IOwihqhgNwl0IrA-1; Tue, 24 Oct 2023 04:12:18 -0400 X-MC-Unique: -7Al3Y6IOwihqhgNwl0IrA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 E2C312808FCE; Tue, 24 Oct 2023 08:12:17 +0000 (UTC) Received: from p1.luc.com (unknown [10.43.2.183]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16D71492BFB; Tue, 24 Oct 2023 08:12:15 +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 v2 1/3] i40e: Move i40e_is_aq_api_ver_ge helper Date: Tue, 24 Oct 2023 10:12:09 +0200 Message-ID: <20231024081211.677502-2-ivecera@redhat.com> In-Reply-To: <20231024081211.677502-1-ivecera@redhat.com> References: <20231024081211.677502-1-ivecera@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 01:13:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780623818028380774 X-GMAIL-MSGID: 1780623818028380774 Move i40e_is_aq_api_ver_ge helper function (used to check if AdminQ API version is recent enough) to header so it can be used from other .c files. Signed-off-by: Ivan Vecera Reviewed-by: Wojciech Drewek Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) --- drivers/net/ethernet/intel/i40e/i40e_common.c | 23 ++++--------------- drivers/net/ethernet/intel/i40e/i40e_type.h | 14 +++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index 7fce881abc93..df7ba349030d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c @@ -1749,21 +1749,6 @@ int i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags, return status; } -/** - * i40e_is_aq_api_ver_ge - * @aq: pointer to AdminQ info containing HW API version to compare - * @maj: API major value - * @min: API minor value - * - * Assert whether current HW API version is greater/equal than provided. - **/ -static bool i40e_is_aq_api_ver_ge(struct i40e_adminq_info *aq, u16 maj, - u16 min) -{ - return (aq->api_maj_ver > maj || - (aq->api_maj_ver == maj && aq->api_min_ver >= min)); -} - /** * i40e_aq_add_vsi * @hw: pointer to the hw struct @@ -1890,14 +1875,14 @@ int i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, if (set) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; - if (rx_only_promisc && i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) + if (rx_only_promisc && i40e_is_aq_api_ver_ge(hw, 1, 5)) flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; } cmd->promiscuous_flags = cpu_to_le16(flags); cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); - if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) + if (i40e_is_aq_api_ver_ge(hw, 1, 5)) cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); @@ -2000,13 +1985,13 @@ int i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw, if (enable) { flags |= I40E_AQC_SET_VSI_PROMISC_UNICAST; - if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) + if (i40e_is_aq_api_ver_ge(hw, 1, 5)) flags |= I40E_AQC_SET_VSI_PROMISC_RX_ONLY; } cmd->promiscuous_flags = cpu_to_le16(flags); cmd->valid_flags = cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_UNICAST); - if (i40e_is_aq_api_ver_ge(&hw->aq, 1, 5)) + if (i40e_is_aq_api_ver_ge(hw, 1, 5)) cmd->valid_flags |= cpu_to_le16(I40E_AQC_SET_VSI_PROMISC_RX_ONLY); cmd->seid = cpu_to_le16(seid); diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h index 22150368ba64..a21cc607c844 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_type.h +++ b/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -594,6 +594,20 @@ static inline bool i40e_is_vf(struct i40e_hw *hw) hw->mac.type == I40E_MAC_X722_VF); } +/** + * 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)); +} + struct i40e_driver_version { u8 major_version; u8 minor_version;