CAN device filterting
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 <[email protected]>
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.
Quoted 3 lines · Puneet Sharma
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
Marc Kleine-Budde
maintainerQuoted 8 lines · Oliver Hartkopp
Quoted 3 lines · Puneet Sharma
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
Signature · 4 lines
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 |
Quoted 8 lines · Marc Kleine-Budde
Quoted 7 lines · Oliver Hartkopp
Quoted 3 lines · Puneet Sharma
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..
Quoted 5 lines
Quoted 1 line
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.
Quoted 4 lines
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.
Quoted 6 lines
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.
Quoted 7 lines
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 inat91_setup_mailboxes[5][6].
Yep. I'm looking forward to a patch :-)
Regards,
Oliver
Quoted 9 lines
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
Marc Kleine-Budde
maintainerQuoted 35 lines · Oliver Hartkopp
Quoted 8 lines · Marc Kleine-Budde
Quoted 7 lines · Oliver Hartkopp
Quoted 3 lines · Puneet Sharma
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..
Quoted 5 lines
Quoted 1 line
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.
Quoted 4 lines
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.
Quoted 6 lines
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].
Quoted 5 lines
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
Signature · 4 lines
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 |
Quoted 13 lines · Marc Kleine-Budde
Quoted 12 lines · Oliver Hartkopp
Quoted 10 lines · Marc Kleine-Budde
Quoted 8 lines · Oliver Hartkopp
Quoted 3 lines · Puneet Sharma
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:
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
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 ?
Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
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.
Quoted 6 lines
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].
Quoted 8 lines
Quoted 5 lines
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.
Quoted 2 lines
Marc
--
Puneet Sharma <[email protected]>
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.