- 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 ? OVS_VPORT_TYPE_INTERNAL
- : (class == &netdev_linux_class ||
- class == &netdev_tap_class) ? OVS_VPORT_TYPE_NETDEV
- : OVS_VPORT_TYPE_UNSPEC);
-}
-
-const char *
-netdev_vport_get_netdev_type(const struct dpif_linux_vport *vport)
-{
- struct nlattr *a[OVS_TUNNEL_ATTR_MAX + 1];
-
- switch (vport->type) {
- case OVS_VPORT_TYPE_UNSPEC:
- break;
-
- case OVS_VPORT_TYPE_NETDEV:
- return "system";
-
- case OVS_VPORT_TYPE_INTERNAL:
- return "internal";
-
- case OVS_VPORT_TYPE_PATCH:
- return "patch";
-
- case OVS_VPORT_TYPE_GRE:
- if (tnl_port_config_from_nlattr(vport->options, vport->options_len,
- a)) {
- break;
- }
- return (nl_attr_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]) & TNL_F_IPSEC
- ? "ipsec_gre" : "gre");
-
- case OVS_VPORT_TYPE_CAPWAP:
- return "capwap";
-
- case __OVS_VPORT_TYPE_MAX:
- break;
- }
-
- VLOG_WARN_RL(&rl, "dp%d: port `%s' has unsupported type %u",
- vport->dp_ifindex, vport->name, (unsigned int) vport->type);
- return "unknown";