Skip to content

Commit f23e59f

Browse files
Alexander Duyckdavem330
authored andcommitted
fib_trie: Move parent from key_vector to tnode
This change pulls the parent pointer from the key_vector and places it in the tnode structure. Signed-off-by: Alexander Duyck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6e22d17 commit f23e59f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

net/ipv4/fib_trie.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ typedef unsigned int t_key;
9393
#define IS_LEAF(n) (!(n)->bits)
9494

9595
struct key_vector {
96-
struct key_vector __rcu *parent;
97-
9896
t_key key;
9997
unsigned char pos; /* 2log(KEYLENGTH) bits needed */
10098
unsigned char bits; /* 2log(KEYLENGTH) bits needed */
@@ -111,6 +109,7 @@ struct tnode {
111109
struct rcu_head rcu;
112110
t_key empty_children; /* KEYLENGTH bits needed */
113111
t_key full_children; /* KEYLENGTH bits needed */
112+
struct key_vector __rcu *parent;
114113
struct key_vector kv[1];
115114
#define tn_bits kv[0].bits
116115
};
@@ -165,21 +164,21 @@ static inline struct tnode *tn_info(struct key_vector *kv)
165164
}
166165

167166
/* caller must hold RTNL */
168-
#define node_parent(n) rtnl_dereference((n)->parent)
167+
#define node_parent(tn) rtnl_dereference(tn_info(tn)->parent)
169168
#define get_child(tn, i) rtnl_dereference((tn)->tnode[i])
170169

171170
/* caller must hold RCU read lock or RTNL */
172-
#define node_parent_rcu(n) rcu_dereference_rtnl((n)->parent)
171+
#define node_parent_rcu(tn) rcu_dereference_rtnl(tn_info(tn)->parent)
173172
#define get_child_rcu(tn, i) rcu_dereference_rtnl((tn)->tnode[i])
174173

175174
/* wrapper for rcu_assign_pointer */
176175
static inline void node_set_parent(struct key_vector *n, struct key_vector *tp)
177176
{
178177
if (n)
179-
rcu_assign_pointer(n->parent, tp);
178+
rcu_assign_pointer(tn_info(n)->parent, tp);
180179
}
181180

182-
#define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER((n)->parent, p)
181+
#define NODE_INIT_PARENT(n, p) RCU_INIT_POINTER(tn_info(n)->parent, p)
183182

184183
/* This provides us with the number of children in this node, in the case of a
185184
* leaf this will return 0 meaning none of the children are accessible.

0 commit comments

Comments
 (0)