Main Page | Directories | File List | Globals

arp_core.c File Reference

#include <agnix/agnix.h>
#include <agnix/adi/adi.h>
#include <agnix/net/net.h>
#include <agnix/memory.h>
#include <agnix/console.h>
#include <agnix/resources.h>
#include <agnix/timers.h>
#include <agnix/counters.h>
#include <agnix/list.h>
#include <agnix/wait.h>
#include <agnix/sched.h>
#include <agnix/spinlock.h>
#include <agnix/data_structures.h>

Include dependency graph for arp_core.c:

Go to the source code of this file.

Defines

#define MOD_NAME   "ARP: "

Functions

void arp_timer_expire (void *data)
int arp_del_entry_lock (struct arp_entry_s *entry)
int arp_reply (struct adi_netdev_s *netdev, struct arp_neigh_s *neigh_src, struct arp_neigh_s *neigh_dest, u8 *mac_dest)
int get_free_arp_entry (void)
int put_free_arp_entry (int arp_entry_desc)
int arp_request_add_lock (struct arp_request_s *arp_request)
int arp_request_add (struct arp_request_s *arp_request)
int arp_request_del_lock (struct arp_request_s *arp_request)
int arp_request_del (struct arp_request_s *arp_request)
int arp_request_wake_up (struct arp_neigh_s *neigh)
int arp_timer_refresh_lock (void)
int arp_timer_refresh (void)
void arp_cache_set (int on)
arp_entry_s * arp_get_entry_lock (struct net_addr_s *addr)
int arp_get_local_mac (struct arp_neigh_s *neigh)
int arp_get_neigh_lock (struct arp_neigh_s *neigh)
int arp_get_neigh (struct arp_neigh_s *neigh)
arp_neigh_s * arp_neigh_clone (struct arp_neigh_s *neigh)
int arp_add_neigh_lock (struct arp_neigh_s *neigh)
int arp_header_build (struct frb_s *frb, u16 ar_hrd, u16 ar_pro, u8 ar_hln, u8 ar_pln, u16 ar_op, u8 *ar_sha, u8 *ar_sip, u8 *ar_tha, u8 *ar_tip)
int arp_header_build_wrapper (struct frb_s *frb, struct adi_netdev_s *netdev, struct arp_neigh_s *neigh_src, struct arp_neigh_s *neigh_dest, u8 ar_op)
int arp_entry_refresh_lock (struct arp_entry_s *arp_entry)
int arp_recv_request_lock (struct frb_s *frb, struct arp_neigh_s *neigh)
int arp_recv_reply_lock (struct frb_s *frb, struct arp_neigh_s *neigh)
int arp_recv (struct frb_s *frb)
int arp_send (struct adi_netdev_s *netdev, struct frb_s *frb, u8 *mac_dest)
int arp_request (struct adi_netdev_s *netdev, struct arp_neigh_s *neigh)
void arp_timeout (void *data)
int arp_resolve (struct adi_netdev_s *netdev, struct arp_neigh_s *neigh)
int arp_print_stats (void)
int net_layer_2_arp_init (void)

Variables

arp_entry_s arp_entries [ARP_MAX_ENTRIES]
u32 arp_bitmap [ARP_BITMAP_LEN]
list_head arp_entries_list
list_head arp_requests_list
spinlock_t arp_entries_list_lock
spinlock_t arp_requests_list_lock
int arp_hash_desc
int arp_resource_desc
int arp_cache
resource_s arp_resource
timer_s arp_timer
arp_stats_s arp_stats
int counter_jiffies_desc
list_head adi_netdev_list
spinlock_t adi_netdev_list_lock
net_layer_2_pack arp_pack


Define Documentation

#define MOD_NAME   "ARP: "
 

Definition at line 28 of file arp_core.c.


Function Documentation

int arp_add_neigh_lock struct arp_neigh_s *  neigh  ) 
 

Definition at line 275 of file arp_core.c.

References arp_entries, arp_entries_list, arp_hash_desc, arp_neigh_clone(), arp_timer_refresh_lock(), get_free_arp_entry(), and hash_entry_add().

Referenced by arp_recv_reply_lock().

00276 {
00277     u32 arp_entry_idx;
00278     struct arp_entry_s *arp_entry;
00279     struct arp_neigh_s *neigh_cloned;
00280 
00281     neigh_cloned     = arp_neigh_clone(neigh);
00282     arp_entry_idx    = get_free_arp_entry();
00283     arp_entry        = (struct arp_entry_s *)&arp_entries[arp_entry_idx];
00284     arp_entry->neigh = neigh_cloned;
00285     arp_entry->idx   = arp_entry_idx;
00286     hash_entry_add(arp_hash_desc, *(u32 *)neigh->addr.address, (u32)arp_entry);
00287     arp_entry->timer = ARP_EXPIRE;
00288     
00289     list_add_tail(&arp_entry->list, &arp_entries_list);
00290     arp_timer_refresh_lock();
00291     
00292     return 0;
00293 }

Here is the call graph for this function:

void arp_cache_set int  on  ) 
 

Definition at line 192 of file arp_core.c.

References arp_cache.

Referenced by net_layer_2_arp_init().

00193 {
00194     arp_cache = on;
00195 }

int arp_del_entry_lock struct arp_entry_s *  entry  ) 
 

Definition at line 295 of file arp_core.c.

References arp_hash_desc, hash_entry_del(), memset(), put_free_arp_entry(), and put_free_pages().

Referenced by arp_timer_expire().

00296 {
00297     int ret;
00298 
00299     ret = hash_entry_del(arp_hash_desc, *(u32 *)arp_entry->neigh->addr.address);
00300     list_del(&arp_entry->list);
00301     put_free_arp_entry(arp_entry->idx);
00302     put_free_pages((u32)arp_entry->neigh, 0);
00303     memset(arp_entry, 0, sizeof(struct arp_entry_s));
00304     
00305     return 0;
00306 }

Here is the call graph for this function:

int arp_entry_refresh_lock struct arp_entry_s *  arp_entry  ) 
 

Definition at line 336 of file arp_core.c.

References arp_entries_list, and counter_jiffies_desc.

Referenced by arp_recv_reply_lock().

00337 {
00338     u32 timer[2];
00339 
00340     counter_read(counter_jiffies_desc, timer);
00341     arp_entry->timer = timer[0];
00342 
00343     list_del(&arp_entry->list);
00344     list_add_tail(&arp_entry->list, &arp_entries_list);
00345 
00346     return 0;
00347 }

struct arp_entry_s* arp_get_entry_lock struct net_addr_s *  addr  ) 
 

Definition at line 197 of file arp_core.c.

References arp_hash_desc, and hash_entry_find().

Referenced by arp_get_neigh_lock(), and arp_recv_reply_lock().

00198 {
00199     struct arp_entry_s *arp_entry;
00200     u32 ptr;
00201 
00202     arp_entry = NULL;
00203     if ((ptr = hash_entry_find(arp_hash_desc, *(u32 *)addr->address))) {
00204         arp_entry = (struct arp_entry_s *)ptr;
00205     }
00206     
00207     return arp_entry;
00208 }

Here is the call graph for this function:

int arp_get_local_mac struct arp_neigh_s *  neigh  ) 
 

Definition at line 210 of file arp_core.c.

References adi_netdev_list, adi_netdev_list_lock, flags, memcmp(), and memcpy().

Referenced by arp_recv_request_lock().

00211 {
00212     struct list_head *tmp;
00213     struct adi_netdev_s *netdev;
00214     int found;
00215     u32 flags;
00216     
00217     spin_lock_irqsave(&adi_netdev_list_lock, flags);
00218     
00219     found = 0;
00220     list_for_each(tmp, &adi_netdev_list) {
00221         netdev = list_entry(tmp, struct adi_netdev_s, list);
00222 
00223         if (!memcmp(netdev->if_layer_3.if_addr.address, neigh->addr.address, neigh->addr.address_len)) {
00224             found = 1;
00225             break;
00226         }
00227     }
00228     
00229     spin_unlock_irqrestore(&adi_netdev_list_lock, flags);
00230     
00231     if (found) {
00232         memcpy(neigh->mac, netdev->if_layer_2.if_addr, ETH_ALEN);
00233         return 1;
00234     }
00235     
00236     return 0;
00237 }

Here is the call graph for this function:

int arp_get_neigh struct arp_neigh_s *  neigh  ) 
 

Definition at line 252 of file arp_core.c.

References arp_entries_list_lock, arp_get_neigh_lock(), and flags.

Referenced by arp_request(), and arp_resolve().

00253 {
00254     int ret;
00255     u32 flags;
00256     
00257     spin_lock_irqsave(&arp_entries_list_lock, flags);
00258     ret = arp_get_neigh_lock(neigh);    
00259     spin_unlock_irqrestore(&arp_entries_list_lock, flags);
00260     
00261     return ret;
00262 }

Here is the call graph for this function:

int arp_get_neigh_lock struct arp_neigh_s *  neigh  ) 
 

Definition at line 239 of file arp_core.c.

References arp_get_entry_lock(), and memcpy().

Referenced by arp_get_neigh(), and arp_recv_request_lock().

00240 {
00241     struct arp_entry_s *arp_entry;
00242 
00243     if ((arp_entry = arp_get_entry_lock(&neigh->addr)) != NULL) {
00244 
00245         memcpy(neigh->mac, arp_entry->neigh->mac, ETH_ALEN);
00246         return 1;       
00247     }
00248     
00249     return 0;
00250 }

Here is the call graph for this function:

int arp_header_build struct frb_s *  frb,
u16  ar_hrd,
u16  ar_pro,
u8  ar_hln,
u8  ar_pln,
u16  ar_op,
u8 *  ar_sha,
u8 *  ar_sip,
u8 *  ar_tha,
u8 *  ar_tip
 

Definition at line 308 of file arp_core.c.

References frb_pop(), and memcpy().

Referenced by arp_header_build_wrapper().

00310 {
00311     struct arp_hdr_s *arphdr = (struct arp_hdr_s *)frb_pop(frb, sizeof(struct arp_hdr_s));
00312 
00313     arphdr->ar_hrd = htons(ar_hrd);
00314     arphdr->ar_pro = htons(ar_pro);
00315     arphdr->ar_hln = ar_hln;
00316     arphdr->ar_pln = ar_pln;
00317     arphdr->ar_op  = htons(ar_op);
00318     memcpy(arphdr->ar_sha, ar_sha, ar_hln);
00319     memcpy(arphdr->ar_sip, ar_sip, ar_pln);
00320     memcpy(arphdr->ar_tha, ar_tha, ar_hln);
00321     memcpy(arphdr->ar_tip, ar_tip, ar_pln);
00322     
00323     return 0;
00324 }

Here is the call graph for this function:

int arp_header_build_wrapper struct frb_s *  frb,
struct adi_netdev_s *  netdev,
struct arp_neigh_s *  neigh_src,
struct arp_neigh_s *  neigh_dest,
u8  ar_op
 

Definition at line 326 of file arp_core.c.

References arp_header_build().

Referenced by arp_reply(), and arp_request().

00329 {
00330     return arp_header_build(frb, ARPHRD_ETHER, ETH_P_IP, ETH_ALEN, 
00331                             neigh_src->addr.address_len, ar_op, 
00332                             neigh_src->mac,  neigh_src->addr.address,
00333                             neigh_dest->mac, neigh_dest->addr.address);
00334 }

Here is the call graph for this function:

struct arp_neigh_s* arp_neigh_clone struct arp_neigh_s *  neigh  ) 
 

Definition at line 264 of file arp_core.c.

References get_free_pages(), and memcpy().

Referenced by arp_add_neigh_lock().

00265 {
00266     struct arp_neigh_s *neigh_cloned;
00267     
00268     /* yes, slab allocator is required, I know */
00269     neigh_cloned = (struct arp_neigh_s *)get_free_pages(0);
00270     memcpy(neigh_cloned, neigh, sizeof(struct arp_neigh_s));
00271     
00272     return neigh_cloned;
00273 }

Here is the call graph for this function:

