LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Driver information along with the packet (https://www.linuxquestions.org/questions/linux-networking-3/driver-information-along-with-the-packet-4175477544/)

lohith.nayak 09-18-2013 01:13 AM

Driver information along with the packet
 
I am new to Linux networking field.
I have a driver code which is called when eth packet arrives to the hardware.
After receiving it, driver information is updated and packet is given to linux network stack by calling netif_rx function.

I want to send some driver error information along with the packet to the userspace.

I have a socket to receive regular packet.
But how can I get the driver information along with the packet?

I thought of appending driver error information to the packet and send it. But I am afraid that packet flow might get in to toss. Another reason is I might overload the system looking for driver error information when there is no error.

Is there any other mechanism where I can fill some buffer with length information along with skb and receive the same in userspace using socket?


Thanks,
regards,
Lohith Nayak

nini09 09-18-2013 03:44 PM

What kind of error information do you want, error or drop counter and so on?

lohith.nayak 09-18-2013 10:34 PM

@nini09

I am doing packet analysis (IPsec SPD) and run some timers, packet counts, seq number checks.
If there are errors have to generate event through stack.
Was thinking in the skb buffer, can I reserve first 0-N-1 bytes for this and from N being skb->head starts having ethernet frame and send to network stack by calling netif_rx and receive in userspace as a RAW socket?

nini09 09-19-2013 02:20 PM

ifconfig command already provide traffic statistics of interface, such as number of bytes, packets, drop and so on.
For other things, such as timer and checks, your own code can take care of it and provide an API to access it from userspace.
In general, you can't reserve first N bytes in skb to save your own information.

lohith.nayak 09-19-2013 11:22 PM

There is an API to copy the information from driver to userspace.
But customer wants to get these information from socket application along with the packet.
Does that mean it is not possible to send driver information trough skb :(

nini09 09-20-2013 02:16 PM

No easy way.


All times are GMT -5. The time now is 03:14 AM.