From patchwork Mon Apr 1 16:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudheer Mogilappagari X-Patchwork-Id: 1918526 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=RS0H2mRG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V7c8j3S6Tz23h8 for ; Tue, 2 Apr 2024 03:36:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4F9BF606D6; Mon, 1 Apr 2024 16:36:14 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id eRwzgOnvJKUk; Mon, 1 Apr 2024 16:36:13 +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 smtp3.osuosl.org 83D526082A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1711989373; bh=EdLnO8Dbk0Uyqud4PtCrv0L18j7/T4l+Jx5tDG8cMi0=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=RS0H2mRGY/7T/2KVXjRh2loR8Gn6CMAQNNyCSpkrEv7FUBpr1MM45FdOJD9NF73bY Gq/1r4QElPYC9v8v/oF6NYsBGV0ZEhgenASLZWG5FNN8TTqjzKHzCe94g81miD0aQC PbLHILV4YR2i3WXp9VRqne7+ZHauU/NXFssGTg1bSEuB5KIg/UApo/BvWwYZUqsnhp nbmHZx1KmzNFIRXIjh0x+PDiFRaSI1CpolYdM+105n4Qyy6lQH7EgulLYOuMWmXkEJ uXDOEf5hicgdsHTfxvEZ3LsWIGdMywImfvzVtMY2SL5oDzocZPtLO6W/n3SdQ55yyC /IEcwYO+UwakA== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 83D526082A; Mon, 1 Apr 2024 16:36:13 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4EFA21BF3C4 for ; Mon, 1 Apr 2024 16:36:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3822B6082A for ; Mon, 1 Apr 2024 16:36:12 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id iF7V0MUTjrD6 for ; Mon, 1 Apr 2024 16:36:10 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.14; helo=mgamail.intel.com; envelope-from=sudheer.mogilappagari@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 18200606D6 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 18200606D6 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by smtp3.osuosl.org (Postfix) with ESMTPS id 18200606D6 for ; Mon, 1 Apr 2024 16:36:08 +0000 (UTC) X-CSE-ConnectionGUID: rbj0U1ykSB6MON3pqjGG2A== X-CSE-MsgGUID: oiK+2jFHRzKIpnPE3RjnQg== X-IronPort-AV: E=McAfee;i="6600,9927,11031"; a="7334320" X-IronPort-AV: E=Sophos;i="6.07,172,1708416000"; d="scan'208";a="7334320" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2024 09:36:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,172,1708416000"; d="scan'208";a="17804466" Received: from msu-dell.jf.intel.com ([10.166.224.119]) by fmviesa006.fm.intel.com with ESMTP; 01 Apr 2024 09:36:08 -0700 From: Sudheer Mogilappagari To: intel-wired-lan@lists.osuosl.org Date: Mon, 1 Apr 2024 09:31:15 -0700 Message-Id: <20240401163115.3702392-1-sudheer.mogilappagari@intel.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711989369; x=1743525369; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=KqQo7FPeQF/Y1aJO1i5pX7hZB53X3oxMFopqDXJKA0Q=; b=Ipu6eijfzQIeDjcIdHqZ2TwttaEWzhNmNvsNevk4qFU3Bq8surp9bhS2 4SfYRr1nJ+NpFEuOciKEFBwCNPSPWd5Rv8gQ7SeUzPnc3yNeHrtT2rClr Ptn8Ek6OVV6QT2luuXyFiLF6YznyTLS9VGhtQdhhRRE5rQ0jEQOMoAyP7 keOwhWD+kmyLmY/b9MzNVTobOpyfIoVaZ5d72HvCYgFWqEnluD3MMFHfR 5F7+pd/AWINw3ZqmWktOJycdru0mkBLjKrd8Hv9zigm8cbqyCj1eX7/HW pbyfuqr2UwxB1TntJ1IuBNApNwD5LY46mdg7Pf15fvBAR7Z8e+hOXMw27 g==; X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ipu6eijf Subject: [Intel-wired-lan] [PATCH iwl-net] iavf: Fix TC config comparison with existing adapter TC config 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: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" 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 Reviewed-by: Tony Nguyen Tested-by: Mineri Bhange (A Contingent Worker at Intel) --- drivers/net/ethernet/intel/iavf/iavf_main.c | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index ef2440f3abf8..6cf71a69cd3b 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -3502,6 +3502,33 @@ 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. Returns + * 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 @@ -3559,7 +3586,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;