+ struct netdev_rx_dummy *rx = netdev_rx_dummy_cast(rx_);
+ ofpbuf_list_delete(&rx->recv_queue);
+ rx->recv_queue_len = 0;
+ return 0;
+}
+
+static int
+netdev_dummy_send(struct netdev *netdev, const void *buffer, size_t size)
+{
+ struct netdev_dummy *dev = netdev_dummy_cast(netdev);
+ size_t i;
+
+ if (size < ETH_HEADER_LEN) {
+ return EMSGSIZE;
+ } else {
+ const struct eth_header *eth = buffer;
+ int max_size;
+
+ max_size = dev->mtu + ETH_HEADER_LEN;
+ if (eth->eth_type == htons(ETH_TYPE_VLAN)) {
+ max_size += VLAN_HEADER_LEN;
+ }
+ if (size > max_size) {
+ return EMSGSIZE;
+ }
+ }
+
+ dev->stats.tx_packets++;
+ dev->stats.tx_bytes += size;
+
+ for (i = 0; i < dev->n_streams; i++) {
+ struct dummy_stream *s = &dev->streams[i];
+
+ if (list_size(&s->txq) < NETDEV_DUMMY_MAX_QUEUE) {
+ struct ofpbuf *b;
+
+ b = ofpbuf_clone_data_with_headroom(buffer, size, 2);
+ put_unaligned_be16(ofpbuf_push_uninit(b, 2), htons(size));
+ list_push_back(&s->txq, &b->list_node);
+ }
+ }
+