Skip to contentSkip to conversation

share thought on socketcan for flexcan driver on imx6 platform

DISCUSSION Ratheendran 2 participants 2 messages May 7, 2014 – May 13, 2014 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hi All,

The mail I write to get more insight on socketcan implementation for flexcan driver on imx6 platform.

Our customer need mode change implementation to be implemented on the driver. Freeze -> Listen-Only
Freeze -> Normal
Listen-Only -> Normal
Normal ->Freeze
Freeze -> Disable
Disable -> Freeze

I very well know this can be achieved with iproute2 utilities with the existing driver implementation.

I can also tweak the driver code to bring in this mode changes with the implementation of ioctl calls,the thought bothers me to go ahead is this changes with lead to undesired consequences on socketcan stack. for example debugging an application with ipoute2 related commands will not give the correct status on the on below stack below when the mode changes occurs at the c code level.

So I need to understand any better way to achieve the scope apart from command line tools, probably by enhancing the upper layer stack to accommodate the mode change ioctl implementation.

I will be great help if you all can share your valuable thoughts.

Regrads,
Ratheendran

#1 lore raw
Quoted 6 lines · Ratheendran

The mail I write to get more insight on socketcan implementation for flexcan driver on imx6 platform.

Our customer need mode change implementation to be implemented on the driver.
Freeze -> Listen-Only

Listen only mode ist supported by the driver, you can use iproute2's ip utility, canconfig for shell, or libsocketcan for C.

canconfig can0 ctrlmode listen-only on
ifconfig can0 up

Quoted 1 line

Freeze -> Normal

it's just a normal ifconfig up, just to be sure switch listen only mode off:

canconfig can0 ctrlmode listen-only off
ifconfig can0 up

Quoted 1 line

Listen-Only -> Normal

ifconfig can0 down
canconfig can0 ctrlmode listen-only off
ifconfig can0 up

Quoted 2 lines

Normal ->Freeze
Freeze -> Disable

ifconfig down is whatever state, usually normal -> freeze, then disable

ifconfig can0 down

Quoted 1 line

Disable -> Freeze

This happens during ifconfig up, but then the device goes straight into normal mode.

Quoted 2 lines

I very well know this can be achieved with iproute2 utilities with the existing driver implementation.

Not quite, we don't distinguish between disable and freeze.

Quoted 6 lines

I can also tweak the driver code to bring in this mode changes with the implementation of ioctl calls,the thought bothers me to go ahead is this changes with lead to undesired consequences on socketcan stack. for example debugging an application with ipoute2 related commands will not give the correct status on the on below stack below when the mode changes occurs at the c code level.

ioctls are out of fashion, nowadays we use netlink to control the network devices.

Quoted 5 lines

So I need to understand any better way to achieve the scope apart from command line tools, probably by enhancing the upper layer stack to accommodate the mode change ioctl implementation.

I will be great help if you all can share your valuable thoughts.

Use libsocketcan for a C interface.

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   |