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