xref: /dpdk/app/test/virtual_pmd.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1a9de470cSBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
2a9de470cSBruce Richardson  * Copyright(c) 2010-2014 Intel Corporation
3a9de470cSBruce Richardson  */
4a9de470cSBruce Richardson 
5a9de470cSBruce Richardson #ifndef __VIRTUAL_ETHDEV_H_
6a9de470cSBruce Richardson #define __VIRTUAL_ETHDEV_H_
7a9de470cSBruce Richardson 
8*719834a6SMattias Rönnblom #include <rte_ether.h>
9*719834a6SMattias Rönnblom 
10a9de470cSBruce Richardson #ifdef __cplusplus
11a9de470cSBruce Richardson extern "C" {
12a9de470cSBruce Richardson #endif
13a9de470cSBruce Richardson 
14a9de470cSBruce Richardson int
15a9de470cSBruce Richardson virtual_ethdev_init(void);
16a9de470cSBruce Richardson 
17a9de470cSBruce Richardson int
186d13ea8eSOlivier Matz virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr,
19a9de470cSBruce Richardson 		uint8_t socket_id, uint8_t isr_support);
20a9de470cSBruce Richardson 
21a9de470cSBruce Richardson void
22a9de470cSBruce Richardson virtual_ethdev_set_link_status(uint16_t port_id, uint8_t link_status);
23a9de470cSBruce Richardson 
24a9de470cSBruce Richardson void
25a9de470cSBruce Richardson virtual_ethdev_simulate_link_status_interrupt(uint16_t port_id,
26a9de470cSBruce Richardson 		uint8_t link_status);
27a9de470cSBruce Richardson 
28a9de470cSBruce Richardson int
29a9de470cSBruce Richardson virtual_ethdev_add_mbufs_to_rx_queue(uint16_t port_id,
30a9de470cSBruce Richardson 		struct rte_mbuf **pkts_burst, int burst_length);
31a9de470cSBruce Richardson 
32a9de470cSBruce Richardson int
33a9de470cSBruce Richardson virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id,
34a9de470cSBruce Richardson 		struct rte_mbuf **pkt_burst, int burst_length);
35a9de470cSBruce Richardson 
36a9de470cSBruce Richardson /** Control methods for the dev_ops functions pointer to control the behavior
37a9de470cSBruce Richardson  *  of the Virtual PMD */
38a9de470cSBruce Richardson 
39a9de470cSBruce Richardson void
40a9de470cSBruce Richardson virtual_ethdev_start_fn_set_success(uint16_t port_id, uint8_t success);
41a9de470cSBruce Richardson 
42a9de470cSBruce Richardson void
43a9de470cSBruce Richardson virtual_ethdev_stop_fn_set_success(uint16_t port_id, uint8_t success);
44a9de470cSBruce Richardson 
45a9de470cSBruce Richardson void
46a9de470cSBruce Richardson virtual_ethdev_configure_fn_set_success(uint16_t port_id, uint8_t success);
47a9de470cSBruce Richardson 
48a9de470cSBruce Richardson void
49a9de470cSBruce Richardson virtual_ethdev_rx_queue_setup_fn_set_success(uint16_t port_id,
50a9de470cSBruce Richardson 					      uint8_t success);
51a9de470cSBruce Richardson 
52a9de470cSBruce Richardson void
53a9de470cSBruce Richardson virtual_ethdev_tx_queue_setup_fn_set_success(uint16_t port_id,
54a9de470cSBruce Richardson 					      uint8_t success);
55a9de470cSBruce Richardson 
56a9de470cSBruce Richardson void
57a9de470cSBruce Richardson virtual_ethdev_link_update_fn_set_success(uint16_t port_id, uint8_t success);
58a9de470cSBruce Richardson 
59a9de470cSBruce Richardson void
60a9de470cSBruce Richardson virtual_ethdev_rx_burst_fn_set_success(uint16_t port_id, uint8_t success);
61a9de470cSBruce Richardson 
62a9de470cSBruce Richardson void
63a9de470cSBruce Richardson virtual_ethdev_tx_burst_fn_set_success(uint16_t port_id, uint8_t success);
64a9de470cSBruce Richardson 
65a9de470cSBruce Richardson /* if a value greater than zero is set for packet_fail_count then virtual
66a9de470cSBruce Richardson  * device tx burst function will fail that many packet from burst or all
67a9de470cSBruce Richardson  * packets if packet_fail_count is greater than the number of packets in the
68a9de470cSBruce Richardson  * burst */
69a9de470cSBruce Richardson void
70a9de470cSBruce Richardson virtual_ethdev_tx_burst_fn_set_tx_pkt_fail_count(uint16_t port_id,
71a9de470cSBruce Richardson 		uint8_t packet_fail_count);
72a9de470cSBruce Richardson 
73a9de470cSBruce Richardson #ifdef __cplusplus
74a9de470cSBruce Richardson }
75a9de470cSBruce Richardson #endif
76a9de470cSBruce Richardson 
77a9de470cSBruce Richardson #endif /* __VIRTUAL_ETHDEV_H_ */
78