igc: Add condition for qbv_config_change_errors counter
authorMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Mon, 15 May 2023 06:03:36 +0000 (14:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:03 +0000 (12:03 +0200)
commit ed89b74d2dc920cb61d3094e0e97ec8775b13086 upstream.

Add condition to increase the qbv counter during taprio qbv
configuration only.

There might be a case when TC already been setup then user configure
the ETF/CBS qdisc and this counter will increase if no condition above.

Fixes: ae4fe4698300 ("igc: Add qbv_config_change_errors counter")
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/intel/igc/igc.h
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/intel/igc/igc_tsn.c

index 0a2b498151930e71663c6cbc54fd2d5601088545..586fd577dbb95efbfce1e2809dc7546c2ac3cee2 100644 (file)
@@ -183,6 +183,7 @@ struct igc_adapter {
        u32 max_frame_size;
        u32 min_frame_size;
 
+       int tc_setup_type;
        ktime_t base_time;
        ktime_t cycle_time;
        bool qbv_enable;
index eac17ab3341528e570e9bff7d3bfc91606cf708c..af37911d0ed6f332efc83c45a04910093db375fd 100644 (file)
@@ -6288,6 +6288,8 @@ static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type,
 {
        struct igc_adapter *adapter = netdev_priv(dev);
 
+       adapter->tc_setup_type = type;
+
        switch (type) {
        case TC_SETUP_QDISC_TAPRIO:
                return igc_tsn_enable_qbv_scheduling(adapter, type_data);
index 893d86268eda3414feaab6a3795f7ed8f409e46f..725db36e399d25ad80700ffafaf335661eb0e512 100644 (file)
@@ -219,6 +219,7 @@ skip_cbs:
                 * Gate Control List (GCL) is running.
                 */
                if ((rd32(IGC_BASET_H) || rd32(IGC_BASET_L)) &&
+                   (adapter->tc_setup_type == TC_SETUP_QDISC_TAPRIO) &&
                    tsn_mode_reconfig)
                        adapter->qbv_config_change_errors++;
        } else {