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 D734512D745; Tue, 30 Apr 2024 11:24:01 +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=1714476241; cv=none; b=V7Tj9R4/RY3jHf2uxOUyJvDYeL7e5fvPUy3ONapPkHxN1EmYCWmT6V9dUoc9rkoF1rnMGdCWt3PZVX6RnPXFMA5Gl62ugQP/amEBSPVEkLVIOhv39zg+tummQoizm3iHIH93f2XBlw7uaKHqng2Rke1TVItRsyjZFTaShIzX1nA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714476241; c=relaxed/simple; bh=7E3r3RXG6A3JCCOe2TV/f9NpxcnDvo4v9V9PDtBZa2k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G9JNfazIBx7xsmV40+iepgGiuQ4iBXDk+Yd80hyIhvNAgs1HfwEHk/KJsWX1EHTARKAhnG0MYYAmpKaL6wKrFj+i+ucK1x/IKCWiZG3vPOIYx0j9tMYyndH8om9wpHf5m/xzEumvdO/PKBnLkcDBDINC+uWV4h/R72BSUiDQ6UI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V+sTKIwF; 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="V+sTKIwF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59BA4C4AF1A; Tue, 30 Apr 2024 11:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714476241; bh=7E3r3RXG6A3JCCOe2TV/f9NpxcnDvo4v9V9PDtBZa2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+sTKIwFNpnHNePcCD3LxMbAp3XV4ynhaAZyD+GBWeq9d8TkZPlb7EBBGrbZzLj5m 4NvSfd4y0NPZjt6ozewpl1QxQhuL0dC3amYEQorvnVe1k/FL6Q42jAHotaWtnvTSp9 2hZjnUb/m+rW1CE8DtJBp4fMbmpqjJxy99En3qsU= 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.4 077/107] iavf: Fix TC config comparison with existing adapter TC config Date: Tue, 30 Apr 2024 12:40:37 +0200 Message-ID: <20240430103046.928807355@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430103044.655968143@linuxfoundation.org> References: <20240430103044.655968143@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.4-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 9cf556fedc704..8cc20db625c22 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2647,6 +2647,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 @@ -2703,7 +2731,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