@@ -19,7 +19,6 @@
#define MAX_PKT_BURST 32
#define MAX_WORKERS 1
-static volatile int exit_thr;
static int g_ret;
struct {
@@ -29,12 +28,6 @@ struct {
odph_ethaddr_t src, dst;
} global;
-static void sig_handler(int signo ODP_UNUSED)
-{
- printf("sig_handler!\n");
- exit_thr = 1;
-}
-
static odp_pktio_t create_pktio(const char *name, odp_pool_t pool,
odp_pktin_queue_t *pktin,
odp_pktout_queue_t *pktout)
@@ -85,6 +78,7 @@ static int run_worker(void *arg ODP_UNUSED)
odp_packet_t pkt_tbl[MAX_PKT_BURST];
int pkts, sent, tx_drops, i;
int total_pkts = 0;
+ uint64_t wait_time = odp_pktin_wait_time(2 * ODP_TIME_SEC_IN_NS);
if (odp_pktio_start(global.if0)) {
printf("unable to start input interface\n");
@@ -98,12 +92,14 @@ static int run_worker(void *arg ODP_UNUSED)
printf("started output interface\n");
printf("started all\n");
- while (!exit_thr) {
+ while (1) {
pkts = odp_pktin_recv_tmo(global.if0in, pkt_tbl, MAX_PKT_BURST,
- ODP_PKTIN_NO_WAIT);
+ wait_time);
+ if (odp_unlikely(pkts <= 0)) {
+ printf("recv tmo!\n");
+ break;
+ }
- if (odp_unlikely(pkts <= 0))
- continue;
for (i = 0; i < pkts; i++) {
odp_packet_t pkt = pkt_tbl[i];
odph_ethhdr_t *eth;
@@ -125,6 +121,8 @@ static int run_worker(void *arg ODP_UNUSED)
odp_packet_free_multi(&pkt_tbl[sent], tx_drops);
}
+ printf("Total send packets: %d\n", total_pkts);
+
if (total_pkts < 10)
g_ret = -1;
@@ -208,8 +206,6 @@ int main(int argc, char **argv)
thr_params.thr_type = ODP_THREAD_WORKER;
thr_params.instance = instance;
- signal(SIGINT, sig_handler);
-
odph_odpthreads_create(thd, &cpumask, &thr_params);
odph_odpthreads_join(thd);
@@ -11,6 +11,7 @@
# linux-generic packet mmap pktio.
#
#
+export ODP_PKTIO_DISABLE_SOCKET_MMSG=1
# directory where platform test sources are, including scripts
TEST_SRC_DIR=$(dirname $0)
@@ -64,19 +65,11 @@ PCAP_OUT=vlan_out.pcap
# Listen on veth pipe and write to pcap Send pcap
plat_mmap_vlan_ins${EXEEXT} pktiop0p1 pcap:out=${PCAP_OUT} \
00:02:03:04:05:06 00:08:09:0a:0b:0c &
-P1=$!
# Send pcap file to veth interface
-plat_mmap_vlan_ins${EXEEXT} pcap:in=${PCAP_IN} pktiop0p1 \
- 01:02:03:04:05:06 01:08:09:0a:0b:0c &
-P2=$!
+plat_mmap_vlan_ins${EXEEXT} pcap:in=${PCAP_IN} pktiop1p0 \
+ 01:02:03:04:05:06 01:08:09:0a:0b:0c
-sleep 1
-kill -s INT ${P1}
-kill -s INT ${P2}
-
-ret=$?
rm -f ${PCAP_OUT}
-
cleanup_pktio_env
-exit $ret
+exit 0
signal can be ignored and app will not exit cleanly, add time-out on recv to exit after that time. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c | 22 +++++++++------------- test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.sh | 15 ++++----------- 2 files changed, 13 insertions(+), 24 deletions(-) -- 2.7.1.250.gff4ea60