int arp_print_stats void   ) 
 

Definition at line 528 of file arp_core.c.

References arp_stats, and printf().

Referenced by agnix_console_arp_stats().

00529 {
00530     printf("\n");
00531     printf("Total recv arps:         %d\n", arp_stats.total_recv_arps);
00532     printf("Total recv request arps: %d\n", arp_stats.recv_request_arps);
00533     printf("Total recv reply arps:   %d\n", arp_stats.recv_reply_arps);
00534     printf("Total send arps:         %d\n", arp_stats.total_send_arps);
00535     printf("Total send request arps: %d\n", arp_stats.send_request_arps);
00536     printf("Total send reply arps:   %d\n", arp_stats.send_reply_arps);
00537     
00538     return 0;
00539 }

Here is the call graph for this function:

int arp_recv struct frb_s *  frb  ) 
 

Definition at line 389 of file arp_core.c.

References arp_entries_list_lock, arp_recv_reply_lock(), arp_recv_request_lock(), arp_stats, flags, frb_data(), and memcpy().

00390 {
00391     struct arp_hdr_s *arp = (struct arp_hdr_s *)frb_data(frb);
00392     struct arp_neigh_s neigh;
00393     int ret = 0;
00394     u32 flags;
00395 
00396     neigh.addr.address_len = arp->ar_pln;
00397 
00398     spin_lock_irqsave(&arp_entries_list_lock, flags);
00399 
00400     arp_stats.total_recv_arps++;
00401 
00402     if (ntohs(arp->ar_op) == ARPOP_REQUEST) {
00403         memcpy(neigh.addr.address, arp->ar_tip, arp->ar_pln);
00404         memcpy(neigh.mac,          arp->ar_tha, arp->ar_hln);
00405         arp_stats.recv_reply_arps++;
00406         
00407         ret = arp_recv_request_lock(frb, &neigh);
00408     }
00409     else
00410     if (ntohs(arp->ar_op) == ARPOP_REPLY) {
00411         memcpy(neigh.addr.address, arp->ar_sip, arp->ar_pln);
00412         memcpy(neigh.mac,          arp->ar_sha, arp->ar_hln);
00413         arp_stats.recv_reply_arps++;
00414 
00415         ret = arp_recv_reply_lock(frb, &neigh);
00416     }
00417     
00418     spin_unlock_irqrestore(&arp_entries_list_lock, flags);
00419     
00420     return ret;
00421 }

Here is the call graph for this function:

int arp_recv_reply_lock struct frb_s *  frb,
struct arp_neigh_s *  neigh
 

Definition at line 372 of file arp_core.c.

References arp_add_neigh_lock(), arp_entry_refresh_lock(), arp_get_entry_lock(), and arp_request_wake_up().

Referenced by arp_recv().

00373 {
00374     struct arp_entry_s *arp_entry;
00375 
00376     arp_request_wake_up(neigh);
00377 
00378     if ((arp_entry = arp_get_entry_lock(&neigh->addr))) {
00379         arp_entry_refresh_lock(arp_entry);
00380 
00381         return 1;
00382     }
00383 
00384     arp_add_neigh_lock(neigh);
00385     
00386     return 0;
00387 }

Here is the call graph for this function:

int arp_recv_request_lock struct frb_s *  frb,
struct arp_neigh_s *  neigh
 

Definition at line 349 of file arp_core.c.

References arp_cache, arp_get_local_mac(), arp_get_neigh_lock(), arp_reply(), frb_data(), and memcpy().

Referenced by arp_recv().

00350 {
00351     struct arp_neigh_s neigh_dest;
00352     struct arp_hdr_s *arp = (struct arp_hdr_s *)frb_data(frb);
00353 
00354     if (arp->ar_hln > ETH_ALEN)
00355         arp->ar_hln = ETH_ALEN;
00356 
00357     if (arp->ar_pln > NET_ADDR_MAX_LEN)
00358         arp->ar_pln = NET_ADDR_MAX_LEN;
00359 
00360     if (!arp_get_local_mac(neigh) && (arp_cache && !arp_get_neigh_lock(neigh)))
00361         return 0;
00362 
00363     memcpy(neigh_dest.mac, arp->ar_sha, arp->ar_hln);
00364     memcpy(neigh_dest.addr.address, arp->ar_sip, arp->ar_pln);
00365     neigh_dest.addr.address_len = arp->ar_pln;
00366 
00367     arp_reply(frb->frb_dev, neigh, &neigh_dest, arp->ar_sha);
00368     
00369     return 0;    
00370 }

