xref: /dpdk/drivers/dma/ioat/ioat_internal.h (revision fd51012de5369679e807be1d6a81d63ef15015ce)
1866e46bcSConor Walsh /* SPDX-License-Identifier: BSD-3-Clause
2866e46bcSConor Walsh  * Copyright 2021 Intel Corporation
3866e46bcSConor Walsh  */
4866e46bcSConor Walsh 
5866e46bcSConor Walsh #ifndef _IOAT_INTERNAL_H_
6866e46bcSConor Walsh #define _IOAT_INTERNAL_H_
7866e46bcSConor Walsh 
8866e46bcSConor Walsh #include "ioat_hw_defs.h"
9866e46bcSConor Walsh 
1013859ab7SConor Walsh struct ioat_dmadev {
1113859ab7SConor Walsh 	struct rte_dma_dev *dmadev;
1213859ab7SConor Walsh 	struct rte_dma_vchan_conf qcfg;
1313859ab7SConor Walsh 	struct rte_dma_stats stats;
1413859ab7SConor Walsh 
1527595cd8STyler Retzlaff 	volatile alignas(RTE_CACHE_LINE_SIZE) uint16_t *doorbell;
1613859ab7SConor Walsh 	phys_addr_t status_addr;
1713859ab7SConor Walsh 	phys_addr_t ring_addr;
1813859ab7SConor Walsh 
1913859ab7SConor Walsh 	struct ioat_dma_hw_desc *desc_ring;
2013859ab7SConor Walsh 
2113859ab7SConor Walsh 	unsigned short next_read;
2213859ab7SConor Walsh 	unsigned short next_write;
2313859ab7SConor Walsh 	unsigned short last_write; /* Used to compute submitted count. */
2413859ab7SConor Walsh 	unsigned short offset; /* Used after a device recovery when counts -> 0. */
2513859ab7SConor Walsh 	unsigned int failure; /* Used to store chanerr for error handling. */
2613859ab7SConor Walsh 
2713859ab7SConor Walsh 	/* To report completions, the device will write status back here. */
2827595cd8STyler Retzlaff 	volatile alignas(RTE_CACHE_LINE_SIZE) uint64_t status;
2913859ab7SConor Walsh 
3013859ab7SConor Walsh 	/* Pointer to the register bar. */
3113859ab7SConor Walsh 	volatile struct ioat_registers *regs;
3213859ab7SConor Walsh 
3313859ab7SConor Walsh 	/* Store the IOAT version. */
3413859ab7SConor Walsh 	uint8_t version;
3513859ab7SConor Walsh };
3613859ab7SConor Walsh 
37866e46bcSConor Walsh extern int ioat_pmd_logtype;
382b843cacSDavid Marchand #define RTE_LOGTYPE_IOAT_PMD ioat_pmd_logtype
39866e46bcSConor Walsh 
402b843cacSDavid Marchand #define IOAT_PMD_LOG(level, ...) \
412b843cacSDavid Marchand 	RTE_LOG_LINE_PREFIX(level, IOAT_PMD, "%s(): ", __func__, __VA_ARGS__)
42866e46bcSConor Walsh 
43*fd51012dSAndre Muezerie #define IOAT_PMD_DEBUG(fmt, ...)  IOAT_PMD_LOG(DEBUG, fmt, ## __VA_ARGS__)
44*fd51012dSAndre Muezerie #define IOAT_PMD_INFO(fmt, ...)   IOAT_PMD_LOG(INFO, fmt, ## __VA_ARGS__)
45*fd51012dSAndre Muezerie #define IOAT_PMD_ERR(fmt, ...)    IOAT_PMD_LOG(ERR, fmt, ## __VA_ARGS__)
46*fd51012dSAndre Muezerie #define IOAT_PMD_WARN(fmt, ...)   IOAT_PMD_LOG(WARNING, fmt, ## __VA_ARGS__)
47866e46bcSConor Walsh 
48866e46bcSConor Walsh #endif /* _IOAT_INTERNAL_H_ */
49