Re: more questions on skbuff allocation

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

 



--- 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