ed414652c52b10e5913ba97e957a52f598d87571
[dpdk.git] / drivers / net / i40e / rte_pmd_i40e.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright (c) 2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _PMD_I40E_H_
34 #define _PMD_I40E_H_
35
36 /**
37  * @file rte_pmd_i40e.h
38  *
39  * i40e PMD specific functions.
40  *
41  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
42  *
43  */
44
45 #include <rte_ethdev.h>
46
47 /**
48  * Response sent back to i40e driver from user app after callback
49  */
50 enum rte_pmd_i40e_mb_event_rsp {
51         RTE_PMD_I40E_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
52         RTE_PMD_I40E_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
53         RTE_PMD_I40E_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
54         RTE_PMD_I40E_MB_EVENT_MAX       /**< max value of this enum */
55 };
56
57 /**
58  * Data sent to the user application when the callback is executed.
59  */
60 struct rte_pmd_i40e_mb_event_param {
61         uint16_t vfid;     /**< Virtual Function number */
62         uint16_t msg_type; /**< VF to PF message type, see virtchnl_ops */
63         uint16_t retval;   /**< return value */
64         void *msg;         /**< pointer to message */
65         uint16_t msglen;   /**< length of the message */
66 };
67
68 /**
69  * Option of package processing.
70  */
71 enum rte_pmd_i40e_package_op {
72         RTE_PMD_I40E_PKG_OP_UNDEFINED = 0,
73         RTE_PMD_I40E_PKG_OP_WR_ADD,   /**< load package and add to info list */
74         RTE_PMD_I40E_PKG_OP_WR_DEL, /**< load package and delete from info list */
75         RTE_PMD_I40E_PKG_OP_WR_ONLY, /**< load package without modifying info list */
76         RTE_PMD_I40E_PKG_OP_MAX = 32
77 };
78
79 /**
80  * Types of package information.
81  */
82 enum rte_pmd_i40e_package_info {
83         RTE_PMD_I40E_PKG_INFO_UNDEFINED = 0,
84         RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER,
85         RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE,
86         RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES,
87         RTE_PMD_I40E_PKG_INFO_GLOBAL_MAX = 1024,
88         RTE_PMD_I40E_PKG_INFO_HEADER,
89         RTE_PMD_I40E_PKG_INFO_DEVID_NUM,
90         RTE_PMD_I40E_PKG_INFO_DEVID_LIST,
91         RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM,
92         RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST,
93         RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM,
94         RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST,
95         RTE_PMD_I40E_PKG_INFO_PTYPE_NUM,
96         RTE_PMD_I40E_PKG_INFO_PTYPE_LIST,
97         RTE_PMD_I40E_PKG_INFO_MAX = 0xFFFFFFFF
98 };
99
100 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
101
102 /**
103  * Version for dynamic device personalization.
104  * Version in "major.minor.update.draft" format.
105  */
106 struct rte_pmd_i40e_ddp_version {
107         uint8_t major;
108         uint8_t minor;
109         uint8_t update;
110         uint8_t draft;
111 };
112
113 /**
114  * Device ID for dynamic device personalization.
115  */
116 struct rte_pmd_i40e_ddp_device_id {
117         uint32_t vendor_dev_id;
118         uint32_t sub_vendor_dev_id;
119 };
120
121 /**
122  * Profile information in profile info list.
123  */
124 struct rte_pmd_i40e_profile_info {
125         uint32_t track_id;
126         struct rte_pmd_i40e_ddp_version version;
127         uint8_t owner;
128         uint8_t reserved[7];
129         uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE];
130 };
131
132 #define RTE_PMD_I40E_DDP_OWNER_UNKNOWN 0xFF
133
134 /**
135  * Profile information list returned from HW.
136  */
137 struct rte_pmd_i40e_profile_list {
138         uint32_t p_count;
139         struct rte_pmd_i40e_profile_info p_info[1];
140 };
141
142 #define RTE_PMD_I40E_PROTO_NUM 6
143 #define RTE_PMD_I40E_PROTO_UNUSED 0xFF
144
145 /**
146  * Protocols information stored in profile
147  */
148 struct rte_pmd_i40e_proto_info {
149         uint8_t proto_id;
150         char name[RTE_PMD_I40E_DDP_NAME_SIZE];
151 };
152
153 /**
154  * Packet classification/ packet type information stored in profile
155  */
156 struct rte_pmd_i40e_ptype_info {
157         uint8_t ptype_id;
158         uint8_t protocols[RTE_PMD_I40E_PROTO_NUM];
159 };
160
161 /**
162  * ptype mapping table only accept RTE_PTYPE_XXX or "user defined" ptype.
163  * A ptype with MSB set will be regarded as a user defined ptype.
164  * Below macro help to create a user defined ptype.
165  */
166 #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000
167
168 struct rte_pmd_i40e_ptype_mapping {
169         uint16_t hw_ptype; /**< hardware defined packet type*/
170         uint32_t sw_ptype; /**< software defined packet type */
171 };
172
173 /**
174  * Notify VF when PF link status changes.
175  *
176  * @param port
177  *   The port identifier of the Ethernet device.
178  * @param vf
179  *   VF id.
180  * @return
181  *   - (0) if successful.
182  *   - (-ENODEV) if *port* invalid.
183  *   - (-EINVAL) if *vf* invalid.
184  */
185 int rte_pmd_i40e_ping_vfs(uint8_t port, uint16_t vf);
186
187 /**
188  * Enable/Disable VF MAC anti spoofing.
189  *
190  * @param port
191  *    The port identifier of the Ethernet device.
192  * @param vf_id
193  *    VF on which to set MAC anti spoofing.
194  * @param on
195  *    1 - Enable VFs MAC anti spoofing.
196  *    0 - Disable VFs MAC anti spoofing.
197  * @return
198  *   - (0) if successful.
199  *   - (-ENODEV) if *port* invalid.
200  *   - (-EINVAL) if bad parameter.
201  */
202 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint8_t port,
203                                        uint16_t vf_id,
204                                        uint8_t on);
205
206 /**
207  * Enable/Disable VF VLAN anti spoofing.
208  *
209  * @param port
210  *    The port identifier of the Ethernet device.
211  * @param vf_id
212  *    VF on which to set VLAN anti spoofing.
213  * @param on
214  *    1 - Enable VFs VLAN anti spoofing.
215  *    0 - Disable VFs VLAN anti spoofing.
216  * @return
217  *   - (0) if successful.
218  *   - (-ENODEV) if *port* invalid.
219  *   - (-EINVAL) if bad parameter.
220  */
221 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint8_t port,
222                                         uint16_t vf_id,
223                                         uint8_t on);
224
225 /**
226  * Enable/Disable TX loopback on all the PF and VFs.
227  *
228  * @param port
229  *    The port identifier of the Ethernet device.
230  * @param on
231  *    1 - Enable TX loopback.
232  *    0 - Disable TX loopback.
233  * @return
234  *   - (0) if successful.
235  *   - (-ENODEV) if *port* invalid.
236  *   - (-EINVAL) if bad parameter.
237  */
238 int rte_pmd_i40e_set_tx_loopback(uint8_t port,
239                                  uint8_t on);
240
241 /**
242  * Enable/Disable VF unicast promiscuous mode.
243  *
244  * @param port
245  *    The port identifier of the Ethernet device.
246  * @param vf_id
247  *    VF on which to set.
248  * @param on
249  *    1 - Enable.
250  *    0 - Disable.
251  * @return
252  *   - (0) if successful.
253  *   - (-ENODEV) if *port* invalid.
254  *   - (-EINVAL) if bad parameter.
255  */
256 int rte_pmd_i40e_set_vf_unicast_promisc(uint8_t port,
257                                         uint16_t vf_id,
258                                         uint8_t on);
259
260 /**
261  * Enable/Disable VF multicast promiscuous mode.
262  *
263  * @param port
264  *    The port identifier of the Ethernet device.
265  * @param vf_id
266  *    VF on which to set.
267  * @param on
268  *    1 - Enable.
269  *    0 - Disable.
270  * @return
271  *   - (0) if successful.
272  *   - (-ENODEV) if *port* invalid.
273  *   - (-EINVAL) if bad parameter.
274  */
275 int rte_pmd_i40e_set_vf_multicast_promisc(uint8_t port,
276                                           uint16_t vf_id,
277                                           uint8_t on);
278
279 /**
280  * Set the VF MAC address.
281  *
282  * PF should set MAC address before VF initialized, if PF sets the MAC
283  * address after VF initialized, new MAC address won't be effective until
284  * VF reinitialize.
285  *
286  * This will remove all existing MAC filters.
287  *
288  * @param port
289  *   The port identifier of the Ethernet device.
290  * @param vf_id
291  *   VF id.
292  * @param mac_addr
293  *   VF MAC address.
294  * @return
295  *   - (0) if successful.
296  *   - (-ENODEV) if *port* invalid.
297  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
298  */
299 int rte_pmd_i40e_set_vf_mac_addr(uint8_t port, uint16_t vf_id,
300                                  struct ether_addr *mac_addr);
301
302 /**
303  * Enable/Disable vf vlan strip for all queues in a pool
304  *
305  * @param port
306  *    The port identifier of the Ethernet device.
307  * @param vf
308  *    ID specifying VF.
309  * @param on
310  *    1 - Enable VF's vlan strip on RX queues.
311  *    0 - Disable VF's vlan strip on RX queues.
312  *
313  * @return
314  *   - (0) if successful.
315  *   - (-ENODEV) if *port* invalid.
316  *   - (-EINVAL) if bad parameter.
317  */
318 int
319 rte_pmd_i40e_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on);
320
321 /**
322  * Enable/Disable vf vlan insert
323  *
324  * @param port
325  *    The port identifier of the Ethernet device.
326  * @param vf_id
327  *    ID specifying VF.
328  * @param vlan_id
329  *    0 - Disable VF's vlan insert.
330  *    n - Enable; n is inserted as the vlan id.
331  *
332  * @return
333  *   - (0) if successful.
334  *   - (-ENODEV) if *port* invalid.
335  *   - (-EINVAL) if bad parameter.
336  */
337 int rte_pmd_i40e_set_vf_vlan_insert(uint8_t port, uint16_t vf_id,
338                                     uint16_t vlan_id);
339
340 /**
341  * Enable/Disable vf broadcast mode
342  *
343  * @param port
344  *    The port identifier of the Ethernet device.
345  * @param vf_id
346  *    ID specifying VF.
347  * @param on
348  *    0 - Disable broadcast.
349  *    1 - Enable broadcast.
350  *
351  * @return
352  *   - (0) if successful.
353  *   - (-ENODEV) if *port* invalid.
354  *   - (-EINVAL) if bad parameter.
355  */
356 int rte_pmd_i40e_set_vf_broadcast(uint8_t port, uint16_t vf_id,
357                                   uint8_t on);
358
359 /**
360  * Enable/Disable vf vlan tag
361  *
362  * @param port
363  *    The port identifier of the Ethernet device.
364  * @param vf_id
365  *    ID specifying VF.
366  * @param on
367  *    0 - Disable VF's vlan tag.
368  *    n - Enable VF's vlan tag.
369  *
370  * @return
371  *   - (0) if successful.
372  *   - (-ENODEV) if *port* invalid.
373  *   - (-EINVAL) if bad parameter.
374  */
375 int rte_pmd_i40e_set_vf_vlan_tag(uint8_t port, uint16_t vf_id, uint8_t on);
376
377 /**
378  * Enable/Disable VF VLAN filter
379  *
380  * @param port
381  *    The port identifier of the Ethernet device.
382  * @param vlan_id
383  *    ID specifying VLAN
384  * @param vf_mask
385  *    Mask to filter VF's
386  * @param on
387  *    0 - Disable VF's VLAN filter.
388  *    1 - Enable VF's VLAN filter.
389  *
390  * @return
391  *   - (0) if successful.
392  *   - (-ENODEV) if *port* invalid.
393  *   - (-EINVAL) if bad parameter.
394  *   - (-ENOTSUP) not supported by firmware.
395  */
396 int rte_pmd_i40e_set_vf_vlan_filter(uint8_t port, uint16_t vlan_id,
397                                     uint64_t vf_mask, uint8_t on);
398
399 /**
400  * Get VF's statistics
401  *
402  * @param port
403  *    The port identifier of the Ethernet device.
404  * @param vf_id
405  *    VF on which to get.
406  * @param stats
407  *    A pointer to a structure of type *rte_eth_stats* to be filled with
408  *    the values of device counters for the following set of statistics:
409  *   - *ipackets* with the total of successfully received packets.
410  *   - *opackets* with the total of successfully transmitted packets.
411  *   - *ibytes*   with the total of successfully received bytes.
412  *   - *obytes*   with the total of successfully transmitted bytes.
413  *   - *ierrors*  with the total of erroneous received packets.
414  *   - *oerrors*  with the total of failed transmitted packets.
415  * @return
416  *   - (0) if successful.
417  *   - (-ENODEV) if *port* invalid.
418  *   - (-EINVAL) if bad parameter.
419  */
420
421 int rte_pmd_i40e_get_vf_stats(uint8_t port,
422                               uint16_t vf_id,
423                               struct rte_eth_stats *stats);
424
425 /**
426  * Clear VF's statistics
427  *
428  * @param port
429  *    The port identifier of the Ethernet device.
430  * @param vf_id
431  *    VF on which to get.
432  * @return
433  *   - (0) if successful.
434  *   - (-ENODEV) if *port* invalid.
435  *   - (-EINVAL) if bad parameter.
436  */
437 int rte_pmd_i40e_reset_vf_stats(uint8_t port,
438                                 uint16_t vf_id);
439
440 /**
441  * Set VF's max bandwidth.
442  *
443  * Per VF bandwidth limitation and per TC bandwidth limitation cannot
444  * be enabled in parallel. If per TC bandwidth is enabled, this function
445  * will disable it.
446  *
447  * @param port
448  *    The port identifier of the Ethernet device.
449  * @param vf_id
450  *    ID specifying VF.
451  * @param bw
452  *    Bandwidth for this VF.
453  *    The value should be an absolute bandwidth in Mbps.
454  *    The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
455  *    Not count the bytes added by physical layer.
456  * @return
457  *   - (0) if successful.
458  *   - (-ENODEV) if *port* invalid.
459  *   - (-EINVAL) if bad parameter.
460  *   - (-ENOTSUP) not supported by firmware.
461  */
462 int rte_pmd_i40e_set_vf_max_bw(uint8_t port,
463                                uint16_t vf_id,
464                                uint32_t bw);
465
466 /**
467  * Set all the TCs' bandwidth weight on a specific VF.
468  *
469  * The bw_weight means the percentage occupied by the TC.
470  * It can be taken as the relative min bandwidth setting.
471  *
472  * @param port
473  *    The port identifier of the Ethernet device.
474  * @param vf_id
475  *    ID specifying VF.
476  * @param tc_num
477  *    Number of TCs.
478  * @param bw_weight
479  *    An array of relative bandwidth weight for all the TCs.
480  *    The summary of the bw_weight should be 100.
481  * @return
482  *   - (0) if successful.
483  *   - (-ENODEV) if *port* invalid.
484  *   - (-EINVAL) if bad parameter.
485  *   - (-ENOTSUP) not supported by firmware.
486  */
487 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint8_t port,
488                                     uint16_t vf_id,
489                                     uint8_t tc_num,
490                                     uint8_t *bw_weight);
491
492 /**
493  * Set a specific TC's max bandwidth on a specific VF.
494  *
495  * @param port
496  *    The port identifier of the Ethernet device.
497  * @param vf_id
498  *    ID specifying VF.
499  * @param tc_no
500  *    Number specifying TC.
501  * @param bw
502  *    Max bandwidth for this TC.
503  *    The value should be an absolute bandwidth in Mbps.
504  *    The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
505  *    Not count the bytes added by physical layer.
506  * @return
507  *   - (0) if successful.
508  *   - (-ENODEV) if *port* invalid.
509  *   - (-EINVAL) if bad parameter.
510  *   - (-ENOTSUP) not supported by firmware.
511  */
512 int rte_pmd_i40e_set_vf_tc_max_bw(uint8_t port,
513                                   uint16_t vf_id,
514                                   uint8_t tc_no,
515                                   uint32_t bw);
516
517 /**
518  * Set some TCs to strict priority mode on a physical port.
519  *
520  * @param port
521  *    The port identifier of the Ethernet device.
522  * @param tc_map
523  *    A bit map for the TCs.
524  * @return
525  *   - (0) if successful.
526  *   - (-ENODEV) if *port* invalid.
527  *   - (-EINVAL) if bad parameter.
528  *   - (-ENOTSUP) not supported by firmware.
529  */
530 int rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map);
531
532 /**
533  * Load/Unload a ddp package
534  *
535  * @param port
536  *    The port identifier of the Ethernet device.
537  * @param buff
538  *    buffer of package.
539  * @param size
540  *    size of buffer.
541  * @param op
542  *   Operation of package processing
543  * @return
544  *   - (0) if successful.
545  *   - (-ENODEV) if *port* invalid.
546  *   - (-EINVAL) if bad parameter.
547  *   - (-EEXIST) if profile exists.
548  *   - (-EACCES) if profile does not exist.
549  *   - (-ENOTSUP) if operation not supported.
550  */
551 int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
552                                      uint32_t size,
553                                      enum rte_pmd_i40e_package_op op);
554
555 /**
556  * rte_pmd_i40e_get_ddp_info - Get profile's info
557  * @param pkg
558  *    buffer of package.
559  * @param pkg_size
560  *    package buffer size
561  * @param info
562  *    buffer for response
563  * @param size
564  *    response buffer size
565  * @param type
566  *    type of information requested
567  * @return
568  *   - (0) if successful.
569  *   - (-ENOTSUP) if information type not supported by the profile.
570  *   - (-EINVAL) if bad parameter.
571  */
572 int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size,
573                                      uint8_t *info, uint32_t size,
574                                      enum rte_pmd_i40e_package_info type);
575
576 /**
577  * rte_pmd_i40e_get_ddp_list - Get loaded profile list
578  * @param port
579  *    port id
580  * @param buff
581  *    buffer for response
582  * @param size
583  *    buffer size
584  * @return
585  *   - (0) if successful.
586  *   - (-ENODEV) if *port* invalid.
587  *   - (-EINVAL) if bad parameter.
588  */
589 int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
590
591 /**
592  * Update hardware defined ptype to software defined packet type
593  * mapping table.
594  *
595  * @param port
596  *    pointer to port identifier of the device.
597  * @param mapping_items
598  *    the base address of the mapping items array.
599  * @param count
600  *    number of mapping items.
601  * @param exclusive
602  *    the flag indicate different ptype mapping update method.
603  *    -(0) only overwrite referred PTYPE mapping,
604  *      keep other PTYPEs mapping unchanged.
605  *    -(!0) overwrite referred PTYPE mapping,
606  *      set other PTYPEs maps to PTYPE_UNKNOWN.
607  */
608 int rte_pmd_i40e_ptype_mapping_update(
609                         uint8_t port,
610                         struct rte_pmd_i40e_ptype_mapping *mapping_items,
611                         uint16_t count,
612                         uint8_t exclusive);
613
614 /**
615  * Reset hardware defined ptype to software defined ptype
616  * mapping table to default.
617  *
618  * @param port
619  *    pointer to port identifier of the device
620  */
621 int rte_pmd_i40e_ptype_mapping_reset(uint8_t port);
622
623 /**
624  * Get hardware defined ptype to software defined ptype
625  * mapping items.
626  *
627  * @param port
628  *    pointer to port identifier of the device.
629  * @param mapping_items
630  *    the base address of the array to store returned items.
631  * @param size
632  *    the size of the input array.
633  * @param count
634  *    the place to store the number of returned items.
635  * @param valid_only
636  *    -(0) return full mapping table.
637  *    -(!0) only return mapping items which packet_type != RTE_PTYPE_UNKNOWN.
638  */
639 int rte_pmd_i40e_ptype_mapping_get(
640                         uint8_t port,
641                         struct rte_pmd_i40e_ptype_mapping *mapping_items,
642                         uint16_t size,
643                         uint16_t *count,
644                         uint8_t valid_only);
645
646 /**
647  * Replace a specific or a group of software defined ptypes
648  * with a new one
649  *
650  * @param port
651  *    pointer to port identifier of the device
652  * @param target
653  *    the packet type to be replaced
654  * @param mask
655  *    -(0) target represent a specific software defined ptype.
656  *    -(!0) target is a mask to represent a group of software defined ptypes.
657  * @param pkt_type
658  *    the new packet type to overwrite
659  */
660 int rte_pmd_i40e_ptype_mapping_replace(uint8_t port,
661                                        uint32_t target,
662                                        uint8_t mask,
663                                        uint32_t pkt_type);
664
665 /**
666  * Add a VF MAC address.
667  *
668  * Add more MAC address for VF. The existing MAC addresses
669  * are still effective.
670  *
671  * @param port
672  *   The port identifier of the Ethernet device.
673  * @param vf_id
674  *   VF id.
675  * @param mac_addr
676  *   VF MAC address.
677  * @return
678  *   - (0) if successful.
679  *   - (-ENODEV) if *port* invalid.
680  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
681  */
682 int rte_pmd_i40e_add_vf_mac_addr(uint8_t port, uint16_t vf_id,
683                                  struct ether_addr *mac_addr);
684
685 #define RTE_PMD_I40E_PCTYPE_MAX         64
686 #define RTE_PMD_I40E_FLOW_TYPE_MAX      64
687
688 struct rte_pmd_i40e_flow_type_mapping {
689         uint16_t flow_type; /**< software defined flow type*/
690         uint64_t pctype;    /**< hardware defined pctype */
691 };
692
693 /**
694  * Update hardware defined pctype to software defined flow type
695  * mapping table.
696  *
697  * @param port
698  *    pointer to port identifier of the device.
699  * @param mapping_items
700  *    the base address of the mapping items array.
701  * @param count
702  *    number of mapping items.
703  * @param exclusive
704  *    the flag indicate different pctype mapping update method.
705  *    -(0) only overwrite referred PCTYPE mapping,
706  *      keep other PCTYPEs mapping unchanged.
707  *    -(!0) overwrite referred PCTYPE mapping,
708  *      set other PCTYPEs maps to PCTYPE_INVALID.
709  */
710 int rte_pmd_i40e_flow_type_mapping_update(
711                         uint8_t port,
712                         struct rte_pmd_i40e_flow_type_mapping *mapping_items,
713                         uint16_t count,
714                         uint8_t exclusive);
715
716 /**
717  * Get software defined flow type to hardware defined pctype
718  * mapping items.
719  *
720  * @param port
721  *    pointer to port identifier of the device.
722  * @param mapping_items
723  *    the base address of the array to store returned items.
724  *    array should be allocated by caller with minimum size of
725  *    RTE_PMD_I40E_FLOW_TYPE_MAX items
726  */
727 int rte_pmd_i40e_flow_type_mapping_get(
728                         uint8_t port,
729                         struct rte_pmd_i40e_flow_type_mapping *mapping_items);
730
731 /**
732  * Reset hardware defined pctype to software defined flow type
733  * mapping table to default.
734  *
735  * @param port
736  *    pointer to port identifier of the device
737  */
738 int rte_pmd_i40e_flow_type_mapping_reset(uint8_t port);
739
740 #endif /* _PMD_I40E_H_ */