Re: Info regarding Linux Network Buffers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

Require some more clarification to an older question :). 
I am attaching my original mail too for reference.
As I understand, Linux first uses skb1->frags array to put data.
Once it is full, it gets another skb (say skb2), fills its data area, then its frags area.
So data is in this form (order):

skb1->data, skb1->frags[1-MAX], skb1->fraglist (ie skb2), 
skb2->data, skb2->frags[1-MAX].

Suppose it needs more space, so it creates skb3.
Now where will it keep skb3.
It seems to me that it goes as:
		skb1->fraglist->next 	(=skb3)
ie, same as 	skb2->next.		(=skb3)
Is this fine???

Moreover, it seems to me that Linux uses this type of frag chaining only while it is 
getting fragments from the network. Does the code handle such sort of chaining if we 
create packet in that format on the output side?? As far as I could check, it seems 
this (skb_shared_info) is used only on the input side. I have checked in some flows, 
just wanted to make sure this is the case for all the output flows.

thanks,
Deepankar.


On Thu, 2003-03-20 at 23:39, Muli Ben-Yehuda wrote:
> On Thu, Mar 20, 2003 at 11:04:55AM +0530, Deepankar Vidyarthi wrote:
> 
> > there are both the frag_list (which as far as I understand is the
> > list of fragments set when reassembling the packet) 
> > and frags[] array (which is an array with pointers to memory pages).
> 
> The frags array is limited to MAX_NUM_SKB fragments. If you need more
> fragments, you need a place to store those frags.  Linux uses another
> skb's ->frags for it, and chains this second skb to the first skb via
> the frag_list. (skb1->frag_list = skb2). 
> -- 
> Muli Ben-Yehuda
> http://www.mulix.org
> 
    Hi,

    I am studying the working of linux TCP/IP stack.
    More so I am trying to understand the present architecture of
    sk_buffs.
    Going through the code (& related functions) I got some idea about
    the concept behind non-linear sk_buffs. 
    Its definitely a lot different from what we get in any written text
    related to sk_buffs 
    (atleast I could not find any proper doc on non-linear skb). 
    But the concept of non-linear sk_buff is really good  -- i.e.
    keeping the pointers to fragments in the skb_shared_info structure.
    
    But I didn't quite get why in skb_shared_info struct:
    
            struct skb_shared_info {
                    atomic_t        dataref;
                    unsigned int    nr_frags;
                    struct sk_buff  *frag_list;
                    skb_frag_t      frags[MAX_SKB_FRAGS];
            };
    
    there are both the frag_list (which as far as I understand is the
    list of fragments set when reassembling the packet)
    and frags[] array (which is an array with pointers to memory pages).
     
    Not sure how these are used. 
    For example, in skb_copy_bits() function, it first goes thru frags
    array copying the data and then traverses the frag_list.
    
    I thought once you traverse the frag_list you should get all the
    data. 
    Or is there any other idea behind this??? If anyone give more
    insight into these, that would be very helpful.
    
    thanks,
    Deepankar.
    
    

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux