can_eth_gw Gateway Module  0.1
A bidirectional CAN to Ethernet Gateway (Kernel Module)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Create & Deleting
static int __init ce_gw_init_module (void)
 Will be automatic called at module init. More...
 
static void __exit ce_gw_cleanup (void)
 Will be automatically called on module remove. More...
 
struct can_frame * ce_gw_alloc_can_frame (void)
 allocates memory for the can frame More...
 
void ce_gw_free_can_frame (struct can_frame *memory)
 frees memory allocated for can_frame More...
 
struct canfd_frame * ce_gw_alloc_canfd_frame (void)
 allocates memory for a canfd frame More...
 
void ce_gw_free_canfd_frame (struct canfd_frame *memory)
 frees memory allocated for can_frame More...
 

Detailed Description

Function Documentation

struct can_frame * ce_gw_alloc_can_frame ( void  )
read

allocates memory for the can frame

Returns
pointer to the memory allocated
Todo:
not tested yet

Definition at line 161 of file ce_gw_main.c.

Referenced by ce_gw_eth_to_can(), and ce_gw_get_header_can().

161  {
162  struct can_frame *memory;
163  memory = kmalloc(sizeof(struct can_frame),GFP_KERNEL);
164  return memory;
165 }

Here is the caller graph for this function:

struct canfd_frame * ce_gw_alloc_canfd_frame ( void  )
read

allocates memory for a canfd frame

Returns
pointer to the memory allocated
Todo:
not tested yet

Definition at line 173 of file ce_gw_main.c.

Referenced by ce_gw_eth_to_canfd(), and ce_gw_get_header_canfd().

173  {
174  struct canfd_frame *memory;
175  memory = kmalloc(sizeof(struct canfd_frame), GFP_KERNEL);
176  return memory;
177 }

Here is the caller graph for this function:

static void __exit ce_gw_cleanup ( void  )
static

Will be automatically called on module remove.

Definition at line 1048 of file ce_gw_main.c.

References ce_gw_dev_cleanup(), ce_gw_netlink_exit(), and ce_gw_remove_route().

1049 {
1050  printk(KERN_INFO "ce_gw: Cleaning up the module\n");
1051 
1052  pr_debug("ce_gw: Unregister netlink server.\n");
1054 
1055  /* Unregister all routes */
1056  pr_info("ce_gw: unregister all CAN ETH GW routes\n");
1057  ce_gw_remove_route(0);
1058 
1059  pr_debug("ce_gw: Unregister virtual net devices.\n");
1061 
1062  /* Mem cleanup */
1063  kmem_cache_destroy(ce_gw_job_cache);
1064 }

Here is the call graph for this function:

void ce_gw_free_can_frame ( struct can_frame *  memory)

frees memory allocated for can_frame

Parameters
memorycan frame that should be freed
Todo:
not tested yet

Definition at line 167 of file ce_gw_main.c.

Referenced by ce_gw_eth_to_can().

168 {
169  kfree (memory);
170 }

Here is the caller graph for this function:

void ce_gw_free_canfd_frame ( struct canfd_frame *  memory)

frees memory allocated for can_frame

Parameters
memorycanfd_frame that should be freed
Todo:
not tested yet

Definition at line 180 of file ce_gw_main.c.

Referenced by ce_gw_eth_to_canfd().

181 {
182  kfree (memory);
183 }

Here is the caller graph for this function:

static int __init ce_gw_init_module ( void  )
static

Will be automatic called at module init.

Return values
0on success
>0on failure

Tests: remove when done!

END TEST

Definition at line 1016 of file ce_gw_main.c.

References ce_gw_dev_init_module(), ce_gw_netlink_init(), and list_jobs().

1017 {
1018  int err = 0;
1019  printk(KERN_INFO "ce_gw: Module started.\n");
1020 
1021  ce_gw_job_cache = kmem_cache_create("can_eth_gw",
1022  sizeof(struct ce_gw_job), 0, 0, NULL);
1023  if (!ce_gw_job_cache)
1024  return ENOMEM;
1025 
1029  list_jobs();
1034  err = ce_gw_netlink_init();
1035  err += ce_gw_dev_init_module();
1036 
1037  if (err != 0)
1038  return 1;
1039  else
1040  return 0;
1041 }

Here is the call graph for this function: