Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp272667lqt; Mon, 18 Mar 2024 07:33:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXikZPbXj6bpkquGqXzkF3xNcn3vVK6t2iR+R++UuFHsiLj/azMNgB5AD8q4Rn3ynLDhvpBPfWESBx6FGL2xQ4CqmA3Gz+86yLJkXJ5iA== X-Google-Smtp-Source: AGHT+IHx7lqRA4pXvPyp6DMxJ2wVtSQZWbzCHCnJX6NGuzoJ0YhQCv+zZHal+18Is/aLcAhd0InZ X-Received: by 2002:a05:6a00:23cb:b0:6e7:30f3:dae8 with SMTP id g11-20020a056a0023cb00b006e730f3dae8mr1703896pfc.19.1710772395831; Mon, 18 Mar 2024 07:33:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710772395; cv=pass; d=google.com; s=arc-20160816; b=r6OiBnlbz2nezo9Rz9T+q80lDQU1TIjFJqWFjwYCe9//J+7mMGe7VdhySn0f3f57Ku ggUfABaMSXS6bqH74rNpfCPUgkz0tIDbcU3eOblhHf8sFfZtnd8hqoI6uaEqOGvtJSMv PbSJtFO1NokIRjP2vVIuz1Eanc2QbcJLvax9VQqubNFWjH3xHLx9Uu1gAJlAyV+Ev+NJ Zq74YAcUWOpoIhk6nWkXHoB2dKGyHM+/ln36IBhLrdIvBGfHuAo6xSLCuvJm/bB1UK6g ZdBKkU02KnRTEPRRqpSRTYONHhng0fman/X952z5ko3yqpow8oZQ+eL1ZBN5q1xGJfGT yYGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nWwHtoZl1wbbpHMnDuTuwYTm4XvT6TfDawuxJMzon0k=; fh=SVRNHM571WgfhsgYmjgXjOIMrO1aq9fhLcRYgtPEP4g=; b=tdP92e/TCt+BDmloZgaGjqGrGBqLRN4Ok5ZqZYj67oRgsM7qySOlpt6+39vNu5mmv5 8ncxcHEQRgPLgw09cMbpzALFwwCaxy9npV6V7F8Eap+H9DLfw+Jg7wc9PoaSvgxZyhra /+9mh0mmhe4nW040A6w0G4giFxLhDEvqYgUq4alhitWU2CI1ogj3HuIdrg6gm15tlgqs jRrsB3CNViRg6iWq+ZPSsTyIfi1tZoawILaeg0q3Cd8BdiUBwLBLII8xtcpX3drFLQ2U r7mbUyinYd8tX7jv+20kwaspYG7y0qwUjFgkr6wjd6WaqIbLQqu/Tv1bZcmtgB1yrP9d y1Ig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aYH4Zf2/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h126-20020a636c84000000b005dc42bb64aesi7949131pgc.617.2024.03.18.07.33.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 07:33:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="aYH4Zf2/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106230-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B29A4B21506 for ; Mon, 18 Mar 2024 14:33:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CDE852F8B; Mon, 18 Mar 2024 14:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aYH4Zf2/" 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 13F221DFC1 for ; Mon, 18 Mar 2024 14:31:25 +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=1710772287; cv=none; b=azHXHrLbMGCx8zqwJksSrlDCl1o6SF2VU0bDrO4/W8S7uUrpghIjqV7qpz8vKo+gWE+uNnPYbZYccYogqHM+iRGiN8ffbN2U8hA6hAx2zln8PX2kDB3juZskNcMVgA2rZ+duxkT3dQ9QzCtHyJRuyqfFkwLTgEQ0oADbfT8XxS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710772287; c=relaxed/simple; bh=xkskm0QdMrn7JyMrtZG83GvHwuov0G6axO/MmPph4xk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ntUF6R/oxnw/fWnGXu0EK3uZQbDC4IcqRRbsJMAvVDHaQXCfbf4LSLsYjJI4Uuq3JDTcPXlys9gmpwhnXQGHIkH2Qw3MaP/JMWDLX9wWzdv9jUiQNVWcampEBiJK2MjLoOV77AqBGuPvehz9RYrdwA8qJAjEGImyWJzVDO3FtKM= 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=aYH4Zf2/; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710772285; 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=nWwHtoZl1wbbpHMnDuTuwYTm4XvT6TfDawuxJMzon0k=; b=aYH4Zf2/WzsZfKIWmey4haewSWSRGf7n273p9FURyVQ1FwNLqwIo8uZD1Psicy0UlWtVE0 wiyz9EgF1QE/LUXGEwNYKkG348fp8u72/xXeEM+ldrGojaLvy6bww+KBBytx6dLE/EYTNS czKyF8MEkeFVLGRpySh0nOx+Us3Mkk8= 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-108-_t9FFwtvOZixWHm-wYPoug-1; Mon, 18 Mar 2024 10:31:20 -0400 X-MC-Unique: _t9FFwtvOZixWHm-wYPoug-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 5D6033802131; Mon, 18 Mar 2024 14:31:19 +0000 (UTC) Received: from p1.luc.cera.cz (unknown [10.45.224.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04DEA112131D; Mon, 18 Mar 2024 14:31:17 +0000 (UTC) From: Ivan Vecera To: intel-wired-lan@lists.osuosl.org Cc: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH iwl-next 7/7] i40e: Add and use helper to reconfigure TC for given VSI Date: Mon, 18 Mar 2024 15:30:51 +0100 Message-ID: <20240318143058.287014-8-ivecera@redhat.com> In-Reply-To: <20240318143058.287014-1-ivecera@redhat.com> References: <20240318143058.287014-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.3 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); 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