patch-2.1.30 linux/net/core/neighbour.c
Next file: linux/net/core/skbuff.c
Previous file: linux/net/core/firewall.c
Back to the patch index
Back to the overall index
- Lines: 125
- Date:
Thu Mar 20 18:17:13 1997
- Orig file:
v2.1.29/linux/net/core/neighbour.c
- Orig date:
Thu Jan 2 04:07:39 1997
diff -u --recursive --new-file v2.1.29/linux/net/core/neighbour.c linux/net/core/neighbour.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/socket.h>
#include <linux/sched.h>
+#include <linux/netdevice.h>
#include <net/neighbour.h>
@@ -44,11 +45,11 @@
memset(tbl->hash_buckets, 0, bmemlen);
}
-struct neighbour *neigh_alloc(int size, int priority)
+struct neighbour *neigh_alloc(int size, struct neigh_ops *ops)
{
struct neighbour *neigh;
- neigh = kmalloc(size, priority);
+ neigh = kmalloc(size, GFP_ATOMIC);
if (neigh == NULL)
{
return NULL;
@@ -57,7 +58,7 @@
memset(neigh, 0, size);
skb_queue_head_init(&neigh->arp_queue);
-
+ neigh->ops = ops;
return neigh;
}
@@ -96,7 +97,6 @@
hash_val = tbl->neigh_ops->hash(neigh->primary_key) % tbl->tbl_size;
neigh->tbl = tbl;
- neigh->ops = tbl->neigh_ops;
head = &tbl->hash_buckets[hash_val];
@@ -143,7 +143,7 @@
return neigh;
}
neigh = neigh->next;
-
+
} while (neigh != head);
}
@@ -156,8 +156,6 @@
*/
void neigh_destroy(struct neighbour *neigh)
{
- unsigned long flags;
-
if (neigh->tbl)
{
printk(KERN_DEBUG "neigh_destroy: neighbour still in table. "
@@ -171,10 +169,6 @@
neigh_purge_send_q(neigh);
- save_flags(flags);
- cli();
- restore_flags(flags);
-
kfree(neigh);
}
@@ -185,14 +179,14 @@
unsigned int hash_val;
struct neighbour *next, *prev;
- tbl = neigh->tbl;
+ tbl = neigh->tbl;
neigh->tbl = NULL;
-
+
hash_val = neigh->ops->hash(neigh->primary_key) % tbl->tbl_size;
head = &tbl->hash_buckets[hash_val];
tbl->tbl_entries--;
-
+
next = neigh->next;
if (neigh == (*head))
{
@@ -220,21 +214,21 @@
unsigned long filter, int max, void *args)
{
int i;
-
+
if (max == 0)
max = tbl->tbl_size;
-
+
for (i=0; i < max; i++)
{
struct neighbour **head;
struct neighbour *entry;
-
+
head = &tbl->hash_buckets[i];
entry = *head;
if (!entry)
continue;
-
+
do {
if (entry->flags & (~filter))
{
@@ -247,10 +241,10 @@
curp = entry;
entry = curp->next;
-
+
neigh_unlink(curp);
neigh_destroy(curp);
-
+
if ((*head) == NULL)
break;
continue;
FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]