The dev_queue_xmit () function is used to directly use sk_buf to send packets. This function has a returned value, but cannot pass
The return value of this function is 0, indicating that the package has been sent and the sk_buff memory can be immediately released. Because Nic packet sending is an asynchronous process,
For example, you can view this article during the packet sending process of the ixgbe NIC Driver. Therefore, the solution is in skb_buff-> uers
Store it in the linked list without any reduction, and release the memory later. For example:
Dev_queue_xmit (send_skb); If (atomic_read (& (send_skb-> Users) = 1) {kmem_cache_free (skbuff_head_cache, send_skb );} else {struct free_slab * PTR = kmem_cache_alloc (skbuff_free_cache, gfp_atomic &~ _ Gfp_dma); PTR-> free_mem = send_skb; spin_lock (& lock); list_add (& PTR-> list, & head_free_slab); spin_unlock (& lock );}
Dev_queue_xmit () function Return Value Problem