ipmr, ip6mr: Unite creation of new mr_table

Now that both ipmr and ip6mr are using the same mr_table structure,
we can have a common function to allocate & initialize a new instance.

Signed-off-by: Yuval Mintz <yuvalm@mellanox.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Yuval Mintz
2018-02-28 23:29:33 +02:00
committed by David S. Miller
parent b70432f731
commit 0bbbf0e7d0
4 changed files with 64 additions and 37 deletions

View File

@@ -85,6 +85,13 @@ void vif_device_init(struct vif_device *v,
unsigned char threshold,
unsigned short flags,
unsigned short get_iflink_mask);
struct mr_table *
mr_table_alloc(struct net *net, u32 id,
const struct rhashtable_params *rht_params,
void (*expire_func)(struct timer_list *t),
void (*table_set)(struct mr_table *mrt,
struct net *net));
#else
static inline void vif_device_init(struct vif_device *v,
struct net_device *dev,
@@ -94,5 +101,15 @@ static inline void vif_device_init(struct vif_device *v,
unsigned short get_iflink_mask)
{
}
static inline struct mr_table *
mr_table_alloc(struct net *net, u32 id,
const struct rhashtable_params *rht_params,
void (*expire_func)(struct timer_list *t),
void (*table_set)(struct mr_table *mrt,
struct net *net))
{
return NULL;
}
#endif
#endif