Patchwork [1/7] neigh: Create mechanism for generic neigh private areas.

login
register
mail settings
Submitter David Miller
Date July 25, 2011, 10:01 a.m.
Message ID <20110725.030117.316830174679013084.davem@davemloft.net>
Download mbox | patch
Permalink /patch/106632/
State Superseded
Delegated to: David Miller
Headers show

Comments

David Miller - July 25, 2011, 10:01 a.m.
The implementation private sits right after the primary_key memory.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/neighbour.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Patch

diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 4ba8521..8ff9143 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -178,6 +178,13 @@  struct neigh_table {
 	struct pneigh_entry	**phash_buckets;
 };
 
+#define NEIGH_PRIV_ALIGN	sizeof(long long)
+
+static inline void *neighbour_priv(const struct neighbour *n)
+{
+	return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN);
+}
+
 /* flags for neigh_update() */
 #define NEIGH_UPDATE_F_OVERRIDE			0x00000001
 #define NEIGH_UPDATE_F_WEAK_OVERRIDE		0x00000002