Main Page | Directories | File List | Globals

core.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/adi.h>
#include <agnix/memory.h>
#include <agnix/net/net.h>
#include <agnix/list.h>
#include <agnix/console.h>

Include dependency graph for core.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "NET: "

Functions

int net_layer_2_add_pack (struct net_layer_2_pack *pack)
int net_layer_2_recv_pack (struct frb_s *frb)
int net_layer_2_init (void)

Variables

list_head layer_2_pack_list
spinlock_t layer_2_pack_list_lock


Define Documentation

#define MOD_NAME   "NET: "
 

Definition at line 21 of file core.c.


Function Documentation

int net_layer_2_add_pack struct net_layer_2_pack *  pack  ) 
 

Definition at line 26 of file core.c.

References flags, layer_2_pack_list, and layer_2_pack_list_lock.

Referenced by net_layer_2_arp_init(), and net_layer_3_ip_init().

00027 {
00028     u32 flags;
00029 
00030     spin_lock_irqsave(&layer_2_pack_list_lock, flags);
00031     list_add(&pack->pack_list, &layer_2_pack_list);
00032     spin_unlock_irqrestore(&layer_2_pack_list_lock, flags);
00033 
00034     return 0;
00035 }

int net_layer_2_init void   ) 
 

Definition at line 70 of file core.c.

References layer_2_pack_list, layer_2_pack_list_lock, MOD_NAME, net_layer_2_arp_init(), net_layer_2_eth_init(), and printk().

Referenced by network_init().

00071 {
00072     printk(MOD_NAME "\tLayer 2: core");
00073 
00074     INIT_LIST_HEAD(&layer_2_pack_list);
00075     spin_lock_init(&layer_2_pack_list_lock);
00076 
00077     net_layer_2_eth_init();
00078     net_layer_2_arp_init();
00079 
00080     printk("\n");
00081 
00082     return 0;
00083 }

Here is the call graph for this function:

int net_layer_2_recv_pack struct frb_s *  frb  ) 
 

Definition at line 37 of file core.c.

References flags, layer_2_pack_list, and layer_2_pack_list_lock.

Referenced by rtl_8029_receive_frames().

00038 {
00039     u32 flags;
00040 //    struct frb_s *frb_clone;
00041     struct list_head *tmp;
00042     struct net_layer_2_pack *pack;
00043 
00044     frb->frb_dev->if_ops->header_parse(frb);
00045     spin_lock_irqsave(&layer_2_pack_list_lock, flags);
00046 
00047     if (!list_empty(&layer_2_pack_list)) {
00048 
00049         list_for_each(tmp, &layer_2_pack_list) {
00050             pack = list_entry(tmp, struct net_layer_2_pack, pack_list);
00051 
00052             if (pack->pack_type != frb->frb_proto_type)
00053                 continue;
00054         
00055 //      frb_clone = frb;
00056 //      if (tmp->next != &layer_2_pack_list) {
00057 //          frb_clone = (struct frb_s *)get_free_pages(0);
00058 //          memcpy((void *)frb_clone, (void *)frb, sizeof(struct frb_s));
00059 //      }
00060 
00061             pack->receiver(frb);
00062         }
00063     }    
00064     
00065     spin_unlock_irqrestore(&layer_2_pack_list_lock, flags);
00066     
00067     return 0;
00068 }


Variable Documentation

struct list_head layer_2_pack_list
 

Definition at line 23 of file core.c.

Referenced by net_layer_2_add_pack(), net_layer_2_init(), and net_layer_2_recv_pack().

spinlock_t layer_2_pack_list_lock
 

Definition at line 24 of file core.c.

Referenced by net_layer_2_add_pack(), net_layer_2_init(), and net_layer_2_recv_pack().

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix