skb_buff

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

 




Just a question.

I'm studying TCP-IP stack in kernel 2.4 and I'm not able to understand
the difference between fields len and data_len in struct skb_buff.
Infact if we see typical steps in sending we could see

/* Only tailroom */
skb = alloc_skb(headerlen + len, GFP_KERNEL);
/* Reserve space for header */
skb_reserve(skb, headerlen);
/* Reserve space for data */
skb_put(skb, len);
[..]

Now skb_put appears as follows.

static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
{
        unsigned char *tmp=skb->tail;
        SKB_LINEAR_ASSERT(skb);
        skb->tail+=len;
        skb->len+=len;
        if(skb->tail>skb->end) {
                skb_over_panic(skb, len, current_text_addr());
        }
        return tmp;
}

I can see it updates only skb->len.

So I thought that difference could be
- skb->len is the number of bytes reserved for data;
- skb->data_len is the number of bytes actually used in data area 
  reserved in the buffer obtained through alloc_skb (and so 
  skb->data_len <= skb->len always).

Is this correct?


Regards,

Angelo Dell'Aera 'buffer' 
<buffer@users.sourceforge.net>
--
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