Dev_queue_xmit () function Return Value Problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.