forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Showing
9 changed files
with
117 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef __LINUX_MROUTE_BASE_H | ||
#define __LINUX_MROUTE_BASE_H | ||
|
||
#include <linux/netdevice.h> | ||
|
||
/** | ||
* struct vif_device - interface representor for multicast routing | ||
* @dev: network device being used | ||
* @bytes_in: statistic; bytes ingressing | ||
* @bytes_out: statistic; bytes egresing | ||
* @pkt_in: statistic; packets ingressing | ||
* @pkt_out: statistic; packets egressing | ||
* @rate_limit: Traffic shaping (NI) | ||
* @threshold: TTL threshold | ||
* @flags: Control flags | ||
* @link: Physical interface index | ||
* @dev_parent_id: device parent id | ||
* @local: Local address | ||
* @remote: Remote address for tunnels | ||
*/ | ||
struct vif_device { | ||
struct net_device *dev; | ||
unsigned long bytes_in, bytes_out; | ||
unsigned long pkt_in, pkt_out; | ||
unsigned long rate_limit; | ||
unsigned char threshold; | ||
unsigned short flags; | ||
int link; | ||
|
||
/* Currently only used by ipmr */ | ||
struct netdev_phys_item_id dev_parent_id; | ||
__be32 local, remote; | ||
}; | ||
|
||
#ifdef CONFIG_IP_MROUTE_COMMON | ||
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); | ||
#else | ||
static inline 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) | ||
{ | ||
} | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters