ipmr,ipmr6: Define a uniform vif_device
The two implementations have almost identical structures - vif_device and mif_device. As a step toward uniforming the mr_tables, eliminate the mif_device and relocate the vif_device definition into a new common header file. Also, introduce a common initializing function for setting most of the vif_device fields in a new common source file. This requires modifying the ipv{4,6] Kconfig and ipv4 makefile as we're introducing a new common config option - CONFIG_IP_MROUTE_COMMON. 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:

committed by
David S. Miller

parent
a25724b05a
commit
6853f21f76
28
net/ipv4/ipmr_base.c
Normal file
28
net/ipv4/ipmr_base.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Linux multicast routing support
|
||||
* Common logic shared by IPv4 [ipmr] and IPv6 [ip6mr] implementation
|
||||
*/
|
||||
|
||||
#include <linux/mroute_base.h>
|
||||
|
||||
/* Sets everything common except 'dev', since that is done under locking */
|
||||
void vif_device_init(struct vif_device *v,
|
||||
struct net_device *dev,
|
||||
unsigned long rate_limit,
|
||||
unsigned char threshold,
|
||||
unsigned short flags,
|
||||
unsigned short get_iflink_mask)
|
||||
{
|
||||
v->dev = NULL;
|
||||
v->bytes_in = 0;
|
||||
v->bytes_out = 0;
|
||||
v->pkt_in = 0;
|
||||
v->pkt_out = 0;
|
||||
v->rate_limit = rate_limit;
|
||||
v->flags = flags;
|
||||
v->threshold = threshold;
|
||||
if (v->flags & get_iflink_mask)
|
||||
v->link = dev_get_iflink(dev);
|
||||
else
|
||||
v->link = dev->ifindex;
|
||||
}
|
||||
EXPORT_SYMBOL(vif_device_init);
|
Reference in New Issue
Block a user