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

Commit d3aaeb38 authored by David S. Miller's avatar David S. Miller
Browse files

net: Add ->neigh_lookup() operation to dst_ops



In the future dst entries will be neigh-less.  In that environment we
need to have an easy transition point for current users of
dst->neighbour outside of the packet output fast path.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69cce1d1
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -38,15 +38,6 @@ static inline struct neighbour *__ipv4_neigh_lookup(struct neigh_table *tbl, str
	return n;
}

static inline struct neighbour *ipv4_neigh_lookup(struct neigh_table *tbl, struct net_device *dev, const __be32 *pkey)
{
	struct neighbour *n = __ipv4_neigh_lookup(tbl, dev,
						  *(__force u32 *)pkey);
	if (n)
		return n;
	return neigh_create(tbl, pkey, dev);
}

extern void	arp_init(void);
extern int	arp_find(unsigned char *haddr, struct sk_buff *skb);
extern int	arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
+5 −0
Original line number Diff line number Diff line
@@ -387,6 +387,11 @@ static inline void dst_confirm(struct dst_entry *dst)
	}
}

static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
{
	return dst->ops->neigh_lookup(dst, daddr);
}

static inline void dst_link_failure(struct sk_buff *skb)
{
	struct dst_entry *dst = skb_dst(skb);
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ struct dst_ops {
	void			(*link_failure)(struct sk_buff *);
	void			(*update_pmtu)(struct dst_entry *dst, u32 mtu);
	int			(*local_out)(struct sk_buff *skb);
	struct neighbour *	(*neigh_lookup)(const struct dst_entry *dst, const void *daddr);

	struct kmem_cache	*kmem_cachep;

+6 −0
Original line number Diff line number Diff line
@@ -109,11 +109,17 @@ static u32 *fake_cow_metrics(struct dst_entry *dst, unsigned long old)
	return NULL;
}

static struct neighbour *fake_neigh_lookup(const struct dst_entry *dst, const void *daddr)
{
	return NULL;
}

static struct dst_ops fake_dst_ops = {
	.family =		AF_INET,
	.protocol =		cpu_to_be16(ETH_P_IP),
	.update_pmtu =		fake_update_pmtu,
	.cow_metrics =		fake_cow_metrics,
	.neigh_lookup =		fake_neigh_lookup,
};

/*
+7 −0
Original line number Diff line number Diff line
@@ -116,6 +116,7 @@ static void dn_dst_destroy(struct dst_entry *);
static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
static void dn_dst_link_failure(struct sk_buff *);
static void dn_dst_update_pmtu(struct dst_entry *dst, u32 mtu);
static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr);
static int dn_route_input(struct sk_buff *);
static void dn_run_flush(unsigned long dummy);

@@ -139,6 +140,7 @@ static struct dst_ops dn_dst_ops = {
	.negative_advice =	dn_dst_negative_advice,
	.link_failure =		dn_dst_link_failure,
	.update_pmtu =		dn_dst_update_pmtu,
	.neigh_lookup =		dn_dst_neigh_lookup,
};

static void dn_dst_destroy(struct dst_entry *dst)
@@ -827,6 +829,11 @@ static unsigned int dn_dst_default_mtu(const struct dst_entry *dst)
	return dst->dev->mtu;
}

static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
{
	return __neigh_lookup_errno(&dn_neigh_table, daddr, dst->dev);
}

static int dn_rt_set_next_hop(struct dn_route *rt, struct dn_fib_res *res)
{
	struct dn_fib_info *fi = res->fi;
Loading