1*d1f59fb7SJerin Jacob /* 2*d1f59fb7SJerin Jacob * BSD LICENSE 3*d1f59fb7SJerin Jacob * 4*d1f59fb7SJerin Jacob * Copyright (C) Cavium 2017. 5*d1f59fb7SJerin Jacob * 6*d1f59fb7SJerin Jacob * Redistribution and use in source and binary forms, with or without 7*d1f59fb7SJerin Jacob * modification, are permitted provided that the following conditions 8*d1f59fb7SJerin Jacob * are met: 9*d1f59fb7SJerin Jacob * 10*d1f59fb7SJerin Jacob * * Redistributions of source code must retain the above copyright 11*d1f59fb7SJerin Jacob * notice, this list of conditions and the following disclaimer. 12*d1f59fb7SJerin Jacob * * Redistributions in binary form must reproduce the above copyright 13*d1f59fb7SJerin Jacob * notice, this list of conditions and the following disclaimer in 14*d1f59fb7SJerin Jacob * the documentation and/or other materials provided with the 15*d1f59fb7SJerin Jacob * distribution. 16*d1f59fb7SJerin Jacob * * Neither the name of Cavium networks nor the names of its 17*d1f59fb7SJerin Jacob * contributors may be used to endorse or promote products derived 18*d1f59fb7SJerin Jacob * from this software without specific prior written permission. 19*d1f59fb7SJerin Jacob * 20*d1f59fb7SJerin Jacob * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21*d1f59fb7SJerin Jacob * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*d1f59fb7SJerin Jacob * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23*d1f59fb7SJerin Jacob * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24*d1f59fb7SJerin Jacob * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25*d1f59fb7SJerin Jacob * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26*d1f59fb7SJerin Jacob * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27*d1f59fb7SJerin Jacob * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28*d1f59fb7SJerin Jacob * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29*d1f59fb7SJerin Jacob * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30*d1f59fb7SJerin Jacob * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*d1f59fb7SJerin Jacob */ 32*d1f59fb7SJerin Jacob 33*d1f59fb7SJerin Jacob #ifndef _TEST_ORDER_COMMON_ 34*d1f59fb7SJerin Jacob #define _TEST_ORDER_COMMON_ 35*d1f59fb7SJerin Jacob 36*d1f59fb7SJerin Jacob #include <stdio.h> 37*d1f59fb7SJerin Jacob #include <stdbool.h> 38*d1f59fb7SJerin Jacob 39*d1f59fb7SJerin Jacob #include <rte_cycles.h> 40*d1f59fb7SJerin Jacob #include <rte_eventdev.h> 41*d1f59fb7SJerin Jacob #include <rte_lcore.h> 42*d1f59fb7SJerin Jacob #include <rte_malloc.h> 43*d1f59fb7SJerin Jacob #include <rte_mbuf.h> 44*d1f59fb7SJerin Jacob 45*d1f59fb7SJerin Jacob #include "evt_common.h" 46*d1f59fb7SJerin Jacob #include "evt_options.h" 47*d1f59fb7SJerin Jacob #include "evt_test.h" 48*d1f59fb7SJerin Jacob 49*d1f59fb7SJerin Jacob #define BURST_SIZE 16 50*d1f59fb7SJerin Jacob 51*d1f59fb7SJerin Jacob struct test_order; 52*d1f59fb7SJerin Jacob 53*d1f59fb7SJerin Jacob struct worker_data { 54*d1f59fb7SJerin Jacob uint8_t dev_id; 55*d1f59fb7SJerin Jacob uint8_t port_id; 56*d1f59fb7SJerin Jacob struct test_order *t; 57*d1f59fb7SJerin Jacob }; 58*d1f59fb7SJerin Jacob 59*d1f59fb7SJerin Jacob struct prod_data { 60*d1f59fb7SJerin Jacob uint8_t dev_id; 61*d1f59fb7SJerin Jacob uint8_t port_id; 62*d1f59fb7SJerin Jacob uint8_t queue_id; 63*d1f59fb7SJerin Jacob struct test_order *t; 64*d1f59fb7SJerin Jacob }; 65*d1f59fb7SJerin Jacob 66*d1f59fb7SJerin Jacob struct test_order { 67*d1f59fb7SJerin Jacob /* Don't change the offset of "err". Signal handler use this memory 68*d1f59fb7SJerin Jacob * to terminate all lcores work. 69*d1f59fb7SJerin Jacob */ 70*d1f59fb7SJerin Jacob int err; 71*d1f59fb7SJerin Jacob /* 72*d1f59fb7SJerin Jacob * The atomic_* is an expensive operation,Since it is a functional test, 73*d1f59fb7SJerin Jacob * We are using the atomic_ operation to reduce the code complexity. 74*d1f59fb7SJerin Jacob */ 75*d1f59fb7SJerin Jacob rte_atomic64_t outstand_pkts; 76*d1f59fb7SJerin Jacob enum evt_test_result result; 77*d1f59fb7SJerin Jacob uint32_t nb_flows; 78*d1f59fb7SJerin Jacob uint64_t nb_pkts; 79*d1f59fb7SJerin Jacob struct rte_mempool *pool; 80*d1f59fb7SJerin Jacob struct prod_data prod; 81*d1f59fb7SJerin Jacob struct worker_data worker[EVT_MAX_PORTS]; 82*d1f59fb7SJerin Jacob uint32_t *producer_flow_seq; 83*d1f59fb7SJerin Jacob uint32_t *expected_flow_seq; 84*d1f59fb7SJerin Jacob struct evt_options *opt; 85*d1f59fb7SJerin Jacob } __rte_cache_aligned; 86*d1f59fb7SJerin Jacob 87*d1f59fb7SJerin Jacob int order_test_setup(struct evt_test *test, struct evt_options *opt); 88*d1f59fb7SJerin Jacob void order_test_destroy(struct evt_test *test, struct evt_options *opt); 89*d1f59fb7SJerin Jacob 90*d1f59fb7SJerin Jacob #endif /* _TEST_ORDER_COMMON_ */ 91