Here is the call graph for this function:

int arp_reply struct adi_netdev_s *  netdev,
struct arp_neigh_s *  neigh_src,
struct arp_neigh_s *  neigh_dest,
u8 *  mac_dest
 

Definition at line 457 of file arp_core.c.

References arp_header_build_wrapper(), arp_send(), arp_stats, frb_create(), frb_destroy(), and frb_reverse().

Referenced by arp_recv_request_lock().

00459 {
00460     struct frb_s frb;
00461 
00462     arp_stats.total_send_arps++;
00463     arp_stats.send_reply_arps++;
00464 
00465     frb_create(&frb);
00466     frb_reverse(&frb);
00467     arp_header_build_wrapper(&frb, netdev, neigh_src, neigh_dest, ARPOP_REPLY);
00468     arp_send(netdev, &frb, mac_dest);
00469     frb_destroy(&frb);
00470     
00471     return 0;
00472 }

Here is the call graph for this function:

int arp_request struct adi_netdev_s *  netdev,
struct arp_neigh_s *  neigh
 

Definition at line 432 of file arp_core.c.

References arp_get_neigh(), arp_header_build_wrapper(), arp_send(), arp_stats, frb_create(), frb_destroy(), frb_reverse(), and memcpy().

Referenced by arp_request_wake_up(), and arp_resolve().

00433 {
00434     struct frb_s frb;
00435     struct arp_neigh_s neigh_src;
00436 
00437     if (arp_get_neigh(neigh)) {
00438         return 1;
00439     }
00440     
00441     arp_stats.total_send_arps++;
00442     arp_stats.send_request_arps++;
00443     
00444     memcpy(neigh_src.mac, netdev->if_layer_2.if_addr, ETH_ALEN);
00445     memcpy(neigh_src.addr.address, netdev->if_layer_3.if_addr.address, netdev->if_layer_3.if_addr.address_len);
00446     neigh_src.addr.address_len = netdev->if_layer_3.if_addr.address_len;
00447     
00448     frb_create(&frb);
00449     frb_reverse(&frb);
00450     arp_header_build_wrapper(&frb, netdev, &neigh_src, neigh, ARPOP_REQUEST);
00451     arp_send(netdev, &frb, netdev->if_layer_2.if_addr_broadcast);
00452     frb_destroy(&frb);
00453     
00454     return 0;
00455 }

Here is the call graph for this function:

int arp_request_add struct arp_request_s *  arp_request  ) 
 

Definition at line 83 of file arp_core.c.

References arp_request_add_lock(), arp_requests_list_lock, and flags.

Referenced by arp_resolve().

00084 {
00085     u32 flags;
00086 
00087     spin_lock_irqsave(&arp_requests_list_lock, flags);
00088     arp_request_add_lock(arp_request);
00089     spin_unlock_irqrestore(&arp_requests_list_lock, flags);
00090     
00091     return 0;
00092 }

Here is the call graph for this function:

int arp_request_add_lock struct arp_request_s *  arp_request  ) 
 

Definition at line 77 of file arp_core.c.

References arp_requests_list.

Referenced by arp_request_add().

00078 {
00079     list_add_tail(&(arp_request->list), &arp_requests_list);
00080     return 0;
00081 }

int arp_request_del struct arp_request_s *  arp_request  ) 
 

Definition at line 100 of file arp_core.c.

References arp_request_del_lock(), arp_requests_list_lock, and flags.

Referenced by arp_resolve().

00101 {
00102     u32 flags;
00103 
00104     spin_lock_irqsave(&arp_requests_list_lock, flags);
00105     arp_request_del_lock(arp_request);
00106     spin_unlock_irqrestore(&arp_requests_list_lock, flags);
00107     
00108     return 0;
00109 }

