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
>