#!/usr/bin/env bash ################################################################################ # Test objective: check if a zero-copy monitor receives frames when its # monitored persistent VALE port is sending, even if the # destination port hasn't yet read the frame (this happens # because VALE switches do not use zero-copy). # Operations: # 0) restart fd_server to have a clean starting state # 1) create a persistent VALE port (v0). # 2) connect v0 and a VALE ephimeral port (v1) to the same VALE switch. # 3) open a zero-copy monitor v0/z for v0. # 4) send from v0 and don't read from v1, check that v0/z receives the frame. # 5) receive from v1. ################################################################################ source test_lib parse_send_recv_arguments "$@" verbosity="${verbosity:-}" fill="${fill:-d}" len="${len:-150}" num="${num:-1}" seq="${seq:-}" restart_fd_server create_vale_persistent_port "v0" attach_to_vale_bridge "vale0" "v0" # Pre-opening interface that will be needed. This is needed to avoid a race # condition between the sending and receiving ports. functional $verbosity -i vale0:v0 check_success $? "pre-open vale0:v0" functional $verbosity -i netmap:v0/z check_success $? "pre-open netmap:v0/z" functional $verbosity -i vale0:v1 check_success $? "pre-open vale0:v1" # First we send without reading from v1 functional $verbosity -i netmap:v0/z -r "${len}:${fill}:${num}" $seq & p1=$! functional $verbosity -i vale0:v0 -t "${len}:${fill}:${num}" $seq e2=$? wait $p1 e1=$? check_success $e1 "receive-${num} netmap:v0/z" check_success $e2 "send-${num} vale0:v0" # Then we read from v1 functional $verbosity -i vale0:v1 -r "${len}:${fill}:${num}" $seq e3=$? check_success $e3 "receive-${num} vale0:v1" test_successful "$0"