1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020-2021 Xilinx, Inc.
11 #include <rte_bus_pci.h>
14 #include "sfc_efx_mcdi.h"
15 #include "sfc_vdpa_debug.h"
16 #include "sfc_vdpa_log.h"
17 #include "sfc_vdpa_ops.h"
19 #define SFC_VDPA_DEFAULT_MCDI_IOVA 0x200000000000
21 /* Adapter private data */
22 struct sfc_vdpa_adapter {
23 TAILQ_ENTRY(sfc_vdpa_adapter) next;
25 * PMD setup and configuration is not thread safe. Since it is not
26 * performance sensitive, it is better to guarantee thread-safety
27 * and add device level lock. vDPA control operations which
28 * change its state should acquire the lock.
31 struct rte_pci_device *pdev;
35 rte_spinlock_t nic_lock;
39 struct sfc_efx_mcdi mcdi;
40 size_t mcdi_buff_size;
42 uint32_t max_queue_count;
44 char log_prefix[SFC_VDPA_LOG_PREFIX_MAX];
45 uint32_t logtype_main;
49 int vfio_container_fd;
51 struct sfc_vdpa_ops_data *ops_data;
55 sfc_vdpa_register_logtype(const struct rte_pci_addr *pci_addr,
56 const char *lt_prefix_str,
59 struct sfc_vdpa_adapter *
60 sfc_vdpa_get_adapter_by_dev(struct rte_pci_device *pdev);
63 sfc_vdpa_hw_init(struct sfc_vdpa_adapter *sva);
65 sfc_vdpa_hw_fini(struct sfc_vdpa_adapter *sva);
68 sfc_vdpa_mcdi_init(struct sfc_vdpa_adapter *sva);
70 sfc_vdpa_mcdi_fini(struct sfc_vdpa_adapter *sva);
73 sfc_vdpa_dma_alloc(struct sfc_vdpa_adapter *sva, const char *name,
74 size_t len, efsys_mem_t *esmp);
77 sfc_vdpa_dma_free(struct sfc_vdpa_adapter *sva, efsys_mem_t *esmp);
79 static inline struct sfc_vdpa_adapter *
80 sfc_vdpa_adapter_by_dev_handle(void *dev_handle)
82 return (struct sfc_vdpa_adapter *)dev_handle;
85 #endif /* _SFC_VDPA_H */