xref: /f-stack/dpdk/examples/vhost/ioat.h (revision 2d9fd380)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2020 Intel Corporation
3  */
4 
5 #ifndef _IOAT_H_
6 #define _IOAT_H_
7 
8 #include <rte_vhost.h>
9 #include <rte_pci.h>
10 #include <rte_vhost_async.h>
11 
12 #define MAX_VHOST_DEVICE 1024
13 #define IOAT_RING_SIZE 4096
14 #define MAX_ENQUEUED_SIZE 256
15 
16 struct dma_info {
17 	struct rte_pci_addr addr;
18 	uint16_t dev_id;
19 	bool is_valid;
20 };
21 
22 struct dma_for_vhost {
23 	struct dma_info dmas[RTE_MAX_QUEUES_PER_PORT * 2];
24 	uint16_t nr;
25 };
26 
27 #ifdef RTE_RAW_IOAT
28 int open_ioat(const char *value);
29 
30 uint32_t
31 ioat_transfer_data_cb(int vid, uint16_t queue_id,
32 		struct rte_vhost_async_desc *descs,
33 		struct rte_vhost_async_status *opaque_data, uint16_t count);
34 
35 uint32_t
36 ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
37 		struct rte_vhost_async_status *opaque_data,
38 		uint16_t max_packets);
39 #else
open_ioat(const char * value __rte_unused)40 static int open_ioat(const char *value __rte_unused)
41 {
42 	return -1;
43 }
44 
45 static uint32_t
ioat_transfer_data_cb(int vid __rte_unused,uint16_t queue_id __rte_unused,struct rte_vhost_async_desc * descs __rte_unused,struct rte_vhost_async_status * opaque_data __rte_unused,uint16_t count __rte_unused)46 ioat_transfer_data_cb(int vid __rte_unused, uint16_t queue_id __rte_unused,
47 		struct rte_vhost_async_desc *descs __rte_unused,
48 		struct rte_vhost_async_status *opaque_data __rte_unused,
49 		uint16_t count __rte_unused)
50 {
51 	return -1;
52 }
53 
54 static uint32_t
ioat_check_completed_copies_cb(int vid __rte_unused,uint16_t queue_id __rte_unused,struct rte_vhost_async_status * opaque_data __rte_unused,uint16_t max_packets __rte_unused)55 ioat_check_completed_copies_cb(int vid __rte_unused,
56 		uint16_t queue_id __rte_unused,
57 		struct rte_vhost_async_status *opaque_data __rte_unused,
58 		uint16_t max_packets __rte_unused)
59 {
60 	return -1;
61 }
62 #endif
63 #endif /* _IOAT_H_ */
64