* hi , question function of net_rx(struct net_device *dev)
@ 2014-07-18 9:04 lx
2014-07-18 10:05 ` Denis Kirjanov
0 siblings, 1 reply; 2+ messages in thread
From: lx @ 2014-07-18 9:04 UTC (permalink / raw)
To: kernelnewbies
hi :
the source code of net_rx(struct net_device *dev) is:
http://lxr.oss.org.cn/source/drivers/net/ethernet/cirrus/cs89x0.c#L670
I can't understand codes about malloc buffer.
##########################################
684 /* Malloc up new buffer. */
685 skb = netdev_alloc_skb(dev, length + 2);
686 if (skb == NULL) {
687 dev->stats.rx_dropped++;
688 return;
689 }
690 skb_reserve(skb, 2); /* longword align L3 header */
##########################################
How to explain 'length + 2' in line of 685? Why add 2 ?
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
* hi , question function of net_rx(struct net_device *dev)
2014-07-18 9:04 hi , question function of net_rx(struct net_device *dev) lx
@ 2014-07-18 10:05 ` Denis Kirjanov
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kirjanov @ 2014-07-18 10:05 UTC (permalink / raw)
To: kernelnewbies
On 7/18/14, lx <lxlenovostar@gmail.com> wrote:
> hi :
> the source code of net_rx(struct net_device *dev) is:
> http://lxr.oss.org.cn/source/drivers/net/ethernet/cirrus/cs89x0.c#L670
>
> I can't understand codes about malloc buffer.
> ##########################################
> 684 /* Malloc up new buffer. */
> 685 skb = netdev_alloc_skb(dev, length + 2);
> 686 if (skb == NULL) {
> 687 dev->stats.rx_dropped++;
> 688 return;
> 689 }
> 690 skb_reserve(skb, 2); /* longword align L3 header */
> ##########################################
>
> How to explain 'length + 2' in line of 685? Why add 2 ?
That's why it's explained on the line 690.
http://lwn.net/Articles/89597/
> Thank you.
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards,
Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-18 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18 9:04 hi , question function of net_rx(struct net_device *dev) lx
2014-07-18 10:05 ` Denis Kirjanov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.