RTnet default behavior
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What are the default values?
Also: The RTmac readme says a slot "transmits a single packet of up to a specific maximum size". I like to know what that size is and what the behavior is when I have many much smaller datagrams queued. Will they be distributed over as many cycles? And also what happens if I send a datagram which is much bigger. Is there an MTU?
Cheers,
Johannes
Quoted 7 lines · Johannes Holtz via Xenomai
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
Quoted 8 lines
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What are the default values?
You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
Quoted 6 lines
Also: The RTmac readme says a slot "transmits a single packet of up to a specific maximum size". I like to know what that size is and what the behavior is when I have many much smaller datagrams queued. Will they be distributed over as many cycles? And also what happens if I send a datagram which is much bigger. Is there an MTU?
I'll be happy to explain, but we should first of all try to find out what is configured here.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 12 lines · Johannes Holtz via Xenomai
Quoted 11 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 6 lines
Quoted 4 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What are the default values?
You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
rt_r8169.ko
subsequently rtifconfig and rtroute
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Quoted 10 lines
Quoted 5 lines
Also: The RTmac readme says a slot "transmits a single packet of up to a specific maximum size". I like to know what that size is and what the behavior is when I have many much smaller datagrams queued. Will they be distributed over as many cycles? And also what happens if I send a datagram which is much bigger. Is there an MTU?
I'll be happy to explain, but we should first of all try to find out what is configured here.
Jan
Quoted 33 lines · Johannes Holtz via Xenomai
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 13 lines · Johannes Holtz via Xenomai
Quoted 12 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 6 lines
Quoted 4 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What are the default values?
You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
Quoted 8 lines
rt_8139too.ko
rt_r8169.ko
subsequently rtifconfig and rtroute
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So, nothing of RTmac should prevent packets from being sent or add size restrictions on them.
Maybe you can specify your performance problems in more details?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Am 18.10.19 um 16:57 schrieb Jan Kiszka:
Quoted 35 lines · Johannes Holtz via Xenomai
Quoted 34 lines
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 13 lines · Johannes Holtz via Xenomai
Quoted 12 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 6 lines
Quoted 4 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What are the default values?
You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
Quoted 8 lines
Quoted 6 lines
rt_r8169.ko
subsequently rtifconfig and rtroute
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So this means I basically run standard Ethernet with no RT benefits?
Quoted 8 lines
So, nothing of RTmac should prevent packets from being sent or add size restrictions on them.
Maybe you can specify your performance problems in more details?
Jan
Well, In this 7 node network one node is receiving datagrams from all other 6 containing sensor data. Each datagram has a sequence number to recognize packet loss. Each node is running a RT SW with 1ms loop. In certain situations the receiver detects that some (between 1 and 20) datagrams where lost. In these situations the amount of sent datagrams is higher than usual.
At first I though this might be a throughput issue but even after I reduced the payload size drastically I still miss datagrams. The sender has no problems sending and my receive code always reads all available data from the queue.
/proc/rtnet/stats doesn't show any errors or drops .
I'm working on an example program to test this issue in detail.
Johannes
Quoted 39 lines · Johannes Holtz via Xenomai
Am 18.10.19 um 16:57 schrieb Jan Kiszka:
Quoted 38 lines · Johannes Holtz via Xenomai
Quoted 37 lines
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 13 lines · Johannes Holtz via Xenomai
Quoted 12 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 7 lines
Quoted 5 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What
are the default values?You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
rt_r8169.ko
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
subsequently rtifconfig and rtroute
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So this means I basically run standard Ethernet with no RT benefits?
The TX and RX path remain deterministic. If your application behave well and do not generate overload on the network that can cause switches or recipients to drop packets, all can still be fine.
Quoted 6 lines
Quoted 6 lines
So, nothing of RTmac should prevent packets from being sent or add size restrictions on them.
Maybe you can specify your performance problems in more details?
Quoted 8 lines
Quoted 2 lines
Jan
Well, In this 7 node network one node is receiving datagrams from all other 6 containing sensor data. Each datagram has a sequence number to recognize packet loss. Each node is running a RT SW with 1ms loop. In certain situations the receiver detects that some (between 1 and 20) datagrams where lost. In these situations the amount of sent datagrams is higher than usual.
What else is on the network? Only those nodes, and they only sent RT datagrams at a well-defined rate?
Quoted 10 lines
At first I though this might be a throughput issue but even after I reduced the payload size drastically I still miss datagrams. The sender has no problems sending and my receive code always reads all available data from the queue.
/proc/rtnet/statsdoesn't show any errors or drops .I'm working on an example program to test this issue in detail.
OK.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux
Am 18.10.19 um 17:36 schrieb Jan Kiszka:
Quoted 42 lines · Johannes Holtz via Xenomai
Quoted 41 lines
Am 18.10.19 um 16:57 schrieb Jan Kiszka:
Quoted 40 lines · Johannes Holtz via Xenomai
Quoted 39 lines
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 13 lines · Johannes Holtz via Xenomai
Quoted 12 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 7 lines
Quoted 5 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What
are the default values?You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
rt_r8169.ko
subsequently rtifconfig and rtroute
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So this means I basically run standard Ethernet with no RT benefits?
The TX and RX path remain deterministic. If your application behave well and do not generate overload on the network that can cause switches or recipients to drop packets, all can still be fine.
Since this is not synced (not TDMA) it is very well possible that different nodes interfere and datagrams collide.
What would be considered overload? Since the PCs are connected via unmanaged switches I can't detect if they have any problems.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
So, nothing of RTmac should prevent packets from being sent or add size restrictions on them.
Maybe you can specify your performance problems in more details?
Jan
Quoted 8 lines
Quoted 6 lines
Well, In this 7 node network one node is receiving datagrams from all other 6 containing sensor data. Each datagram has a sequence number to recognize packet loss. Each node is running a RT SW with 1ms loop. In certain situations the receiver detects that some (between 1 and 20) datagrams where lost. In these situations the amount of sent datagrams is higher than usual.
What else is on the network? Only those nodes, and they only sent RT datagrams at a well-defined rate?
PC1,PC2 <--->Switch1<--->Switch2<---->PC3-7
That's the whole network. Both are un-managed industry switches.
PC2 is the receiver.
Quoted 14 lines
Quoted 10 lines
At first I though this might be a throughput issue but even after I reduced the payload size drastically I still miss datagrams. The sender has no problems sending and my receive code always reads all available data from the queue.
/proc/rtnet/statsdoesn't show any errors or drops .I'm working on an example program to test this issue in detail.
OK.
Jan
Am 18.10.19 um 18:00 schrieb Johannes Holtz:
Quoted 70 lines
Am 18.10.19 um 17:36 schrieb Jan Kiszka:
Quoted 42 lines · Johannes Holtz via Xenomai
Quoted 41 lines
Am 18.10.19 um 16:57 schrieb Jan Kiszka:
Quoted 40 lines · Johannes Holtz via Xenomai
Quoted 39 lines
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 13 lines · Johannes Holtz via Xenomai
Quoted 12 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot time. To be specific. Instead of using the rtnet command line programs the rtnet.ko kernel object as well as the necessary drivers are loaded with insmod. The devices are then brought up with rtifconfig and rtroute.
The network consist of 7 PCs (all with the same boot time mechanism) with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).
Quoted 7 lines
Quoted 5 lines
I'm investigating some performance problems and I don't know whats is really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What
are the default values?You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg. Are you sure RTmac is involved?
This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
rt_r8169.ko
subsequently rtifconfig and rtroute
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Nothing else is done. I don't know id that satisfies for rtmac. How can I check?
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So this means I basically run standard Ethernet with no RT benefits?
The TX and RX path remain deterministic. If your application behave well and do not generate overload on the network that can cause switches or recipients to drop packets, all can still be fine.
Since this is not synced (not TDMA) it is very well possible that different nodes interfere and datagrams collide.
What would be considered overload? Since the PCs are connected via unmanaged switches I can't detect if they have any problems.
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
So, nothing of RTmac should prevent packets from being sent or add size restrictions on them.
Maybe you can specify your performance problems in more details?
Jan
Well, In this 7 node network one node is receiving datagrams from all other 6 containing sensor data. Each datagram has a sequence number to recognize packet loss. Each node is running a RT SW with 1ms loop. In certain situations the receiver detects that some (between 1 and 20) datagrams where lost. In these situations the amount of sent datagrams is higher than usual.
Quoted 24 lines
Quoted 2 lines
What else is on the network? Only those nodes, and they only sent RT datagrams at a well-defined rate?
PC1,PC2 <--->Switch1<--->Switch2<---->PC3-7
That's the whole network. Both are un-managed industry switches.
PC2 is the receiver.
Quoted 14 lines
Quoted 10 lines
At first I though this might be a throughput issue but even after I reduced the payload size drastically I still miss datagrams. The sender has no problems sending and my receive code always reads all available data from the queue.
/proc/rtnet/statsdoesn't show any errors or drops .I'm working on an example program to test this issue in detail.
OK.
Jan
Ok, after a lot of testing I arrived at some sort of insight. I almost became crazy after all the kernel segfaults.
I wrote a simple program with a sender and receiver where the sender sends a configurable amount of datagrams per 1ms cycle. (attached)
First I noticed that I get problems when allocating a static buffer of several kB. So I started to play around with the stack size. If I increase the overall stack size I can allocate that buffer but still get buffer size problems on the sender side so I also increased the socket buffer size and as long as the increased socket buffer is smaller than the stack everything is OK and performance increases. If not you get said kernel issues. Unsurprisingly in hindsight.
Obviously the size of the datagrams is also important. The smaller they are the smaller the buffers can be.
Curious is that I wasn't able to reproduce the case where datagrams where missed.
So plugging my insight of the stack and buffer increases into my actual program the overall system performance increases. The amount of missed datagrams is reduced dramatically. I'm not sure why though.
Cheers,
Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 8469 bytes
Desc: not available
URL: <http://xenomai.org/pipermail/xenomai/attachments/20191022/9ee34255/attachment.c>
Quoted 122 lines · Johannes Holtz via Xenomai
Am 18.10.19 um 18:00 schrieb Johannes Holtz:
Quoted 80 lines
Am 18.10.19 um 17:36 schrieb Jan Kiszka:
Quoted 51 lines · Johannes Holtz via Xenomai
Quoted 50 lines
Am 18.10.19 um 16:57 schrieb Jan Kiszka:
Quoted 49 lines · Johannes Holtz via Xenomai
Quoted 48 lines
Am 18.10.19 um 16:33 schrieb Jan Kiszka:
Quoted 23 lines · Johannes Holtz via Xenomai
Quoted 16 lines
Hi ,
I inherited a project where the RTnet stack is loaded manually at boot
time. To be specific. Instead of using the rtnet command line programs
the rtnet.ko kernel object as well as the necessary drivers are loaded
with insmod. The devices are then brought up with rtifconfig and rtroute.The network consist of 7 PCs (all with the same boot time mechanism)
with pre-defined IPs. The setup works and initializes in an asynchronized way (like a typical non-RT network).Quoted 6 lines
I'm investigating some performance problems and I don't know whats is
really going on since no config is used. How is determined which participant is acting as Master and how the slots are distributed? What
are the default values?Quoted 3 lines
You only mentioned rtifconfig and rtroute above, no rtcfg or tdmacfg.
Are you sure RTmac is involved?This is the list of kernel object that are loaded:
rtnet.ko
rtipv4.ko
rtpacket.ko
rtudp.ko
rt_e100e.ko
rt_8139too.ko
rt_r8169.ko
subsequently rtifconfig and rtroute
Nothing else is done. I don't know id that satisfies for rtmac. How can
I check?Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Nope, there would be rtmac.ko, tdma.ko, possibly also rtcfg.ko in addition. And you would see the script calling tdmacfg at least.
So this means I basically run standard Ethernet with no RT benefits?
The TX and RX path remain deterministic. If your application behave well and do not generate overload on the network that can cause switches or recipients to drop packets, all can still be fine.
Since this is not synced (not TDMA) it is very well possible that different nodes interfere and datagrams collide.
What would be considered overload? Since the PCs are connected via unmanaged switches I can't detect if they have any problems.
Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
So, nothing of RTmac should prevent packets from being sent or add size
restrictions on them.Maybe you can specify your performance problems in more details?
Jan
Well, In this 7 node network one node is receiving datagrams from all other 6 containing sensor data. Each datagram has a sequence number to recognize packet loss. Each node is running a RT SW with 1ms loop. In certain situations the receiver detects that some (between 1 and 20) datagrams where lost. In these situations the amount of sent datagrams is higher than usual.
Quoted 24 lines
Quoted 2 lines
What else is on the network? Only those nodes, and they only sent RT datagrams at a well-defined rate?
PC1,PC2 <--->Switch1<--->Switch2<---->PC3-7
That's the whole network. Both are un-managed industry switches.
PC2 is the receiver.
Quoted 14 lines
Quoted 10 lines
At first I though this might be a throughput issue but even after I reduced the payload size drastically I still miss datagrams. The sender has no problems sending and my receive code always reads all available data from the queue.
/proc/rtnet/statsdoesn't show any errors or drops .I'm working on an example program to test this issue in detail.
OK.
Jan
Ok, after a lot of testing I arrived at some sort of insight. I almost became crazy after all the kernel segfaults.
I wrote a simple program with a sender and receiver where the sender sends a configurable amount of datagrams per 1ms cycle. (attached)
First I noticed that I get problems when allocating a static buffer of several kB. So I started to play around with the stack size. If I increase the overall stack size I can allocate that buffer but still get buffer size problems on the sender side so I also increased the socket buffer size and as long as the increased socket buffer is smaller than the stack everything is OK and performance increases. If not you get said kernel issues. Unsurprisingly in hindsight.
Obviously the size of the datagrams is also important. The smaller they are the smaller the buffers can be.
Quoted 6 lines
Curious is that I wasn't able to reproduce the case where datagrams where missed.
So plugging my insight of the stack and buffer increases into my actual program the overall system performance increases. The amount of missed datagrams is reduced dramatically. I'm not sure why though.
Did you already read xenomai/kernel/drivers/net/doc/README.pools? Also xenomai/kernel/drivers/net/stack/include/rtskb.h may shed some light on how buffer management works with RTnet. If one side runs out of them and if it cannot push back (via TCP specifically), you will lose messages.
Jan