]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2017 Intel Corporation | |
3 | */ | |
4 | ||
5 | #ifndef _PMD_I40E_H_ | |
6 | #define _PMD_I40E_H_ | |
7 | ||
8 | /** | |
9 | * @file rte_pmd_i40e.h | |
10 | * | |
11 | * i40e PMD specific functions. | |
12 | * | |
13 | * @b EXPERIMENTAL: this API may change, or be removed, without prior notice | |
14 | * | |
15 | */ | |
16 | ||
17 | #include <rte_ethdev_driver.h> | |
18 | ||
19 | /** | |
20 | * Response sent back to i40e driver from user app after callback | |
21 | */ | |
22 | enum rte_pmd_i40e_mb_event_rsp { | |
23 | RTE_PMD_I40E_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */ | |
24 | RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */ | |
25 | RTE_PMD_I40E_MB_EVENT_PROCEED, /**< proceed with mbox request */ | |
26 | RTE_PMD_I40E_MB_EVENT_MAX /**< max value of this enum */ | |
27 | }; | |
28 | ||
29 | /** | |
30 | * Data sent to the user application when the callback is executed. | |
31 | */ | |
32 | struct rte_pmd_i40e_mb_event_param { | |
33 | uint16_t vfid; /**< Virtual Function number */ | |
34 | uint16_t msg_type; /**< VF to PF message type, see virtchnl_ops */ | |
35 | uint16_t retval; /**< return value */ | |
36 | void *msg; /**< pointer to message */ | |
37 | uint16_t msglen; /**< length of the message */ | |
38 | }; | |
39 | ||
40 | /** | |
41 | * Option of package processing. | |
42 | */ | |
43 | enum rte_pmd_i40e_package_op { | |
44 | RTE_PMD_I40E_PKG_OP_UNDEFINED = 0, | |
45 | RTE_PMD_I40E_PKG_OP_WR_ADD, /**< load package and add to info list */ | |
46 | RTE_PMD_I40E_PKG_OP_WR_DEL, /**< load package and delete from info list */ | |
47 | RTE_PMD_I40E_PKG_OP_WR_ONLY, /**< load package without modifying info list */ | |
48 | RTE_PMD_I40E_PKG_OP_MAX = 32 | |
49 | }; | |
50 | ||
51 | /** | |
52 | * Types of package information. | |
53 | */ | |
54 | enum rte_pmd_i40e_package_info { | |
55 | RTE_PMD_I40E_PKG_INFO_UNDEFINED = 0, | |
56 | RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER, | |
57 | RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE, | |
58 | RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES, | |
59 | RTE_PMD_I40E_PKG_INFO_GLOBAL_MAX = 1024, | |
60 | RTE_PMD_I40E_PKG_INFO_HEADER, | |
61 | RTE_PMD_I40E_PKG_INFO_DEVID_NUM, | |
62 | RTE_PMD_I40E_PKG_INFO_DEVID_LIST, | |
63 | RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM, | |
64 | RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST, | |
65 | RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM, | |
66 | RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST, | |
67 | RTE_PMD_I40E_PKG_INFO_PTYPE_NUM, | |
68 | RTE_PMD_I40E_PKG_INFO_PTYPE_LIST, | |
69 | RTE_PMD_I40E_PKG_INFO_MAX = (int)0xFFFFFFFF | |
70 | }; | |
71 | ||
72 | /** | |
73 | * Option types of queue region. | |
74 | */ | |
75 | enum rte_pmd_i40e_queue_region_op { | |
76 | RTE_PMD_I40E_RSS_QUEUE_REGION_UNDEFINED, | |
77 | /** add queue region set */ | |
78 | RTE_PMD_I40E_RSS_QUEUE_REGION_SET, | |
79 | /** add PF region pctype set */ | |
80 | RTE_PMD_I40E_RSS_QUEUE_REGION_FLOWTYPE_SET, | |
81 | /** add queue region user priority set */ | |
82 | RTE_PMD_I40E_RSS_QUEUE_REGION_USER_PRIORITY_SET, | |
83 | /** | |
84 | * ALL configuration about queue region from up layer | |
85 | * at first will only keep in DPDK software stored in driver, | |
86 | * only after " FLUSH_ON ", it commit all configuration to HW. | |
87 | * Because PMD had to set hardware configuration at a time, so | |
88 | * it will record all up layer command at first. | |
89 | */ | |
90 | RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON, | |
91 | /** | |
92 | * "FLUSH_OFF " is just clean all configuration about queue | |
93 | * region just now, and restore all to DPDK i40e driver default | |
94 | * config when start up. | |
95 | */ | |
96 | RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF, | |
97 | RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET, | |
98 | RTE_PMD_I40E_RSS_QUEUE_REGION_OP_MAX | |
99 | }; | |
100 | ||
101 | #define RTE_PMD_I40E_DDP_NAME_SIZE 32 | |
102 | #define RTE_PMD_I40E_PCTYPE_MAX 64 | |
103 | #define RTE_PMD_I40E_REGION_MAX_NUM 8 | |
104 | #define RTE_PMD_I40E_MAX_USER_PRIORITY 8 | |
105 | ||
106 | /** | |
107 | * Version for dynamic device personalization. | |
108 | * Version in "major.minor.update.draft" format. | |
109 | */ | |
110 | struct rte_pmd_i40e_ddp_version { | |
111 | uint8_t major; | |
112 | uint8_t minor; | |
113 | uint8_t update; | |
114 | uint8_t draft; | |
115 | }; | |
116 | ||
117 | /** | |
118 | * Device ID for dynamic device personalization. | |
119 | */ | |
120 | struct rte_pmd_i40e_ddp_device_id { | |
121 | uint32_t vendor_dev_id; | |
122 | uint32_t sub_vendor_dev_id; | |
123 | }; | |
124 | ||
125 | /** | |
126 | * Profile information in profile info list. | |
127 | */ | |
128 | struct rte_pmd_i40e_profile_info { | |
129 | uint32_t track_id; | |
130 | struct rte_pmd_i40e_ddp_version version; | |
131 | uint8_t owner; | |
132 | uint8_t reserved[7]; | |
133 | uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE]; | |
134 | }; | |
135 | ||
136 | #define RTE_PMD_I40E_DDP_OWNER_UNKNOWN 0xFF | |
137 | ||
138 | /** | |
139 | * Profile information list returned from HW. | |
140 | */ | |
141 | struct rte_pmd_i40e_profile_list { | |
142 | uint32_t p_count; | |
143 | struct rte_pmd_i40e_profile_info p_info[1]; | |
144 | }; | |
145 | ||
146 | #define RTE_PMD_I40E_PROTO_NUM 6 | |
147 | #define RTE_PMD_I40E_PROTO_UNUSED 0xFF | |
148 | ||
149 | /** | |
150 | * Protocols information stored in profile | |
151 | */ | |
152 | struct rte_pmd_i40e_proto_info { | |
153 | uint8_t proto_id; | |
154 | char name[RTE_PMD_I40E_DDP_NAME_SIZE]; | |
155 | }; | |
156 | ||
157 | /** | |
158 | * Packet classification/ packet type information stored in profile | |
159 | */ | |
160 | struct rte_pmd_i40e_ptype_info { | |
161 | uint8_t ptype_id; | |
162 | uint8_t protocols[RTE_PMD_I40E_PROTO_NUM]; | |
163 | }; | |
164 | ||
165 | /** | |
166 | * ptype mapping table only accept RTE_PTYPE_XXX or "user defined" ptype. | |
167 | * A ptype with MSB set will be regarded as a user defined ptype. | |
168 | * Below macro help to create a user defined ptype. | |
169 | */ | |
170 | #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000 | |
171 | ||
172 | struct rte_pmd_i40e_ptype_mapping { | |
173 | uint16_t hw_ptype; /**< hardware defined packet type*/ | |
174 | uint32_t sw_ptype; /**< software defined packet type */ | |
175 | }; | |
176 | ||
177 | /** | |
178 | * Queue region related information. | |
179 | */ | |
180 | struct rte_pmd_i40e_queue_region_conf { | |
181 | /** the region id for this configuration */ | |
182 | uint8_t region_id; | |
183 | /** the pctype or hardware flowtype of packet, | |
184 | * the specific index for each type has been defined | |
185 | * in file i40e_type.h as enum i40e_filter_pctype. | |
186 | */ | |
187 | uint8_t hw_flowtype; | |
188 | /** the start queue index for this region */ | |
189 | uint8_t queue_start_index; | |
190 | /** the total queue number of this queue region */ | |
191 | uint8_t queue_num; | |
192 | /** the packet's user priority for this region */ | |
193 | uint8_t user_priority; | |
194 | }; | |
195 | ||
196 | /* queue region info */ | |
197 | struct rte_pmd_i40e_queue_region_info { | |
198 | /** the region id for this configuration */ | |
199 | uint8_t region_id; | |
200 | /** the start queue index for this region */ | |
201 | uint8_t queue_start_index; | |
202 | /** the total queue number of this queue region */ | |
203 | uint8_t queue_num; | |
204 | /** the total number of user priority for this region */ | |
205 | uint8_t user_priority_num; | |
206 | /** the packet's user priority for this region */ | |
207 | uint8_t user_priority[RTE_PMD_I40E_MAX_USER_PRIORITY]; | |
208 | /** the total number of flowtype for this region */ | |
209 | uint8_t flowtype_num; | |
210 | /** | |
211 | * the pctype or hardware flowtype of packet, | |
212 | * the specific index for each type has been defined | |
213 | * in file i40e_type.h as enum i40e_filter_pctype. | |
214 | */ | |
215 | uint8_t hw_flowtype[RTE_PMD_I40E_PCTYPE_MAX]; | |
216 | }; | |
217 | ||
218 | struct rte_pmd_i40e_queue_regions { | |
219 | /** the total number of queue region for this port */ | |
220 | uint16_t queue_region_number; | |
221 | struct rte_pmd_i40e_queue_region_info | |
222 | region[RTE_PMD_I40E_REGION_MAX_NUM]; | |
223 | }; | |
224 | ||
225 | /** | |
226 | * Behavior will be taken if raw packet template is matched. | |
227 | */ | |
228 | enum rte_pmd_i40e_pkt_template_behavior { | |
229 | RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT, | |
230 | RTE_PMD_I40E_PKT_TEMPLATE_REJECT, | |
231 | RTE_PMD_I40E_PKT_TEMPLATE_PASSTHRU, | |
232 | }; | |
233 | ||
234 | /** | |
235 | * Flow director report status | |
236 | * It defines what will be reported if raw packet template is matched. | |
237 | */ | |
238 | enum rte_pmd_i40e_pkt_template_status { | |
239 | /** report nothing */ | |
240 | RTE_PMD_I40E_PKT_TEMPLATE_NO_REPORT_STATUS, | |
241 | /** only report FD ID */ | |
242 | RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID, | |
243 | /** report FD ID and 4 flex bytes */ | |
244 | RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID_FLEX_4, | |
245 | /** report 8 flex bytes */ | |
246 | RTE_PMD_I40E_PKT_TEMPLATE_REPORT_FLEX_8, | |
247 | }; | |
248 | ||
249 | /** | |
250 | * A structure used to define an action when raw packet template is matched. | |
251 | */ | |
252 | struct rte_pmd_i40e_pkt_template_action { | |
253 | /** queue assigned to if raw packet template match */ | |
254 | uint16_t rx_queue; | |
255 | /** behavior will be taken */ | |
256 | enum rte_pmd_i40e_pkt_template_behavior behavior; | |
257 | /** status report option */ | |
258 | enum rte_pmd_i40e_pkt_template_status report_status; | |
259 | /** | |
260 | * If report_status is RTE_PMD_I40E_PKT_TEMPLATE_REPORT_ID_FLEX_4 or | |
261 | * RTE_PMD_I40E_PKT_TEMPLATE_REPORT_FLEX_8, flex_off specifies | |
262 | * where the reported flex bytes start from in flexible payload. | |
263 | */ | |
264 | uint8_t flex_off; | |
265 | }; | |
266 | ||
267 | /** | |
268 | * A structure used to define the input for raw packet template. | |
269 | */ | |
270 | struct rte_pmd_i40e_pkt_template_input { | |
271 | /** the pctype used for raw packet template */ | |
272 | uint16_t pctype; | |
9f95a23c | 273 | /** the buffer containing raw packet template */ |
11fdf7f2 TL |
274 | void *packet; |
275 | /** the length of buffer with raw packet template */ | |
276 | uint32_t length; | |
277 | }; | |
278 | ||
279 | /** | |
280 | * A structure used to define the configuration parameters | |
281 | * for raw packet template. | |
282 | */ | |
283 | struct rte_pmd_i40e_pkt_template_conf { | |
284 | /** the input for raw packet template. */ | |
285 | struct rte_pmd_i40e_pkt_template_input input; | |
286 | /** the action to be taken when raw packet template is matched */ | |
287 | struct rte_pmd_i40e_pkt_template_action action; | |
288 | /** ID, an unique software index for the raw packet template filter */ | |
289 | uint32_t soft_id; | |
290 | }; | |
291 | ||
292 | enum rte_pmd_i40e_inset_type { | |
293 | INSET_NONE = 0, | |
294 | INSET_HASH, | |
295 | INSET_FDIR, | |
296 | INSET_FDIR_FLX, | |
297 | }; | |
298 | ||
299 | struct rte_pmd_i40e_inset_mask { | |
300 | uint8_t field_idx; | |
301 | uint16_t mask; | |
302 | }; | |
303 | ||
304 | struct rte_pmd_i40e_inset { | |
305 | uint64_t inset; | |
306 | struct rte_pmd_i40e_inset_mask mask[2]; | |
307 | }; | |
308 | ||
309 | /** | |
310 | * Add or remove raw packet template filter to Flow Director. | |
311 | * | |
312 | * @param port | |
313 | * The port identifier of the Ethernet device. | |
314 | * @param conf | |
315 | * Specifies configuration parameters of raw packet template filter. | |
316 | * @param add | |
9f95a23c | 317 | * Specifies an action to be taken - add or remove raw packet template filter. |
11fdf7f2 TL |
318 | * @return |
319 | * - (0) if successful. | |
320 | * - (-ENODEV) if *port* invalid. | |
321 | * - (-EINVAL) if *conf* invalid. | |
322 | * - (-ENOTSUP) not supported by firmware. | |
323 | */ | |
324 | int rte_pmd_i40e_flow_add_del_packet_template( | |
325 | uint16_t port, | |
326 | const struct rte_pmd_i40e_pkt_template_conf *conf, | |
327 | uint8_t add); | |
328 | ||
329 | /** | |
330 | * Notify VF when PF link status changes. | |
331 | * | |
332 | * @param port | |
333 | * The port identifier of the Ethernet device. | |
334 | * @param vf | |
335 | * VF id. | |
336 | * @return | |
337 | * - (0) if successful. | |
338 | * - (-ENODEV) if *port* invalid. | |
339 | * - (-EINVAL) if *vf* invalid. | |
340 | */ | |
341 | int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf); | |
342 | ||
343 | /** | |
344 | * Enable/Disable VF MAC anti spoofing. | |
345 | * | |
346 | * @param port | |
347 | * The port identifier of the Ethernet device. | |
348 | * @param vf_id | |
349 | * VF on which to set MAC anti spoofing. | |
350 | * @param on | |
351 | * 1 - Enable VFs MAC anti spoofing. | |
352 | * 0 - Disable VFs MAC anti spoofing. | |
353 | * @return | |
354 | * - (0) if successful. | |
355 | * - (-ENODEV) if *port* invalid. | |
356 | * - (-EINVAL) if bad parameter. | |
357 | */ | |
358 | int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port, | |
359 | uint16_t vf_id, | |
360 | uint8_t on); | |
361 | ||
362 | /** | |
363 | * Enable/Disable VF VLAN anti spoofing. | |
364 | * | |
365 | * @param port | |
366 | * The port identifier of the Ethernet device. | |
367 | * @param vf_id | |
368 | * VF on which to set VLAN anti spoofing. | |
369 | * @param on | |
370 | * 1 - Enable VFs VLAN anti spoofing. | |
371 | * 0 - Disable VFs VLAN anti spoofing. | |
372 | * @return | |
373 | * - (0) if successful. | |
374 | * - (-ENODEV) if *port* invalid. | |
375 | * - (-EINVAL) if bad parameter. | |
376 | */ | |
377 | int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port, | |
378 | uint16_t vf_id, | |
379 | uint8_t on); | |
380 | ||
381 | /** | |
382 | * Enable/Disable TX loopback on all the PF and VFs. | |
383 | * | |
384 | * @param port | |
385 | * The port identifier of the Ethernet device. | |
386 | * @param on | |
387 | * 1 - Enable TX loopback. | |
388 | * 0 - Disable TX loopback. | |
389 | * @return | |
390 | * - (0) if successful. | |
391 | * - (-ENODEV) if *port* invalid. | |
392 | * - (-EINVAL) if bad parameter. | |
393 | */ | |
394 | int rte_pmd_i40e_set_tx_loopback(uint16_t port, | |
395 | uint8_t on); | |
396 | ||
397 | /** | |
398 | * Enable/Disable VF unicast promiscuous mode. | |
399 | * | |
400 | * @param port | |
401 | * The port identifier of the Ethernet device. | |
402 | * @param vf_id | |
403 | * VF on which to set. | |
404 | * @param on | |
405 | * 1 - Enable. | |
406 | * 0 - Disable. | |
407 | * @return | |
408 | * - (0) if successful. | |
409 | * - (-ENODEV) if *port* invalid. | |
410 | * - (-EINVAL) if bad parameter. | |
411 | */ | |
412 | int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port, | |
413 | uint16_t vf_id, | |
414 | uint8_t on); | |
415 | ||
416 | /** | |
417 | * Enable/Disable VF multicast promiscuous mode. | |
418 | * | |
419 | * @param port | |
420 | * The port identifier of the Ethernet device. | |
421 | * @param vf_id | |
422 | * VF on which to set. | |
423 | * @param on | |
424 | * 1 - Enable. | |
425 | * 0 - Disable. | |
426 | * @return | |
427 | * - (0) if successful. | |
428 | * - (-ENODEV) if *port* invalid. | |
429 | * - (-EINVAL) if bad parameter. | |
430 | */ | |
431 | int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, | |
432 | uint16_t vf_id, | |
433 | uint8_t on); | |
434 | ||
435 | /** | |
436 | * Set the VF MAC address. | |
437 | * | |
438 | * PF should set MAC address before VF initialized, if PF sets the MAC | |
439 | * address after VF initialized, new MAC address won't be effective until | |
440 | * VF reinitialize. | |
441 | * | |
442 | * This will remove all existing MAC filters. | |
443 | * | |
444 | * @param port | |
445 | * The port identifier of the Ethernet device. | |
446 | * @param vf_id | |
447 | * VF id. | |
448 | * @param mac_addr | |
449 | * VF MAC address. | |
450 | * @return | |
451 | * - (0) if successful. | |
452 | * - (-ENODEV) if *port* invalid. | |
453 | * - (-EINVAL) if *vf* or *mac_addr* is invalid. | |
454 | */ | |
455 | int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, | |
456 | struct ether_addr *mac_addr); | |
457 | ||
458 | /** | |
459 | * Remove the VF MAC address. | |
460 | * | |
461 | * @param port | |
462 | * The port identifier of the Ethernet device. | |
463 | * @param vf_id | |
464 | * VF id. | |
465 | * @param mac_addr | |
466 | * VF MAC address. | |
467 | * @return | |
468 | * - (0) if successful. | |
469 | * - (-ENODEV) if *port* invalid. | |
470 | * - (-EINVAL) if *vf* or *mac_addr* is invalid. | |
471 | */ | |
472 | int | |
473 | rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, | |
474 | struct ether_addr *mac_addr); | |
475 | ||
476 | /** | |
477 | * Enable/Disable vf vlan strip for all queues in a pool | |
478 | * | |
479 | * @param port | |
480 | * The port identifier of the Ethernet device. | |
481 | * @param vf | |
482 | * ID specifying VF. | |
483 | * @param on | |
484 | * 1 - Enable VF's vlan strip on RX queues. | |
485 | * 0 - Disable VF's vlan strip on RX queues. | |
486 | * | |
487 | * @return | |
488 | * - (0) if successful. | |
489 | * - (-ENODEV) if *port* invalid. | |
490 | * - (-EINVAL) if bad parameter. | |
491 | */ | |
492 | int | |
493 | rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on); | |
494 | ||
495 | /** | |
496 | * Enable/Disable vf vlan insert | |
497 | * | |
498 | * @param port | |
499 | * The port identifier of the Ethernet device. | |
500 | * @param vf_id | |
501 | * ID specifying VF. | |
502 | * @param vlan_id | |
503 | * 0 - Disable VF's vlan insert. | |
504 | * n - Enable; n is inserted as the vlan id. | |
505 | * | |
506 | * @return | |
507 | * - (0) if successful. | |
508 | * - (-ENODEV) if *port* invalid. | |
509 | * - (-EINVAL) if bad parameter. | |
510 | */ | |
511 | int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id, | |
512 | uint16_t vlan_id); | |
513 | ||
514 | /** | |
515 | * Enable/Disable vf broadcast mode | |
516 | * | |
517 | * @param port | |
518 | * The port identifier of the Ethernet device. | |
519 | * @param vf_id | |
520 | * ID specifying VF. | |
521 | * @param on | |
522 | * 0 - Disable broadcast. | |
523 | * 1 - Enable broadcast. | |
524 | * | |
525 | * @return | |
526 | * - (0) if successful. | |
527 | * - (-ENODEV) if *port* invalid. | |
528 | * - (-EINVAL) if bad parameter. | |
529 | */ | |
530 | int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, | |
531 | uint8_t on); | |
532 | ||
533 | /** | |
534 | * Enable/Disable vf vlan tag | |
535 | * | |
536 | * @param port | |
537 | * The port identifier of the Ethernet device. | |
538 | * @param vf_id | |
539 | * ID specifying VF. | |
540 | * @param on | |
541 | * 0 - Disable VF's vlan tag. | |
542 | * n - Enable VF's vlan tag. | |
543 | * | |
544 | * @return | |
545 | * - (0) if successful. | |
546 | * - (-ENODEV) if *port* invalid. | |
547 | * - (-EINVAL) if bad parameter. | |
548 | */ | |
549 | int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on); | |
550 | ||
551 | /** | |
552 | * Enable/Disable VF VLAN filter | |
553 | * | |
554 | * @param port | |
555 | * The port identifier of the Ethernet device. | |
556 | * @param vlan_id | |
557 | * ID specifying VLAN | |
558 | * @param vf_mask | |
559 | * Mask to filter VF's | |
560 | * @param on | |
561 | * 0 - Disable VF's VLAN filter. | |
562 | * 1 - Enable VF's VLAN filter. | |
563 | * | |
564 | * @return | |
565 | * - (0) if successful. | |
566 | * - (-ENODEV) if *port* invalid. | |
567 | * - (-EINVAL) if bad parameter. | |
568 | * - (-ENOTSUP) not supported by firmware. | |
569 | */ | |
570 | int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id, | |
571 | uint64_t vf_mask, uint8_t on); | |
572 | ||
573 | /** | |
574 | * Get VF's statistics | |
575 | * | |
576 | * @param port | |
577 | * The port identifier of the Ethernet device. | |
578 | * @param vf_id | |
579 | * VF on which to get. | |
580 | * @param stats | |
581 | * A pointer to a structure of type *rte_eth_stats* to be filled with | |
582 | * the values of device counters for the following set of statistics: | |
583 | * - *ipackets* with the total of successfully received packets. | |
584 | * - *opackets* with the total of successfully transmitted packets. | |
585 | * - *ibytes* with the total of successfully received bytes. | |
586 | * - *obytes* with the total of successfully transmitted bytes. | |
587 | * - *ierrors* with the total of erroneous received packets. | |
588 | * - *oerrors* with the total of failed transmitted packets. | |
589 | * @return | |
590 | * - (0) if successful. | |
591 | * - (-ENODEV) if *port* invalid. | |
592 | * - (-EINVAL) if bad parameter. | |
593 | */ | |
594 | ||
595 | int rte_pmd_i40e_get_vf_stats(uint16_t port, | |
596 | uint16_t vf_id, | |
597 | struct rte_eth_stats *stats); | |
598 | ||
599 | /** | |
600 | * Clear VF's statistics | |
601 | * | |
602 | * @param port | |
603 | * The port identifier of the Ethernet device. | |
604 | * @param vf_id | |
605 | * VF on which to get. | |
606 | * @return | |
607 | * - (0) if successful. | |
608 | * - (-ENODEV) if *port* invalid. | |
609 | * - (-EINVAL) if bad parameter. | |
610 | */ | |
611 | int rte_pmd_i40e_reset_vf_stats(uint16_t port, | |
612 | uint16_t vf_id); | |
613 | ||
614 | /** | |
615 | * Set VF's max bandwidth. | |
616 | * | |
617 | * Per VF bandwidth limitation and per TC bandwidth limitation cannot | |
618 | * be enabled in parallel. If per TC bandwidth is enabled, this function | |
619 | * will disable it. | |
620 | * | |
621 | * @param port | |
622 | * The port identifier of the Ethernet device. | |
623 | * @param vf_id | |
624 | * ID specifying VF. | |
625 | * @param bw | |
626 | * Bandwidth for this VF. | |
627 | * The value should be an absolute bandwidth in Mbps. | |
628 | * The bandwidth is a L2 bandwidth counting the bytes of ethernet packets. | |
629 | * Not count the bytes added by physical layer. | |
630 | * @return | |
631 | * - (0) if successful. | |
632 | * - (-ENODEV) if *port* invalid. | |
633 | * - (-EINVAL) if bad parameter. | |
634 | * - (-ENOTSUP) not supported by firmware. | |
635 | */ | |
636 | int rte_pmd_i40e_set_vf_max_bw(uint16_t port, | |
637 | uint16_t vf_id, | |
638 | uint32_t bw); | |
639 | ||
640 | /** | |
641 | * Set all the TCs' bandwidth weight on a specific VF. | |
642 | * | |
643 | * The bw_weight means the percentage occupied by the TC. | |
644 | * It can be taken as the relative min bandwidth setting. | |
645 | * | |
646 | * @param port | |
647 | * The port identifier of the Ethernet device. | |
648 | * @param vf_id | |
649 | * ID specifying VF. | |
650 | * @param tc_num | |
651 | * Number of TCs. | |
652 | * @param bw_weight | |
653 | * An array of relative bandwidth weight for all the TCs. | |
654 | * The summary of the bw_weight should be 100. | |
655 | * @return | |
656 | * - (0) if successful. | |
657 | * - (-ENODEV) if *port* invalid. | |
658 | * - (-EINVAL) if bad parameter. | |
659 | * - (-ENOTSUP) not supported by firmware. | |
660 | */ | |
661 | int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port, | |
662 | uint16_t vf_id, | |
663 | uint8_t tc_num, | |
664 | uint8_t *bw_weight); | |
665 | ||
666 | /** | |
667 | * Set a specific TC's max bandwidth on a specific VF. | |
668 | * | |
669 | * @param port | |
670 | * The port identifier of the Ethernet device. | |
671 | * @param vf_id | |
672 | * ID specifying VF. | |
673 | * @param tc_no | |
674 | * Number specifying TC. | |
675 | * @param bw | |
676 | * Max bandwidth for this TC. | |
677 | * The value should be an absolute bandwidth in Mbps. | |
678 | * The bandwidth is a L2 bandwidth counting the bytes of ethernet packets. | |
679 | * Not count the bytes added by physical layer. | |
680 | * @return | |
681 | * - (0) if successful. | |
682 | * - (-ENODEV) if *port* invalid. | |
683 | * - (-EINVAL) if bad parameter. | |
684 | * - (-ENOTSUP) not supported by firmware. | |
685 | */ | |
686 | int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port, | |
687 | uint16_t vf_id, | |
688 | uint8_t tc_no, | |
689 | uint32_t bw); | |
690 | ||
691 | /** | |
692 | * Set some TCs to strict priority mode on a physical port. | |
693 | * | |
694 | * @param port | |
695 | * The port identifier of the Ethernet device. | |
696 | * @param tc_map | |
697 | * A bit map for the TCs. | |
698 | * @return | |
699 | * - (0) if successful. | |
700 | * - (-ENODEV) if *port* invalid. | |
701 | * - (-EINVAL) if bad parameter. | |
702 | * - (-ENOTSUP) not supported by firmware. | |
703 | */ | |
704 | int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map); | |
705 | ||
706 | /** | |
707 | * Load/Unload a ddp package | |
708 | * | |
709 | * @param port | |
710 | * The port identifier of the Ethernet device. | |
711 | * @param buff | |
712 | * buffer of package. | |
713 | * @param size | |
714 | * size of buffer. | |
715 | * @param op | |
716 | * Operation of package processing | |
717 | * @return | |
718 | * - (0) if successful. | |
719 | * - (-ENODEV) if *port* invalid. | |
720 | * - (-EINVAL) if bad parameter. | |
721 | * - (-EEXIST) if profile exists. | |
722 | * - (-EACCES) if profile does not exist. | |
723 | * - (-ENOTSUP) if operation not supported. | |
724 | */ | |
725 | int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff, | |
726 | uint32_t size, | |
727 | enum rte_pmd_i40e_package_op op); | |
728 | ||
729 | /** | |
730 | * rte_pmd_i40e_get_ddp_info - Get profile's info | |
731 | * @param pkg | |
732 | * buffer of package. | |
733 | * @param pkg_size | |
734 | * package buffer size | |
735 | * @param info | |
736 | * buffer for response | |
737 | * @param size | |
738 | * response buffer size | |
739 | * @param type | |
740 | * type of information requested | |
741 | * @return | |
742 | * - (0) if successful. | |
743 | * - (-ENOTSUP) if information type not supported by the profile. | |
744 | * - (-EINVAL) if bad parameter. | |
745 | */ | |
746 | int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size, | |
747 | uint8_t *info, uint32_t size, | |
748 | enum rte_pmd_i40e_package_info type); | |
749 | ||
750 | /** | |
751 | * rte_pmd_i40e_get_ddp_list - Get loaded profile list | |
752 | * @param port | |
753 | * port id | |
754 | * @param buff | |
755 | * buffer for response | |
756 | * @param size | |
757 | * buffer size | |
758 | * @return | |
759 | * - (0) if successful. | |
760 | * - (-ENODEV) if *port* invalid. | |
761 | * - (-EINVAL) if bad parameter. | |
762 | */ | |
763 | int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size); | |
764 | ||
765 | /** | |
766 | * Update hardware defined ptype to software defined packet type | |
767 | * mapping table. | |
768 | * | |
769 | * @param port | |
770 | * pointer to port identifier of the device. | |
771 | * @param mapping_items | |
772 | * the base address of the mapping items array. | |
773 | * @param count | |
774 | * number of mapping items. | |
775 | * @param exclusive | |
776 | * the flag indicate different ptype mapping update method. | |
777 | * -(0) only overwrite referred PTYPE mapping, | |
778 | * keep other PTYPEs mapping unchanged. | |
779 | * -(!0) overwrite referred PTYPE mapping, | |
780 | * set other PTYPEs maps to PTYPE_UNKNOWN. | |
781 | */ | |
782 | int rte_pmd_i40e_ptype_mapping_update( | |
783 | uint16_t port, | |
784 | struct rte_pmd_i40e_ptype_mapping *mapping_items, | |
785 | uint16_t count, | |
786 | uint8_t exclusive); | |
787 | ||
788 | /** | |
789 | * Reset hardware defined ptype to software defined ptype | |
790 | * mapping table to default. | |
791 | * | |
792 | * @param port | |
793 | * pointer to port identifier of the device | |
794 | */ | |
795 | int rte_pmd_i40e_ptype_mapping_reset(uint16_t port); | |
796 | ||
797 | /** | |
798 | * Get hardware defined ptype to software defined ptype | |
799 | * mapping items. | |
800 | * | |
801 | * @param port | |
802 | * pointer to port identifier of the device. | |
803 | * @param mapping_items | |
804 | * the base address of the array to store returned items. | |
805 | * @param size | |
806 | * the size of the input array. | |
807 | * @param count | |
808 | * the place to store the number of returned items. | |
809 | * @param valid_only | |
810 | * -(0) return full mapping table. | |
811 | * -(!0) only return mapping items which packet_type != RTE_PTYPE_UNKNOWN. | |
812 | */ | |
813 | int rte_pmd_i40e_ptype_mapping_get( | |
814 | uint16_t port, | |
815 | struct rte_pmd_i40e_ptype_mapping *mapping_items, | |
816 | uint16_t size, | |
817 | uint16_t *count, | |
818 | uint8_t valid_only); | |
819 | ||
820 | /** | |
821 | * Replace a specific or a group of software defined ptypes | |
822 | * with a new one | |
823 | * | |
824 | * @param port | |
825 | * pointer to port identifier of the device | |
826 | * @param target | |
827 | * the packet type to be replaced | |
828 | * @param mask | |
829 | * -(0) target represent a specific software defined ptype. | |
830 | * -(!0) target is a mask to represent a group of software defined ptypes. | |
831 | * @param pkt_type | |
832 | * the new packet type to overwrite | |
833 | */ | |
834 | int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, | |
835 | uint32_t target, | |
836 | uint8_t mask, | |
837 | uint32_t pkt_type); | |
838 | ||
839 | /** | |
840 | * Add a VF MAC address. | |
841 | * | |
842 | * Add more MAC address for VF. The existing MAC addresses | |
843 | * are still effective. | |
844 | * | |
845 | * @param port | |
846 | * The port identifier of the Ethernet device. | |
847 | * @param vf_id | |
848 | * VF id. | |
849 | * @param mac_addr | |
850 | * VF MAC address. | |
851 | * @return | |
852 | * - (0) if successful. | |
853 | * - (-ENODEV) if *port* invalid. | |
854 | * - (-EINVAL) if *vf* or *mac_addr* is invalid. | |
855 | */ | |
856 | int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, | |
857 | struct ether_addr *mac_addr); | |
858 | ||
859 | #define RTE_PMD_I40E_PCTYPE_MAX 64 | |
860 | #define RTE_PMD_I40E_FLOW_TYPE_MAX 64 | |
861 | ||
862 | struct rte_pmd_i40e_flow_type_mapping { | |
863 | uint16_t flow_type; /**< software defined flow type*/ | |
864 | uint64_t pctype; /**< hardware defined pctype */ | |
865 | }; | |
866 | ||
867 | /** | |
868 | * Update hardware defined pctype to software defined flow type | |
869 | * mapping table. | |
870 | * | |
871 | * @param port | |
872 | * pointer to port identifier of the device. | |
873 | * @param mapping_items | |
874 | * the base address of the mapping items array. | |
875 | * @param count | |
876 | * number of mapping items. | |
877 | * @param exclusive | |
878 | * the flag indicate different pctype mapping update method. | |
879 | * -(0) only overwrite referred PCTYPE mapping, | |
880 | * keep other PCTYPEs mapping unchanged. | |
881 | * -(!0) overwrite referred PCTYPE mapping, | |
882 | * set other PCTYPEs maps to PCTYPE_INVALID. | |
883 | */ | |
884 | int rte_pmd_i40e_flow_type_mapping_update( | |
885 | uint16_t port, | |
886 | struct rte_pmd_i40e_flow_type_mapping *mapping_items, | |
887 | uint16_t count, | |
888 | uint8_t exclusive); | |
889 | ||
890 | /** | |
891 | * Get software defined flow type to hardware defined pctype | |
892 | * mapping items. | |
893 | * | |
894 | * @param port | |
895 | * pointer to port identifier of the device. | |
896 | * @param mapping_items | |
897 | * the base address of the array to store returned items. | |
898 | * array should be allocated by caller with minimum size of | |
899 | * RTE_PMD_I40E_FLOW_TYPE_MAX items | |
900 | */ | |
901 | int rte_pmd_i40e_flow_type_mapping_get( | |
902 | uint16_t port, | |
903 | struct rte_pmd_i40e_flow_type_mapping *mapping_items); | |
904 | ||
905 | /** | |
906 | * Reset hardware defined pctype to software defined flow type | |
907 | * mapping table to default. | |
908 | * | |
909 | * @param port | |
910 | * pointer to port identifier of the device | |
911 | */ | |
912 | int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port); | |
913 | ||
914 | /** | |
915 | * On the PF, find VF index based on VF MAC address | |
916 | * | |
917 | * @param port | |
918 | * pointer to port identifier of the device | |
919 | * @param vf_mac | |
920 | * the mac address of the vf to determine index of | |
921 | * @return | |
922 | * The index of vfid If successful. | |
923 | * -EINVAL: vf mac address does not exist for this port | |
924 | * -ENOTSUP: i40e not supported for this port. | |
925 | */ | |
926 | int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, | |
927 | const struct ether_addr *vf_mac); | |
928 | ||
929 | /** | |
930 | * Do RSS queue region configuration for that port as | |
931 | * the command option type | |
932 | * | |
933 | * @param port_id | |
934 | * The port identifier of the Ethernet device. | |
935 | * @param op_type | |
936 | * Queue region operation type | |
937 | * @param arg | |
938 | * Queue region operation type specific data | |
939 | */ | |
940 | int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id, | |
941 | enum rte_pmd_i40e_queue_region_op op_type, void *arg); | |
942 | ||
943 | int rte_pmd_i40e_cfg_hash_inset(uint16_t port, | |
944 | uint64_t pctype, uint64_t inset); | |
945 | ||
946 | /** | |
947 | * Get input set | |
948 | * | |
949 | * @param port | |
950 | * The port identifier of the Ethernet device. | |
951 | * @param pctype | |
952 | * HW pctype. | |
953 | * @param inset | |
954 | * Buffer for input set info. | |
955 | * @param inset_type | |
956 | * Type of input set. | |
957 | * @return | |
958 | * - (0) if successful. | |
959 | * - (-ENODEV) if *port* invalid. | |
960 | * - (-EINVAL) if bad parameter. | |
961 | * - (-ENOTSUP) if operation not supported. | |
962 | */ | |
963 | int rte_pmd_i40e_inset_get(uint16_t port, uint8_t pctype, | |
964 | struct rte_pmd_i40e_inset *inset, | |
965 | enum rte_pmd_i40e_inset_type inset_type); | |
966 | ||
967 | /** | |
968 | * Set input set | |
969 | * | |
970 | * @param port | |
971 | * The port identifier of the Ethernet device. | |
972 | * @param pctype | |
973 | * HW pctype. | |
974 | * @param inset | |
975 | * Input set info. | |
976 | * @param inset_type | |
977 | * Type of input set. | |
978 | * @return | |
979 | * - (0) if successful. | |
980 | * - (-ENODEV) if *port* invalid. | |
981 | * - (-EINVAL) if bad parameter. | |
982 | * - (-ENOTSUP) if operation not supported. | |
983 | */ | |
984 | int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype, | |
985 | struct rte_pmd_i40e_inset *inset, | |
986 | enum rte_pmd_i40e_inset_type inset_type); | |
987 | ||
988 | /** | |
989 | * Get bit value for some field index | |
990 | * | |
991 | * @param inset | |
992 | * Input set value. | |
993 | * @param field_idx | |
994 | * Field index for input set. | |
995 | * @return | |
996 | * - (1) if set. | |
997 | * - (0) if cleared. | |
998 | */ | |
999 | static inline int | |
1000 | rte_pmd_i40e_inset_field_get(uint64_t inset, uint8_t field_idx) | |
1001 | { | |
1002 | uint8_t bit_idx; | |
1003 | ||
1004 | if (field_idx > 63) | |
1005 | return 0; | |
1006 | ||
1007 | bit_idx = 63 - field_idx; | |
1008 | if (inset & (1ULL << bit_idx)) | |
1009 | return 1; | |
1010 | ||
1011 | return 0; | |
1012 | } | |
1013 | ||
1014 | /** | |
1015 | * Set bit value for some field index | |
1016 | * | |
1017 | * @param inset | |
1018 | * Input set value. | |
1019 | * @param field_idx | |
1020 | * Field index for input set. | |
1021 | * @return | |
1022 | * - (-1) if failed. | |
1023 | * - (0) if success. | |
1024 | */ | |
1025 | static inline int | |
1026 | rte_pmd_i40e_inset_field_set(uint64_t *inset, uint8_t field_idx) | |
1027 | { | |
1028 | uint8_t bit_idx; | |
1029 | ||
1030 | if (field_idx > 63) | |
1031 | return -1; | |
1032 | ||
1033 | bit_idx = 63 - field_idx; | |
1034 | *inset = *inset | (1ULL << bit_idx); | |
1035 | ||
1036 | return 0; | |
1037 | } | |
1038 | ||
1039 | /** | |
1040 | * Clear bit value for some field index | |
1041 | * | |
1042 | * @param inset | |
1043 | * Input set value. | |
1044 | * @param field_idx | |
1045 | * Field index for input set. | |
1046 | * @return | |
1047 | * - (-1) if failed. | |
1048 | * - (0) if success. | |
1049 | */ | |
1050 | static inline int | |
1051 | rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx) | |
1052 | { | |
1053 | uint8_t bit_idx; | |
1054 | ||
1055 | if (field_idx > 63) | |
1056 | return -1; | |
1057 | ||
1058 | bit_idx = 63 - field_idx; | |
1059 | *inset = *inset & ~(1ULL << bit_idx); | |
1060 | ||
1061 | return 0; | |
1062 | } | |
1063 | ||
1064 | #endif /* _PMD_I40E_H_ */ |