From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5390512D1E8; Tue, 30 Apr 2024 11:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475861; cv=none; b=b3Tw+1BBBeu8tviD07K2pApNKU1o5pEex8cOth9M3GX/zV/v1e9fkr4iCAFDrg+SIQ4FAm2mFCVxTMrc1UUDhCaWAhCJNElTSycSl6+4UM0pW6KM1a7vEA3aB4rbvVJg2E77BnbpnHboO+5bn1lavn9tjDNhwAml0IF7ZMZSbOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714475861; c=relaxed/simple; bh=O9CCqum9hNQP78XMQ5UXWb83QibATuMQKGpbC6FgGp8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bfuwdsKNB/8BMzXAp/Xuxez7d+uT+lqc1SaaMenSUkPQpf8eV8CldmQeJwBbI7jk9edb6J07YsIws01rO0H7j0j0Ww8CCE1q6Hzb6i+sxQvTk3rtB0Jg9DFDeKML7HZf+2kSLwHkZGScsIQqQgQVeGaLndpnHJdkJBsAumr7teM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qUGhdqhk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qUGhdqhk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF741C2BBFC; Tue, 30 Apr 2024 11:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714475861; bh=O9CCqum9hNQP78XMQ5UXWb83QibATuMQKGpbC6FgGp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUGhdqhkLM6Jf49qrt5X2pShg1laXruYEuUdXL5POyMTyc8RjJR74cWlUFxXpMuRD nct8QDrjxknmy5vwL38ODJOR8Y4RUL763MxhtLv9A+JXSXs2olsWxnoHCsiI/OfkrI olv0VcCkDPVoLEBT1CY1+Hifg3unyynTnQ/JdSVQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sudheer Mogilappagari , Tony Nguyen , Jakub Kicinski , Sasha Levin , Mineri Bhange Subject: [PATCH 5.15 41/80] iavf: Fix TC config comparison with existing adapter TC config Date: Tue, 30 Apr 2024 12:40:13 +0200 Message-ID: <20240430103044.631399383@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430103043.397234724@linuxfoundation.org> References: <20240430103043.397234724@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sudheer Mogilappagari [ Upstream commit 54976cf58d6168b8d15cebb395069f23b2f34b31 ] Same number of TCs doesn't imply that underlying TC configs are same. The config could be different due to difference in number of queues in each TC. Add utility function to determine if TC configs are same. Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Sudheer Mogilappagari Tested-by: Mineri Bhange (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen Link: https://lore.kernel.org/r/20240423182723.740401-4-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_main.c | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 41b8ff0d4df5e..6073dcc414d6d 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2901,6 +2901,34 @@ static void iavf_del_all_cloud_filters(struct iavf_adapter *adapter) spin_unlock_bh(&adapter->cloud_filter_list_lock); } +/** + * iavf_is_tc_config_same - Compare the mqprio TC config with the + * TC config already configured on this adapter. + * @adapter: board private structure + * @mqprio_qopt: TC config received from kernel. + * + * This function compares the TC config received from the kernel + * with the config already configured on the adapter. + * + * Return: True if configuration is same, false otherwise. + **/ +static bool iavf_is_tc_config_same(struct iavf_adapter *adapter, + struct tc_mqprio_qopt *mqprio_qopt) +{ + struct virtchnl_channel_info *ch = &adapter->ch_config.ch_info[0]; + int i; + + if (adapter->num_tc != mqprio_qopt->num_tc) + return false; + + for (i = 0; i < adapter->num_tc; i++) { + if (ch[i].count != mqprio_qopt->count[i] || + ch[i].offset != mqprio_qopt->offset[i]) + return false; + } + return true; +} + /** * __iavf_setup_tc - configure multiple traffic classes * @netdev: network interface device structure @@ -2958,7 +2986,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data) if (ret) return ret; /* Return if same TC config is requested */ - if (adapter->num_tc == num_tc) + if (iavf_is_tc_config_same(adapter, &mqprio_qopt->qopt)) return 0; adapter->num_tc = num_tc; -- 2.43.0