Networking Forums

Networking Forums > Computer Networking > Linux Networking > Why is sk_buff_head used?

Reply
Thread Tools Display Modes

Why is sk_buff_head used?

 
 
Matthew
Guest
Posts: n/a

 
      01-06-2004, 03:32 PM
I read the net module source of linux kernel. I don't understand why
sk_buff_head is used instead sk_buff.
Such as :
struct softnet_data
{
int throttle;
int cng_level;
int avg_blog;
struct sk_buff_head input_pkt_queue;
struct net_device *output_queue;
struct sk_buff *completion_queue;
} __attribute__((__aligned__(SMP_CACHE_BYTES)));

I guess the target is to save the memory but I'm not sure. who can tell me
why.

THX.



 
Reply With Quote
 
 
 
 
Neil Horman
Guest
Posts: n/a

 
      01-06-2004, 05:11 PM
Matthew wrote:
> I read the net module source of linux kernel. I don't understand why
> sk_buff_head is used instead sk_buff.
> Such as :
> struct softnet_data
> {
> int throttle;
> int cng_level;
> int avg_blog;
> struct sk_buff_head input_pkt_queue;
> struct net_device *output_queue;
> struct sk_buff *completion_queue;
> } __attribute__((__aligned__(SMP_CACHE_BYTES)));
>
> I guess the target is to save the memory but I'm not sure. who can tell me
> why.
>
> THX.
>
>
>

Not quite sure what you're missing, but sk_buff_heads are different data
structures than sk_buffs. sk_buff_head structures hold the start of a
linked list of sk_buffs, pluss additional data. Particularly they hold
the length of the linked list they point to, and contain a lock
structure to ensure mutually exclusive access to the queue, to prevent
corruption.

HTH
Neil

--
Neil Horman
Red Hat, Inc., http://people.redhat.com/nhorman
gpg keyid: 1024D / 0x92A74FA1, http://www.keyserver.net

 
Reply With Quote
 
Matthew
Guest
Posts: n/a

 
      01-07-2004, 02:56 PM
So if there was no plus addition data to save in the sk_buff_head structure,
the linked list of sk_buffs would need not begin with the sk_buff_head.
the linked list would look like:
sk_buff1<->sk_buff2<->sk_buff3<->sk_buff4<->sk_buff5<->sk_buff6<->sk_buff1
But actully it looks like:
sk_buff_head<->sk_buff1<->sk_buff2<->sk_buff3<->sk_buff4<->sk_buff5<->sk_buf
f6<->sk_buff_head
Am I right?

"Neil Horman" <(E-Mail Removed)> ????
news:bteuf2$o36$(E-Mail Removed)...
> Matthew wrote:
> > I read the net module source of linux kernel. I don't understand why
> > sk_buff_head is used instead sk_buff.
> > Such as :
> > struct softnet_data
> > {
> > int throttle;
> > int cng_level;
> > int avg_blog;
> > struct sk_buff_head input_pkt_queue;
> > struct net_device *output_queue;
> > struct sk_buff *completion_queue;
> > } __attribute__((__aligned__(SMP_CACHE_BYTES)));
> >
> > I guess the target is to save the memory but I'm not sure. who can tell

me
> > why.
> >
> > THX.
> >
> >
> >

> Not quite sure what you're missing, but sk_buff_heads are different data
> structures than sk_buffs. sk_buff_head structures hold the start of a
> linked list of sk_buffs, pluss additional data. Particularly they hold
> the length of the linked list they point to, and contain a lock
> structure to ensure mutually exclusive access to the queue, to prevent
> corruption.
>
> HTH
> Neil
>
> --
> Neil Horman
> Red Hat, Inc., http://people.redhat.com/nhorman
> gpg keyid: 1024D / 0x92A74FA1, http://www.keyserver.net
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




1 2 3 4 5 6 7 8 9 10 11