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