Linux CAN drivers development
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: puneet.sharma@moschip.com,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: CAN Driver
Date: Thu, 06 Dec 2012 10:02:37 +0100	[thread overview]
Message-ID: <50C05F2D.8060903@pengutronix.de> (raw)
In-Reply-To: <1354779353.5010.2.camel@punsfloyd-desktop>

[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]

Hello,

I've put the linux-can mailinglist on Cc.

On 12/06/2012 08:35 AM, Puneet Sharma wrote:
> Can you guide me how to implement system wide per CAN device
> filterting in driver code.

Here is my old mail with some thoughts:

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#L724
[4] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L633
[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

> We also want to test CAN controller in u-boot. Can you help me out to
> write some test cases which can test the CAN controller on a basic
> level.

If you just want to do testing, I suggest, don't do it in u-boot. I
think it's more complicated to port a CAN driver to u-boot, than to boot
linux and do the tests there.

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: 261 bytes --]

       reply	other threads:[~2012-12-06  9:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1346761707.5009.4.camel@punsfloyd-desktop>
     [not found] ` <5045F53F.7070209@pengutronix.de>
     [not found]   ` <1354779353.5010.2.camel@punsfloyd-desktop>
2012-12-06  9:02     ` Marc Kleine-Budde [this message]
     [not found]       ` <1354785999.5871.8.camel@punsfloyd-desktop>
2012-12-06  9:44         ` CAN Driver Marc Kleine-Budde
     [not found]           ` <1354787514.6620.3.camel@punsfloyd-desktop>
2012-12-06 10:09             ` Marc Kleine-Budde
     [not found]               ` <1354789804.6620.6.camel@punsfloyd-desktop>
2012-12-06 10:42                 ` Marc Kleine-Budde
2012-12-06 10:43                   ` Puneet Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50C05F2D.8060903@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=puneet.sharma@moschip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox