![]() |
can_eth_gw Gateway Module
0.1
A bidirectional CAN to Ethernet Gateway (Kernel Module)
|
| int | ce_gw_dev_open (struct net_device *dev) |
| called by the OS on device up More... | |
| int | ce_gw_dev_stop (struct net_device *dev) |
| called by the OS on device down More... | |
| static int | ce_gw_dev_start_xmit (struct sk_buff *skb, struct net_device *dev) |
| called by the OS if a package is sent to the device More... | |
| int | ce_gw_dev_init (struct net_device *dev) |
| called by the OS on device registered More... | |
| int | ce_gw_is_allocated_dev (struct net_device *eth_dev) |
| check if the param eth_dev is allocated by this module More... | |
| int | ce_gw_is_registered_dev (struct net_device *eth_dev) |
| check if the param eth_dev is registered by this module More... | |
| void | ce_gw_dev_job_src_add (struct ce_gw_job *job) |
| Adds an pointer to the net_device internal list where it is the src. More... | |
| void | ce_gw_dev_job_dst_add (struct ce_gw_job *job) |
| Adds an pointer to the net_device internal list where it is the dst. More... | |
| int | ce_gw_dev_job_add (struct net_device *eth_dev, struct ce_gw_job *job) |
| Adds an pointer to the net_device internal list where it is part of. More... | |
| void | ce_gw_dev_job_remove (struct ce_gw_job *job) |
| Removes the pointer to param job from the list in ethernet net_device. More... | |
| void | ce_gw_dev_free (struct net_device *eth_dev) |
| Free virtual ethernet device and remove from internal lists. More... | |
| void | ce_gw_dev_setup (struct net_device *dev, enum ce_gw_type type, __u32 flags) |
| Sets the default attributes for the Gateway Ethernet device. More... | |
| int | ce_gw_dev_register (struct net_device *eth_dev) |
| Register a virtual ethernet device on the OS. More... | |
| void | ce_gw_dev_unregister (struct net_device *eth_dev) |
| Unregister virtual ethernet device and remove from internal lists. More... | |
| int | ce_gw_dev_init_module (void) |
| Initialise all objects, wich are needed by the other functions. More... | |
| void | ce_gw_dev_cleanup (void) |
| Deleting all objects created by ce_gw_dev_init_module() and all devices. More... | |
| int | ce_gw_has_min_mtu (struct net_device *dev, enum ce_gw_type type, u32 flags) |
| checks if the given device has enough mtu to use the type and flags More... | |
| struct net_device * | ce_gw_dev_alloc (char *dev_name) |
| struct net_device * | ce_gw_dev_create (enum ce_gw_type type, __u32 flags, char *dev_name) |
|
read |
Definition at line 279 of file ce_gw_dev.c.
References ce_gw_dev_list::dev, ce_gw_job_info::job_dst, ce_gw_job_info::job_src, and ce_gw_dev_list::list_alloc.
Referenced by ce_gw_dev_create().

| void ce_gw_dev_cleanup | ( | void | ) |
Deleting all objects created by ce_gw_dev_init_module() and all devices.
Definition at line 513 of file ce_gw_dev.c.
References ce_gw_dev_free(), ce_gw_dev_unregister(), and ce_gw_dev_list::dev.
Referenced by ce_gw_cleanup().


|
read |
Definition at line 381 of file ce_gw_dev.c.
References ce_gw_dev_alloc(), and ce_gw_dev_setup().
Referenced by ce_gw_netlink_add().


| void ce_gw_dev_free | ( | struct net_device * | eth_dev | ) |
Free virtual ethernet device and remove from internal lists.
| eth_dev | the virtual ethernet device allocated by ce_gw_dev_alloc() |
Definition at line 318 of file ce_gw_dev.c.
References ce_gw_dev_list::dev, and ce_gw_dev_list::list_alloc.
Referenced by ce_gw_dev_cleanup(), ce_gw_netlink_add(), and ce_gw_netlink_del().

| static int ce_gw_dev_init | ( | struct net_device * | dev | ) |
called by the OS on device registered
| dev | correspondening eth device |
| 0 | on success |
| <0 | on failure |
Definition at line 156 of file ce_gw_dev.c.
| int ce_gw_dev_init_module | ( | void | ) |
Initialise all objects, wich are needed by the other functions.
| 0 | on success |
| <0 | on failure |
Definition at line 503 of file ce_gw_dev.c.
Referenced by ce_gw_init_module().

| void ce_gw_dev_job_add | ( | struct net_device * | eth_dev, |
| struct ce_gw_job * | job | ||
| ) |
Adds an pointer to the net_device internal list where it is part of.
The Function will add a Pointer to the list in the net_device private field back to the param job. There must be a pointer in union src or union dst in the param job to the struct net_device *eth_dev.
| eth_dev | The ethernet struct net_device witch is pointed from union src or union dst in param job. |
| job | The struct ce_gw_job where union src or union dst points to the param eth_dev. A Pointer to this param will be added. |
| 0 | success |
| <0 | failure |
Definition at line 263 of file ce_gw_dev.c.
References ce_gw_dev_job_dst_add(), ce_gw_dev_job_src_add(), ce_gw_job::dev, ce_gw_job::dst, and ce_gw_job::src.

| void ce_gw_dev_job_dst_add | ( | struct ce_gw_job * | job | ) |
Adds an pointer to the net_device internal list where it is the dst.
The Function will add a Pointer to the list in the net_device private field back to the param job. The pointer in union dst.dev in the param job be set to the param eth_dev.
| job | The struct ce_gw_job where union dst will points to the param eth_dev. A Pointer to this param will be added. |
Definition at line 257 of file ce_gw_dev.c.
References ce_gw_job::dev, ce_gw_job::dst, ce_gw_job_info::job_dst, and ce_gw_job::list_dev.
Referenced by ce_gw_dev_job_add().

