All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net-next v1 0/3] igc: Qbv Feature Improvement for I226
@ 2022-12-12  2:37 Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Muhammad Husaini Zulkifli @ 2022-12-12  2:37 UTC (permalink / raw)
  To: intel-wired-lan, vinicius.gomes
  Cc: muhammad.husaini.zulkifli, anthony.l.nguyen, tee.min.tan

Hello!

Improvements to the Time-Sensitive Networking (TSN) Qbv Scheduling
capabilities were included in this patch series for I226 SKU.

An overview of each patch series is given below:

Patch 1: To enable basetime scheduling in the future, remove the existing
restriction for i226 stepping while maintain the restriction for i225.
Patch 2: Remove the restriction which require a controller reset when
setting the basetime register for new i226 steps and enable the second
GCL configuration.
Patch 3: Remove the power reset adapter during disabling the tsn config.

Muhammad Husaini Zulkifli (2):
  igc: remove I226 Qbv BaseTime restriction
  igc: Remove reset adapter task for i226 during disable tsn config

Tan Tee Min (1):
  igc: enable Qbv configuration for 2nd GCL

 drivers/net/ethernet/intel/igc/igc_base.c    | 29 ++++++++++
 drivers/net/ethernet/intel/igc/igc_base.h    |  2 +
 drivers/net/ethernet/intel/igc/igc_defines.h |  1 +
 drivers/net/ethernet/intel/igc/igc_main.c    |  8 ++-
 drivers/net/ethernet/intel/igc/igc_tsn.c     | 56 ++++++++++++--------
 5 files changed, 73 insertions(+), 23 deletions(-)

--
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction
  2022-12-12  2:37 [Intel-wired-lan] [PATCH net-next v1 0/3] igc: Qbv Feature Improvement for I226 Muhammad Husaini Zulkifli
@ 2022-12-12  2:37 ` Muhammad Husaini Zulkifli
  2022-12-13 22:33   ` Tony Nguyen
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 2/3] igc: enable Qbv configuration for 2nd GCL Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config Muhammad Husaini Zulkifli
  2 siblings, 1 reply; 8+ messages in thread
From: Muhammad Husaini Zulkifli @ 2022-12-12  2:37 UTC (permalink / raw)
  To: intel-wired-lan, vinicius.gomes
  Cc: muhammad.husaini.zulkifli, anthony.l.nguyen, tee.min.tan

Remove the Qbv BaseTime restriction for I226 so that the BaseTime can be
scheduled to the future time. A new register bit of Tx Qav Control
(Bit-7: FutScdDis) was introduced to allow I226 scheduling future time as
Qbv BaseTime and not having the Tx hang timeout issue.

Besides, according to datasheet section 7.5.2.9.3.3, FutScdDis bit has to
be configured first before the cycle time and base time.

Indeed the FutScdDis bit is only active on re-configuration, thus we have
to set the BASET_L to zero and then only set it to the desired value.

Please also note that the Qbv configuration flow is moved around based on
the Qbv programming guideline that is documented in the latest datasheet.

Co-Developed-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_base.c    | 29 +++++++++++++
 drivers/net/ethernet/intel/igc/igc_base.h    |  2 +
 drivers/net/ethernet/intel/igc/igc_defines.h |  1 +
 drivers/net/ethernet/intel/igc/igc_main.c    |  5 ++-
 drivers/net/ethernet/intel/igc/igc_tsn.c     | 44 +++++++++++++-------
 5 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_base.c b/drivers/net/ethernet/intel/igc/igc_base.c
index a15927e77272..a1d815af507d 100644
--- a/drivers/net/ethernet/intel/igc/igc_base.c
+++ b/drivers/net/ethernet/intel/igc/igc_base.c
@@ -396,6 +396,35 @@ void igc_rx_fifo_flush_base(struct igc_hw *hw)
 	rd32(IGC_MPC);
 }
 
