struct netdev_class netdev_class;
int (*parse_config)(const char *name, const char *type,
const struct shash *args, struct ofpbuf *options);
struct netdev_class netdev_class;
int (*parse_config)(const char *name, const char *type,
const struct shash *args, struct ofpbuf *options);
static void netdev_vport_poll_notify(const struct netdev *);
static int tnl_port_config_from_nlattr(const struct nlattr *options,
size_t options_len,
static void netdev_vport_poll_notify(const struct netdev *);
static int tnl_port_config_from_nlattr(const struct nlattr *options,
size_t options_len,
netdev_vport_get_vport_type(const struct netdev *netdev)
{
const struct netdev_dev *dev = netdev_get_dev(netdev);
const struct netdev_class *class = netdev_dev_get_class(dev);
return (is_vport_class(class) ? vport_class_cast(class)->type
netdev_vport_get_vport_type(const struct netdev *netdev)
{
const struct netdev_dev *dev = netdev_get_dev(netdev);
const struct netdev_class *class = netdev_dev_get_class(dev);
return (is_vport_class(class) ? vport_class_cast(class)->type
- : class == &netdev_internal_class ? ODP_VPORT_TYPE_INTERNAL
- : class == &netdev_linux_class ? ODP_VPORT_TYPE_NETDEV
- : ODP_VPORT_TYPE_UNSPEC);
+ : class == &netdev_internal_class ? OVS_VPORT_TYPE_INTERNAL
+ : class == &netdev_linux_class ? OVS_VPORT_TYPE_NETDEV
+ : OVS_VPORT_TYPE_UNSPEC);
netdev_stats_to_rtnl_link_stats64(&rtnl_stats, stats);
dpif_linux_vport_init(&vport);
netdev_stats_to_rtnl_link_stats64(&rtnl_stats, stats);
dpif_linux_vport_init(&vport);
shash_add(sh, "tunnel_egress_iface_carrier",
xstrdup(netdev_get_carrier(egress_netdev)
? "up" : "down"));
shash_add(sh, "tunnel_egress_iface_carrier",
xstrdup(netdev_get_carrier(egress_netdev)
? "up" : "down"));
if (lookup_ip(node->data, &in_addr)) {
VLOG_WARN("%s: bad %s 'local_ip'", name, type);
} else {
if (lookup_ip(node->data, &in_addr)) {
VLOG_WARN("%s: bad %s 'local_ip'", name, type);
} else {
in_addr.s_addr);
}
} else if (!strcmp(node->name, "tos")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TOS_INHERIT;
} else {
in_addr.s_addr);
}
} else if (!strcmp(node->name, "tos")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TOS_INHERIT;
} else {
}
} else if (!strcmp(node->name, "ttl")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TTL_INHERIT;
} else {
}
} else if (!strcmp(node->name, "ttl")) {
if (!strcmp(node->data, "inherit")) {
flags |= TNL_F_TTL_INHERIT;
} else {
}
} else if (!strcmp(node->name, "csum") && is_gre) {
if (!strcmp(node->data, "true")) {
}
} else if (!strcmp(node->name, "csum") && is_gre) {
if (!strcmp(node->data, "true")) {
- set_key(args, "in_key", ODP_TUNNEL_ATTR_IN_KEY, options);
- set_key(args, "out_key", ODP_TUNNEL_ATTR_OUT_KEY, options);
+ set_key(args, "in_key", OVS_TUNNEL_ATTR_IN_KEY, options);
+ set_key(args, "out_key", OVS_TUNNEL_ATTR_OUT_KEY, options);
- struct nlattr *a[ODP_TUNNEL_ATTR_MAX + 1])
-{
- static const struct nl_policy odp_tunnel_policy[] = {
- [ODP_TUNNEL_ATTR_FLAGS] = { .type = NL_A_U32 },
- [ODP_TUNNEL_ATTR_DST_IPV4] = { .type = NL_A_BE32 },
- [ODP_TUNNEL_ATTR_SRC_IPV4] = { .type = NL_A_BE32, .optional = true },
- [ODP_TUNNEL_ATTR_IN_KEY] = { .type = NL_A_BE64, .optional = true },
- [ODP_TUNNEL_ATTR_OUT_KEY] = { .type = NL_A_BE64, .optional = true },
- [ODP_TUNNEL_ATTR_TOS] = { .type = NL_A_U8, .optional = true },
- [ODP_TUNNEL_ATTR_TTL] = { .type = NL_A_U8, .optional = true },
+ struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1])
+{
+ static const struct nl_policy ovs_tunnel_policy[] = {
+ [OVS_TUNNEL_ATTR_FLAGS] = { .type = NL_A_U32 },
+ [OVS_TUNNEL_ATTR_DST_IPV4] = { .type = NL_A_BE32 },
+ [OVS_TUNNEL_ATTR_SRC_IPV4] = { .type = NL_A_BE32, .optional = true },
+ [OVS_TUNNEL_ATTR_IN_KEY] = { .type = NL_A_BE64, .optional = true },
+ [OVS_TUNNEL_ATTR_OUT_KEY] = { .type = NL_A_BE64, .optional = true },
+ [OVS_TUNNEL_ATTR_TOS] = { .type = NL_A_U8, .optional = true },
+ [OVS_TUNNEL_ATTR_TTL] = { .type = NL_A_U8, .optional = true },
- if (!nl_policy_parse(&buf, 0, odp_tunnel_policy,
- a, ARRAY_SIZE(odp_tunnel_policy))) {
+ if (!nl_policy_parse(&buf, 0, ovs_tunnel_policy,
+ a, ARRAY_SIZE(ovs_tunnel_policy))) {
if (!(flags & TNL_F_HDR_CACHE) == !(flags & TNL_F_IPSEC)) {
smap_add(args, "header_cache",
flags & TNL_F_HDR_CACHE ? "true" : "false");
}
if (!(flags & TNL_F_HDR_CACHE) == !(flags & TNL_F_IPSEC)) {
smap_add(args, "header_cache",
flags & TNL_F_HDR_CACHE ? "true" : "false");
}
shash_add(args, "remote_ip", xasprintf(IP_FMT, IP_ARGS(&daddr)));
shash_add(args, "remote_ip", xasprintf(IP_FMT, IP_ARGS(&daddr)));
- if (a[ODP_TUNNEL_ATTR_SRC_IPV4]) {
- ovs_be32 saddr = nl_attr_get_be32(a[ODP_TUNNEL_ATTR_SRC_IPV4]);
+ if (a[OVS_TUNNEL_ATTR_SRC_IPV4]) {
+ ovs_be32 saddr = nl_attr_get_be32(a[OVS_TUNNEL_ATTR_SRC_IPV4]);
shash_add(args, "local_ip", xasprintf(IP_FMT, IP_ARGS(&saddr)));
}
shash_add(args, "local_ip", xasprintf(IP_FMT, IP_ARGS(&saddr)));
}
- uint64_t in_key = get_be64_or_zero(a[ODP_TUNNEL_ATTR_IN_KEY]);
- uint64_t out_key = get_be64_or_zero(a[ODP_TUNNEL_ATTR_OUT_KEY]);
+ uint64_t in_key = get_be64_or_zero(a[OVS_TUNNEL_ATTR_IN_KEY]);
+ uint64_t out_key = get_be64_or_zero(a[OVS_TUNNEL_ATTR_OUT_KEY]);
if (in_key && in_key == out_key) {
shash_add(args, "key", xasprintf("%"PRIu64, in_key));
} else {
if (in_key && in_key == out_key) {
shash_add(args, "key", xasprintf("%"PRIu64, in_key));
} else {
smap_add(args, "in_key", "flow");
} else if (in_key) {
shash_add(args, "in_key", xasprintf("%"PRIu64, in_key));
}
smap_add(args, "in_key", "flow");
} else if (in_key) {
shash_add(args, "in_key", xasprintf("%"PRIu64, in_key));
}
smap_add(args, "out_key", "flow");
} else if (out_key) {
shash_add(args, "out_key", xasprintf("%"PRIu64, out_key));
smap_add(args, "out_key", "flow");
} else if (out_key) {
shash_add(args, "out_key", xasprintf("%"PRIu64, out_key));
if (flags & TNL_F_TTL_INHERIT) {
smap_add(args, "tos", "inherit");
if (flags & TNL_F_TTL_INHERIT) {
smap_add(args, "tos", "inherit");
shash_add(args, "tos", xasprintf("%d", ttl));
}
if (flags & TNL_F_TOS_INHERIT) {
smap_add(args, "tos", "inherit");
shash_add(args, "tos", xasprintf("%d", ttl));
}
if (flags & TNL_F_TOS_INHERIT) {
smap_add(args, "tos", "inherit");
shash_add(args, "tos", xasprintf("%d", tos));
}
shash_add(args, "tos", xasprintf("%d", tos));
}
- static const struct nl_policy odp_patch_policy[] = {
- [ODP_PATCH_ATTR_PEER] = { .type = NL_A_STRING,
+ static const struct nl_policy ovs_patch_policy[] = {
+ [OVS_PATCH_ATTR_PEER] = { .type = NL_A_STRING,
- if (!nl_policy_parse(&buf, 0, odp_patch_policy,
- a, ARRAY_SIZE(odp_patch_policy))) {
+ if (!nl_policy_parse(&buf, 0, ovs_patch_policy,
+ a, ARRAY_SIZE(ovs_patch_policy))) {
{ "gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "capwap", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "capwap", VPORT_FUNCTIONS(netdev_vport_get_status) },
parse_tunnel_config, unparse_tunnel_config },
{ "patch", VPORT_FUNCTIONS(NULL) },
parse_patch_config, unparse_patch_config }
};
{ "patch", VPORT_FUNCTIONS(NULL) },
parse_patch_config, unparse_patch_config }
};