Skip to contentSkip to conversation

Get packet timestamp in af_packet or other RTNET components

DISCUSSION François Legal 3 participants 6 messages Mar 12, 2021 – Mar 15, 2021

lore
Share & tools
lore
#0 lore raw

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

Thanks

François

#1 lore raw
Quoted 4 lines · François Legal via Xenomai

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

Quoted 8 lines

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

I would add SO_RCVTIMEO support, like rtipc already has.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#2 lore raw
Quoted 14 lines · Jan Kiszka
Quoted 4 lines · François Legal via Xenomai

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

Quoted 8 lines

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

Quoted 7 lines

I would add SO_RCVTIMEO support, like rtipc already has.

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

Hello,

Isn't SO_RCVTIMEO used to set receive timeout ?

What I intend to do is retrieve the receive time of the packet.

François

#3 lore raw
Quoted 24 lines · François Legal
Quoted 9 lines · Jan Kiszka
Quoted 8 lines · François Legal via Xenomai

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Quoted 12 lines
Quoted 4 lines

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

I would add SO_RCVTIMEO support, like rtipc already has.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
Quoted 5 lines

Hello,

Isn't SO_RCVTIMEO used to set receive timeout ?

What I intend to do is retrieve the receive time of the packet.

Sorry, wrong option. But I suspect there is something official to obtain the time stamps as well.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#4 lore raw
Quoted 25 lines · Jan Kiszka via Xenomai
Quoted 24 lines · François Legal
Quoted 21 lines · Jan Kiszka
Quoted 4 lines · François Legal via Xenomai

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

Quoted 8 lines

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

I would add SO_RCVTIMEO support, like rtipc already has.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
Quoted 9 lines
Quoted 5 lines

Hello,

Isn't SO_RCVTIMEO used to set receive timeout ?

What I intend to do is retrieve the receive time of the packet.

Sorry, wrong option. But I suspect there is something official to obtain the time stamps as well.

SO_TIMESTAMP, and that takes you to those ancillary data.

Jan

Signature · 2 lines
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 36 lines · Jan Kiszka
Quoted 25 lines · Jan Kiszka via Xenomai
Quoted 24 lines · François Legal
Quoted 21 lines · Jan Kiszka
Quoted 4 lines · François Legal via Xenomai

Hello,

working on a data recorder application, I would need to get access to each packet receive timestamp (populated during packet reception ISR generally in network drivers).

Quoted 8 lines

I figured out, the cleanest way to do it would be using the
"void __user *msg_control; /* ancillary data */" / "__kernel_size_t msg_controllen; /* ancillary data buffer length */"
members of the struct user_msghdr that is carried over when using the recvmsg call, plus possibly an ioctl to enable the timestamp retrieving

Did anybody already do something like this in xenomai/RTNET ? Any thought on the proposed vector ?
Any chance such modification could become mainline ?

I would add SO_RCVTIMEO support, like rtipc already has.

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

Quoted 9 lines
Quoted 5 lines

Hello,

Isn't SO_RCVTIMEO used to set receive timeout ?

What I intend to do is retrieve the receive time of the packet.

Sorry, wrong option. But I suspect there is something official to obtain the time stamps as well.

Quoted 7 lines

SO_TIMESTAMP, and that takes you to those ancillary data.

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

That's what I just figured out.
I'll implement that then, and submit patch.

François