can_eth_gw Gateway Module
0.1
A bidirectional CAN to Ethernet Gateway (Kernel Module)
|
Control Area Network - Ethernet - Gateway - Device. More...
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <uapi/linux/can.h>
#include "ce_gw_dev.h"
#include "ce_gw_main.h"
#include <asm-generic/errno-base.h>
#include <asm-generic/errno.h>
Go to the source code of this file.
Data Structures | |
struct | ce_gw_dev_list |
internal list of all registered and allocated devices. More... | |
static struct kmem_cache *ce_gw_dev_cache | __read_mostly |
static struct net_device_ops | ce_gw_ops |
Defined Functions of Ethernet device. More... | |
HLIST_HEAD (ce_gw_dev_allocated) | |
HLIST_HEAD (ce_gw_dev_registered) | |
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... | |
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... | |
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... | |
struct net_device * | ce_gw_dev_alloc (char *dev_name) |
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... | |
struct net_device * | ce_gw_dev_create (enum ce_gw_type type, __u32 flags, char *dev_name) |
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... | |
Control Area Network - Ethernet - Gateway - Device.
Definition in file ce_gw_dev.c.
|
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().
|
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().
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().
HLIST_HEAD | ( | ce_gw_dev_allocated | ) |
list of all allocated ethernet devices
HLIST_HEAD | ( | ce_gw_dev_registered | ) |
list of all registered ethernet devices
|
static |
cache for lists
Definition at line 54 of file ce_gw_dev.c.
|
static |
Defined Functions of Ethernet device.
Definition at line 164 of file ce_gw_dev.c.
Referenced by ce_gw_dev_setup().