-static int
-netdev_vport_create(const struct netdev_class *netdev_class, const char *name,
- const struct shash *args,
- struct netdev_dev **netdev_devp)
-{
- const struct vport_class *vport_class = vport_class_cast(netdev_class);
- struct ofpbuf *options = NULL;
- struct shash fetched_args;
- int error;
-
- shash_init(&fetched_args);
-
- if (!shash_is_empty(args)) {
- /* Parse the provided configuration. */
- options = ofpbuf_new(64);
- error = vport_class->parse_config(name, netdev_class->type,
- args, options);
- } else {
- /* Fetch an existing configuration from the kernel.
- *
- * This case could be ambiguous with initializing a new vport with an
- * empty configuration, but none of the existing vport classes accept
- * an empty configuration. */
- struct dpif_linux_vport reply;
- struct ofpbuf *buf;
-
- error = dpif_linux_vport_get(name, &reply, &buf);
- if (!error) {
- /* XXX verify correct type */
- error = vport_class->unparse_config(name, netdev_class->type,
- reply.options,
- reply.options_len,
- &fetched_args);
- if (error) {
- VLOG_ERR_RL(&rl, "%s: failed to parse kernel config (%s)",
- name, strerror(error));
- } else {
- options = ofpbuf_clone_data(reply.options, reply.options_len);
- }
- ofpbuf_delete(buf);
- } else {
- VLOG_ERR_RL(&rl, "%s: vport query failed (%s)",
- name, strerror(error));
- }
- }
-
- if (!error) {
- struct netdev_dev_vport *dev;
-
- dev = xmalloc(sizeof *dev);
- netdev_dev_init(&dev->netdev_dev, name,
- shash_is_empty(&fetched_args) ? args : &fetched_args,
- netdev_class);
- dev->options = options;
-
- *netdev_devp = &dev->netdev_dev;
- route_table_register();
+const char *
+netdev_vport_get_dpif_port(const struct netdev *netdev,
+ char namebuf[], size_t bufsize)
+{
+ if (netdev_vport_needs_dst_port(netdev)) {
+ const struct netdev_vport *vport = netdev_vport_cast(netdev);
+ const char *type = netdev_get_type(netdev);
+
+ /*
+ * Note: IFNAMSIZ is 16 bytes long. The maximum length of a VXLAN
+ * or LISP port name below is 15 or 14 bytes respectively. Still,
+ * assert here on the size of strlen(type) in case that changes
+ * in the future.
+ */
+ BUILD_ASSERT(NETDEV_VPORT_NAME_BUFSIZE >= IFNAMSIZ);
+ ovs_assert(strlen(type) + 10 < IFNAMSIZ);
+ snprintf(namebuf, bufsize, "%s_sys_%d", type,
+ ntohs(vport->tnl_cfg.dst_port));
+ return namebuf;