From 323cc924088d7d99d1868892dc48ba2c8e8cf2d0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 28 May 2013 11:23:29 -0700 Subject: [PATCH] netdev-dummy: Drop "nobody listened" reply from netdev-dummy/receive. Ethan pointed out that this wasn't very useful. Signed-off-by: Ben Pfaff --- lib/netdev-dummy.c | 18 +++--------------- tests/ofproto-dpif.at | 24 ++++++++---------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index ad35fb7e3..58a4535ed 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -435,24 +435,19 @@ eth_from_packet_or_flow(const char *s) return packet; } -static int +static void netdev_dummy_queue_packet(struct netdev_dummy *dummy, const void *data, size_t size) { struct netdev_rx_dummy *rx; - int n_listeners; - n_listeners = 0; LIST_FOR_EACH (rx, node, &dummy->rxes) { if (rx->recv_queue_len < NETDEV_DUMMY_MAX_QUEUE) { struct ofpbuf *copy = ofpbuf_clone_data(data, size); list_push_back(&rx->recv_queue, ©->list_node); rx->recv_queue_len++; - n_listeners++; } } - - return n_listeners; } static void @@ -460,7 +455,6 @@ netdev_dummy_receive(struct unixctl_conn *conn, int argc, const char *argv[], void *aux OVS_UNUSED) { struct netdev_dummy *dummy_dev; - int n_listeners; int i; dummy_dev = shash_find_data(&dummy_netdevs, argv[1]); @@ -469,7 +463,6 @@ netdev_dummy_receive(struct unixctl_conn *conn, return; } - n_listeners = 0; for (i = 2; i < argc; i++) { struct ofpbuf *packet; @@ -482,16 +475,11 @@ netdev_dummy_receive(struct unixctl_conn *conn, dummy_dev->stats.rx_packets++; dummy_dev->stats.rx_bytes += packet->size; - n_listeners += netdev_dummy_queue_packet(dummy_dev, - packet->data, packet->size); + netdev_dummy_queue_packet(dummy_dev, packet->data, packet->size); ofpbuf_delete(packet); } - if (!n_listeners) { - unixctl_command_reply(conn, "packets queued but nobody listened"); - } else { - unixctl_command_reply(conn, "success"); - } + unixctl_command_reply(conn, NULL); } static void diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index ff007cddb..3b816afdc 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -1986,8 +1986,7 @@ AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], # flow stats updates are mainly what implements the fin_timeout # feature, we warp forward a couple of times to ensure that flow stats # run before re-checking the flow table.) -AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307], [0], [success -]) +AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307]) AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped warped ]) @@ -1996,8 +1995,7 @@ AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5) ]) # Check that a TCP FIN packet does change the timeout. -AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588], [0], [success -]) +AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588]) AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped warped ]) @@ -2059,12 +2057,9 @@ OVS_VSWITCHD_START([add-br br1 -- \ ADD_OF_PORTS([br0], [1], [2]) ADD_OF_PORTS([br1], [3]) -AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'], [0], [success -]) -AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'], [0], [success -]) -AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'], [0], [success -]) +AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) +AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)']) +AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller)) @@ -2084,12 +2079,9 @@ OVS_VSWITCHD_START([add-br br1 -- \ ADD_OF_PORTS([br0], [1], [2]) ADD_OF_PORTS([br1], [3]) -AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'], [0], [success -]) -AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'], [0], [success -]) -AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'], [0], [success -]) +AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) +AT_CHECK([ovs-appctl netdev-dummy/receive p2 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)']) +AT_CHECK([ovs-appctl netdev-dummy/receive p3 'in_port(3),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)']) AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:0, bytes:0, used:0.0s, actions:userspace(pid=0,slow_path(controller)) -- 2.43.0