Here is the call graph for this function:

int arp_request_del_lock struct arp_request_s *  arp_request  ) 
 

Definition at line 94 of file arp_core.c.

Referenced by arp_request_del().

00095 {
00096     list_del(&(arp_request->list));
00097     return 0;
00098 }

int arp_request_wake_up struct arp_neigh_s *  neigh  ) 
 

Definition at line 111 of file arp_core.c.

References arp_request(), arp_requests_list, arp_requests_list_lock, flags, memcmp(), and sched_activate_task().

Referenced by arp_recv_reply_lock().

00112 {
00113     struct arp_request_s *arp_request;
00114     struct list_head *tmp;
00115     u32 flags;
00116 
00117     spin_lock_irqsave(&arp_requests_list_lock, flags);        
00118 
00119     if (list_empty(&arp_requests_list)) {
00120         spin_unlock_irqrestore(&arp_requests_list_lock, flags);    
00121         return 0;
00122     }
00123     
00124     list_for_each(tmp, &arp_requests_list) {
00125         arp_request = list_entry(tmp, struct arp_request_s, list);
00126 
00127         if (!memcmp(arp_request->neigh->addr.address, neigh->addr.address, neigh->addr.address_len)) {
00128             sched_activate_task(arp_request->task);
00129         }
00130     }
00131 
00132     spin_unlock_irqrestore(&arp_requests_list_lock, flags);    
00133     
00134     return 0;
00135 }

Here is the call graph for this function:

int arp_resolve struct adi_netdev_s *  netdev,
struct arp_neigh_s *  neigh
 

Definition at line 479 of file arp_core.c.

References arp_entries_list_lock, arp_get_neigh(), arp_request(), arp_request_add(), arp_request_del(), arp_timeout(), flags, get_free_pages(), put_free_pages(), register_timer(), sched_deactivate_task(), schedule_task(), and unregister_timer().

Referenced by agnix_console_arp_request().

00480 {
00481     struct arp_request_s *request;
00482     struct timer_s arp_timer;
00483     u32 flags;
00484     
00485     if (arp_get_neigh(neigh)) {
00486         return 0;
00487     }
00488     
00489     request = (struct arp_request_s *)get_free_pages(0);
00490     request->neigh = neigh;
00491     request->task  = current_task;
00492     INIT_LIST_HEAD(&(request->list));    
00493     
00494     arp_timer.timer_function = arp_timeout;
00495     arp_timer.timer_data     = current_task;
00496     arp_timer.timer_expire   = ARP_TIMEOUT;
00497     arp_timer.timer_flags    = TIMER_FLAG_ONESHOT;
00498     
00499     spin_lock_irqsave(&arp_entries_list_lock, flags);    
00500     
00501     arp_request_add(request);
00502 
00503     if (arp_request(netdev, neigh)) {
00504         arp_request_del(request);
00505         spin_unlock_irqrestore(&arp_entries_list_lock, flags);    
00506         return 0;
00507     }
00508 
00509     spin_unlock_irqrestore(&arp_entries_list_lock, flags);    
00510     sched_deactivate_task(current_task);
00511     register_timer(&arp_timer);
00512     schedule_task();
00513 
00514     unregister_timer(&arp_timer);
00515     spin_lock_irqsave(&arp_entries_list_lock, flags);    
00516     arp_request_del(request);
00517     spin_unlock_irqrestore(&arp_entries_list_lock, flags);    
00518     
00519     put_free_pages((u32)request, 0);
00520 
00521     if (arp_get_neigh(neigh)) {
00522         return 0;
00523     }
00524 
00525     return -1;
00526 }

Here is the call graph for this function:

int arp_send struct adi_netdev_s *  netdev,
struct frb_s *  frb,
u8 *  mac_dest
 

Definition at line 423 of file arp_core.c.

Referenced by arp_reply(), and arp_request().

00424 {
00425     frb->frb_dev = netdev;
00426     netdev->if_ops->header_build(frb, mac_dest, netdev->if_layer_2.if_addr, ETH_P_ARP);
00427     netdev->if_ops->transmit_frame(frb);
00428 
00429     return 0;
00430 }

void arp_timeout void *  data  ) 
 

Definition at line 474 of file arp_core.c.

References sched_activate_task().

Referenced by arp_resolve().

00475 {
00476     sched_activate_task((struct task_s *)data);
00477 }

Here is the call graph for this function:

void arp_timer_expire void *  data  ) 
 

Definition at line 171 of file arp_core.c.

References arp_del_entry_lock(), arp_entries_list, arp_entries_list_lock, arp_timer_refresh_lock(), and flags.

00172 {
00173     struct arp_entry_s *arp_entry;
00174     struct arp_entry_s *arp_entry_list;
00175     struct list_head *tmp, *n;
00176     u32 flags;
00177 
00178     spin_lock_irqsave(&arp_entries_list_lock, flags);    
00179 
00180     arp_entry = (struct arp_entry_s *)data;
00181     list_for_each_safe(tmp, n, &arp_entries_list) {
00182         arp_entry_list = list_entry(tmp, struct arp_entry_s, list);        
00183         if (arp_entry_list->timer == arp_entry->timer) {
00184             arp_del_entry_lock(arp_entry_list);
00185         }
00186     }
00187     arp_timer_refresh_lock();
00188 
00189     spin_unlock_irqrestore(&arp_entries_list_lock, flags);    
00190 }

Here is the call graph for this function:

int arp_timer_refresh void   ) 
 

Definition at line 159 of file arp_core.c.

References arp_entries_list_lock, arp_timer_refresh_lock(), and flags.

00160 {
00161     int ret;
00162     u32 flags;
00163 
00164     spin_lock_irqsave(&arp_entries_list_lock, flags);        
00165     ret = arp_timer_refresh_lock();
00166     spin_unlock_irqrestore(&arp_entries_list_lock, flags);    
00167     
00168     return ret;
00169 }

Here is the call graph for this function:

int arp_timer_refresh_lock void   ) 
 

Definition at line 137 of file arp_core.c.

References arp_entries_list, arp_timer, register_timer(), and unregister_timer().

Referenced by arp_add_neigh_lock(), arp_timer_expire(), and arp_timer_refresh().

00138 {
00139     struct arp_entry_s *arp_entry;
00140 
00141     if (arp_timer.timer_expire != 0) {
00142         arp_timer.timer_expire = 0;
00143         unregister_timer(&arp_timer);
00144     }
00145     
00146     if (list_empty(&arp_entries_list))
00147         return 1;
00148 
00149     arp_entry = list_entry(arp_entries_list.prev, struct arp_entry_s, list);    
00150 
00151     arp_timer.timer_flags  = TIMER_FLAG_ONESHOT;
00152     arp_timer.timer_expire = ARP_EXPIRE;
00153     arp_timer.timer_data   = (void *)arp_entry;
00154     register_timer(&arp_timer);
00155 
00156     return 0;
00157 }

Here is the call graph for this function:

int get_free_arp_entry void   ) 
 

Definition at line 67 of file arp_core.c.

References arp_resource_desc, and get_free_resource().

Referenced by arp_add_neigh_lock().

00068 {
00069     return get_free_resource(arp_resource_desc);
00070 }

Here is the call graph for this function:

int net_layer_2_arp_init void   ) 
 

Definition at line 546 of file arp_core.c.

References arp_cache_set(), arp_entries_list, arp_entries_list_lock, arp_hash_desc, arp_pack, arp_requests_list, arp_requests_list_lock, arp_resource, arp_resource_desc, kernel_panic(), net_layer_2_add_pack(), printk(), register_hash_table(), and register_resource().

Referenced by net_layer_2_init().

00547 {
00548     printk(", arp");
00549 
00550     net_layer_2_add_pack(&arp_pack);
00551     
00552     if ((arp_hash_desc = register_hash_table("arp", 4096, NULL)) < 0) {
00553         kernel_panic("can not create hash table for arp!");
00554     }
00555 
00556     arp_cache_set(1);    
00557     arp_resource_desc = register_resource(&arp_resource);
00558     spin_lock_init(&arp_entries_list_lock);
00559     INIT_LIST_HEAD(&arp_entries_list);
00560     spin_lock_init(&arp_requests_list_lock);
00561     INIT_LIST_HEAD(&arp_requests_list);
00562 
00563     return 0;
00564 }

