Problem with skb_queue_tail(), skb_dequeue() and working with the skb's
Hello,
I'm programming a protocol handler for a new ethernet type id for fast network transfers. I registered that handler with dev_add_pack(). Everytime I receive a vaild packet with that type id the receiving function is called and checks if the packed is vaild. If packed is valid, it gets added to a skb queue by calling skb_queue_tail().
The module also spawns a new kthread which, if the queue is not empty, call skb_dequeue() to remove one skb from the list and then write that skb directly to the disk by calling vfs_write(). I'm aware that file I/O is a bad thing in the kernel but this will save some context switches.
I noticed that skb->len is 14 bytes shorter than it should be. Im receiving 8192 bytes paylod + 14 bytes header but skb->len is only 8192 bytes. Second thing is, the data I wrote with vfs_write does in no way match the content I see with wireshark on the sending machine. It's a P2P link between both machines.
The receiving function and the dequeue thread have both counters inside which I read from /proc. The show me that I receive numerous of valid skb's but none of them appear in the file on my disk. Sometimes there are some bytes of valid data but most of the time it's 0x00 or other data stored in my memory, like dmesg entries.
Anyone with a good advice here? Thanks.