Re: Re: more questions on skbuff allocation

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

 



  
hi Kiran,
       so let me tell you what i understood is that from skb->head to skb->data area contains all tcp/ip layer headers
   skb->data to akb->tail contains main application level data that is to be transmitted.
    Is that correct? anyone please reply me about my understandings.
 Also i want to know where in kernel source code main allo_skb implemented that is the size equal to all layer headers and main application data.

regards.
parag

On Thu, 29 Apr 2004 Kiran Kumar wrote :
>--- bunty  <bunty123_4@rediffmail.com> wrote:
>
> >        1)I want to know where are actaully packet
> > layer headers are stored by sk_buff structure? i got
> > some diagrams that tells that area between data and
> > tail contains compelete packet.then what is stored
> > between skb->head and skb->data area?
>
>   Ok, let me try to sort things out. This diagram
>might help.
>
>-> head
>{headroom space}
>->data
>->tail
>{tailroom space}
>->end
>
>Also,
>len = total lenght of the data in the skb;
>data_len = length of the data not in the main body of
>the skb, ie, is in the frags.
>
>headlen = len - data_len = data in the main body of
>the skb.
>
>When you normally create an skb (using alloc_skb()),
>there is no headroom, and there is tailroom of how
>many ever bytes you requested.
>
>A packet will be like this in the skb
>
>->head, data
>eth hdr
>nw hdr
>tran hdr
>->tail
>->end
>
>Then, you say,
>ethhdr = skb->dat;
>skb_pull(skb, ethhdr size);
>
>next
>iphdr = skb->data;
>skb_pull(skb, iphdr size);
>
>and so on;
>
>Hope this clarfies to some extent. Please do correct
>me if I am wrong anywhere.
>
> >         2) what exactly skb_put does?
>
>This adds data to the buffer, by decreasing the
>tailroom, that is it moves the tail pointer towards
>the end pointer.
>
> >         3) which functions very first takes data
> > from application layer and store in skbuff?
>
>Every 'struct sock' has a sk_proto field which in turn
>has a protocol specific function generally
>proto_sendmsg (like tcp_sendmsg) which actually
>allocates the skbuff.
>
> >         4) Is there any main alloc_skb call that
> > allocates total length skb buffer for whole packet?
>
>   net/core/skbuff.c:alloc_skb() is the function
>
>=====
>Regards,
>Kiran Kumar Immidi
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Win a $20,000 Career Makeover at Yahoo! HotJobs
>http://hotjobs.sweepstakes.yahoo.com/careermakeover
>
>--
>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