Here is the call graph for this function:

int put_free_arp_entry int  arp_entry_desc  ) 
 

Definition at line 72 of file arp_core.c.

References arp_resource_desc, and put_free_resource().

Referenced by arp_del_entry_lock().

00073 {
00074     return put_free_resource(arp_resource_desc, arp_entry_desc);
00075 }

Here is the call graph for this function:


Variable Documentation

struct list_head adi_netdev_list
 

Definition at line 26 of file adi_net.c.

Referenced by adi_netdev_data_init(), adi_netdev_find_by_name(), adi_netdev_list_add(), adi_netdev_print_interfaces(), and arp_get_local_mac().

spinlock_t adi_netdev_list_lock
 

Definition at line 27 of file adi_net.c.

Referenced by adi_netdev_data_init(), adi_netdev_find_by_name(), adi_netdev_list_add(), adi_netdev_print_interfaces(), and arp_get_local_mac().

u32 arp_bitmap[ARP_BITMAP_LEN]
 

Definition at line 31 of file arp_core.c.

int arp_cache
 

Definition at line 40 of file arp_core.c.

Referenced by arp_cache_set(), and arp_recv_request_lock().

struct arp_entry_s arp_entries[ARP_MAX_ENTRIES]
 

Definition at line 30 of file arp_core.c.

Referenced by arp_add_neigh_lock().

struct list_head arp_entries_list
 

Definition at line 33 of file arp_core.c.

Referenced by arp_add_neigh_lock(), arp_entry_refresh_lock(), arp_timer_expire(), arp_timer_refresh_lock(), and net_layer_2_arp_init().

spinlock_t arp_entries_list_lock
 

Definition at line 35 of file arp_core.c.

Referenced by arp_get_neigh(), arp_recv(), arp_resolve(), arp_timer_expire(), arp_timer_refresh(), and net_layer_2_arp_init().

int arp_hash_desc
 

Definition at line 38 of file arp_core.c.

Referenced by arp_add_neigh_lock(), arp_del_entry_lock(), arp_get_entry_lock(), and net_layer_2_arp_init().

struct net_layer_2_pack arp_pack
 

Initial value:

 {
    .pack_type          = 0x0608,
    .receiver           = arp_recv,
}

Definition at line 541 of file arp_core.c.

Referenced by net_layer_2_arp_init().

struct list_head arp_requests_list
 

Definition at line 34 of file arp_core.c.

Referenced by arp_request_add_lock(), arp_request_wake_up(), and net_layer_2_arp_init().

spinlock_t arp_requests_list_lock
 

Definition at line 36 of file arp_core.c.

Referenced by arp_request_add(), arp_request_del(), arp_request_wake_up(), and net_layer_2_arp_init().

struct resource_s arp_resource
 

Initial value:

 {
    .resource_name      = "arp",
    .resource_bitmap    = arp_bitmap,
    .resource_len       = ARP_BITMAP_LEN
}

Definition at line 45 of file arp_core.c.

Referenced by net_layer_2_arp_init().

int arp_resource_desc
 

Definition at line 39 of file arp_core.c.

Referenced by get_free_arp_entry(), net_layer_2_arp_init(), and put_free_arp_entry().

struct arp_stats_s arp_stats
 

Definition at line 58 of file arp_core.c.

Referenced by arp_print_stats(), arp_recv(), arp_reply(), and arp_request().

struct timer_s arp_timer
 

Initial value:

 {
    .timer_function     = arp_timer_expire,
    .timer_data         = NULL,
    .timer_expire       = 0,
    .timer_flags        = TIMER_FLAG_ONESHOT,
}

Definition at line 51 of file arp_core.c.

Referenced by arp_timer_refresh_lock().

int counter_jiffies_desc
 

Definition at line 18 of file counters_sys.c.

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix