From mboxrd@z Thu Jan 1 00:00:00 1970 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 9D5F5383AB for ; Wed, 27 Mar 2024 07:57:59 +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=1711526281; cv=none; b=F9afhKn7Y2fJVpzIuzXa+K8/n+5P2U7pTPZr1ekC/Pf7aIlMVQ4oIpY+0I8G9LqZfj3o16jaw2PDwEbnDsRsdZ9ADmBGfPv4/eWak7Ro/xfIIzS60qx9G0sLRhCEs9Llt72J4y6nEEcYEdIxLBG4hu0zuyimbc50asQPFKGujx8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711526281; c=relaxed/simple; bh=Vat65M6stqG5LA6cc3GP/buZ1IUl+hHUoX98W5OebkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VhrmVka72Mw7TzsCvugkQ7BP9ydH2b5SYdRV57yw8LqF0PQzttOA5uugjtMw+HBv9VNzv1qWNl8Vswa9iC9GitFWfsmjWaknTYM9Qte6tJSVEhEyInHUEKUM1MeYiL9n/x/ahoumG1EA7uzxChkxI//qoCQB3vk6IRWghXmNfUk= 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=Ab3fFdlG; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ab3fFdlG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711526278; 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=C+d10wCVD+Bb8HTautm4Nb6wFglF1en0DfE0cedzY+0=; b=Ab3fFdlGV6XBTLBWcyQM/L18FKS4W0D+OJ/Sn3iSgFoKBADbxocuVTkapCVdkFLg4Ja5GK 8naZDTbQS03WE/UzCX9glUZzf7sJOKoHHuKLS86ahvXP6n+Hh72KZbiF5RkJO+NnHs+kiG aar9win2MiPwXdSS9qe+WBYLzS3eaI0= 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-288-5Fi22-_JPOuSAlaIFpsNEQ-1; Wed, 27 Mar 2024 03:57:53 -0400 X-MC-Unique: 5Fi22-_JPOuSAlaIFpsNEQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 8B817800266; Wed, 27 Mar 2024 07:57:52 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.224.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9B65C15774; Wed, 27 Mar 2024 07:57:50 +0000 (UTC) From: Ivan Vecera To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mschmidt@redhat.com, aleksandr.loktionov@intel.com, jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Subject: [PATCH iwl-next v2 7/7] i40e: Add and use helper to reconfigure TC for given VSI Date: Wed, 27 Mar 2024 08:57:33 +0100 Message-ID: <20240327075733.8967-8-ivecera@redhat.com> In-Reply-To: <20240327075733.8967-1-ivecera@redhat.com> References: <20240327075733.8967-1-ivecera@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Add helper i40e_vsi_reconfig_tc(vsi) that configures TC for given VSI using previously stored TC bitmap. Effectively replaces open-coded patterns: enabled_tc = vsi->tc_config.enabled_tc; vsi->tc_config.enabled_tc = 0; i40e_vsi_config_tc(vsi, enabled_tc); Reviewed-by: Michal Schmidt Signed-off-by: Ivan Vecera --- drivers/net/ethernet/intel/i40e/i40e_main.c | 31 +++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 2e1955064abb..6c25d02ea05e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -5924,6 +5924,27 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc) return ret; } +/** + * i40e_vsi_reconfig_tc - Reconfigure VSI Tx Scheduler for stored TC map + * @vsi: VSI to be reconfigured + * + * This reconfigures a particular VSI for TCs that are mapped to the + * TC bitmap stored previously for the VSI. + * + * NOTE: + * It is expected that the VSI queues have been quisced before calling + * this function. + **/ +static int i40e_vsi_reconfig_tc(struct i40e_vsi *vsi) +{ + u8 enabled_tc; + + enabled_tc = vsi->tc_config.enabled_tc; + vsi->tc_config.enabled_tc = 0; + + return i40e_vsi_config_tc(vsi, enabled_tc); +} + /** * i40e_get_link_speed - Returns link speed for the interface * @vsi: VSI to be configured @@ -14290,7 +14311,6 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) struct i40e_vsi *main_vsi; u16 alloc_queue_pairs; struct i40e_pf *pf; - u8 enabled_tc; int ret; if (!vsi) @@ -14323,10 +14343,8 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) * layout configurations. */ main_vsi = i40e_pf_get_main_vsi(pf); - enabled_tc = main_vsi->tc_config.enabled_tc; - main_vsi->tc_config.enabled_tc = 0; main_vsi->seid = pf->main_vsi_seid; - i40e_vsi_config_tc(main_vsi, enabled_tc); + i40e_vsi_reconfig_tc(main_vsi); if (vsi->type == I40E_VSI_MAIN) i40e_rm_default_mac_filter(vsi, pf->hw.mac.perm_addr); @@ -15085,11 +15103,8 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acqui } } else { /* force a reset of TC and queue layout configurations */ - u8 enabled_tc = main_vsi->tc_config.enabled_tc; - - main_vsi->tc_config.enabled_tc = 0; main_vsi->seid = pf->main_vsi_seid; - i40e_vsi_config_tc(main_vsi, enabled_tc); + i40e_vsi_reconfig_tc(main_vsi); } i40e_vlan_stripping_disable(main_vsi); -- 2.43.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AFE0C54E67 for ; Wed, 27 Mar 2024 07:58:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0053B81FCD; Wed, 27 Mar 2024 07:58:05 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id tDCrmHLRvAyi; Wed, 27 Mar 2024 07:58:04 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4F5B881EFE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1711526284; bh=C+d10wCVD+Bb8HTautm4Nb6wFglF1en0DfE0cedzY+0=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=sws6+oBq5Bkp1yhYbSgHsiGtWrwzcSGAhDwStKcLrBAMOvBct7SrZEmgMYq7PoEFi b2dbJITSWWY/IsWBSyofzF+6BGJzfj9TpMgyX2f6M3YYTAdk1pJ6bZ2xbgNH4koUoJ GlL+XZp4qg7Y6Ld5+71+xRm5obWmTrXqetm5yqBhsO3x2G4vFI8Y0r8LyiJlbdBSO8 RAGYN4425YNvJuGovwTvfF8CJvC+oPPyD0UNU6OmBaQnQSxj/PCk/ctQGG8UqJ9Uqk OBjuSq6/1TGnhpQsaY8afIZXuv280lT2cT0BBmr/duwV0LSGII0RBJ5RM33OTSpydc 7RkbozlT9cqeA== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 4F5B881EFE; Wed, 27 Mar 2024 07:58:04 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id DEA401BF42D for ; Wed, 27 Mar 2024 07:58:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CAFBA408E0 for ; Wed, 27 Mar 2024 07:58:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id iX1BmzsyXc3s for ; Wed, 27 Mar 2024 07:58:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=ivecera@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org C2CA0408DF DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C2CA0408DF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id C2CA0408DF for ; Wed, 27 Mar 2024 07:57:59 +0000 (UTC) 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-288-5Fi22-_JPOuSAlaIFpsNEQ-1; Wed, 27 Mar 2024 03:57:53 -0400 X-MC-Unique: 5Fi22-_JPOuSAlaIFpsNEQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 8B817800266; Wed, 27 Mar 2024 07:57:52 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.224.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9B65C15774; Wed, 27 Mar 2024 07:57:50 +0000 (UTC) From: Ivan Vecera To: intel-wired-lan@lists.osuosl.org Date: Wed, 27 Mar 2024 08:57:33 +0100 Message-ID: <20240327075733.8967-8-ivecera@redhat.com> In-Reply-To: <20240327075733.8967-1-ivecera@redhat.com> References: <20240327075733.8967-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711526278; 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=C+d10wCVD+Bb8HTautm4Nb6wFglF1en0DfE0cedzY+0=; b=Ab3fFdlGV6XBTLBWcyQM/L18FKS4W0D+OJ/Sn3iSgFoKBADbxocuVTkapCVdkFLg4Ja5GK 8naZDTbQS03WE/UzCX9glUZzf7sJOKoHHuKLS86ahvXP6n+Hh72KZbiF5RkJO+NnHs+kiG aar9win2MiPwXdSS9qe+WBYLzS3eaI0= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ab3fFdlG Subject: [Intel-wired-lan] [PATCH iwl-next v2 7/7] i40e: Add and use helper to reconfigure TC for given VSI X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, aleksandr.loktionov@intel.com, edumazet@google.com, anthony.l.nguyen@intel.com, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add helper i40e_vsi_reconfig_tc(vsi) that configures TC for given VSI using previously stored TC bitmap. Effectively replaces open-coded patterns: enabled_tc = vsi->tc_config.enabled_tc; vsi->tc_config.enabled_tc = 0; i40e_vsi_config_tc(vsi, enabled_tc); Reviewed-by: Michal Schmidt Signed-off-by: Ivan Vecera --- drivers/net/ethernet/intel/i40e/i40e_main.c | 31 +++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 2e1955064abb..6c25d02ea05e 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -5924,6 +5924,27 @@ static int i40e_vsi_config_tc(struct i40e_vsi *vsi, u8 enabled_tc) return ret; } +/** + * i40e_vsi_reconfig_tc - Reconfigure VSI Tx Scheduler for stored TC map + * @vsi: VSI to be reconfigured + * + * This reconfigures a particular VSI for TCs that are mapped to the + * TC bitmap stored previously for the VSI. + * + * NOTE: + * It is expected that the VSI queues have been quisced before calling + * this function. + **/ +static int i40e_vsi_reconfig_tc(struct i40e_vsi *vsi) +{ + u8 enabled_tc; + + enabled_tc = vsi->tc_config.enabled_tc; + vsi->tc_config.enabled_tc = 0; + + return i40e_vsi_config_tc(vsi, enabled_tc); +} + /** * i40e_get_link_speed - Returns link speed for the interface * @vsi: VSI to be configured @@ -14290,7 +14311,6 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) struct i40e_vsi *main_vsi; u16 alloc_queue_pairs; struct i40e_pf *pf; - u8 enabled_tc; int ret; if (!vsi) @@ -14323,10 +14343,8 @@ static struct i40e_vsi *i40e_vsi_reinit_setup(struct i40e_vsi *vsi) * layout configurations. */ main_vsi = i40e_pf_get_main_vsi(pf); - enabled_tc = main_vsi->tc_config.enabled_tc; - main_vsi->tc_config.enabled_tc = 0; main_vsi->seid = pf->main_vsi_seid; - i40e_vsi_config_tc(main_vsi, enabled_tc); + i40e_vsi_reconfig_tc(main_vsi); if (vsi->type == I40E_VSI_MAIN) i40e_rm_default_mac_filter(vsi, pf->hw.mac.perm_addr); @@ -15085,11 +15103,8 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit, bool lock_acqui } } else { /* force a reset of TC and queue layout configurations */ - u8 enabled_tc = main_vsi->tc_config.enabled_tc; - - main_vsi->tc_config.enabled_tc = 0; main_vsi->seid = pf->main_vsi_seid; - i40e_vsi_config_tc(main_vsi, enabled_tc); + i40e_vsi_reconfig_tc(main_vsi); } i40e_vlan_stripping_disable(main_vsi); -- 2.43.0