utils/net/rtnet.in: add delay during master configuration
PATCH v2 1/1 utils/net/rtnet.in: add delay during master configuration
Some cards are slow to get the connection link up after the "rtifconfig rteth0 up" command, e.g. on an Atom-x5 with an Intel I210 (rt_igb driver) I detected approximately 3 seconds to get the link up.
On master, the "rtifconfig rteth0 up" is followed by TDMA configuration and start. After the TDMA start, the sync packet is sent at the defined cycle time.
Sometimes, after "rtnet start", the dmesg fills with this error:
TDMA: Failed to transmit sync frame!
and the rt driver locks. Then, the kernel watchdog is triggered and the NIC is hw-reset by the kernel, producing more errors and another lock. Sometimes the dmesg only fills with the error message and the NIC does not lock.
This happens because the interface is not up and ready to handle the sync packets when TDMA is started.
This patch introduces a configurable delay between the "rtifconfig rteth0 up" and the TDMA start on master host. This allows to avoid these kind of problems.
--- utils/net/rtnet.in | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
utils/net/rtnet.in +6 -2
@@ -15,15 +15,19 @@ debug_func() { usage() { cat << EOF Usage: - $0 [-cf <config-file>] [-v] [-c] {start|stop} + $0 [-cf <config-file>] [-d <delay>] [-v] [-c] {start|stop} Start or stop station according to configuration file - $0 [-cf <config-file>] [-v] [-c] master <slave_ip1> [<slave_ip2> ...] + $0 [-cf <config-file>] [-d <delay>] [-v] [-c] master <slave_ip1> [<slave_ip2> ...] Start station as master for given list of slaves $0 [-cf <config-file>] [-v] capture Start only passive realtime capturing + The parameter -d allows to introduce a delay in seconds between the + "rtifconfig rtethX up" command and the TDMA start on the host + configured as master. Useful to avoid errors/card locks when the + RT NIC is slow to get the link up. The additional switch -v enables verbose output. The additional switch -c enables capturing mode to allow use of a
network
analyzer such as Wireshark (if rtnet was built with --enable-rtcap).
@@ -76,6 +80,10 @@ submit_cfg() {
master)
$RTIFCONFIG rteth0 up $STATION_IP
+ if [ -n "$UPDELAY" ]; then
+ sleep $UPDELAY
+ fi
+
$TDMACFG rteth0 master $TDMA_CYCLE
eval "$TDMA_SLOTS"
@@ -144,6 +152,10 @@ start_master() {
$RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ if [ -n "$UPDELAY" ]; then
+ sleep $UPDELAY
+ fi
+
$TDMACFG rteth0 master $TDMA_CYCLE
$TDMACFG rteth0 slot 0 0
@@ -258,6 +270,11 @@ else
exit 1
fi
+if [ "$1" = "-d" ]; then
+ UPDELAY="$2"
+ shift 2
+fi
+
if [ "$1" = "-v" ]; then
echo "Turning on verbose mode"
RTIFCONFIG="debug_func $RTIFCONFIG"
Signature · 1 line
2.17.1
Hi all,
some minor comments, see below:
Quoted 61 lines · Mauro S. via Xenomai
Some cards are slow to get the connection link up after the "rtifconfig rteth0 up" command, e.g. on an Atom-x5 with an Intel I210 (
rt_igbdriver) I detected approximately 3 seconds to get the link up.On master, the "rtifconfig rteth0 up" is followed by TDMA configuration and start. After the TDMA start, the sync packet is sent at the defined cycle time.
Sometimes, after "rtnet start", the dmesg fills with this error:
TDMA: Failed to transmit sync frame!
and the rt driver locks. Then, the kernel watchdog is triggered and the NIC is hw-reset by the kernel, producing more errors and another lock. Sometimes the dmesg only fills with the error message and the NIC does not lock.
This happens because the interface is not up and ready to handle the sync packets when TDMA is started.This patch introduces a configurable delay between the "rtifconfig rteth0 up"
and the TDMA start on master host. This allows to avoid these kind of problems.Signed-off-by Mauro Salvini <[email protected]>---
utils/net/rtnet.in | 21 +++++++++++++++++++--1 file changed, 19 insertions(+), 2 deletions(-)utils/net/rtnet.in +0
-0@@ -15,15 +15,19 @@ debug_func() { usage() {cat << EOF
Usage:
- $0 [-cf <config-file>] [-v] [-c] {start|stop}
+ $0 [-cf <config-file>] [-d <delay>] [-v] [-c] {start|stop} Start or stop station according to configuration file- $0 [-cf <config-file>] [-v] [-c] master <
slave_ip1> [<slave_ip2> ...] + $0 [-cf <config-file>] [-d <delay>] [-v] [-c] master <slave_ip1> [<slave_ip2> ...]
Start station as master for given list of slaves$0 [-cf <config-file>] [-v] capture
Start only passive realtime capturing+ The parameter -d allows to introduce a delay in seconds between the + "rtifconfig rtethX up" command and the TDMA start on the host + configured as master. Useful to avoid errors/card locks when the + RT NIC is slow to get the link up.
The additional switch -v enables verbose output.
The additional switch -c enables capturing mode to allow use of a network
analyzer such as Wireshark (if rtnet was built with --enable-rtcap).utils/net/rtnet.in +0
-0@@ -76,6 +80,10 @@ submit_cfg() { master)$RTIFCONFIG rteth0 up $STATION_IP
Quoted 1 line
+ if [ -n "$UPDELAY" ]; then
Checked with shellcheck? I would expect ${UPDELAY} here and below.
Quoted 1 line
+ sleep $UPDELAY
Indention looks broken.
Quoted 28 lines
+ fi
+
$TDMACFG rteth0 master $TDMA_CYCLE
eval "$TDMA_SLOTS"utils/net/rtnet.in +0
-0@@ -144,6 +152,10 @@ start_master() {$RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ if [ -n "$UPDELAY" ]; then
+ sleep $UPDELAY
+ fi
+
$TDMACFG rteth0 master $TDMA_CYCLE
$TDMACFG rteth0 slot 0 0utils/net/rtnet.in +0
-0@@ -258,6 +270,11 @@ elseexit 1
fiutils/net/rtnet.in +5
-0+if [ "$1" = "-d" ]; then + UPDELAY="$2" + shift 2 +fi +if [ "$1" = "-v" ]; then
echo "Turning on verbose mode"
RTIFCONFIG="debug_func $RTIFCONFIG"
Hi Florian,
thanks for your comments. See below mine.
Il 23/04/22 19:26, Florian Bezdeka ha scritto:
Quoted 66 lines
Hi all,
some minor comments, see below:
Quoted 61 lines · Mauro S. via Xenomai
Some cards are slow to get the connection link up after the "rtifconfig rteth0 up" command, e.g. on an Atom-x5 with an Intel I210 (
rt_igbdriver) I detected approximately 3 seconds to get the link up.On master, the "rtifconfig rteth0 up" is followed by TDMA configuration and start. After the TDMA start, the sync packet is sent at the defined cycle time.
Sometimes, after "rtnet start", the dmesg fills with this error:
TDMA: Failed to transmit sync frame!
and the rt driver locks. Then, the kernel watchdog is triggered and the NIC is hw-reset by the kernel, producing more errors and another lock. Sometimes the dmesg only fills with the error message and the NIC does not lock.
This happens because the interface is not up and ready to handle the sync packets when TDMA is started.This patch introduces a configurable delay between the "rtifconfig rteth0 up"
and the TDMA start on master host. This allows to avoid these kind of problems.Signed-off-by Mauro Salvini <[email protected]>--- utils/net/rtnet.in | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)utils/net/rtnet.in +2
-2@@ -15,15 +15,19 @@ debug_func() { usage() { cat << EOF Usage: - $0 [-cf <config-file>] [-v] [-c] {start|stop} + $0 [-cf <config-file>] [-d <delay>] [-v] [-c] {start|stop} Start or stop station according to configuration file - $0 [-cf <config-file>] [-v] [-c] master <slave_ip1> [<slave_ip2> ...] + $0 [-cf <config-file>] [-d <delay>] [-v] [-c] master <slave_ip1>[<
slave_ip2> ...]
Start station as master for given list of slaves$0 [-cf <config-file>] [-v] capture
Start only passive realtime capturing+ The parameter -d allows to introduce a delay in seconds between the + "rtifconfig rtethX up" command and the TDMA start on the host + configured as master. Useful to avoid errors/card locks when the + RT NIC is slow to get the link up.
The additional switch -v enables verbose output.
The additional switch -c enables capturing mode to allow use of a
network
analyzer such as Wireshark (if rtnet was built with --enable-rtcap).utils/net/rtnet.in +0
-0@@ -76,6 +80,10 @@ submit_cfg() { master) $RTIFCONFIG rteth0 up $STATION_IP
Quoted 3 lines
utils/net/rtnet.in submit_cfg() { · line 83
Quoted 1 line
utils/net/rtnet.in +1
-0+ if [ -n "$UPDELAY" ]; thenChecked with shellcheck? I would expect ${UPDELAY} here and below.
In fact, among many (info) and (warning) messages regarding other lines, shellcheck says about this row:
Line 84:
sleep $UPDELAY
^-- SC2086 (info): Double quote to prevent
globbing and word splitting.
Did you mean: (apply this, apply all SC2086)
sleep "$UPDELAY"
What should I do?
Quoted 4 lines
utils/net/rtnet.in submit_cfg() { · line 84
Quoted 2 lines
utils/net/rtnet.in +1
-0+ sleep $UPDELAYIndention looks broken.
You are right, fixed thanks.
Quoted 30 lines
Quoted 29 lines
utils/net/rtnet.in +11
-0+ fi + $TDMACFG rteth0 master $TDMA_CYCLE eval "$TDMA_SLOTS"@@ -144,6 +152,10 @@ start_master() { $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT + if [ -n "$UPDELAY" ]; then + sleep $UPDELAY + fi + $TDMACFG rteth0 master $TDMA_CYCLE $TDMACFG rteth0 slot 0 0@@ -258,6 +270,11 @@ else exit 1 fi +if [ "$1" = "-d" ]; then + UPDELAY="$2" + shift 2 +fi + if [ "$1" = "-v" ]; then echo "Turning on verbose mode" RTIFCONFIG="debug_func $RTIFCONFIG"
Signature · 1 line
Mauro S.
Quoted 8 lines · Mauro S.
Hi Florian,
thanks for your comments. See below mine.
Il 23/04/22 19:26, Florian Bezdeka ha scritto:
Quoted 3 lines
Hi all,
some minor comments, see below:
[snip]
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
+ The parameter -d allows to introduce a delay in seconds between the + "rtifconfig rtethX up" command and the TDMA start on the host + configured as master. Useful to avoid errors/card locks when the + RT NIC is slow to get the link up.
The additional switch -v enables verbose output.
The additional switch -c enables capturing mode to allow use of a
network
analyzer such as Wireshark (if rtnet was built with --enable-rtcap).(quoted diff) +0
-0@@ -76,6 +80,10 @@ submit_cfg() { master) $RTIFCONFIG rteth0 up $STATION_IPQuoted 3 lines
Review submit_cfg() { · line 83
Quoted 1 line
(quoted diff) +1
-0+ if [ -n "$UPDELAY" ]; thenChecked with shellcheck? I would expect ${UPDELAY} here and below.
In fact, among many (info) and (warning) messages regarding other lines, shellcheck says about this row:
Line 84:
sleep $UPDELAY
^-- SC2086 (info): Double quote to prevent
globbing and word splitting.
Quoted 4 lines
Did you mean: (apply this, apply all SC2086)
sleep "$UPDELAY"What should I do?
My understanding is that "${UPDELAY}" is the correct thing here. In case shellcheck reports more issues in the same file I would prefer two patches:
1) Fixing shellcheck reportings
2) This one on top
But at the end it's the maintainers' decision.
Quoted 4 lines
Quoted 3 lines
Quoted 6 lines
-----Original Message-----
From: Xenomai <[email protected]> On Behalf Of Bezdeka, Florian via Xenomai
Sent: Tuesday, April 26, 2022 5:18 PM
To: [email protected]; [email protected]
…
My understanding is that "${UPDELAY}" is the correct thing here.
sleep "$UPDELAY"
is just as correct.
--
Regards,
Dietmar Schindler
________________________________
manroland Goss web systems GmbH | Managing Director: Franz Kriechbaum Registered Office: Augsburg | Trade Register: AG Augsburg | HRB-No.: 32609 | VAT: DE815764857
Confidentiality note:
This message and any attached documents may contain confidential or proprietary information of manroland|Goss. These materials are intended only for the use of the intended recipient. If you are not the intended recipient of this transmission, you are hereby notified that any distribution, disclosure, printing, copying, storage, modification or the taking of any action in reliance upon this transmission is strictly prohibited. Delivery of this message to any person other than the intended recipient shall not compromise or waive such confidentiality, privilege or exemption from disclosure as to this communication. If you have received this communication in error, please immediately notify the sender and delete the message from your system. All liability for viruses is excluded to the fullest extent permitted by law.
________________________________
Il 26/04/22 17:18, Bezdeka, Florian ha scritto:
Quoted 41 lines · Mauro S.
Quoted 8 lines
Hi Florian,
thanks for your comments. See below mine.
Il 23/04/22 19:26, Florian Bezdeka ha scritto:
Quoted 3 lines
Hi all,
some minor comments, see below:
[snip]
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines
+ The parameter -d allows to introduce a delay in seconds between the + "rtifconfig rtethX up" command and the TDMA start on the host + configured as master. Useful to avoid errors/card locks when the + RT NIC is slow to get the link up.
The additional switch -v enables verbose output.
The additional switch -c enables capturing mode to allow use of a
network
analyzer such as Wireshark (if rtnet was built with --enable-rtcap).(quoted diff) +0
-0@@ -76,6 +80,10 @@ submit_cfg() { master) $RTIFCONFIG rteth0 up $STATION_IPQuoted 3 lines
Review submit_cfg() { · line 83
Quoted 1 line
(quoted diff) +1
-0+ if [ -n "$UPDELAY" ]; thenChecked with shellcheck? I would expect ${UPDELAY} here and below.
In fact, among many (info) and (warning) messages regarding other lines, shellcheck says about this row:
Line 84:
sleep $UPDELAY
^-- SC2086 (info): Double quote to prevent
globbing and word splitting.Quoted 4 lines
Did you mean: (apply this, apply all SC2086)
sleep "$UPDELAY"What should I do?
Quoted 8 lines
My understanding is that "${UPDELAY}" is the correct thing here. In case shellcheck reports more issues in the same file I would prefer two patches:
1) Fixing shellcheck reportings
2) This one on topBut at the end it's the maintainers' decision.
Sorry for the delay.
Ok, I will do that.
Thanks.
Signature · 1 line
Mauro S.