| void ce_gw_dev_job_remove | ( | struct ce_gw_job * | job | ) |
Removes the pointer to param job from the list in ethernet net_device.
The private field of the ethernet struct net_device contains a a pointer to the param job. The Function will remove this Pointer from the list.
| job | The struct ce_gw_job where union src or union dst points to the param eth_dev. A Pointer to this param will be removed. |
Definition at line 275 of file ce_gw_dev.c.
References ce_gw_job::list_dev.
Referenced by ce_gw_unregister_eth_src().

| void ce_gw_dev_job_src_add | ( | struct ce_gw_job * | job | ) |
Adds an pointer to the net_device internal list where it is the src.
The Function will add a Pointer to the list in the net_device private field back to the param job. The pointer in union src.dev in the param job be set to the param eth_dev.
| job | The struct ce_gw_job where union src will points to the param eth_dev. A Pointer to this param will be added. |
Definition at line 252 of file ce_gw_dev.c.
References ce_gw_job::dev, ce_gw_job_info::job_src, ce_gw_job::list_dev, and ce_gw_job::src.
Referenced by ce_gw_dev_job_add(), and ce_gw_register_eth_src().

| int ce_gw_dev_open | ( | struct net_device * | dev | ) |
called by the OS on device up
| dev | correspondening eth device |
| 0 | on success |
| <0 | on failure |
Definition at line 77 of file ce_gw_dev.c.
| int ce_gw_dev_register | ( | struct net_device * | eth_dev | ) |
Register a virtual ethernet device on the OS.
| eth_dev | the virtual ethernet device |
| 0 | on success |
| <0 | on failure |
Definition at line 392 of file ce_gw_dev.c.
References ce_gw_dev_list::dev, and ce_gw_dev_list::list_reg.
Referenced by ce_gw_netlink_add().

| void ce_gw_dev_setup | ( | struct net_device * | dev, |
| enum ce_gw_type | type, | ||
| __u32 | flags | ||
| ) |
Sets the default attributes for the Gateway Ethernet device.
| type | Type of the Gateway wich will be linked to the device. A sensible MTU will be set. Use CE_GW_TYPE_NONE for default ethernet MTU. |
| flags | If CE_GW_F_CAN_FD Flag is set the MTU will be set to the CAN-FD size else to the normal CAN size. |
| dev | the ethernet device which should be set up |
Sets the default attributes for the Gateway Ethernet device. Also links the net_device operations to the net_dev structure. ce_gw_dev_register() should be called afterwards for registering, ce_gw_dev_unregister() for unregistering at the end.
Definition at line 347 of file ce_gw_dev.c.
References CE_GW_F_CAN_FD, ce_gw_ops, CE_GW_TYPE_ETH, CE_GW_TYPE_NET, CE_GW_TYPE_NONE, CE_GW_TYPE_TCP, and CE_GW_TYPE_UDP.
Referenced by ce_gw_dev_create().

|
static |
called by the OS if a package is sent to the device
| dev | correspondening eth device |
| skb | sk buffer from OS |
| 0 | on success |
| <0 | on failure |
Definition at line 115 of file ce_gw_dev.c.
References ce_gw_eth_rcv(), and ce_gw_job_info::job_src.

| int ce_gw_dev_stop | ( | struct net_device * | dev | ) |
called by the OS on device down
| dev | correspondening eth device |
| 0 | on success |
| <0 | on failure |
Definition at line 98 of file ce_gw_dev.c.
| void ce_gw_dev_unregister | ( | struct net_device * | eth_dev | ) |
Unregister virtual ethernet device and remove from internal lists.
| eth_dev | the virtual ethernet device |
Definition at line 430 of file ce_gw_dev.c.
References ce_gw_remove_route(), ce_gw_dev_list::dev, ce_gw_job::id, ce_gw_job_info::job_dst, ce_gw_job_info::job_src, and ce_gw_dev_list::list_reg.
Referenced by ce_gw_dev_cleanup(), and ce_gw_netlink_del().


| int ce_gw_has_min_mtu | ( | struct net_device * | dev, |
| enum ce_gw_type | type, | ||
| u32 | flags | ||
| ) |
checks if the given device has enough mtu to use the type and flags
| dev | The net_device which schould be checked |
| type | The type which sould be compared to |
| flags | needed dor the CE_GW_F_CAN_FD flag, to check if the type is CANfd capable |
| true | The mtu of dev is bigger then the nedded mtu by the type |
| false | if not |
Definition at line 213 of file ce_gw_dev.c.
References CE_GW_F_CAN_FD, CE_GW_TYPE_ETH, CE_GW_TYPE_NET, CE_GW_TYPE_NONE, CE_GW_TYPE_TCP, and CE_GW_TYPE_UDP.
Referenced by ce_gw_create_route().

| int ce_gw_is_allocated_dev | ( | struct net_device * | eth_dev | ) |
check if the param eth_dev is allocated by this module
| eth_dev | the device wich should be checked |
| 0 | param eth_dev was allocated by this module |
| -ENODEV | param eth_dev was NOT allocated by this module |
| others | error occured |
Definition at line 172 of file ce_gw_dev.c.
References ce_gw_dev_list::dev.
| int ce_gw_is_registered_dev | ( | struct net_device * | eth_dev | ) |
check if the param eth_dev is registered by this module
| eth_dev | the device wich should be checked |
| 0 | param eth_dev was registered by this module |
| -ENODEV | param eth_dev was NOT registered by this module |
| others | error occured |
Definition at line 192 of file ce_gw_dev.c.
References ce_gw_dev_list::dev.
Referenced by ce_gw_create_route().
