> You don't use sockets from INSIDE the kernel. > If you want to send CAN frames from inside the kernel you should use the > can_send() function from af_can.c Great to know! I Will look at that right away, any example(s) you could point me towards? > Is your requirement to send "some content" in a very defined time slot > OR do you need to send the time as content? Use case: I need to send the epoch seconds as close to the zeroth of the second as possible, there are some legacy cards that use this packet to set their clocks, and I am attempting a solution to improve their accuracy without modifying their firmware. Hence I have a kernel module that can run a function with sub 10uS accuracy, the function of choice would spit out a CAN packet with the epoch seconds in it. > Sending CAN frames in a very precise (hrtimer) manner can be done with > the broadcast manager (aka CAN_BCM) sockets. > > See: > https://elixir.bootlin.com/linux/latest/source/Documentation/networking/can.rst#L677 > > 1. You can send fixed CAN frames and also a sequence of up to 256 > (different) CAN frames at a precisely defined time with a CAN_BCM TX job. struct timeval ival1, ival2; /* count and subsequent interval */ Unfortunately, this doesn't look like it fits my use case, would have been nice to do from user space though. This looks like it can send out evenly spaced packets. And I need to send one packet at a precise clock time. > 2. You can generate the timestamp in user space and send it via CAN_RAW > socket. This also wont work due to the use case. > 3. You write your own kernel module o_O :) Here we are :)