igc: allow BaseTime 0 enrollment for Qbv
authorTan Tee Min <tee.min.tan@linux.intel.com>
Fri, 9 Dec 2022 04:15:20 +0000 (12:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:54 +0000 (13:32 +0100)
[ Upstream commit e17090eb24944fbbe1f24d9f336d7bad4fbe47e8 ]

Introduce qbv_enable flag in igc_adapter struct to store the Qbv on/off.
So this allow the BaseTime to enroll with zero value.

Fixes: 61572d5f8f91 ("igc: Simplify TSN flags handling")
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.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 66a57636d329a808fea647ae1ee58f3cba2a2bcb..df3e26c0cf01ac79000128139508c412c6100492 100644 (file)
@@ -184,6 +184,7 @@ struct igc_adapter {
 
        ktime_t base_time;
        ktime_t cycle_time;
+       bool qbv_enable;
 
        /* OS defined structs */
        struct pci_dev *pdev;
index 42386a0eef68619b016e3e029723b31a23dcb9b2..d666b3aab523555c2df13d444cb3ea088bbd1a82 100644 (file)
@@ -6037,6 +6037,8 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
        u32 start_time = 0, end_time = 0;
        size_t n;
 
+       adapter->qbv_enable = qopt->enable;
+
        if (!qopt->enable)
                return igc_tsn_clear_schedule(adapter);
 
index 4a019954cadb618df6930c8dcc44757bd3a685dd..356c7455c5cee31c1dd7259d3af17217fc85b77f 100644 (file)
@@ -36,7 +36,7 @@ static unsigned int igc_tsn_new_flags(struct igc_adapter *adapter)
 {
        unsigned int new_flags = adapter->flags & ~IGC_FLAG_TSN_ANY_ENABLED;
 
-       if (adapter->base_time)
+       if (adapter->qbv_enable)
                new_flags |= IGC_FLAG_TSN_QBV_ENABLED;
 
        if (is_any_launchtime(adapter))