Re: Interrupt Handler of Ethernet Device

2013-04-07 Thread Rami Rosen
Hi, we have in : http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c struct nic { /* Begin: frequently used values: keep adjacent for cache effect */ u32 msg_enable cacheline_aligned; struct net_device *netdev;

simple question about the function memcmp in kernel

2013-04-07 Thread Ben Wu
Dear All:      int memcmp(const void *cs, const void *ct, size_t count) { const unsigned char *su1, *su2; int res = 0; for (su1 = cs, su2 = ct; 0 count; ++su1, ++su2, count--)   if ((res = *su1 - *su2) != 0)    break; return res; } I want to know why it

Re: simple question about the function memcmp in kernel

2013-04-07 Thread Valdis . Kletnieks
On Mon, 08 Apr 2013 08:57:01 +0800, Ben Wu said: int memcmp(const void *cs, const void *ct, size_t count) { I want to know why it use the temp pointer su1, su2? why it doesn't directly use the cs and ct pointer? This is a C 101 question, not a kernel question. But anyhow.. They're

Re: simple question about the function memcmp in kernel

2013-04-07 Thread Max Filippov
On Mon, Apr 8, 2013 at 5:33 AM, valdis.kletni...@vt.edu wrote: On Mon, 08 Apr 2013 08:57:01 +0800, Ben Wu said: int memcmp(const void *cs, const void *ct, size_t count) { I want to know why it use the temp pointer su1, su2? why it doesn't directly use the cs and ct pointer? This is a C

Re: simple question about the function memcmp in kernel

2013-04-07 Thread Valdis . Kletnieks
On Mon, 08 Apr 2013 05:56:29 +0400, Max Filippov said: const is the the object they point to, not the pointers themselves (that would be void * const cs). memcmp compares bytes at which cs and ct point, but these are void pointers, and the expression res = *cs - *ct is thus meaningless.

Re: simple question about the function memcmp in kernel

2013-04-07 Thread Burke
于 2013-4-8 10:29, valdis.kletni...@vt.edu 写道: On Mon, 08 Apr 2013 05:56:29 +0400, Max Filippov said: const is the the object they point to, not the pointers themselves (that would be void * const cs). memcmp compares bytes at which cs and ct point, but these are void pointers, and the

Re: Interrupt Handler of Ethernet Device

2013-04-07 Thread Robert Clove
As far i have read the packet reception i have found out that When working in interrupt driven model, the nic registers an interrupt handler; • This interrupt handler will be called when a frame is received; • Typically in the handler, we allocate sk buff by calling dev alloc skb(); • Copies data