xref: /dpdk/drivers/net/thunderx/nicvf_struct.h (revision e12a0166c80f65e35408f4715b2f3a60763c3741)
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 <ethdev_driver.h>
15 #include <rte_memory.h>
16 
17 struct __rte_cache_aligned 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 	RTE_ATOMIC(uint32_t) tail;
24 	RTE_ATOMIC(uint32_t) next_tail;
25 	uint32_t head;
26 	uint32_t qlen_mask;
27 };
28 
29 struct __rte_cache_aligned 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 };
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 __rte_cache_aligned nicvf_rxq {
58 	RTE_MARKER rxq_fastpath_data_start;
59 	uint8_t  rbptr_offset;
60 	uint16_t rx_free_thresh;
61 	uint32_t head;
62 	uint32_t qlen_mask;
63 	int32_t recv_buffers;
64 	int32_t available_space;
65 	uint64_t mbuf_phys_off;
66 	uintptr_t cq_status;
67 	uintptr_t cq_door;
68 	struct nicvf_rbdr *shared_rbdr;
69 	struct rte_mempool *pool;
70 	union cq_entry_t *desc;
71 	union mbuf_initializer mbuf_initializer;
72 	RTE_MARKER rxq_fastpath_data_end;
73 	uint8_t rx_drop_en;
74 	uint16_t precharge_cnt;
75 	uint16_t port_id;
76 	uint16_t queue_id;
77 	struct nicvf *nic;
78 	nicvf_iova_addr_t phys;
79 };
80 
81 struct __rte_cache_aligned nicvf {
82 	uint8_t vf_id;
83 	uint8_t node;
84 	uintptr_t reg_base;
85 	bool tns_mode;
86 	bool sqs_mode;
87 	bool loopback_supported;
88 	bool pf_acked:1;
89 	bool pf_nacked:1;
90 	bool offload_cksum:1;
91 	bool vlan_strip:1;
92 	uint64_t hwcap;
93 	uint8_t link_up;
94 	uint8_t	duplex;
95 	uint32_t speed;
96 	uint32_t msg_enable;
97 	uint16_t device_id;
98 	uint16_t vendor_id;
99 	uint16_t subsystem_device_id;
100 	uint16_t subsystem_vendor_id;
101 	struct nicvf_rbdr *rbdr;
102 	struct nicvf_rss_reta_info rss_info;
103 	struct rte_intr_handle *intr_handle;
104 	uint8_t cpi_alg;
105 	uint16_t mtu;
106 	int skip_bytes;
107 	bool vlan_filter_en;
108 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
109 	/* secondary queue set support */
110 	uint8_t sqs_id;
111 	uint8_t sqs_count;
112 #define MAX_SQS_PER_VF 11
113 	struct nicvf *snicvf[MAX_SQS_PER_VF];
114 };
115 
116 struct change_link_mode {
117 	bool	   enable;
118 	uint8_t    qlm_mode;
119 	bool	   autoneg;
120 	uint8_t    duplex;
121 	uint32_t   speed;
122 
123 };
124 
125 #endif /* _THUNDERX_NICVF_STRUCT_H */
126