1
2
3
4#ifndef _I40E_CLIENT_H_
5#define _I40E_CLIENT_H_
6
7#define I40E_CLIENT_STR_LENGTH 10
8
9
10
11
12#define I40E_CLIENT_VERSION_MAJOR 0
13#define I40E_CLIENT_VERSION_MINOR 01
14#define I40E_CLIENT_VERSION_BUILD 00
15#define I40E_CLIENT_VERSION_STR \
16 __stringify(I40E_CLIENT_VERSION_MAJOR) "." \
17 __stringify(I40E_CLIENT_VERSION_MINOR) "." \
18 __stringify(I40E_CLIENT_VERSION_BUILD)
19
20struct i40e_client_version {
21 u8 major;
22 u8 minor;
23 u8 build;
24 u8 rsvd;
25};
26
27enum i40e_client_state {
28 __I40E_CLIENT_NULL,
29 __I40E_CLIENT_REGISTERED
30};
31
32enum i40e_client_instance_state {
33 __I40E_CLIENT_INSTANCE_NONE,
34 __I40E_CLIENT_INSTANCE_OPENED,
35};
36
37struct i40e_ops;
38struct i40e_client;
39
40
41
42
43
44#define I40E_QUEUE_TYPE_PE_AEQ 0x80
45#define I40E_QUEUE_INVALID_IDX 0xFFFF
46
47struct i40e_qv_info {
48 u32 v_idx;
49 u16 ceq_idx;
50 u16 aeq_idx;
51 u8 itr_idx;
52};
53
54struct i40e_qvlist_info {
55 u32 num_vectors;
56 struct i40e_qv_info qv_info[1];
57};
58
59#define I40E_CLIENT_MSIX_ALL 0xFFFFFFFF
60
61
62
63
64struct i40e_prio_qos_params {
65 u16 qs_handle;
66 u8 tc;
67 u8 reserved;
68};
69
70#define I40E_CLIENT_MAX_USER_PRIORITY 8
71
72struct i40e_qos_params {
73 struct i40e_prio_qos_params prio_qos[I40E_CLIENT_MAX_USER_PRIORITY];
74};
75
76struct i40e_params {
77 struct i40e_qos_params qos;
78 u16 mtu;
79};
80
81
82struct i40e_info {
83 struct i40e_client_version version;
84 u8 lanmac[6];
85 struct net_device *netdev;
86 struct pci_dev *pcidev;
87 u8 __iomem *hw_addr;
88 u8 fid;
89#define I40E_CLIENT_FTYPE_PF 0
90#define I40E_CLIENT_FTYPE_VF 1
91 u8 ftype;
92 void *pf;
93
94
95
96
97 struct i40e_qvlist_info *qvlist_info;
98 struct i40e_params params;
99 struct i40e_ops *ops;
100
101 u16 msix_count;
102
103 struct msix_entry *msix_entries;
104 u16 itr_index;
105 u16 fw_maj_ver;
106 u16 fw_min_ver;
107 u32 fw_build;
108};
109
110#define I40E_CLIENT_RESET_LEVEL_PF 1
111#define I40E_CLIENT_RESET_LEVEL_CORE 2
112#define I40E_CLIENT_VSI_FLAG_TCP_ENABLE BIT(1)
113
114struct i40e_ops {
115
116 int (*setup_qvlist)(struct i40e_info *ldev, struct i40e_client *client,
117 struct i40e_qvlist_info *qv_info);
118
119 int (*virtchnl_send)(struct i40e_info *ldev, struct i40e_client *client,
120 u32 vf_id, u8 *msg, u16 len);
121
122
123
124
125 void (*request_reset)(struct i40e_info *ldev,
126 struct i40e_client *client, u32 level);
127
128
129
130
131 int (*update_vsi_ctxt)(struct i40e_info *ldev,
132 struct i40e_client *client,
133 bool is_vf, u32 vf_id,
134 u32 flag, u32 valid_flag);
135};
136
137struct i40e_client_ops {
138
139
140
141 int (*open)(struct i40e_info *ldev, struct i40e_client *client);
142
143
144
145
146
147 void (*close)(struct i40e_info *ldev, struct i40e_client *client,
148 bool reset);
149
150
151 void (*l2_param_change)(struct i40e_info *ldev,
152 struct i40e_client *client,
153 struct i40e_params *params);
154
155 int (*virtchnl_receive)(struct i40e_info *ldev,
156 struct i40e_client *client, u32 vf_id,
157 u8 *msg, u16 len);
158
159
160 void (*vf_reset)(struct i40e_info *ldev,
161 struct i40e_client *client, u32 vf_id);
162
163
164 void (*vf_enable)(struct i40e_info *ldev,
165 struct i40e_client *client, u32 num_vfs);
166
167
168 int (*vf_capable)(struct i40e_info *ldev,
169 struct i40e_client *client, u32 vf_id);
170};
171
172
173struct i40e_client_instance {
174 struct list_head list;
175 struct i40e_info lan_info;
176 struct i40e_client *client;
177 unsigned long state;
178};
179
180struct i40e_client {
181 struct list_head list;
182 char name[I40E_CLIENT_STR_LENGTH];
183 struct i40e_client_version version;
184 unsigned long state;
185 atomic_t ref_cnt;
186 u32 flags;
187#define I40E_CLIENT_FLAGS_LAUNCH_ON_PROBE BIT(0)
188#define I40E_TX_FLAGS_NOTIFY_OTHER_EVENTS BIT(2)
189 u8 type;
190#define I40E_CLIENT_IWARP 0
191 const struct i40e_client_ops *ops;
192};
193
194static inline bool i40e_client_is_registered(struct i40e_client *client)
195{
196 return test_bit(__I40E_CLIENT_REGISTERED, &client->state);
197}
198
199
200int i40e_register_client(struct i40e_client *client);
201int i40e_unregister_client(struct i40e_client *client);
202
203#endif
204