Interrupt Handler of Ethernet Device
Hello All, I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception. Thanks Robert
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev))) ... This means that e100_intr is registered as an interrupt handler. Best, Rami Rosen http://ramirose.wix.com/ramirosen On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Thanks for the link. I have another query too......should i ask right now? On Fri, Apr 5, 2013 at 5:36 PM, Rami Rosen <roszenrami@gmail.com> wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Fri, Apr 5, 2013 at 1:11 PM, Robert Clove <cloverobert@gmail.com> wrote:
Thanks for the link. I have another query too......should i ask right now?
If the question is relevant to current discussion, please ask here but if it just piggyback to totally different topic at hand make a new thread. Also in case of doubt: http://www.catb.org/esr/faqs/smart-questions.html
On Fri, Apr 5, 2013 at 5:36 PM, Rami Rosen <roszenrami@gmail.com> wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thank you Warm Regards Anuz
On Fri, Apr 05, 2013 at 03:06:37PM +0300, Rami Rosen wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Is this nic->netdev represent a Ethernet interface ?
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
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; struct pci_dev *pdev; ... ... And indeed nic->netdev represents an Ethernet interface, which is the struct net_device (see: include/linux/netdevice.h) Regards, Rami Rosen http://ramirose.wix.com/ramirosen On Sun, Apr 7, 2013 at 5:52 AM, ishare <june.tune.sea@gmail.com> wrote:
On Fri, Apr 05, 2013 at 03:06:37PM +0300, Rami Rosen wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Is this nic->netdev represent a Ethernet interface ?
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
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 use the temp pointer su1, su2? why it doesn't directly use the cs and ct pointer?
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 declared const, so the compiler will whine about ++'ing them.
On Mon, Apr 8, 2013 at 5:33 AM, <Valdis.Kletnieks@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 101 question, not a kernel question. But anyhow..
They're declared const, so the compiler will whine about ++'ing them.
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. One must convert them to (const unsigned char *), which looks ugly, otherwise such implementation looks like pretty much valid: int memcmp(const void *cs, const void *ct, size_t count) { int res = 0; for (; 0 < count; ++cs, ++ct, count--) if ((res =*(const unsigned char *)cs - *(const unsigned char *)ct) != 0) break; return res; } -- Thanks. -- Max
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.
Max is right, and I'm obviously under-caffienated or something. :)
于 2013-4-8 10:29, Valdis.Kletnieks@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 expression res = *cs - *ct is thus meaningless. Max is right, and I'm obviously under-caffienated or something. :) Dear Max,Valdis: I got it, many thanks for your kindly reply.
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 from nic’s buffer to this struct just created; • nic call generic reception routine netif rx(); • netif rx() put frame in per cpu queue; • if queue is full, drop! BUT i didn't found the netif_rx() in the following link http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c#L2204 On Sun, Apr 7, 2013 at 8:52 PM, Rami Rosen <roszenrami@gmail.com> wrote:
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; struct pci_dev *pdev; ... ...
And indeed nic->netdev represents an Ethernet interface, which is the struct net_device (see: include/linux/netdevice.h)
Regards, Rami Rosen http://ramirose.wix.com/ramirosen
On Sun, Apr 7, 2013 at 5:52 AM, ishare <june.tune.sea@gmail.com> wrote:
On Fri, Apr 05, 2013 at 03:06:37PM +0300, Rami Rosen wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Is this nic->netdev represent a Ethernet interface ?
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com>
wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Hi,
When working in interrupt driven model, the nic registers an interrupt handler; The nic registers an interrupt handle also when working in polling mode; See all the new drivers like e1000, e1000e and more.
when working in interrupt mode, each packet received triggers an interrupt; when working in polling mode, we start in interrupt model; but only the first packet triggers interrupt, afterward we work in poll mode. If traffic is low we switch again to interrupt mode. There are cases when netif_rx() is used for interrupt driven driver; look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/davicom/dm9000.c dm9000_rx() is called from the interrupt isr, dm9000_interrupt. And grepping for the network drivers subtree will easily find some more examples. Regards, Rami Rosen http://ramirose.wix.com/ramirosen On Mon, Apr 8, 2013 at 8:42 AM, Robert Clove <cloverobert@gmail.com> wrote:
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 from nic’s buffer to this struct just created; • nic call generic reception routine netif rx(); • netif rx() put frame in per cpu queue; • if queue is full, drop!
BUT i didn't found the netif_rx() in the following link http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c#L2204
On Sun, Apr 7, 2013 at 8:52 PM, Rami Rosen <roszenrami@gmail.com> wrote:
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; struct pci_dev *pdev; ... ...
And indeed nic->netdev represents an Ethernet interface, which is the struct net_device (see: include/linux/netdevice.h)
Regards, Rami Rosen http://ramirose.wix.com/ramirosen
On Sun, Apr 7, 2013 at 5:52 AM, ishare <june.tune.sea@gmail.com> wrote:
On Fri, Apr 05, 2013 at 03:06:37PM +0300, Rami Rosen wrote:
Robert, You should look for the request_irq() method in the driver. This method registers an interrupt handler. For example, you can look in: http://lxr.free-electrons.com/source/drivers/net/ethernet/intel/e100.c ... ... if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, nic->netdev->name, nic->netdev)))
...
This means that e100_intr is registered as an interrupt handler.
Is this nic->netdev represent a Ethernet interface ?
Best, Rami Rosen http://ramirose.wix.com/ramirosen
On Fri, Apr 5, 2013 at 11:50 AM, Robert Clove <cloverobert@gmail.com> wrote:
Hello All,
I am new here. I want to know the interrupt handler of the ethernet card and where can i find the definition of it so as i can clear the flow of packet reception.
Thanks Robert
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (8)
-
Anuz Pratap Singh Tomar -
Ben Wu -
Burke -
ishare -
Max Filippov -
Rami Rosen -
Robert Clove -
Valdis.Kletnieks@vt.edu