aboutsummaryrefslogtreecommitdiff
path: root/lib/netdev-vport.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-01-08 20:01:24 -0800
committerEthan Jackson <ethan@nicira.com>2013-01-11 15:15:56 -0800
commitdb078f85c709300b5e2d7d13921b0fc553205ee5 (patch)
tree9db7d8ccf7e8367de255792f454f83fa209e2893 /lib/netdev-vport.c
parent6033d9d9d7058b1fb83f8235a6eed0572285b97c (diff)
netdev-vport: Create new TUNNEL_CLASS macro.
There are a lot of tunnels, and they all use the exact same functions, so it makes sense to collapse their initialization into a macro. Suggested-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/netdev-vport.c')
-rw-r--r--lib/netdev-vport.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index d6a17a9a..d6c4aa64 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -872,33 +872,21 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED,
\
netdev_vport_change_seq
+#define TUNNEL_CLASS(NAME, VPORT_TYPE) \
+ { VPORT_TYPE, \
+ { NAME, VPORT_FUNCTIONS(tunnel_get_status) }, \
+ parse_tunnel_config, unparse_tunnel_config }
+
void
netdev_vport_register(void)
{
static const struct vport_class vport_classes[] = {
- { OVS_VPORT_TYPE_GRE,
- { "gre", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
-
- { OVS_VPORT_TYPE_GRE,
- { "ipsec_gre", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
-
- { OVS_VPORT_TYPE_GRE64,
- { "gre64", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
-
- { OVS_VPORT_TYPE_GRE64,
- { "ipsec_gre64", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
-
- { OVS_VPORT_TYPE_CAPWAP,
- { "capwap", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
-
- { OVS_VPORT_TYPE_VXLAN,
- { "vxlan", VPORT_FUNCTIONS(tunnel_get_status) },
- parse_tunnel_config, unparse_tunnel_config },
+ TUNNEL_CLASS("gre", OVS_VPORT_TYPE_GRE),
+ TUNNEL_CLASS("ipsec_gre", OVS_VPORT_TYPE_GRE),
+ TUNNEL_CLASS("gre64", OVS_VPORT_TYPE_GRE64),
+ TUNNEL_CLASS("ipsec_gre64", OVS_VPORT_TYPE_GRE64),
+ TUNNEL_CLASS("capwap", OVS_VPORT_TYPE_CAPWAP),
+ TUNNEL_CLASS("vxlan", OVS_VPORT_TYPE_VXLAN),
{ OVS_VPORT_TYPE_PATCH,
{ "patch", VPORT_FUNCTIONS(NULL) },