* CAN device filterting @ 2012-09-04 13:31 Puneet Sharma 2012-09-04 13:40 ` Oliver Hartkopp 0 siblings, 1 reply; 6+ messages in thread From: Puneet Sharma @ 2012-09-04 13:31 UTC (permalink / raw) To: linux-can Dear All, I need some guidance on implementing the CAN filtering of identifier in the driver code of CAN for atmel AT91SAM9263 board. Please guide me how to proceed with it.. Thanks & Regards -- Puneet Sharma <puneet.sharma@moschip.com> Moschip Semiconductor, Hyderabad (India) https://www.moschip.com The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CAN device filterting 2012-09-04 13:31 CAN device filterting Puneet Sharma @ 2012-09-04 13:40 ` Oliver Hartkopp 2012-09-04 13:57 ` Marc Kleine-Budde 0 siblings, 1 reply; 6+ messages in thread From: Oliver Hartkopp @ 2012-09-04 13:40 UTC (permalink / raw) To: puneet.sharma; +Cc: linux-can On 04.09.2012 15:31, Puneet Sharma wrote: > I need some guidance on implementing the CAN filtering of identifier in > the driver code of CAN for atmel AT91SAM9263 board. Please guide me how > to proceed with it.. Hm - i wrote that some days ago: The CAN netdev driver model is as easy and simple as ethernet devices. To fulfill multi-user requirements the CAN driver disables any CAN controller specific filters and mailboxes to enable all different users on the host to filter their own requires messages, using the CAN filter infrastructure: http://lxr.linux.no/#linux+v3.5.3/Documentation/networking/can.txt#L393 You can also check out the filter capabilities with the 'candump' tool, see 'candump -?' Does this help? Regards, Oliver ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CAN device filterting 2012-09-04 13:40 ` Oliver Hartkopp @ 2012-09-04 13:57 ` Marc Kleine-Budde 2012-09-04 16:53 ` Oliver Hartkopp 0 siblings, 1 reply; 6+ messages in thread From: Marc Kleine-Budde @ 2012-09-04 13:57 UTC (permalink / raw) To: Oliver Hartkopp; +Cc: puneet.sharma, linux-can [-- Attachment #1: Type: text/plain, Size: 1942 bytes --] On 09/04/2012 03:40 PM, Oliver Hartkopp wrote: > On 04.09.2012 15:31, Puneet Sharma wrote: > >> I need some guidance on implementing the CAN filtering of identifier in >> the driver code of CAN for atmel AT91SAM9263 board. Please guide me how >> to proceed with it.. > > > Hm - i wrote that some days ago: I talked to Puneet in private before, if I understand him correctly he wants to implement hardware filtering, although software filtering is available. From my point of view it should become a per device callback, which you (admin, i.e. the root user) can set when the device is down. You have to extend the CAN netlink interface [1]. Each device should identify what kind and how many hardware filters it supports: a) mask+id b) just id c) ... Analogue to ctrlmode [2][3]. The requested filers are transferred into the kernel via netlink, but you have to figure out how to encode a variable length list (netfilter has probably a solution for this). Then the code in can_changelink() [4] should check if the transferred filter is supported on that hardware. Then, during open the driver should code the filters into hardware, on at91 it should be done in at91_setup_mailboxes [5][6]. Marc [1] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L585 [2] http://lxr.free-electrons.com/source/include/linux/can/netlink.h#L81 [3] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L691 [4] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L600 [5] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L418 [6] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L336 -- 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 | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 259 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CAN device filterting 2012-09-04 13:57 ` Marc Kleine-Budde @ 2012-09-04 16:53 ` Oliver Hartkopp 2012-09-04 17:13 ` Marc Kleine-Budde 0 siblings, 1 reply; 6+ messages in thread From: Oliver Hartkopp @ 2012-09-04 16:53 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: puneet.sharma, linux-can On 04.09.2012 15:57, Marc Kleine-Budde wrote: > On 09/04/2012 03:40 PM, Oliver Hartkopp wrote: >> On 04.09.2012 15:31, Puneet Sharma wrote: >> >>> I need some guidance on implementing the CAN filtering of identifier in >>> the driver code of CAN for atmel AT91SAM9263 board. Please guide me how >>> to proceed with it.. >> >> >> Hm - i wrote that some days ago: > > I talked to Puneet in private before, if I understand him correctly he > wants to implement hardware filtering, although software filtering is > available. Ah, ok. > > From my point of view it should become a per device callback, which you > (admin, i.e. the root user) can set when the device is down. You have to > extend the CAN netlink interface [1]. Good idea. > Each device should identify what kind and how many hardware filters it > supports: > a) mask+id > b) just id > c) ... > Analogue to ctrlmode [2][3]. Yes. Could be ambitious. E.g. a 2048 bit bitfield is an option too :-) The question is, if the usual mailbox configurations in CAN controller IP-cores can be stripped down to 2-3 standard types of filters, so that a good interface can be specified. > > The requested filers are transferred into the kernel via netlink, but > you have to figure out how to encode a variable length list (netfilter > has probably a solution for this). Then the code in can_changelink() [4] > should check if the transferred filter is supported on that hardware. > Then, during open the driver should code the filters into hardware, on > at91 it should be done in at91_setup_mailboxes [5][6]. Yep. I'm looking forward to a patch :-) Regards, Oliver > > Marc > > [1] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L585 > [2] http://lxr.free-electrons.com/source/include/linux/can/netlink.h#L81 > [3] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L691 > [4] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L600 > [5] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L418 > [6] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L336 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CAN device filterting 2012-09-04 16:53 ` Oliver Hartkopp @ 2012-09-04 17:13 ` Marc Kleine-Budde 2012-09-05 9:28 ` Puneet Sharma 0 siblings, 1 reply; 6+ messages in thread From: Marc Kleine-Budde @ 2012-09-04 17:13 UTC (permalink / raw) To: Oliver Hartkopp; +Cc: puneet.sharma, linux-can [-- Attachment #1: Type: text/plain, Size: 1600 bytes --] On 09/04/2012 06:53 PM, Oliver Hartkopp wrote: > On 04.09.2012 15:57, Marc Kleine-Budde wrote: > >> On 09/04/2012 03:40 PM, Oliver Hartkopp wrote: >>> On 04.09.2012 15:31, Puneet Sharma wrote: >>> >>>> I need some guidance on implementing the CAN filtering of identifier in >>>> the driver code of CAN for atmel AT91SAM9263 board. Please guide me how >>>> to proceed with it.. >>> >>> >>> Hm - i wrote that some days ago: >> >> I talked to Puneet in private before, if I understand him correctly he >> wants to implement hardware filtering, although software filtering is >> available. > > > Ah, ok. > >> >> From my point of view it should become a per device callback, which you >> (admin, i.e. the root user) can set when the device is down. You have to >> extend the CAN netlink interface [1]. > > > Good idea. > >> Each device should identify what kind and how many hardware filters it >> supports: >> a) mask+id >> b) just id >> c) ... >> Analogue to ctrlmode [2][3]. > > > Yes. Could be ambitious. E.g. a 2048 bit bitfield is an option too :-) > > The question is, if the usual mailbox configurations in CAN controller > IP-cores can be stripped down to 2-3 standard types of filters, so that a good > interface can be specified. id+mask is quite common. 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 | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 259 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CAN device filterting 2012-09-04 17:13 ` Marc Kleine-Budde @ 2012-09-05 9:28 ` Puneet Sharma 0 siblings, 0 replies; 6+ messages in thread From: Puneet Sharma @ 2012-09-05 9:28 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: Oliver Hartkopp, linux-can@vger.kernel.org On Tue, 2012-09-04 at 22:43 +0530, Marc Kleine-Budde wrote: > On 09/04/2012 06:53 PM, Oliver Hartkopp wrote: > > On 04.09.2012 15:57, Marc Kleine-Budde wrote: > > > >> On 09/04/2012 03:40 PM, Oliver Hartkopp wrote: > >>> On 04.09.2012 15:31, Puneet Sharma wrote: > >>> > >>>> I need some guidance on implementing the CAN filtering of identifier in > >>>> the driver code of CAN for atmel AT91SAM9263 board. Please guide me how > >>>> to proceed with it.. > >>> > >>> > >>> Hm - i wrote that some days ago: > >> > >> I talked to Puneet in private before, if I understand him correctly he > >> wants to implement hardware filtering, although software filtering is > >> available. > > > > > > Ah, ok. > > Hello, Marc is correct. I want to implement hardware filtering. Need some guidance on this how to proceed with it ? > >> From my point of view it should become a per device callback, which you > >> (admin, i.e. the root user) can set when the device is down. You have to > >> extend the CAN netlink interface [1]. > > > > > > Good idea. > > > >> Each device should identify what kind and how many hardware filters it > >> supports: > >> a) mask+id > >> b) just id > >> c) ... > >> Analogue to ctrlmode [2][3]. > > > > > > Yes. Could be ambitious. E.g. a 2048 bit bitfield is an option too :-) > > > > The question is, if the usual mailbox configurations in CAN controller > > IP-cores can be stripped down to 2-3 standard types of filters, so that a good > > interface can be specified. > > id+mask is quite common. > id+mask is what will be required for the driver. > Marc > -- Puneet Sharma <puneet.sharma@moschip.com> The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-09-05 9:30 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-09-04 13:31 CAN device filterting Puneet Sharma 2012-09-04 13:40 ` Oliver Hartkopp 2012-09-04 13:57 ` Marc Kleine-Budde 2012-09-04 16:53 ` Oliver Hartkopp 2012-09-04 17:13 ` Marc Kleine-Budde 2012-09-05 9:28 ` Puneet Sharma
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox