Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351977
b: refs/heads/master
c: 08433ef
h: refs/heads/master
i:
  351975: 0c93740
v: v3
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 29, 2013
1 parent a1935f2 commit fa8798b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cdda88912d62f9603d27433338a18be83ef23ac1
refs/heads/master: 08433eff2d041b263c68306f6a6ccb4e1f75e196
2 changes: 1 addition & 1 deletion trunk/include/net/neighbour.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ struct neigh_table {

static inline void *neighbour_priv(const struct neighbour *n)
{
return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN);
return (char *)n + n->tbl->entry_size;
}

/* flags for neigh_update() */
Expand Down
16 changes: 7 additions & 9 deletions trunk/net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,7 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device
goto out_entries;
}

if (tbl->entry_size)
n = kzalloc(tbl->entry_size, GFP_ATOMIC);
else {
int sz = sizeof(*n) + tbl->key_len;

sz = ALIGN(sz, NEIGH_PRIV_ALIGN);
sz += dev->neigh_priv_len;
n = kzalloc(sz, GFP_ATOMIC);
}
n = kzalloc(tbl->entry_size + dev->neigh_priv_len, GFP_ATOMIC);
if (!n)
goto out_entries;

Expand Down Expand Up @@ -1546,6 +1538,12 @@ static void neigh_table_init_no_netlink(struct neigh_table *tbl)
if (!tbl->nht || !tbl->phash_buckets)
panic("cannot allocate neighbour cache hashes");

if (!tbl->entry_size)
tbl->entry_size = ALIGN(offsetof(struct neighbour, primary_key) +
tbl->key_len, NEIGH_PRIV_ALIGN);
else
WARN_ON(tbl->entry_size % NEIGH_PRIV_ALIGN);

rwlock_init(&tbl->lock);
INIT_DEFERRABLE_WORK(&tbl->gc_work, neigh_periodic_work);
schedule_delayed_work(&tbl->gc_work, tbl->parms.reachable_time);
Expand Down

0 comments on commit fa8798b

Please sign in to comment.