Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
81a49f62
Commit
81a49f62
authored
Sep 23, 2004
by
David S. Miller
Committed by
David S. Miller
Sep 23, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Privatize {P,}NEIGH_HASHMASK.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
4e181ca7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
include/net/neighbour.h
include/net/neighbour.h
+2
-5
net/core/neighbour.c
net/core/neighbour.c
+23
-0
No files found.
include/net/neighbour.h
View file @
81a49f62
...
...
@@ -140,9 +140,6 @@ struct pneigh_entry
u8
key
[
0
];
};
#define NEIGH_HASHMASK 0x1F
#define PNEIGH_HASHMASK 0xF
/*
* neighbour table manipulation
*/
...
...
@@ -176,8 +173,8 @@ struct neigh_table
struct
neigh_parms
*
parms_list
;
kmem_cache_t
*
kmem_cachep
;
struct
neigh_statistics
stats
;
struct
neighbour
*
hash_buckets
[
NEIGH_HASHMASK
+
1
]
;
struct
pneigh_entry
*
phash_buckets
[
PNEIGH_HASHMASK
+
1
]
;
struct
neighbour
*
*
hash_buckets
;
struct
pneigh_entry
*
*
phash_buckets
;
};
/* flags for neigh_update() */
...
...
net/core/neighbour.c
View file @
81a49f62
...
...
@@ -47,6 +47,9 @@
#define NEIGH_PRINTK2 NEIGH_PRINTK
#endif
#define NEIGH_HASHMASK 0x1F
#define PNEIGH_HASHMASK 0xF
static
void
neigh_timer_handler
(
unsigned
long
arg
);
#ifdef CONFIG_ARPD
static
void
neigh_app_notify
(
struct
neighbour
*
n
);
...
...
@@ -1205,6 +1208,7 @@ void neigh_parms_destroy(struct neigh_parms *parms)
void
neigh_table_init
(
struct
neigh_table
*
tbl
)
{
unsigned
long
now
=
jiffies
;
unsigned
long
hsize
,
phsize
;
atomic_set
(
&
tbl
->
parms
.
refcnt
,
1
);
INIT_RCU_HEAD
(
&
tbl
->
parms
.
rcu_head
);
...
...
@@ -1220,6 +1224,18 @@ void neigh_table_init(struct neigh_table *tbl)
if
(
!
tbl
->
kmem_cachep
)
panic
(
"cannot create neighbour cache"
);
hsize
=
(
NEIGH_HASHMASK
+
1
)
*
sizeof
(
struct
neighbour
*
);
tbl
->
hash_buckets
=
kmalloc
(
hsize
,
GFP_KERNEL
);
phsize
=
(
PNEIGH_HASHMASK
+
1
)
*
sizeof
(
struct
pneigh_entry
*
);
tbl
->
phash_buckets
=
kmalloc
(
phsize
,
GFP_KERNEL
);
if
(
!
tbl
->
hash_buckets
||
!
tbl
->
phash_buckets
)
panic
(
"cannot allocate neighbour cache hashes"
);
memset
(
tbl
->
hash_buckets
,
0
,
hsize
);
memset
(
tbl
->
phash_buckets
,
0
,
phsize
);
tbl
->
lock
=
RW_LOCK_UNLOCKED
;
init_timer
(
&
tbl
->
gc_timer
);
tbl
->
gc_timer
.
data
=
(
unsigned
long
)
tbl
;
...
...
@@ -1260,6 +1276,13 @@ int neigh_table_clear(struct neigh_table *tbl)
}
}
write_unlock
(
&
neigh_tbl_lock
);
kfree
(
tbl
->
hash_buckets
);
tbl
->
hash_buckets
=
NULL
;
kfree
(
tbl
->
phash_buckets
);
tbl
->
phash_buckets
=
NULL
;
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment