can_eth_gw Gateway Module
0.1
A bidirectional CAN to Ethernet Gateway (Kernel Module)
|
void | ce_gw_can2net (struct sk_buff *eth_skb, struct sk_buff *can_skb, struct net_device *eth_dev, struct net_device *can_dev, unsigned char *mac_dst, unsigned char *mac_src) |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload More... | |
struct sk_buff * | ce_gw_can2net_alloc (struct sk_buff *can_skb, struct net_device *eth_dev, struct net_device *can_dev, unsigned char *mac_dst, unsigned char *mac_src) |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload and allocate More... | |
struct sk_buff * | ce_gw_net2can_alloc (struct sk_buff *eth_skb, struct net_device *can_dev) |
for CE_GW_TYPE_NET: Copy the can-frame from eth_skb to a new can skb. More... | |
void | ce_gw_canfd2net (struct sk_buff *eth_skb, struct sk_buff *can_skb, struct net_device *eth_dev, struct net_device *can_dev, unsigned char *mac_dst, unsigned char *mac_src) |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload More... | |
struct sk_buff * | ce_gw_canfd2net_alloc (struct sk_buff *can_skb, struct net_device *eth_dev, struct net_device *can_dev, unsigned char *mac_dst, unsigned char *mac_src) |
for CE_GW_TYPE_NET: copy canfd-Frame into ethernet payload and allocate More... | |
struct sk_buff * | ce_gw_net2canfd_alloc (struct sk_buff *eth_skb, struct net_device *can_dev, struct net_device *eth_dev) |
for CE_GW_TYPE_NET: Copy the canfd-frame from eth_skb to a new can skb. More... | |
struct sk_buff * | ce_gw_can_to_eth (unsigned char *dest, unsigned char *source, __be16 type, struct sk_buff *can_buffer, struct net_device *dev) |
converts sk buffer including can frame into sk buffer including ethernet_frame More... | |
struct sk_buff * | ce_gw_canfd_to_eth (unsigned char *dest, unsigned char *source, __be16 type, struct sk_buff *canfd_skb, struct net_device *dev) |
converts sk buffer including canfd frame into sk buffer including ethernet frame More... | |
struct sk_buff * | ce_gw_eth_to_can (canid_t id, struct sk_buff *eth_buff, struct net_device *dev) |
converst sk_buffer including an ethernet frame to sk_buffer including a can_frame More... | |
struct sk_buff * | ce_gw_eth_to_canfd (canid_t id, __u8 flags, __u8 res0, __u8 res1, struct sk_buff *eth_skb, struct net_device *dev) |
converst sk buffer including an ethernet frame to sk buffer including a canfd frame More... | |
void ce_gw_can2net | ( | struct sk_buff * | eth_skb, |
struct sk_buff * | can_skb, | ||
struct net_device * | eth_dev, | ||
struct net_device * | can_dev, | ||
unsigned char * | mac_dst, | ||
unsigned char * | mac_src | ||
) |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload
eth_skb | The sk_buff where the frame should copy to. Must be already allocated and must have sizeof(struct ethhdr) + sizeof(struct can_frame) headroom. |
can_skb | The sk_buff where the can-frame is located. |
eth_dev | The device which will later redirect the eth_skb. (this function does not redirect) |
can_dev | The device where can_skb was received. |
mac_dst | The dest MAC Address for the eth_skb. |
mac_src | The source MAC Address for the eth_skb |
It create an ethernet header in the empty param eth_skb and copy the can-frame from param can_skb as an an network layer protocol into the payload. It sets the layer pointer and the ethernet type.
Definition at line 240 of file ce_gw_main.c.
Referenced by ce_gw_can2net_alloc(), and ce_gw_canfd2net_alloc().
|
read |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload and allocate
can_skb | The sk_buff where the can-frame is located. |
eth_dev | The device which will redirect the eth_skb. |
can_dev | The device where can_skb was received. |
mac_dst | The dest MAC Address for the eth_skb. |
mac_src | The source MAC Address for the eth_skb |
NULL | if an error occured |
sk_buff | An allocated sk_buff with an ethernet header and the can frame as payload. |
It create an ethernet header in a new sk_buff and copy the can-frame from param can_skb as an an network layer protocol into the payload. It allocates a new socket buffer and sets some default skb settings. The returned sk_buff will be set to a PACKET_BROADCAST.
Definition at line 295 of file ce_gw_main.c.
References ce_gw_can2net().
Referenced by ce_gw_can_rcv().
|
read |
converts sk buffer including can frame into sk buffer including ethernet_frame
dest | MAC address of destination |
source | MAC address of source |
type | type of layer3 message (example: ipv4 or ipv6 ...) |
can_buffer | sk buffer including a can frame |
dev | device of destination |
sk_buffer | on success including ethernet frame |
NULL | if unsuccessful |
Definition at line 533 of file ce_gw_main.c.
void ce_gw_canfd2net | ( | struct sk_buff * | eth_skb, |
struct sk_buff * | can_skb, | ||
struct net_device * | eth_dev, | ||
struct net_device * | can_dev, | ||
unsigned char * | mac_dst, | ||
unsigned char * | mac_src | ||
) |
for CE_GW_TYPE_NET: copy CAN-Frame into ethernet payload
eth_skb | The sk_buff where the frame should copy to. Must be already allocated and must have sizeof(struct ethhdr) + sizeof(struct can_frame) headroom. |
can_skb | The sk_buff where the canfd-frame is located. |
eth_dev | The device which will later redirect the eth_skb. (this function does not redirect) |
can_dev | The device where can_skb was received. |
mac_dst | The dest MAC Address for the eth_skb. |
mac_src | The source MAC Address for the eth_skb |
It create an ethernet header in the empty param eth_skb and copy the canfd-frame from param can_skb as an an network layer protocol into the payload. It sets the layer pointer and the ethernet type.
Definition at line 387 of file ce_gw_main.c.
|
read |
for CE_GW_TYPE_NET: copy canfd-Frame into ethernet payload and allocate
can_skb | The sk_buff where the canfd-frame is located. |
eth_dev | The device which will redirect the eth_skb. |
can_dev | The device where can_skb was received. |
mac_dst | The dest MAC Address for the eth_skb. |
mac_src | The source MAC Address for the eth_skb |
NULL | if an error occured |
sk_buff | An allocated sk_buff with an ethernet header and the can frame as payload. |
It create an ethernet header in a new sk_buff and copy the canfd-frame from param can_skb as an an network layer protocol into the payload. It allocates a new socket buffer and sets some default skb settings. The returned sk_buff will be set to a PACKET_BROADCAST.
Definition at line 444 of file ce_gw_main.c.
References ce_gw_can2net().
|
read |
converts sk buffer including canfd frame into sk buffer including ethernet frame
dest | MAC address of destination |
source | MAC address of source |
type | type of layer3 message (example: ipv4 or ipv6 ...) |
canfd_skb | sk buffer including a canfd_frame |
dev | device of the destination |
sk_buff | including ethernet frame if successful |
NULL | if unsuccessful |
Definition at line 577 of file ce_gw_main.c.
|
read |
converst sk_buffer including an ethernet frame to sk_buffer including a can_frame
id | identifier of can_frame (see ce_gw_get_header for more information |
eth_buff | sk_buffer including an ethernet frame |
dev | device of the destination |
Definition at line 625 of file ce_gw_main.c.
References ce_gw_alloc_can_frame(), and ce_gw_free_can_frame().
|
read |
converst sk buffer including an ethernet frame to sk buffer including a canfd frame
id | identifier of canfd (see ce_gw_get_canfd_header for more information) |
flags | additional flags for CAN FD |
res0 | reserved / padding |
res1 | reserved / padding |
eth_skb | sk buffer including ethernet frame |
dev | device of the destination |
Definition at line 678 of file ce_gw_main.c.
References ce_gw_alloc_canfd_frame(), and ce_gw_free_canfd_frame().
|
read |
for CE_GW_TYPE_NET: Copy the can-frame from eth_skb to a new can skb.
eth_skb | An ethernet header as hardware layer and a can-frame as network layer. |
can_dev | CAN net device where the package will be later redirect to (this function does not redirect) |
NULL | on error |
sk_buff | on success including can-frame |
Copy the can-frame from the network layer in eth_skb to hardware layer in a new sk_buff. This Function allocates a new sk_buff and set some settings. The returned sk_buff will be set to a PACKET_BROADCAST.
Definition at line 338 of file ce_gw_main.c.
Referenced by ce_gw_eth_rcv().
|
read |
for CE_GW_TYPE_NET: Copy the canfd-frame from eth_skb to a new can skb.
eth_skb | An ethernet header as hardware layer and a canfd-frame as network layer. |
can_dev | CAN net device where the package will be later redirect to (this function does not redirect) |
NULL | on error |
sk_buff | on success including canfd-frame |
Copy the canfd-frame from the network layer in eth_skb to hardware layer in a new sk_buff. This Function allocates a new sk_buff and set some settings. The returned sk_buff will be set to a PACKET_BROADCAST.
not tested yet.
there might be a better way to allocted the new skb.
Definition at line 490 of file ce_gw_main.c.