xref: /dpdk/drivers/dma/ioat/ioat_internal.h (revision fd51012de5369679e807be1d6a81d63ef15015ce)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2021 Intel Corporation
3  */
4 
5 #ifndef _IOAT_INTERNAL_H_
6 #define _IOAT_INTERNAL_H_
7 
8 #include "ioat_hw_defs.h"
9 
10 struct ioat_dmadev {
11 	struct rte_dma_dev *dmadev;
12 	struct rte_dma_vchan_conf qcfg;
13 	struct rte_dma_stats stats;
14 
15 	volatile alignas(RTE_CACHE_LINE_SIZE) uint16_t *doorbell;
16 	phys_addr_t status_addr;
17 	phys_addr_t ring_addr;
18 
19 	struct ioat_dma_hw_desc *desc_ring;
20 
21 	unsigned short next_read;
22 	unsigned short next_write;
23 	unsigned short last_write; /* Used to compute submitted count. */
24 	unsigned short offset; /* Used after a device recovery when counts -> 0. */
25 	unsigned int failure; /* Used to store chanerr for error handling. */
26 
27 	/* To report completions, the device will write status back here. */
28 	volatile alignas(RTE_CACHE_LINE_SIZE) uint64_t status;
29 
30 	/* Pointer to the register bar. */
31 	volatile struct ioat_registers *regs;
32 
33 	/* Store the IOAT version. */
34 	uint8_t version;
35 };
36 
37 extern int ioat_pmd_logtype;
38 #define RTE_LOGTYPE_IOAT_PMD ioat_pmd_logtype
39 
40 #define IOAT_PMD_LOG(level, ...) \
41 	RTE_LOG_LINE_PREFIX(level, IOAT_PMD, "%s(): ", __func__, __VA_ARGS__)
42 
43 #define IOAT_PMD_DEBUG(fmt, ...)  IOAT_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
44 #define IOAT_PMD_INFO(fmt, ...)   IOAT_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
45 #define IOAT_PMD_ERR(fmt, ...)    IOAT_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
46 #define IOAT_PMD_WARN(fmt, ...)   IOAT_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
47 
48 #endif /* _IOAT_INTERNAL_H_ */
49