From 5a5df0c858e48ce537441ec3e0e3204c28c4d900 Mon Sep 17 00:00:00 2001
From: Adam Wujek <dev_public@wujek.eu>
Date: Fri, 14 Apr 2023 14:30:48 +0200
Subject: [PATCH] [BUG: #233] Kconfig_port_timing: add T24P_TRANS_POINT even if
 no instances on a port

This avoids error printouts from HAL when no instances are configured on
a given port.

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
 Kconfig_port_timing.in                        | 108 +++++++++++++++---
 .../host_tools/gen_kconfig_port_timing.sh     |  15 ++-
 2 files changed, 103 insertions(+), 20 deletions(-)

diff --git a/Kconfig_port_timing.in b/Kconfig_port_timing.in
index b322fa322..fb839faf4 100644
--- a/Kconfig_port_timing.in
+++ b/Kconfig_port_timing.in
@@ -128,7 +128,6 @@ config PORT01_INST01_INGRESS_LATENCY
 
 config PORT01_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 13600
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -186,6 +185,11 @@ config PORT01_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT01_INST01_T24P_TRANS_POINT
+    int
+    default 13600
+
 endmenu
 
 menu "PORT 2"
@@ -299,7 +303,6 @@ config PORT02_INST01_INGRESS_LATENCY
 
 config PORT02_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 10800
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -357,6 +360,11 @@ config PORT02_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT02_INST01_T24P_TRANS_POINT
+    int
+    default 10800
+
 endmenu
 
 menu "PORT 3"
@@ -470,7 +478,6 @@ config PORT03_INST01_INGRESS_LATENCY
 
 config PORT03_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 13650
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -528,6 +535,11 @@ config PORT03_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT03_INST01_T24P_TRANS_POINT
+    int
+    default 13650
+
 endmenu
 
 menu "PORT 4"
@@ -641,7 +653,6 @@ config PORT04_INST01_INGRESS_LATENCY
 
 config PORT04_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 12150
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -699,6 +710,11 @@ config PORT04_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT04_INST01_T24P_TRANS_POINT
+    int
+    default 12150
+
 endmenu
 
 menu "PORT 5"
@@ -812,7 +828,6 @@ config PORT05_INST01_INGRESS_LATENCY
 
 config PORT05_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 13550
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -870,6 +885,11 @@ config PORT05_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT05_INST01_T24P_TRANS_POINT
+    int
+    default 13550
+
 endmenu
 
 menu "PORT 6"
@@ -983,7 +1003,6 @@ config PORT06_INST01_INGRESS_LATENCY
 
 config PORT06_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14500
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1041,6 +1060,11 @@ config PORT06_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT06_INST01_T24P_TRANS_POINT
+    int
+    default 14500
+
 endmenu
 
 menu "PORT 7"
@@ -1154,7 +1178,6 @@ config PORT07_INST01_INGRESS_LATENCY
 
 config PORT07_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 13950
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1212,6 +1235,11 @@ config PORT07_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT07_INST01_T24P_TRANS_POINT
+    int
+    default 13950
+
 endmenu
 
 menu "PORT 8"
@@ -1325,7 +1353,6 @@ config PORT08_INST01_INGRESS_LATENCY
 
 config PORT08_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14450
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1383,6 +1410,11 @@ config PORT08_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT08_INST01_T24P_TRANS_POINT
+    int
+    default 14450
+
 endmenu
 
 menu "PORT 9"
@@ -1496,7 +1528,6 @@ config PORT09_INST01_INGRESS_LATENCY
 
 config PORT09_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14750
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1554,6 +1585,11 @@ config PORT09_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT09_INST01_T24P_TRANS_POINT
+    int
+    default 14750
+
 endmenu
 
 menu "PORT 10"
@@ -1667,7 +1703,6 @@ config PORT10_INST01_INGRESS_LATENCY
 
 config PORT10_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 15100
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1725,6 +1760,11 @@ config PORT10_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT10_INST01_T24P_TRANS_POINT
+    int
+    default 15100
+
 endmenu
 
 menu "PORT 11"
@@ -1838,7 +1878,6 @@ config PORT11_INST01_INGRESS_LATENCY
 
 config PORT11_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14500
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -1896,6 +1935,11 @@ config PORT11_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT11_INST01_T24P_TRANS_POINT
+    int
+    default 14500
+
 endmenu
 
 menu "PORT 12"
@@ -2009,7 +2053,6 @@ config PORT12_INST01_INGRESS_LATENCY
 
 config PORT12_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 9850
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2067,6 +2110,11 @@ config PORT12_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT12_INST01_T24P_TRANS_POINT
+    int
+    default 9850
+
 endmenu
 
 menu "PORT 13"
@@ -2180,7 +2228,6 @@ config PORT13_INST01_INGRESS_LATENCY
 
 config PORT13_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14150
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2238,6 +2285,11 @@ config PORT13_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT13_INST01_T24P_TRANS_POINT
+    int
+    default 14150
+
 endmenu
 
 menu "PORT 14"
@@ -2351,7 +2403,6 @@ config PORT14_INST01_INGRESS_LATENCY
 
 config PORT14_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 11950
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2409,6 +2460,11 @@ config PORT14_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT14_INST01_T24P_TRANS_POINT
+    int
+    default 11950
+
 endmenu
 
 menu "PORT 15"
@@ -2522,7 +2578,6 @@ config PORT15_INST01_INGRESS_LATENCY
 
 config PORT15_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 12900
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2580,6 +2635,11 @@ config PORT15_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT15_INST01_T24P_TRANS_POINT
+    int
+    default 12900
+
 endmenu
 
 menu "PORT 16"
@@ -2693,7 +2753,6 @@ config PORT16_INST01_INGRESS_LATENCY
 
 config PORT16_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 13800
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2751,6 +2810,11 @@ config PORT16_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT16_INST01_T24P_TRANS_POINT
+    int
+    default 13800
+
 endmenu
 
 menu "PORT 17"
@@ -2864,7 +2928,6 @@ config PORT17_INST01_INGRESS_LATENCY
 
 config PORT17_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14200
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -2922,6 +2985,11 @@ config PORT17_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT17_INST01_T24P_TRANS_POINT
+    int
+    default 14200
+
 endmenu
 
 menu "PORT 18"
@@ -3035,7 +3103,6 @@ config PORT18_INST01_INGRESS_LATENCY
 
 config PORT18_INST01_T24P_TRANS_POINT
     int "timestampCorrectionPortDS.t24p_trans_point (ps)"
-    default 14350
  help
 	 Defines the phase transition point for reception timestamps t2/t4 (ps)
 
@@ -3093,6 +3160,11 @@ config PORT18_INST01_MIN_PDELAY_REQ_INTERVAL
 
 endmenu
 
+# Keep T24P_TRANS_POINT also for ports without instances
+config PORT18_INST01_T24P_TRANS_POINT
+    int
+    default 14350
+
 endmenu
 
 endmenu
diff --git a/userspace/host_tools/gen_kconfig_port_timing.sh b/userspace/host_tools/gen_kconfig_port_timing.sh
index 22be603c9..ac38b1c65 100755
--- a/userspace/host_tools/gen_kconfig_port_timing.sh
+++ b/userspace/host_tools/gen_kconfig_port_timing.sh
@@ -193,7 +193,6 @@ function print_instance_header() {
 
 	echo -e "\nconfig PORT${portStr}_INST${instStr}_T24P_TRANS_POINT" >>$OUTPUT_FILE
 	echo -e "    int \"timestampCorrectionPortDS.t24p_trans_point (ps)\"" >>$OUTPUT_FILE
-	echo -e "    default ${t24p}" >>$OUTPUT_FILE
 	echo -e " help" >>$OUTPUT_FILE
 	echo -e "	 Defines the phase transition point for reception timestamps t2/t4 (ps)" >>$OUTPUT_FILE
 		
@@ -329,8 +328,20 @@ function print_instance_header() {
 }
 
 function print_instance_footer() { 
- 
+	local portIdx=$1
+	local portStr=`printf "%02d" $portIdx`
+
+	local instIdx=$2
+	local instStr=`printf "%02d" $instIdx`
+
+	local t24p=${port_t24p[$1]}
+
 	echo -e "\nendmenu" >>$OUTPUT_FILE
+
+	echo -e "\n# Keep T24P_TRANS_POINT also for ports without instances" >>$OUTPUT_FILE
+	echo -e "config PORT${portStr}_INST${instStr}_T24P_TRANS_POINT" >>$OUTPUT_FILE
+	echo -e "    int" >>$OUTPUT_FILE
+	echo -e "    default ${t24p}" >>$OUTPUT_FILE
 }
 
 declare -A port_tx=(
-- 
GitLab