@@ -2110,6 +2110,9 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
if (error) {
return error;
}
+ if (port_no == ODPP_LOCAL) {
+ netdev_set_internal(port->netdev);
+ }
hmap_insert(&dp->ports, &port->node, hash_port_no(port_no));
seq_change(dp->port_seq);
@@ -3551,7 +3551,7 @@ exit:
const struct netdev_class netdev_linux_class = {
NETDEV_LINUX_CLASS_COMMON,
.type = "system",
- .is_pmd = false,
+ .is_pmd = true,
.construct = netdev_linux_construct,
.destruct = netdev_linux_destruct,
.get_stats = netdev_linux_get_stats,
@@ -3567,7 +3567,7 @@ const struct netdev_class netdev_linux_class = {
const struct netdev_class netdev_tap_class = {
NETDEV_LINUX_CLASS_COMMON,
.type = "tap",
- .is_pmd = false,
+ .is_pmd = true,
.construct = netdev_linux_construct_tap,
.destruct = netdev_linux_destruct,
.get_stats = netdev_tap_get_stats,
@@ -54,6 +54,7 @@ struct netdev {
char *name; /* Name of network device. */
const struct netdev_class *netdev_class; /* Functions to control
this device. */
+ bool is_internal; /* Is interface type internal? */
/* If this is 'true' the user did not specify a netdev_class when
* opening this device, and therefore got assigned to the "system" class */
@@ -124,7 +124,13 @@ netdev_n_rxq(const struct netdev *netdev)
bool
netdev_is_pmd(const struct netdev *netdev)
{
- return netdev->netdev_class->is_pmd;
+ return netdev->is_internal ? false: netdev->netdev_class->is_pmd;
+}
+
+void
+netdev_set_internal(struct netdev *netdev)
+{
+ netdev->is_internal = true;
}
bool
@@ -150,6 +150,7 @@ bool netdev_is_reserved_name(const char *name);
int netdev_n_txq(const struct netdev *netdev);
int netdev_n_rxq(const struct netdev *netdev);
bool netdev_is_pmd(const struct netdev *netdev);
+void netdev_set_internal(struct netdev *netdev);
bool netdev_has_tunnel_push_pop(const struct netdev *netdev);
/* Open and close. */
@@ -2034,6 +2034,7 @@ iface_do_create(const struct bridge *br,
struct netdev *netdev = NULL;
int error;
const char *type;
+ const char *iface_type;
if (netdev_is_reserved_name(iface_cfg->name)) {
VLOG_WARN("could not create interface %s, name is reserved",
@@ -2042,14 +2043,17 @@ iface_do_create(const struct bridge *br,
goto error;
}
- type = ofproto_port_open_type(br->ofproto,
- iface_get_type(iface_cfg, br->cfg));
+ iface_type = iface_get_type(iface_cfg, br->cfg);
+ type = ofproto_port_open_type(br->ofproto, iface_type);
error = netdev_open(iface_cfg->name, type, &netdev);
if (error) {
VLOG_WARN_BUF(errp, "could not open network device %s (%s)",
iface_cfg->name, ovs_strerror(error));
goto error;
}
+ if (strcmp(iface_type, "internal") == 0) {
+ netdev_set_internal(netdev);
+ }
error = iface_set_netdev_config(iface_cfg, netdev, errp);
if (error) {
@@ -2142,6 +2146,7 @@ iface_create(struct bridge *br, const struct ovsrec_interface *iface_cfg,
error = netdev_open(port->name, "internal", &netdev);
if (!error) {
ofp_port_t fake_ofp_port = OFPP_NONE;
+ netdev_set_internal(netdev);
ofproto_port_add(br->ofproto, netdev, &fake_ofp_port);
netdev_close(netdev);
} else {