Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5b43760 authored by Robert Olsson's avatar Robert Olsson Committed by David S. Miller
Browse files

[IPV4]: Prepare FIB core for RCU.



* RCU versions of hlist_***_rcu
* fib_alias partial rcu port just whats needed now.

Signed-off-by: default avatarRobert Olsson <Robert.Olsson@data.slu.se>
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36257968
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -634,6 +634,27 @@ static inline void hlist_add_after(struct hlist_node *n,
		next->next->pprev  = &next->next;
		next->next->pprev  = &next->next;
}
}


static inline void hlist_add_before_rcu(struct hlist_node *n,
					struct hlist_node *next)
{
	n->pprev = next->pprev;
	n->next = next;
	smp_wmb();
	next->pprev = &n->next;
	*(n->pprev) = n;
}

static inline void hlist_add_after_rcu(struct hlist_node *prev,
				       struct hlist_node *n)
{
	n->next = prev->next;
	n->pprev = &prev->next;
	smp_wmb();
	prev->next = n;
	if (n->next)
		n->next->pprev = &n->next;
}

#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
#define hlist_entry(ptr, type, member) container_of(ptr,type,member)


#define hlist_for_each(pos, head) \
#define hlist_for_each(pos, head) \
+1 −0
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@


struct fib_alias {
struct fib_alias {
	struct list_head	fa_list;
	struct list_head	fa_list;
	struct rcu_head rcu;
	struct fib_info		*fa_info;
	struct fib_info		*fa_info;
	u8			fa_tos;
	u8			fa_tos;
	u8			fa_type;
	u8			fa_type;
+2 −1
Original line number Original line Diff line number Diff line
@@ -854,6 +854,7 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta,
	return NULL;
	return NULL;
}
}


/* Note! fib_semantic_match intentionally uses  RCU list functions. */
int fib_semantic_match(struct list_head *head, const struct flowi *flp,
int fib_semantic_match(struct list_head *head, const struct flowi *flp,
		       struct fib_result *res, __u32 zone, __u32 mask, 
		       struct fib_result *res, __u32 zone, __u32 mask, 
			int prefixlen)
			int prefixlen)
@@ -861,7 +862,7 @@ int fib_semantic_match(struct list_head *head, const struct flowi *flp,
	struct fib_alias *fa;
	struct fib_alias *fa;
	int nh_sel = 0;
	int nh_sel = 0;


	list_for_each_entry(fa, head, fa_list) {
	list_for_each_entry_rcu(fa, head, fa_list) {
		int err;
		int err;


		if (fa->fa_tos &&
		if (fa->fa_tos &&