+bool igc_is_device_id_i225(struct igc_hw *hw)
+{
+	switch (hw->device_id) {
+	case IGC_DEV_ID_I225_LM:
+	case IGC_DEV_ID_I225_V:
+	case IGC_DEV_ID_I225_I:
+	case IGC_DEV_ID_I225_K:
+	case IGC_DEV_ID_I225_K2:
+	case IGC_DEV_ID_I225_LMVP:
+	case IGC_DEV_ID_I225_IT:
+		return true;
+	default:
+		return false;
+	}
+}
+
+bool igc_is_device_id_i226(struct igc_hw *hw)
+{
+	switch (hw->device_id) {
+	case IGC_DEV_ID_I226_LM:
+	case IGC_DEV_ID_I226_V:
+	case IGC_DEV_ID_I226_K:
+	case IGC_DEV_ID_I226_IT:
+		return true;
+	default:
+		return false;
+	}
+}
+
 static struct igc_mac_operations igc_mac_ops_base = {
 	.init_hw		= igc_init_hw_base,
 	.check_for_link		= igc_check_for_copper_link,
diff --git a/drivers/net/ethernet/intel/igc/igc_base.h b/drivers/net/ethernet/intel/igc/igc_base.h
index ce530f5fd7bd..7a992befca24 100644
--- a/drivers/net/ethernet/intel/igc/igc_base.h
+++ b/drivers/net/ethernet/intel/igc/igc_base.h
@@ -7,6 +7,8 @@
 /* forward declaration */
 void igc_rx_fifo_flush_base(struct igc_hw *hw);
 void igc_power_down_phy_copper_base(struct igc_hw *hw);
+bool igc_is_device_id_i225(struct igc_hw *hw);
+bool igc_is_device_id_i226(struct igc_hw *hw);
 
 /* Transmit Descriptor - Advanced */
 union igc_adv_tx_desc {
diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/ethernet/intel/igc/igc_defines.h
index a7b22639cfcd..0e23f6244ffb 100644
--- a/drivers/net/ethernet/intel/igc/igc_defines.h
+++ b/drivers/net/ethernet/intel/igc/igc_defines.h
@@ -522,6 +522,7 @@
 /* Transmit Scheduling */
 #define IGC_TQAVCTRL_TRANSMIT_MODE_TSN	0x00000001
 #define IGC_TQAVCTRL_ENHANCED_QAV	0x00000008
+#define IGC_TQAVCTRL_FUTSCDDIS		0x00000080
 
 #define IGC_TXQCTL_QUEUE_MODE_LAUNCHT	0x00000001
 #define IGC_TXQCTL_STRICT_CYCLE		0x00000002
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index e07287e05862..37221c99b899 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -5941,6 +5941,7 @@ static bool validate_schedule(struct igc_adapter *adapter,
 			      const struct tc_taprio_qopt_offload *qopt)
 {
 	int queue_uses[IGC_MAX_TX_QUEUES] = { };
+	struct igc_hw *hw = &adapter->hw;
 	struct timespec64 now;
 	size_t n;
 
@@ -5953,8 +5954,10 @@ static bool validate_schedule(struct igc_adapter *adapter,
 	 * in the future, it will hold all the packets until that
 	 * time, causing a lot of TX Hangs, so to avoid that, we
 	 * reject schedules that would start in the future.
+	 * Note: Limitation above is no longer in i226.
 	 */
-	if (!is_base_time_past(qopt->base_time, &now))
+	if (!is_base_time_past(qopt->base_time, &now) &&
+	    igc_is_device_id_i225(hw))
 		return false;
 
 	for (n = 0; n < qopt->num_entries; n++) {
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c
index bb10d7b65232..28325dc4fc5b 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -2,6 +2,7 @@
 /* Copyright (c)  2019 Intel Corporation */
 
 #include "igc.h"
+#include "igc_hw.h"
 #include "igc_tsn.h"
 
 static bool is_any_launchtime(struct igc_adapter *adapter)
@@ -92,7 +93,8 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)
 
 	tqavctrl = rd32(IGC_TQAVCTRL);
 	tqavctrl &= ~(IGC_TQAVCTRL_TRANSMIT_MODE_TSN |
-		      IGC_TQAVCTRL_ENHANCED_QAV);
+		      IGC_TQAVCTRL_ENHANCED_QAV | IGC_TQAVCTRL_FUTSCDDIS);
+
 	wr32(IGC_TQAVCTRL, tqavctrl);
 
 	for (i = 0; i < adapter->num_tx_queues; i++) {
@@ -117,20 +119,10 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
 	ktime_t base_time, systim;
 	int i;
 
-	cycle = adapter->cycle_time;
-	base_time = adapter->base_time;
-
 	wr32(IGC_TSAUXC, 0);
 	wr32(IGC_DTXMXPKTSZ, IGC_DTXMXPKTSZ_TSN);
 	wr32(IGC_TXPBS, IGC_TXPBSIZE_TSN);
 
-	tqavctrl = rd32(IGC_TQAVCTRL);
-	tqavctrl |= IGC_TQAVCTRL_TRANSMIT_MODE_TSN | IGC_TQAVCTRL_ENHANCED_QAV;
-	wr32(IGC_TQAVCTRL, tqavctrl);
-
-	wr32(IGC_QBVCYCLET_S, cycle);
-	wr32(IGC_QBVCYCLET, cycle);
-
 	for (i = 0; i < adapter->num_tx_queues; i++) {
 		struct igc_ring *ring = adapter->tx_ring[i];
 		u32 txqctl = 0;
@@ -233,21 +225,43 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
 		wr32(IGC_TXQCTL(i), txqctl);
 	}
 
+	tqavctrl = rd32(IGC_TQAVCTRL);
+	tqavctrl |= IGC_TQAVCTRL_TRANSMIT_MODE_TSN | IGC_TQAVCTRL_ENHANCED_QAV;
+
+	cycle = adapter->cycle_time;
+	base_time = adapter->base_time;
+
 	nsec = rd32(IGC_SYSTIML);
 	sec = rd32(IGC_SYSTIMH);
 
 	systim = ktime_set(sec, nsec);
-
 	if (ktime_compare(systim, base_time) > 0) {
-		s64 n;
+		s64 n = div64_s64(ktime_sub_ns(systim, base_time), cycle);
 
-		n = div64_s64(ktime_sub_ns(systim, base_time), cycle);
 		base_time = ktime_add_ns(base_time, (n + 1) * cycle);
+	} else {
+		/* According to datasheet section 7.5.2.9.3.3, FutScdDis bit
+		 * has to be configured before the cycle time and base time.
+		 */
+		if (igc_is_device_id_i226(hw))
+			tqavctrl |= IGC_TQAVCTRL_FUTSCDDIS;
 	}
 
-	baset_h = div_s64_rem(base_time, NSEC_PER_SEC, &baset_l);
+	wr32(IGC_TQAVCTRL, tqavctrl);
+
+	wr32(IGC_QBVCYCLET_S, cycle);
+	wr32(IGC_QBVCYCLET, cycle);
 
+	baset_h = div_s64_rem(base_time, NSEC_PER_SEC, &baset_l);
 	wr32(IGC_BASET_H, baset_h);
+
+	/* In i226, Future base time is only supported when FutScdDis bit
+	 * is enabled and only active for re-configuration.
+	 * In this case, initialize the base time with zero to create
+	 * "re-configuration" scenario then only set the desired base time.
+	 */
+	if (tqavctrl & IGC_TQAVCTRL_FUTSCDDIS)
+		wr32(IGC_BASET_L, 0);
 	wr32(IGC_BASET_L, baset_l);
 
 	return 0;
-- 
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH net-next v1 2/3] igc: enable Qbv configuration for 2nd GCL
  2022-12-12  2:37 [Intel-wired-lan] [PATCH net-next v1 0/3] igc: Qbv Feature Improvement for I226 Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
@ 2022-12-12  2:37 ` Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config Muhammad Husaini Zulkifli
  2 siblings, 0 replies; 8+ messages in thread
From: Muhammad Husaini Zulkifli @ 2022-12-12  2:37 UTC (permalink / raw)
  To: intel-wired-lan, vinicius.gomes
  Cc: muhammad.husaini.zulkifli, anthony.l.nguyen, tee.min.tan

From: Tan Tee Min <tee.min.tan@linux.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@linux.intel.com>
Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.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 37221c99b899..bf66395a59bb 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6003,7 +6003,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)
@@ -6027,6 +6027,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;
@@ -6039,7 +6040,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))
@@ -6116,7 +6117,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,
@@ -6184,7 +6185,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..c2cc5d406213 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.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config
  2022-12-12  2:37 [Intel-wired-lan] [PATCH net-next v1 0/3] igc: Qbv Feature Improvement for I226 Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 2/3] igc: enable Qbv configuration for 2nd GCL Muhammad Husaini Zulkifli
@ 2022-12-12  2:37 ` Muhammad Husaini Zulkifli
  2022-12-13 22:37   ` Tony Nguyen
  2 siblings, 1 reply; 8+ messages in thread
From: Muhammad Husaini Zulkifli @ 2022-12-12  2:37 UTC (permalink / raw)
  To: intel-wired-lan, vinicius.gomes
  Cc: muhammad.husaini.zulkifli, anthony.l.nguyen, tee.min.tan

I225 have limitation when programming the BaseTime register which required
a power cycle of the controller. This limitation already lifted in I226.
This patch removes the restriction so that when user configure/remove any
TSN mode, it would not go into power cycle reset adapter.

How to test:

Schedule any gate control list configuration or delete it.

Example:

1)

BASE_TIME=$(date +%s%N)
tc qdisc replace dev $interface_name parent root handle 100 taprio \
    num_tc 4 \
    map 3 1 0 2 3 3 3 3 3 3 3 3 3 3 3 3 \
    queues 1@0 1@1 1@2 1@3 \
    base-time $BASE_TIME \
    sched-entry S 0F 1000000 \
    flags 0x2

2) tc qdisc del dev $intername_name root

Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c |  6 +++---
 drivers/net/ethernet/intel/igc/igc_tsn.c  | 11 +++--------
 drivers/net/ethernet/intel/igc/igc_tsn.h  |  2 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index bf66395a59bb..fdb7f0b26ed0 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6003,7 +6003,7 @@ static int igc_tsn_enable_launchtime(struct igc_adapter *adapter,
 	if (err)
 		return err;
 
-	return igc_tsn_offload_apply(adapter, qopt->enable);
+	return igc_tsn_offload_apply(adapter);
 }
 
 static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
@@ -6117,7 +6117,7 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
 	if (err)
 		return err;
 
-	return igc_tsn_offload_apply(adapter, qopt->enable);
+	return igc_tsn_offload_apply(adapter);
 }
 
 static int igc_save_cbs_params(struct igc_adapter *adapter, int queue,
@@ -6185,7 +6185,7 @@ static int igc_tsn_enable_cbs(struct igc_adapter *adapter,
 	if (err)
 		return err;
 
-	return igc_tsn_offload_apply(adapter, qopt->enable);
+	return igc_tsn_offload_apply(adapter);
 }
 
 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 c2cc5d406213..b03c6168bd23 100644
--- a/drivers/net/ethernet/intel/igc/igc_tsn.c
+++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
@@ -289,21 +289,16 @@ int igc_tsn_reset(struct igc_adapter *adapter)
 	return err;
 }
 
-int igc_tsn_offload_apply(struct igc_adapter *adapter, bool enable)
+int igc_tsn_offload_apply(struct igc_adapter *adapter)
 {
 	struct igc_hw *hw = &adapter->hw;
-	int err;
 
-	if (netif_running(adapter->netdev) &&
-	    (igc_is_device_id_i225(hw) || !enable)) {
+	if (netif_running(adapter->netdev) && igc_is_device_id_i225(hw)) {
 		schedule_work(&adapter->reset_task);
 		return 0;
 	}
 
-	err = igc_tsn_enable_offload(adapter);
-	if (err < 0)
-		return err;
+	igc_tsn_reset(adapter);
 
-	adapter->flags = igc_tsn_new_flags(adapter);
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h b/drivers/net/ethernet/intel/igc/igc_tsn.h
index 631222bb6eb5..b53e6af560b7 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, bool enable);
+int igc_tsn_offload_apply(struct igc_adapter *adapter);
 int igc_tsn_reset(struct igc_adapter *adapter);
 void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
 
-- 
2.17.1

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
@ 2022-12-13 22:33   ` Tony Nguyen
  2022-12-13 22:58     ` Zulkifli, Muhammad Husaini
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Nguyen @ 2022-12-13 22:33 UTC (permalink / raw)
  To: Muhammad Husaini Zulkifli, intel-wired-lan, vinicius.gomes; +Cc: tee.min.tan



On 12/11/2022 6:37 PM, Muhammad Husaini Zulkifli wrote:
> Remove the Qbv BaseTime restriction for I226 so that the BaseTime can be
> scheduled to the future time. A new register bit of Tx Qav Control
> (Bit-7: FutScdDis) was introduced to allow I226 scheduling future time as
> Qbv BaseTime and not having the Tx hang timeout issue.
> 
> Besides, according to datasheet section 7.5.2.9.3.3, FutScdDis bit has to
> be configured first before the cycle time and base time.
> 
> Indeed the FutScdDis bit is only active on re-configuration, thus we have
> to set the BASET_L to zero and then only set it to the desired value.
> 
> Please also note that the Qbv configuration flow is moved around based on
> the Qbv programming guideline that is documented in the latest datasheet.
> 
> Co-Developed-by: Tan Tee Min <tee.min.tan@linux.intel.com>

nit: WARNING: 'Co-developed-by:' is the preferred signature form

> Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config
  2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config Muhammad Husaini Zulkifli
@ 2022-12-13 22:37   ` Tony Nguyen
  2022-12-13 22:56     ` Zulkifli, Muhammad Husaini
  0 siblings, 1 reply; 8+ messages in thread
From: Tony Nguyen @ 2022-12-13 22:37 UTC (permalink / raw)
  To: Muhammad Husaini Zulkifli, intel-wired-lan, vinicius.gomes; +Cc: tee.min.tan



On 12/11/2022 6:37 PM, Muhammad Husaini Zulkifli wrote:
> I225 have limitation when programming the BaseTime register which required
> a power cycle of the controller. This limitation already lifted in I226.
> This patch removes the restriction so that when user configure/remove any
> TSN mode, it would not go into power cycle reset adapter.

This patch is mostly undoing changes made in patch 2. Is there a reason 
you don't squash the two and mention the net change in the previous patch?

> How to test:
> 
> Schedule any gate control list configuration or delete it.
> 
> Example:
> 
> 1)
> 
> BASE_TIME=$(date +%s%N)
> tc qdisc replace dev $interface_name parent root handle 100 taprio \
>      num_tc 4 \
>      map 3 1 0 2 3 3 3 3 3 3 3 3 3 3 3 3 \
>      queues 1@0 1@1 1@2 1@3 \
>      base-time $BASE_TIME \
>      sched-entry S 0F 1000000 \
>      flags 0x2
> 
> 2) tc qdisc del dev $intername_name root
> 
> Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
> ---
>   drivers/net/ethernet/intel/igc/igc_main.c |  6 +++---
>   drivers/net/ethernet/intel/igc/igc_tsn.c  | 11 +++--------
>   drivers/net/ethernet/intel/igc/igc_tsn.h  |  2 +-
>   3 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index bf66395a59bb..fdb7f0b26ed0 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -6003,7 +6003,7 @@ static int igc_tsn_enable_launchtime(struct igc_adapter *adapter,
>   	if (err)
>   		return err;
>   
> -	return igc_tsn_offload_apply(adapter, qopt->enable);
> +	return igc_tsn_offload_apply(adapter);
>   }
>   
>   static int igc_tsn_clear_schedule(struct igc_adapter *adapter)
> @@ -6117,7 +6117,7 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter,
>   	if (err)
>   		return err;
>   
> -	return igc_tsn_offload_apply(adapter, qopt->enable);
> +	return igc_tsn_offload_apply(adapter);
>   }
>   
>   static int igc_save_cbs_params(struct igc_adapter *adapter, int queue,
> @@ -6185,7 +6185,7 @@ static int igc_tsn_enable_cbs(struct igc_adapter *adapter,
>   	if (err)
>   		return err;
>   
> -	return igc_tsn_offload_apply(adapter, qopt->enable);
> +	return igc_tsn_offload_apply(adapter);
>   }
>   
>   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 c2cc5d406213..b03c6168bd23 100644
> --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> @@ -289,21 +289,16 @@ int igc_tsn_reset(struct igc_adapter *adapter)
>   	return err;
>   }
>   
> -int igc_tsn_offload_apply(struct igc_adapter *adapter, bool enable)
> +int igc_tsn_offload_apply(struct igc_adapter *adapter)
>   {
>   	struct igc_hw *hw = &adapter->hw;
> -	int err;
>   
> -	if (netif_running(adapter->netdev) &&
> -	    (igc_is_device_id_i225(hw) || !enable)) {
> +	if (netif_running(adapter->netdev) && igc_is_device_id_i225(hw)) {
>   		schedule_work(&adapter->reset_task);
>   		return 0;
>   	}
>   
> -	err = igc_tsn_enable_offload(adapter);
> -	if (err < 0)
> -		return err;
> +	igc_tsn_reset(adapter);
>   
> -	adapter->flags = igc_tsn_new_flags(adapter);
>   	return 0;
>   }
> diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h b/drivers/net/ethernet/intel/igc/igc_tsn.h
> index 631222bb6eb5..b53e6af560b7 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, bool enable);
> +int igc_tsn_offload_apply(struct igc_adapter *adapter);
>   int igc_tsn_reset(struct igc_adapter *adapter);
>   void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
>   
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config
  2022-12-13 22:37   ` Tony Nguyen
@ 2022-12-13 22:56     ` Zulkifli, Muhammad Husaini
  0 siblings, 0 replies; 8+ messages in thread
From: Zulkifli, Muhammad Husaini @ 2022-12-13 22:56 UTC (permalink / raw)
  To: Nguyen, Anthony L, intel-wired-lan, Gomes, Vinicius; +Cc: tee.min.tan



> -----Original Message-----
> From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Sent: Wednesday, 14 December, 2022 6:37 AM
> To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>;
> intel-wired-lan@osuosl.org; Gomes, Vinicius <vinicius.gomes@intel.com>
> Cc: tee.min.tan@linux.intel.com; naamax.meir@linux.intel.com
> Subject: Re: [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226
> during disable tsn config
> 
> 
> 
> On 12/11/2022 6:37 PM, Muhammad Husaini Zulkifli wrote:
> > I225 have limitation when programming the BaseTime register which
> > required a power cycle of the controller. This limitation already lifted in
> I226.
> > This patch removes the restriction so that when user configure/remove
> > any TSN mode, it would not go into power cycle reset adapter.
> 
> This patch is mostly undoing changes made in patch 2. Is there a reason you
> don't squash the two and mention the net change in the previous patch?

Tee Min and I have discussed this topic, and we've thought about separating this 
fix if we ever encounter a situation where removing the tsn configuration requires
 a power cycle. In that case, we can just remove this patch.

> 
> > How to test:
> >
> > Schedule any gate control list configuration or delete it.
> >
> > Example:
> >
> > 1)
> >
> > BASE_TIME=$(date +%s%N)
> > tc qdisc replace dev $interface_name parent root handle 100 taprio \
> >      num_tc 4 \
> >      map 3 1 0 2 3 3 3 3 3 3 3 3 3 3 3 3 \
> >      queues 1@0 1@1 1@2 1@3 \
> >      base-time $BASE_TIME \
> >      sched-entry S 0F 1000000 \
> >      flags 0x2
> >
> > 2) tc qdisc del dev $intername_name root
> >
> > Signed-off-by: Muhammad Husaini Zulkifli
> > <muhammad.husaini.zulkifli@intel.com>
> > ---
> >   drivers/net/ethernet/intel/igc/igc_main.c |  6 +++---
> >   drivers/net/ethernet/intel/igc/igc_tsn.c  | 11 +++--------
> >   drivers/net/ethernet/intel/igc/igc_tsn.h  |  2 +-
> >   3 files changed, 7 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> > b/drivers/net/ethernet/intel/igc/igc_main.c
> > index bf66395a59bb..fdb7f0b26ed0 100644
> > --- a/drivers/net/ethernet/intel/igc/igc_main.c
> > +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> > @@ -6003,7 +6003,7 @@ static int igc_tsn_enable_launchtime(struct
> igc_adapter *adapter,
> >   	if (err)
> >   		return err;
> >
> > -	return igc_tsn_offload_apply(adapter, qopt->enable);
> > +	return igc_tsn_offload_apply(adapter);
> >   }
> >
> >   static int igc_tsn_clear_schedule(struct igc_adapter *adapter) @@
> > -6117,7 +6117,7 @@ static int igc_tsn_enable_qbv_scheduling(struct
> igc_adapter *adapter,
> >   	if (err)
> >   		return err;
> >
> > -	return igc_tsn_offload_apply(adapter, qopt->enable);
> > +	return igc_tsn_offload_apply(adapter);
> >   }
> >
> >   static int igc_save_cbs_params(struct igc_adapter *adapter, int
> > queue, @@ -6185,7 +6185,7 @@ static int igc_tsn_enable_cbs(struct
> igc_adapter *adapter,
> >   	if (err)
> >   		return err;
> >
> > -	return igc_tsn_offload_apply(adapter, qopt->enable);
> > +	return igc_tsn_offload_apply(adapter);
> >   }
> >
> >   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 c2cc5d406213..b03c6168bd23 100644
> > --- a/drivers/net/ethernet/intel/igc/igc_tsn.c
> > +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c
> > @@ -289,21 +289,16 @@ int igc_tsn_reset(struct igc_adapter *adapter)
> >   	return err;
> >   }
> >
> > -int igc_tsn_offload_apply(struct igc_adapter *adapter, bool enable)
> > +int igc_tsn_offload_apply(struct igc_adapter *adapter)
> >   {
> >   	struct igc_hw *hw = &adapter->hw;
> > -	int err;
> >
> > -	if (netif_running(adapter->netdev) &&
> > -	    (igc_is_device_id_i225(hw) || !enable)) {
> > +	if (netif_running(adapter->netdev) && igc_is_device_id_i225(hw)) {
> >   		schedule_work(&adapter->reset_task);
> >   		return 0;
> >   	}
> >
> > -	err = igc_tsn_enable_offload(adapter);
> > -	if (err < 0)
> > -		return err;
> > +	igc_tsn_reset(adapter);
> >
> > -	adapter->flags = igc_tsn_new_flags(adapter);
> >   	return 0;
> >   }
> > diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.h
> > b/drivers/net/ethernet/intel/igc/igc_tsn.h
> > index 631222bb6eb5..b53e6af560b7 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, bool enable);
> > +int igc_tsn_offload_apply(struct igc_adapter *adapter);
> >   int igc_tsn_reset(struct igc_adapter *adapter);
> >   void igc_tsn_adjust_txtime_offset(struct igc_adapter *adapter);
> >
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction
  2022-12-13 22:33   ` Tony Nguyen
@ 2022-12-13 22:58     ` Zulkifli, Muhammad Husaini
  0 siblings, 0 replies; 8+ messages in thread
From: Zulkifli, Muhammad Husaini @ 2022-12-13 22:58 UTC (permalink / raw)
  To: Nguyen, Anthony L, intel-wired-lan, Gomes, Vinicius; +Cc: tee.min.tan

Hi Anthony,

> -----Original Message-----
> From: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Sent: Wednesday, 14 December, 2022 6:34 AM
> To: Zulkifli, Muhammad Husaini <muhammad.husaini.zulkifli@intel.com>;
> intel-wired-lan@osuosl.org; Gomes, Vinicius <vinicius.gomes@intel.com>
> Cc: tee.min.tan@linux.intel.com; naamax.meir@linux.intel.com
> Subject: Re: [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime
> restriction
> 
> 
> 
> On 12/11/2022 6:37 PM, Muhammad Husaini Zulkifli wrote:
> > Remove the Qbv BaseTime restriction for I226 so that the BaseTime can
> > be scheduled to the future time. A new register bit of Tx Qav Control
> > (Bit-7: FutScdDis) was introduced to allow I226 scheduling future time
> > as Qbv BaseTime and not having the Tx hang timeout issue.
> >
> > Besides, according to datasheet section 7.5.2.9.3.3, FutScdDis bit has
> > to be configured first before the cycle time and base time.
> >
> > Indeed the FutScdDis bit is only active on re-configuration, thus we
> > have to set the BASET_L to zero and then only set it to the desired value.
> >
> > Please also note that the Qbv configuration flow is moved around based
> > on the Qbv programming guideline that is documented in the latest
> datasheet.
> >
> > Co-Developed-by: Tan Tee Min <tee.min.tan@linux.intel.com>
> 
> nit: WARNING: 'Co-developed-by:' is the preferred signature form

I think tee min prefer to use this signature.

> 
> > Signed-off-by: Tan Tee Min <tee.min.tan@linux.intel.com>
> > Signed-off-by: Muhammad Husaini Zulkifli
> > <muhammad.husaini.zulkifli@intel.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-13 22:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12  2:37 [Intel-wired-lan] [PATCH net-next v1 0/3] igc: Qbv Feature Improvement for I226 Muhammad Husaini Zulkifli
2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 1/3] igc: remove I226 Qbv BaseTime restriction Muhammad Husaini Zulkifli
2022-12-13 22:33   ` Tony Nguyen
2022-12-13 22:58     ` Zulkifli, Muhammad Husaini
2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 2/3] igc: enable Qbv configuration for 2nd GCL Muhammad Husaini Zulkifli
2022-12-12  2:37 ` [Intel-wired-lan] [PATCH net-next v1 3/3] igc: Remove reset adapter task for i226 during disable tsn config Muhammad Husaini Zulkifli
2022-12-13 22:37   ` Tony Nguyen
2022-12-13 22:56     ` Zulkifli, Muhammad Husaini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.