[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230103230503.1102426-3-anthony.l.nguyen@intel.com>
Date: Tue, 3 Jan 2023 15:05:02 -0800
From: Tony Nguyen <anthony.l.nguyen@...el.com>
To: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com
Cc: Tan Tee Min <tee.min.tan@...ux.intel.com>, netdev@...r.kernel.org,
anthony.l.nguyen@...el.com, sasha.neftin@...el.com,
Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@...el.com>,
Naama Meir <naamax.meir@...ux.intel.com>
Subject: [PATCH net-next 2/3] igc: enable Qbv configuration for 2nd GCL
From: Tan Tee Min <tee.min.tan@...ux.intel.com>
Make reset task only executes for i225 and Qbv disabling to allow
i226 configure for 2nd GCL without resetting the adapter.
In i226, Tx won't hang if there is a GCL is already running, so in
this case we don't need to set FutScdDis bit.
Signed-off-by: Tan Tee Min <tee.min.tan@...ux.intel.com>
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@...el.com>
Tested-by: Naama Meir <naamax.meir@...ux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 9 +++++----
drivers/net/ethernet/intel/igc/igc_tsn.c | 13 +++++++++----
drivers/net/ethernet/intel/igc/igc_tsn.h | 2 +-
3 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 988131d7acd7..212560f22254 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6020,7 +6020,7 @@ static int igc_tsn_enable_launchtime(struct igc_adapter *adapter,
if (err)
return err;
- return igc_tsn_offload_apply(adapter);
+ return igc_tsn_offload_apply(adapter, qopt->enable);
}
static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
@@ -6044,6 +6044,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
struct tc_taprio_qopt_offload *qopt)
{
bool queue_configured[IGC_MAX_TX_QUEUES] = { };
+ struct igc_hw *hw = &adapter->hw;
u32 start_time = 0, end_time = 0;
size_t n;
int i;
@@ -6056,7 +6057,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
if (qopt->base_time < 0)
return -ERANGE;
- if (adapter->base_time)
+ if (igc_is_device_id_i225(hw) && adapter->base_time)
return -EALREADY;
if (!validate_schedule(adapter, qopt))
@@ -6133,7 +6134,7 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
if (err)
return err;
- return igc_tsn_offload_apply(adapter);
+ return igc_tsn_offload_apply(adapter, qopt->enable);
}
static int igc_save_cbs_params(struct igc_adapter *adapter, int queue,
@@ -6201,7 +6202,7 @@ static int igc_tsn_enable_cbs(struct igc_adapter *adapter,
if (err)
return err;
- return igc_tsn_offload_apply(adapter);
+ return igc_tsn_offload_apply(adapter, qopt->enable);
}
static int igc_setup_tc(struct net_device *dev, enum tc_setup_type type,
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index 28325dc4fc5b..d26fc0f47640 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -225,7 +225,7 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
wr32(IGC_TXQCTL(i), txqctl);
}
- tqavctrl = rd32(IGC_TQAVCTRL);
+ tqavctrl = rd32(IGC_TQAVCTRL) & ~IGC_TQAVCTRL_FUTSCDDIS;
tqavctrl |= IGC_TQAVCTRL_TRANSMIT_MODE_TSN | IGC_TQAVCTRL_ENHANCED_QAV;
cycle = adapter->cycle_time;
@@ -242,8 +242,11 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
} else {
/* According to datasheet section 7.5.2.9.3.3, FutScdDis bit
* has to be configured before the cycle time and base time.
+ * Tx won't hang if there is a GCL is already running,
+ * so in this case we don't need to set FutScdDis.
*/
- if (igc_is_device_id_i226(hw))
+ if (igc_is_device_id_i226(hw) &&
+ !(rd32(IGC_BASET_H) || rd32(IGC_BASET_L)))
tqavctrl |= IGC_TQAVCTRL_FUTSCDDIS;
}
@@ -286,11 +289,13 @@ int igc_tsn_reset(struct igc_adapter *adapter)
return err;
}
-int igc_tsn_offload_apply(struct igc_adapter *adapter)
+int igc_tsn_offload_apply(struct igc_adapter *adapter, bool enable)
{
+ struct igc_hw *hw = &adapter->hw;
int err;
- if (netif_running(adapter->netdev)) {
+ if (netif_running(adapter->netdev) &&
+ (igc_is_device_id_i225(hw) || !enable)) {
schedule_work(&adapter->reset_task);
return 0;
}
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h b/drivers/net/ethernet/intel/igc/igc_tsn.h
index b53e6af560b7..631222bb6eb5 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.h
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.h
@@ -4,7 +4,7 @@
#ifndef _IGC_TSN_H_
#define _IGC_TSN_H_
-int igc_tsn_offload_apply(struct igc_adapter *adapter);
+int igc_tsn_offload_apply(struct igc_adapter *adapter, bool enable);
int igc_tsn_reset(struct igc_adapter *adapter);
void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
--
2.38.1
Powered by blists - more mailing lists