1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Intel Corporation 3 */ 4 5 #ifndef _SAMPLE_PACKET_FORWARD_H_ 6 #define _SAMPLE_PACKET_FORWARD_H_ 7 8 #include <stdint.h> 9 10 /* MACROS to support virtual ring creation */ 11 #define RING_SIZE 256 12 #define NUM_QUEUES 1 13 #define NB_MBUF 512 14 15 #define NUM_PACKETS 10 16 17 struct rte_mbuf; 18 struct rte_mempool; 19 struct rte_ring; 20 21 /* Sample test to create virtual rings and tx,rx portid from rings */ 22 int test_ring_setup(struct rte_ring **ring, uint16_t *portid); 23 24 /* Sample test to free the virtual rings */ 25 void test_ring_free(struct rte_ring *rxtx); 26 27 /* Sample test to forward packet using virtual port id */ 28 int test_packet_forward(struct rte_mbuf **pbuf, uint16_t portid, 29 uint16_t queue_id); 30 31 /* sample test to allocate buffer for pkts */ 32 int test_get_mbuf_from_pool(struct rte_mempool **mp, struct rte_mbuf **pbuf, 33 char *poolname); 34 35 /* Sample test to create the mempool */ 36 int test_get_mempool(struct rte_mempool **mp, char *poolname); 37 38 /* sample test to deallocate the allocated buffers and mempool */ 39 void test_put_mbuf_to_pool(struct rte_mempool *mp, struct rte_mbuf **pbuf); 40 41 /* Sample test to free the mempool */ 42 void test_mp_free(struct rte_mempool *mp); 43 44 /* Sample test to release the vdev */ 45 void test_vdev_uninit(const char *vdev); 46 47 #endif /* _SAMPLE_PACKET_FORWARD_H_ */ 48