1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2016 Cavium, Inc 3 */ 4 5 #ifndef _THUNDERX_NICVF_STRUCT_H 6 #define _THUNDERX_NICVF_STRUCT_H 7 8 #include <stdint.h> 9 10 #include <rte_spinlock.h> 11 #include <rte_mempool.h> 12 #include <rte_mbuf.h> 13 #include <rte_interrupts.h> 14 #include <rte_ethdev_driver.h> 15 #include <rte_memory.h> 16 17 struct nicvf_rbdr { 18 uintptr_t rbdr_status; 19 uintptr_t rbdr_door; 20 struct rbdr_entry_t *desc; 21 nicvf_iova_addr_t phys; 22 uint32_t buffsz; 23 uint32_t tail; 24 uint32_t next_tail; 25 uint32_t head; 26 uint32_t qlen_mask; 27 } __rte_cache_aligned; 28 29 struct nicvf_txq { 30 union sq_entry_t *desc; 31 nicvf_iova_addr_t phys; 32 struct rte_mbuf **txbuffs; 33 uintptr_t sq_head; 34 uintptr_t sq_door; 35 struct rte_mempool *pool; 36 struct nicvf *nic; 37 void (*pool_free)(struct nicvf_txq *sq); 38 uint32_t head; 39 uint32_t tail; 40 int32_t xmit_bufs; 41 uint32_t qlen_mask; 42 uint64_t offloads; 43 uint16_t queue_id; 44 uint16_t tx_free_thresh; 45 } __rte_cache_aligned; 46 47 union mbuf_initializer { 48 struct { 49 uint16_t data_off; 50 uint16_t refcnt; 51 uint16_t nb_segs; 52 uint16_t port; 53 } fields; 54 uint64_t value; 55 }; 56 57 struct nicvf_rxq { 58 uint64_t mbuf_phys_off; 59 uintptr_t cq_status; 60 uintptr_t cq_door; 61 union mbuf_initializer mbuf_initializer; 62 nicvf_iova_addr_t phys; 63 union cq_entry_t *desc; 64 struct nicvf_rbdr *shared_rbdr; 65 struct nicvf *nic; 66 struct rte_mempool *pool; 67 uint32_t head; 68 uint32_t qlen_mask; 69 int32_t available_space; 70 int32_t recv_buffers; 71 uint16_t rx_free_thresh; 72 uint16_t queue_id; 73 uint16_t precharge_cnt; 74 uint8_t rx_drop_en; 75 uint16_t port_id; 76 uint8_t rbptr_offset; 77 } __rte_cache_aligned; 78 79 struct nicvf { 80 uint8_t vf_id; 81 uint8_t node; 82 uintptr_t reg_base; 83 bool tns_mode; 84 bool sqs_mode; 85 bool loopback_supported; 86 bool pf_acked:1; 87 bool pf_nacked:1; 88 uint64_t hwcap; 89 uint8_t link_up; 90 uint8_t duplex; 91 uint32_t speed; 92 uint32_t msg_enable; 93 uint16_t device_id; 94 uint16_t vendor_id; 95 uint16_t subsystem_device_id; 96 uint16_t subsystem_vendor_id; 97 struct nicvf_rbdr *rbdr; 98 struct nicvf_rss_reta_info rss_info; 99 struct rte_intr_handle intr_handle; 100 uint8_t cpi_alg; 101 uint16_t mtu; 102 bool vlan_filter_en; 103 uint8_t mac_addr[ETHER_ADDR_LEN]; 104 /* secondary queue set support */ 105 uint8_t sqs_id; 106 uint8_t sqs_count; 107 #define MAX_SQS_PER_VF 11 108 struct nicvf *snicvf[MAX_SQS_PER_VF]; 109 } __rte_cache_aligned; 110 111 #endif /* _THUNDERX_NICVF_STRUCT_H */ 112