ferrymax wrote:
> Hi! 

Hi Markus,

> 
> I am trying to write a network device driver for using multiple
> CAN-channels. 
> I have a network-device-driver-module "can".

This is just the networklayer core for PF_CAN (no driver).

> I use the command "ip link add
> dev canX type can" to create can0 to can3. 
> 

You created "virtual" CAN interfaces named like "real" CAN interfaces here.

> In an example application, I can connect to each of these devices with a
> socket by setting "ifr_name" for ioctrl accordingly. So far so good. 
> 
> What I just don't get is how I can distinguish the four devices in the "can"
> module. E.g., the "can_transmit()" [=net_device_ops.ndo_start_xmit()]
> function is called with the respective net_device parameter for the calling
> socket. However, I need to know which CHANNEL is calling (i.e., can0, can1,
> ...) to forward the message to the correct mailbox. 
> 
> Also, if I call "ip link add can0 type can", the init function
> [=rtnl_link_ops.setup()] is called. The name-field of the net_device
> parameter, however, is NOT can0, as I would have expected. So I am missing
> the link between the "ip link add" command and the device-module. 
> 
> I guess I'm missing something really important and fundamental here... 

You need to have the ifindex to define on which CAN netdevice (canX, vcanX)
you are sending.

See linux/Documentation/networking/can.txt :-)

Do you have "real" CAN hardware?

Regards,
Oliver

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to