1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28#ifndef _E1000_VF_H_
29#define _E1000_VF_H_
30
31#include <linux/pci.h>
32#include <linux/delay.h>
33#include <linux/interrupt.h>
34#include <linux/if_ether.h>
35
36#include "regs.h"
37#include "defines.h"
38
39struct e1000_hw;
40
41#define E1000_DEV_ID_82576_VF 0x10CA
42#define E1000_DEV_ID_I350_VF 0x1520
43#define E1000_REVISION_0 0
44#define E1000_REVISION_1 1
45#define E1000_REVISION_2 2
46#define E1000_REVISION_3 3
47#define E1000_REVISION_4 4
48
49#define E1000_FUNC_0 0
50#define E1000_FUNC_1 1
51
52
53
54
55
56
57#define E1000_RAR_ENTRIES_VF 1
58
59
60union e1000_adv_rx_desc {
61 struct {
62 u64 pkt_addr;
63 u64 hdr_addr;
64 } read;
65 struct {
66 struct {
67 union {
68 u32 data;
69 struct {
70 u16 pkt_info;
71
72 u16 hdr_info;
73 } hs_rss;
74 } lo_dword;
75 union {
76 u32 rss;
77 struct {
78 u16 ip_id;
79 u16 csum;
80 } csum_ip;
81 } hi_dword;
82 } lower;
83 struct {
84 u32 status_error;
85 u16 length;
86 u16 vlan;
87 } upper;
88 } wb;
89};
90
91#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
92#define E1000_RXDADV_HDRBUFLEN_SHIFT 5
93
94
95union e1000_adv_tx_desc {
96 struct {
97 u64 buffer_addr;
98 u32 cmd_type_len;
99 u32 olinfo_status;
100 } read;
101 struct {
102 u64 rsvd;
103 u32 nxtseq_seed;
104 u32 status;
105 } wb;
106};
107
108
109#define E1000_ADVTXD_DTYP_CTXT 0x00200000
110#define E1000_ADVTXD_DTYP_DATA 0x00300000
111#define E1000_ADVTXD_DCMD_EOP 0x01000000
112#define E1000_ADVTXD_DCMD_IFCS 0x02000000
113#define E1000_ADVTXD_DCMD_RS 0x08000000
114#define E1000_ADVTXD_DCMD_DEXT 0x20000000
115#define E1000_ADVTXD_DCMD_VLE 0x40000000
116#define E1000_ADVTXD_DCMD_TSE 0x80000000
117#define E1000_ADVTXD_PAYLEN_SHIFT 14
118
119
120struct e1000_adv_tx_context_desc {
121 u32 vlan_macip_lens;
122 u32 seqnum_seed;
123 u32 type_tucmd_mlhl;
124 u32 mss_l4len_idx;
125};
126
127#define E1000_ADVTXD_MACLEN_SHIFT 9
128#define E1000_ADVTXD_TUCMD_IPV4 0x00000400
129#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800
130#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000
131#define E1000_ADVTXD_L4LEN_SHIFT 8
132#define E1000_ADVTXD_MSS_SHIFT 16
133
134enum e1000_mac_type {
135 e1000_undefined = 0,
136 e1000_vfadapt,
137 e1000_vfadapt_i350,
138 e1000_num_macs
139};
140
141struct e1000_vf_stats {
142 u64 base_gprc;
143 u64 base_gptc;
144 u64 base_gorc;
145 u64 base_gotc;
146 u64 base_mprc;
147 u64 base_gotlbc;
148 u64 base_gptlbc;
149 u64 base_gorlbc;
150 u64 base_gprlbc;
151
152 u32 last_gprc;
153 u32 last_gptc;
154 u32 last_gorc;
155 u32 last_gotc;
156 u32 last_mprc;
157 u32 last_gotlbc;
158 u32 last_gptlbc;
159 u32 last_gorlbc;
160 u32 last_gprlbc;
161
162 u64 gprc;
163 u64 gptc;
164 u64 gorc;
165 u64 gotc;
166 u64 mprc;
167 u64 gotlbc;
168 u64 gptlbc;
169 u64 gorlbc;
170 u64 gprlbc;
171};
172
173#include "mbx.h"
174
175struct e1000_mac_operations {
176
177 s32 (*init_params)(struct e1000_hw *);
178 s32 (*check_for_link)(struct e1000_hw *);
179 void (*clear_vfta)(struct e1000_hw *);
180 s32 (*get_bus_info)(struct e1000_hw *);
181 s32 (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *);
182 void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32, u32, u32);
183 s32 (*set_uc_addr)(struct e1000_hw *, u32, u8 *);
184 s32 (*reset_hw)(struct e1000_hw *);
185 s32 (*init_hw)(struct e1000_hw *);
186 s32 (*setup_link)(struct e1000_hw *);
187 void (*write_vfta)(struct e1000_hw *, u32, u32);
188 void (*mta_set)(struct e1000_hw *, u32);
189 void (*rar_set)(struct e1000_hw *, u8*, u32);
190 s32 (*read_mac_addr)(struct e1000_hw *);
191 s32 (*set_vfta)(struct e1000_hw *, u16, bool);
192};
193
194struct e1000_mac_info {
195 struct e1000_mac_operations ops;
196 u8 addr[6];
197 u8 perm_addr[6];
198
199 enum e1000_mac_type type;
200
201 u16 mta_reg_count;
202 u16 rar_entry_count;
203
204 bool get_link_status;
205};
206
207struct e1000_mbx_operations {
208 s32 (*init_params)(struct e1000_hw *hw);
209 s32 (*read)(struct e1000_hw *, u32 *, u16);
210 s32 (*write)(struct e1000_hw *, u32 *, u16);
211 s32 (*read_posted)(struct e1000_hw *, u32 *, u16);
212 s32 (*write_posted)(struct e1000_hw *, u32 *, u16);
213 s32 (*check_for_msg)(struct e1000_hw *);
214 s32 (*check_for_ack)(struct e1000_hw *);
215 s32 (*check_for_rst)(struct e1000_hw *);
216};
217
218struct e1000_mbx_stats {
219 u32 msgs_tx;
220 u32 msgs_rx;
221
222 u32 acks;
223 u32 reqs;
224 u32 rsts;
225};
226
227struct e1000_mbx_info {
228 struct e1000_mbx_operations ops;
229 struct e1000_mbx_stats stats;
230 u32 timeout;
231 u32 usec_delay;
232 u16 size;
233};
234
235struct e1000_dev_spec_vf {
236 u32 vf_number;
237 u32 v2p_mailbox;
238};
239
240struct e1000_hw {
241 void *back;
242
243 u8 __iomem *hw_addr;
244 u8 __iomem *flash_address;
245 unsigned long io_base;
246
247 struct e1000_mac_info mac;
248 struct e1000_mbx_info mbx;
249 spinlock_t mbx_lock;
250
251 union {
252 struct e1000_dev_spec_vf vf;
253 } dev_spec;
254
255 u16 device_id;
256 u16 subsystem_vendor_id;
257 u16 subsystem_device_id;
258 u16 vendor_id;
259
260 u8 revision_id;
261};
262
263
264void e1000_rlpml_set_vf(struct e1000_hw *, u16);
265void e1000_init_function_pointers_vf(struct e1000_hw *hw);
266
267#endif
268