xref: /dpdk/app/test/sample_packet_forward.h (revision b66412f24f17fcba5a248888bf4b3c1f5d6880de)
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 /* configure and start device created by test_ring_setup */
25 int test_dev_start(uint16_t port, struct rte_mempool *mp);
26 
27 /* Sample test to free the virtual rings */
28 void test_ring_free(struct rte_ring *rxtx);
29 
30 /* Sample test to forward packet using virtual port id */
31 int test_packet_forward(struct rte_mbuf **pbuf, uint16_t portid,
32 		uint16_t queue_id);
33 
34 /* sample test to allocate buffer for pkts */
35 int test_get_mbuf_from_pool(struct rte_mempool **mp, struct rte_mbuf **pbuf,
36 		char *poolname);
37 
38 /* Sample test to create the mempool */
39 int test_get_mempool(struct rte_mempool **mp, char *poolname);
40 
41 /* sample test to deallocate the allocated buffers and mempool */
42 void test_put_mbuf_to_pool(struct rte_mempool *mp, struct rte_mbuf **pbuf);
43 
44 /* Sample test to free the mempool */
45 void test_mp_free(struct rte_mempool *mp);
46 
47 /* Sample test to release the vdev */
48 void test_vdev_uninit(const char *vdev);
49 
50 #endif /* _SAMPLE_PACKET_FORWARD_H_ */
51