On Wed, Feb 03, 2010 at 03:11:35AM +0100, Marc Kleine-Budde wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello
> 
> wendy liang wrote:
> > I am writing a CAN driver using the socketCAN framework.
> > When there is an ACK error, the CAN hardware keeps resending the packet and
> > keeps raising interrupts, which introduce too much overhead to the
> > processor.
> 
> This is a...IMHO..."weak" point of our current driver design. We don't
> disable error interrupts even if they are coming at an incredible high
> rate. Maybe it's time to discuss the problem again.
If I understand well, the ACK error comes 'once per message'. The
controller can only generate an ACK error when the complete message was
on the bus.
> 
> If your driver uses NAPI the system would stay more responsive compared
> to a standard interrupt handler. Have a look at e.g. the at91_can.c
> which is already mainline.
> 
> For a discussion:
> A possible solution might be to switch of the error interrupt and poll
> it e.g. with delayed work.
> 
> > And thus, I want the driver to close itself when the interrupt handler
> > detects there are too many error interrupts.
> 
> That should be done from userspace....See below:
> 
> > Is there anyway to ask the upper layer to close the driver from the driver
> > itself such that the upper layer knows the driver is closed?
> 
> We usually generate error frames and send them to the upper layes, i.e.
> userspace. It's up to the application to react in an appropriate way.
> Which depends on the design of your system.
> 
> > Is it enough to just call the ".ndo_stop() " function from the driver
> > itself?
> 
> I think this function is called if the user requests the interface to go
> down. You don't want to call it from the driver itself.
Ack. don't!
include/linux/netdevice.h  exports interesting things for those.
but you will have to call such functions from process context (or
      workqueue), so if the IRQ is coming too fast, disabling the
interrupt is the only option that I see. Any process would be postponed
until no interrupts come.
Kurt
> 
> Marc
> 
> - --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkto21cACgkQjTAFq1RaXHMXSgCeJAirvJF0nR8APW5N3USAXPZl
> 8gMAn3Aks5zefpPSPdq1HRSZVL8fLqPv
> =JN9M
> -----END PGP SIGNATURE-----
> _______________________________________________
> Socketcan-core mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/socketcan-core
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to