@@ -888,7 +888,7 @@ static const char *
dpif_netdev_port_open_type(const struct dpif_class *class, const char *type)
{
return strcmp(type, "internal") ? type
- : dpif_netdev_class_is_dummy(class) ? "dummy"
+ : dpif_netdev_class_is_dummy(class) ? "dummy-internal"
: "tap";
}
@@ -622,12 +622,15 @@ dummy_netdev_get_conn_state(struct dummy_packet_conn *conn)
}
static void
-netdev_dummy_run(const struct netdev_class *netdev_class OVS_UNUSED)
+netdev_dummy_run(const struct netdev_class *netdev_class)
{
struct netdev_dummy *dev;
ovs_mutex_lock(&dummy_list_mutex);
LIST_FOR_EACH (dev, list_node, &dummy_list) {
+ if (netdev_get_class(&dev->up) != netdev_class) {
+ continue;
+ }
ovs_mutex_lock(&dev->mutex);
dummy_packet_conn_run(dev);
ovs_mutex_unlock(&dev->mutex);
@@ -636,12 +639,15 @@ netdev_dummy_run(const struct netdev_class *netdev_class OVS_UNUSED)
}
static void
-netdev_dummy_wait(const struct netdev_class *netdev_class OVS_UNUSED)
+netdev_dummy_wait(const struct netdev_class *netdev_class)
{
struct netdev_dummy *dev;
ovs_mutex_lock(&dummy_list_mutex);
LIST_FOR_EACH (dev, list_node, &dummy_list) {
+ if (netdev_get_class(&dev->up) != netdev_class) {
+ continue;
+ }
ovs_mutex_lock(&dev->mutex);
dummy_packet_conn_wait(&dev->conn);
ovs_mutex_unlock(&dev->mutex);
@@ -1380,6 +1386,9 @@ netdev_dummy_update_flags(struct netdev *netdev_,
static const struct netdev_class dummy_class =
NETDEV_DUMMY_CLASS("dummy", false, NULL);
+static const struct netdev_class dummy_internal_class =
+ NETDEV_DUMMY_CLASS("dummy-internal", false, NULL);
+
static const struct netdev_class dummy_pmd_class =
NETDEV_DUMMY_CLASS("dummy-pmd", true,
netdev_dummy_reconfigure);
@@ -1751,6 +1760,7 @@ netdev_dummy_register(enum dummy_level level)
netdev_dummy_override("system");
}
netdev_register_provider(&dummy_class);
+ netdev_register_provider(&dummy_internal_class);
netdev_register_provider(&dummy_pmd_class);
netdev_vport_tunnel_register();
@@ -12,7 +12,7 @@ add_of_ports br0 1 2
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (dummy)
p2 2/2: (dummy)
])
@@ -23,7 +23,7 @@ AT_CHECK([ovs-appctl dpctl/del-if dummy@ovs-dummy p1])
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p2 2/2: (dummy)
])
@@ -32,7 +32,7 @@ AT_CHECK([ovs-vsctl del-port p2])
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (dummy)
])
OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
@@ -23,14 +23,14 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
- port 0: br0 (dummy)
+ port 0: br0 (dummy-internal)
])
AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=dummy,port_no=5])
AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
- port 0: br0 (dummy)
+ port 0: br0 (dummy-internal)
port 5: vif1.0 (dummy)
])
AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=dummy], [2], [],
@@ -44,9 +44,9 @@ AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 vif1.0,type=system], [2], [],
[ovs-vswitchd: vif1.0: can't change type from dummy to system
ovs-appctl: ovs-vswitchd: server returned an error
])
-AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=dummy], [0])
+AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=dummy-internal], [0])
AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=internal], [2], [],
- [ovs-vswitchd: br0: can't change type from dummy to internal
+ [ovs-vswitchd: br0: can't change type from dummy-internal to internal
ovs-appctl: ovs-vswitchd: server returned an error
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0])
@@ -54,7 +54,7 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
- port 0: br0 (dummy)
+ port 0: br0 (dummy-internal)
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0], [2], [],
[ovs-vswitchd: no port named vif1.0
@@ -64,7 +64,7 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
dummy@br0:
lookups: hit:0 missed:0 lost:0
flows: 0
- port 0: br0 (dummy)
+ port 0: br0 (dummy-internal)
])
AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 nonexistent], [2], [],
[ovs-vswitchd: no port named nonexistent
@@ -16,11 +16,11 @@ OVS_VSWITCHD_START(
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy)
p1 2/none: (patch: peer=p2)
br1:
- br1 65534/101: (dummy)
+ br1 65534/101: (dummy-internal)
p2 1/none: (patch: peer=p1)
])
@@ -9,7 +9,7 @@ add_of_ports br0 1
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (dummy)
])
#
@@ -5657,7 +5657,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
p2 2/2: (dummy)
])
@@ -5829,10 +5829,10 @@ AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy: ifindex=1010)
int-br:
- int-br 65534/2: (dummy)
+ int-br 65534/2: (dummy-internal)
t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
vm1 5/3: (dummy: ifindex=2011)
])
@@ -6573,11 +6573,11 @@ add_of_ports br1 3
AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (dummy-pmd: <cleared>)
p2 2/2: (dummy-pmd: <cleared>)
br1:
- br1 65534/101: (dummy)
+ br1 65534/101: (dummy-internal)
p3 3/3: (dummy)
])
OVS_VSWITCHD_STOP
@@ -6757,11 +6757,11 @@ sleep 1 # wait for log writer
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:13 missed:2
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p2 2/2: (dummy)
pbr0 1/none: (patch: peer=pbr1)
br1:
- br1 65534/101: (dummy)
+ br1 65534/101: (dummy-internal)
p3 3/3: (dummy)
pbr1 1/none: (patch: peer=pbr0)
])
@@ -6822,11 +6822,11 @@ OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:1
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p2 2/2: (dummy)
pbr0 1/none: (patch: peer=pbr1)
br1:
- br1 65534/101: (dummy)
+ br1 65534/101: (dummy-internal)
p3 3/3: (dummy)
pbr1 1/none: (patch: peer=pbr0)
])
@@ -186,9 +186,9 @@ AT_CHECK([ovs-vsctl add-port br0 p1 -- set interface p1 type=internal])
dnl ovs-vswitchd should still 'see' ovsdb change with the 'monitor' method
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
- p0 1/1: (dummy)
- p1 2/2: (dummy)
+ br0 65534/100: (dummy-internal)
+ p0 1/1: (dummy-internal)
+ p1 2/2: (dummy-internal)
])
OVS_VSWITCHD_STOP
AT_CLEANUP
@@ -70,7 +70,7 @@ pmd thread numa_id <cleared> core_id <cleared>:
AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy-pmd: configured_rx_queues=1, configured_tx_queues=<cleared>, requested_rx_queues=1, requested_tx_queues=<cleared>)
])
@@ -88,7 +88,7 @@ AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=8])
AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
])
@@ -112,7 +112,7 @@ CHECK_PMD_THREADS_CREATED()
AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
])
@@ -164,7 +164,7 @@ sleep 1
AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 7/1: (dummy-pmd: configured_rx_queues=4, configured_tx_queues=<cleared>, requested_rx_queues=4, requested_tx_queues=<cleared>)
])
@@ -17,10 +17,10 @@ AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy)
int-br:
- int-br 65534/2: (dummy)
+ int-br 65534/2: (dummy-internal)
t1 3/3: (gre: key=456, remote_ip=2001:cafe::92)
t2 2/4789: (vxlan: key=123, remote_ip=2001:cafe::92)
t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=2001:cafe::93)
@@ -17,10 +17,10 @@ AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dummy@ovs-dummy: hit:0 missed:0
br0:
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p0 1/1: (dummy)
int-br:
- int-br 65534/2: (dummy)
+ int-br 65534/2: (dummy-internal)
t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=1.1.2.93)
@@ -16,7 +16,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: remote_ip=1.1.1.1)
p2 2/1: (gre: local_ip=2.2.2.2, remote_ip=1.1.1.1)
p3 3/1: (gre: remote_ip=2.2.2.2)
@@ -39,7 +39,7 @@ AT_CHECK([ovs-vsctl set Interface p2 type=gre options:local_ip=2.2.2.3 \
options:df_default=false options:ttl=1 options:csum=true \
-- set Interface p3 type=vxlan])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: remote_ip=1.1.1.1)
p2 2/1: (gre: csum=true, df_default=false, local_ip=2.2.2.3, remote_ip=1.1.1.1, ttl=1)
p3 3/4789: (vxlan: remote_ip=2.2.2.2)
@@ -74,7 +74,7 @@ actions=2
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: remote_ip=1.1.1.1)
p2 2/2: (dummy)
])
@@ -123,7 +123,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
p2 2/2: (dummy)
])
@@ -276,7 +276,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
p2 2/2: (dummy)
])
@@ -319,7 +319,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
@@ -352,7 +352,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
@@ -405,7 +405,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
p3 3/3: (dummy)
@@ -441,7 +441,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
])
@@ -453,7 +453,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
options:remote_ip=1.1.1.1 ofport_request=1])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/4789: (vxlan: remote_ip=1.1.1.1)
])
@@ -465,7 +465,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
options:remote_ip=1.1.1.1 ofport_request=1])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/4341: (lisp: remote_ip=1.1.1.1)
])
@@ -477,7 +477,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
])
@@ -486,7 +486,7 @@ dnl change UDP port
AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
])
@@ -495,7 +495,7 @@ dnl change UDP port to default
AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
- br0 65534/100: (dummy)
+ br0 65534/100: (dummy-internal)
p1 1/4789: (vxlan: remote_ip=1.1.1.1)
])
OVS_VSWITCHD_STOP
"internal" netdevs are treated specially in OVS (e.g. for MTU), but the dummy datapath remaps both "system" and "internal" devices to the same "dummy" netdev class, so there's no way to discern those in tests. This commit adds a new "dummy-internal" netdev type, which will be used by the dummy datapath for internal ports, so that other parts of the code can understand which ports are internal just by looking at the netdev object. The alternative solution, using the original interface type ("internal") instead of the translated netdev type ("dummy"), is harder to implement, because in so many places only the netdev object is available. Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> --- lib/dpif-netdev.c | 2 +- lib/netdev-dummy.c | 14 ++++++++++++-- tests/bridge.at | 6 +++--- tests/dpctl.at | 12 ++++++------ tests/mpls-xlate.at | 4 ++-- tests/netdev-type.at | 2 +- tests/ofproto-dpif.at | 18 +++++++++--------- tests/ovs-vswitchd.at | 6 +++--- tests/pmd.at | 8 ++++---- tests/tunnel-push-pop-ipv6.at | 4 ++-- tests/tunnel-push-pop.at | 4 ++-- tests/tunnel.at | 28 ++++++++++++++-------------- 12 files changed, 59 insertions(+), 49 deletions(-)