mk: do not generate LDLIBS from directory dependencies
[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 /**
101  *  Option types of queue region.
102  */
103 enum rte_pmd_i40e_queue_region_op {
104         RTE_PMD_I40E_RSS_QUEUE_REGION_UNDEFINED,
105         /** add queue region set */
106         RTE_PMD_I40E_RSS_QUEUE_REGION_SET,
107         /** add PF region pctype set */
108         RTE_PMD_I40E_RSS_QUEUE_REGION_FLOWTYPE_SET,
109         /** add queue region user priority set */
110         RTE_PMD_I40E_RSS_QUEUE_REGION_USER_PRIORITY_SET,
111         /**
112          * ALL configuration about queue region from up layer
113          * at first will only keep in DPDK software stored in driver,
114          * only after " FLUSH_ON ", it commit all configuration to HW.
115          * Because PMD had to set hardware configuration at a time, so
116          * it will record all up layer command at first.
117          */
118         RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_ON,
119         /**
120          * "FLUSH_OFF " is just clean all configuration about queue
121          * region just now, and restore all to DPDK i40e driver default
122          * config when start up.
123          */
124         RTE_PMD_I40E_RSS_QUEUE_REGION_ALL_FLUSH_OFF,
125         RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
126         RTE_PMD_I40E_RSS_QUEUE_REGION_OP_MAX
127 };
128
129 #define RTE_PMD_I40E_DDP_NAME_SIZE     32
130 #define RTE_PMD_I40E_PCTYPE_MAX        64
131 #define RTE_PMD_I40E_REGION_MAX_NUM    8
132 #define RTE_PMD_I40E_MAX_USER_PRIORITY 8
133
134 /**
135  * Version for dynamic device personalization.
136  * Version in "major.minor.update.draft" format.
137  */
138 struct rte_pmd_i40e_ddp_version {
139         uint8_t major;
140         uint8_t minor;
141         uint8_t update;
142         uint8_t draft;
143 };
144
145 /**
146  * Device ID for dynamic device personalization.
147  */
148 struct rte_pmd_i40e_ddp_device_id {
149         uint32_t vendor_dev_id;
150         uint32_t sub_vendor_dev_id;
151 };
152
153 /**
154  * Profile information in profile info list.
155  */
156 struct rte_pmd_i40e_profile_info {
157         uint32_t track_id;
158         struct rte_pmd_i40e_ddp_version version;
159         uint8_t owner;
160         uint8_t reserved[7];
161         uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE];
162 };
163
164 #define RTE_PMD_I40E_DDP_OWNER_UNKNOWN 0xFF
165
166 /**
167  * Profile information list returned from HW.
168  */
169 struct rte_pmd_i40e_profile_list {
170         uint32_t p_count;
171         struct rte_pmd_i40e_profile_info p_info[1];
172 };
173
174 #define RTE_PMD_I40E_PROTO_NUM 6
175 #define RTE_PMD_I40E_PROTO_UNUSED 0xFF
176
177 /**
178  * Protocols information stored in profile
179  */
180 struct rte_pmd_i40e_proto_info {
181         uint8_t proto_id;
182         char name[RTE_PMD_I40E_DDP_NAME_SIZE];
183 };
184
185 /**
186  * Packet classification/ packet type information stored in profile
187  */
188 struct rte_pmd_i40e_ptype_info {
189         uint8_t ptype_id;
190         uint8_t protocols[RTE_PMD_I40E_PROTO_NUM];
191 };
192
193 /**
194  * ptype mapping table only accept RTE_PTYPE_XXX or "user defined" ptype.
195  * A ptype with MSB set will be regarded as a user defined ptype.
196  * Below macro help to create a user defined ptype.
197  */
198 #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000
199
200 struct rte_pmd_i40e_ptype_mapping {
201         uint16_t hw_ptype; /**< hardware defined packet type*/
202         uint32_t sw_ptype; /**< software defined packet type */
203 };
204
205 /**
206  * Queue region related information.
207  */
208 struct rte_pmd_i40e_queue_region_conf {
209         /** the region id for this configuration */
210         uint8_t region_id;
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;
216         /** the start queue index for this region */
217         uint8_t queue_start_index;
218         /** the total queue number of this queue region */
219         uint8_t queue_num;
220         /** the packet's user priority for this region */
221         uint8_t user_priority;
222 };
223
224 /* queue region info */
225 struct rte_pmd_i40e_queue_region_info {
226         /** the region id for this configuration */
227         uint8_t region_id;
228         /** the start queue index for this region */
229         uint8_t queue_start_index;
230         /** the total queue number of this queue region */
231         uint8_t queue_num;
232         /** the total number of user priority for this region */
233         uint8_t user_priority_num;
234         /** the packet's user priority for this region */
235         uint8_t user_priority[RTE_PMD_I40E_MAX_USER_PRIORITY];
236         /** the total number of flowtype for this region */
237         uint8_t flowtype_num;
238         /**
239          * the pctype or hardware flowtype of packet,
240          * the specific index for each type has been defined
241          * in file i40e_type.h as enum i40e_filter_pctype.
242          */
243         uint8_t hw_flowtype[RTE_PMD_I40E_PCTYPE_MAX];
244 };
245
246 struct rte_pmd_i40e_queue_regions {
247         /** the total number of queue region for this port */
248         uint16_t queue_region_number;
249         struct rte_pmd_i40e_queue_region_info
250                 region[RTE_PMD_I40E_REGION_MAX_NUM];
251 };
252
253 /**
254  * Notify VF when PF link status changes.
255  *
256  * @param port
257  *   The port identifier of the Ethernet device.
258  * @param vf
259  *   VF id.
260  * @return
261  *   - (0) if successful.
262  *   - (-ENODEV) if *port* invalid.
263  *   - (-EINVAL) if *vf* invalid.
264  */
265 int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf);
266
267 /**
268  * Enable/Disable VF MAC anti spoofing.
269  *
270  * @param port
271  *    The port identifier of the Ethernet device.
272  * @param vf_id
273  *    VF on which to set MAC anti spoofing.
274  * @param on
275  *    1 - Enable VFs MAC anti spoofing.
276  *    0 - Disable VFs MAC anti spoofing.
277  * @return
278  *   - (0) if successful.
279  *   - (-ENODEV) if *port* invalid.
280  *   - (-EINVAL) if bad parameter.
281  */
282 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port,
283                                        uint16_t vf_id,
284                                        uint8_t on);
285
286 /**
287  * Enable/Disable VF VLAN anti spoofing.
288  *
289  * @param port
290  *    The port identifier of the Ethernet device.
291  * @param vf_id
292  *    VF on which to set VLAN anti spoofing.
293  * @param on
294  *    1 - Enable VFs VLAN anti spoofing.
295  *    0 - Disable VFs VLAN anti spoofing.
296  * @return
297  *   - (0) if successful.
298  *   - (-ENODEV) if *port* invalid.
299  *   - (-EINVAL) if bad parameter.
300  */
301 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port,
302                                         uint16_t vf_id,
303                                         uint8_t on);
304
305 /**
306  * Enable/Disable TX loopback on all the PF and VFs.
307  *
308  * @param port
309  *    The port identifier of the Ethernet device.
310  * @param on
311  *    1 - Enable TX loopback.
312  *    0 - Disable TX loopback.
313  * @return
314  *   - (0) if successful.
315  *   - (-ENODEV) if *port* invalid.
316  *   - (-EINVAL) if bad parameter.
317  */
318 int rte_pmd_i40e_set_tx_loopback(uint16_t port,
319                                  uint8_t on);
320
321 /**
322  * Enable/Disable VF unicast promiscuous mode.
323  *
324  * @param port
325  *    The port identifier of the Ethernet device.
326  * @param vf_id
327  *    VF on which to set.
328  * @param on
329  *    1 - Enable.
330  *    0 - Disable.
331  * @return
332  *   - (0) if successful.
333  *   - (-ENODEV) if *port* invalid.
334  *   - (-EINVAL) if bad parameter.
335  */
336 int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port,
337                                         uint16_t vf_id,
338                                         uint8_t on);
339
340 /**
341  * Enable/Disable VF multicast promiscuous mode.
342  *
343  * @param port
344  *    The port identifier of the Ethernet device.
345  * @param vf_id
346  *    VF on which to set.
347  * @param on
348  *    1 - Enable.
349  *    0 - Disable.
350  * @return
351  *   - (0) if successful.
352  *   - (-ENODEV) if *port* invalid.
353  *   - (-EINVAL) if bad parameter.
354  */
355 int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port,
356                                           uint16_t vf_id,
357                                           uint8_t on);
358
359 /**
360  * Set the VF MAC address.
361  *
362  * PF should set MAC address before VF initialized, if PF sets the MAC
363  * address after VF initialized, new MAC address won't be effective until
364  * VF reinitialize.
365  *
366  * This will remove all existing MAC filters.
367  *
368  * @param port
369  *   The port identifier of the Ethernet device.
370  * @param vf_id
371  *   VF id.
372  * @param mac_addr
373  *   VF MAC address.
374  * @return
375  *   - (0) if successful.
376  *   - (-ENODEV) if *port* invalid.
377  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
378  */
379 int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
380                                  struct ether_addr *mac_addr);
381
382 /**
383  * Enable/Disable vf vlan strip for all queues in a pool
384  *
385  * @param port
386  *    The port identifier of the Ethernet device.
387  * @param vf
388  *    ID specifying VF.
389  * @param on
390  *    1 - Enable VF's vlan strip on RX queues.
391  *    0 - Disable VF's vlan strip on RX queues.
392  *
393  * @return
394  *   - (0) if successful.
395  *   - (-ENODEV) if *port* invalid.
396  *   - (-EINVAL) if bad parameter.
397  */
398 int
399 rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
400
401 /**
402  * Enable/Disable vf vlan insert
403  *
404  * @param port
405  *    The port identifier of the Ethernet device.
406  * @param vf_id
407  *    ID specifying VF.
408  * @param vlan_id
409  *    0 - Disable VF's vlan insert.
410  *    n - Enable; n is inserted as the vlan id.
411  *
412  * @return
413  *   - (0) if successful.
414  *   - (-ENODEV) if *port* invalid.
415  *   - (-EINVAL) if bad parameter.
416  */
417 int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id,
418                                     uint16_t vlan_id);
419
420 /**
421  * Enable/Disable vf broadcast mode
422  *
423  * @param port
424  *    The port identifier of the Ethernet device.
425  * @param vf_id
426  *    ID specifying VF.
427  * @param on
428  *    0 - Disable broadcast.
429  *    1 - Enable broadcast.
430  *
431  * @return
432  *   - (0) if successful.
433  *   - (-ENODEV) if *port* invalid.
434  *   - (-EINVAL) if bad parameter.
435  */
436 int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
437                                   uint8_t on);
438
439 /**
440  * Enable/Disable vf vlan tag
441  *
442  * @param port
443  *    The port identifier of the Ethernet device.
444  * @param vf_id
445  *    ID specifying VF.
446  * @param on
447  *    0 - Disable VF's vlan tag.
448  *    n - Enable VF's vlan tag.
449  *
450  * @return
451  *   - (0) if successful.
452  *   - (-ENODEV) if *port* invalid.
453  *   - (-EINVAL) if bad parameter.
454  */
455 int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on);
456
457 /**
458  * Enable/Disable VF VLAN filter
459  *
460  * @param port
461  *    The port identifier of the Ethernet device.
462  * @param vlan_id
463  *    ID specifying VLAN
464  * @param vf_mask
465  *    Mask to filter VF's
466  * @param on
467  *    0 - Disable VF's VLAN filter.
468  *    1 - Enable VF's VLAN filter.
469  *
470  * @return
471  *   - (0) if successful.
472  *   - (-ENODEV) if *port* invalid.
473  *   - (-EINVAL) if bad parameter.
474  *   - (-ENOTSUP) not supported by firmware.
475  */
476 int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id,
477                                     uint64_t vf_mask, uint8_t on);
478
479 /**
480  * Get VF's statistics
481  *
482  * @param port
483  *    The port identifier of the Ethernet device.
484  * @param vf_id
485  *    VF on which to get.
486  * @param stats
487  *    A pointer to a structure of type *rte_eth_stats* to be filled with
488  *    the values of device counters for the following set of statistics:
489  *   - *ipackets* with the total of successfully received packets.
490  *   - *opackets* with the total of successfully transmitted packets.
491  *   - *ibytes*   with the total of successfully received bytes.
492  *   - *obytes*   with the total of successfully transmitted bytes.
493  *   - *ierrors*  with the total of erroneous received packets.
494  *   - *oerrors*  with the total of failed transmitted packets.
495  * @return
496  *   - (0) if successful.
497  *   - (-ENODEV) if *port* invalid.
498  *   - (-EINVAL) if bad parameter.
499  */
500
501 int rte_pmd_i40e_get_vf_stats(uint16_t port,
502                               uint16_t vf_id,
503                               struct rte_eth_stats *stats);
504
505 /**
506  * Clear VF's statistics
507  *
508  * @param port
509  *    The port identifier of the Ethernet device.
510  * @param vf_id
511  *    VF on which to get.
512  * @return
513  *   - (0) if successful.
514  *   - (-ENODEV) if *port* invalid.
515  *   - (-EINVAL) if bad parameter.
516  */
517 int rte_pmd_i40e_reset_vf_stats(uint16_t port,
518                                 uint16_t vf_id);
519
520 /**
521  * Set VF's max bandwidth.
522  *
523  * Per VF bandwidth limitation and per TC bandwidth limitation cannot
524  * be enabled in parallel. If per TC bandwidth is enabled, this function
525  * will disable it.
526  *
527  * @param port
528  *    The port identifier of the Ethernet device.
529  * @param vf_id
530  *    ID specifying VF.
531  * @param bw
532  *    Bandwidth for this VF.
533  *    The value should be an absolute bandwidth in Mbps.
534  *    The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
535  *    Not count the bytes added by physical layer.
536  * @return
537  *   - (0) if successful.
538  *   - (-ENODEV) if *port* invalid.
539  *   - (-EINVAL) if bad parameter.
540  *   - (-ENOTSUP) not supported by firmware.
541  */
542 int rte_pmd_i40e_set_vf_max_bw(uint16_t port,
543                                uint16_t vf_id,
544                                uint32_t bw);
545
546 /**
547  * Set all the TCs' bandwidth weight on a specific VF.
548  *
549  * The bw_weight means the percentage occupied by the TC.
550  * It can be taken as the relative min bandwidth setting.
551  *
552  * @param port
553  *    The port identifier of the Ethernet device.
554  * @param vf_id
555  *    ID specifying VF.
556  * @param tc_num
557  *    Number of TCs.
558  * @param bw_weight
559  *    An array of relative bandwidth weight for all the TCs.
560  *    The summary of the bw_weight should be 100.
561  * @return
562  *   - (0) if successful.
563  *   - (-ENODEV) if *port* invalid.
564  *   - (-EINVAL) if bad parameter.
565  *   - (-ENOTSUP) not supported by firmware.
566  */
567 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port,
568                                     uint16_t vf_id,
569                                     uint8_t tc_num,
570                                     uint8_t *bw_weight);
571
572 /**
573  * Set a specific TC's max bandwidth on a specific VF.
574  *
575  * @param port
576  *    The port identifier of the Ethernet device.
577  * @param vf_id
578  *    ID specifying VF.
579  * @param tc_no
580  *    Number specifying TC.
581  * @param bw
582  *    Max bandwidth for this TC.
583  *    The value should be an absolute bandwidth in Mbps.
584  *    The bandwidth is a L2 bandwidth counting the bytes of ethernet packets.
585  *    Not count the bytes added by physical layer.
586  * @return
587  *   - (0) if successful.
588  *   - (-ENODEV) if *port* invalid.
589  *   - (-EINVAL) if bad parameter.
590  *   - (-ENOTSUP) not supported by firmware.
591  */
592 int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port,
593                                   uint16_t vf_id,
594                                   uint8_t tc_no,
595                                   uint32_t bw);
596
597 /**
598  * Set some TCs to strict priority mode on a physical port.
599  *
600  * @param port
601  *    The port identifier of the Ethernet device.
602  * @param tc_map
603  *    A bit map for the TCs.
604  * @return
605  *   - (0) if successful.
606  *   - (-ENODEV) if *port* invalid.
607  *   - (-EINVAL) if bad parameter.
608  *   - (-ENOTSUP) not supported by firmware.
609  */
610 int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map);
611
612 /**
613  * Load/Unload a ddp package
614  *
615  * @param port
616  *    The port identifier of the Ethernet device.
617  * @param buff
618  *    buffer of package.
619  * @param size
620  *    size of buffer.
621  * @param op
622  *   Operation of package processing
623  * @return
624  *   - (0) if successful.
625  *   - (-ENODEV) if *port* invalid.
626  *   - (-EINVAL) if bad parameter.
627  *   - (-EEXIST) if profile exists.
628  *   - (-EACCES) if profile does not exist.
629  *   - (-ENOTSUP) if operation not supported.
630  */
631 int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
632                                      uint32_t size,
633                                      enum rte_pmd_i40e_package_op op);
634
635 /**
636  * rte_pmd_i40e_get_ddp_info - Get profile's info
637  * @param pkg
638  *    buffer of package.
639  * @param pkg_size
640  *    package buffer size
641  * @param info
642  *    buffer for response
643  * @param size
644  *    response buffer size
645  * @param type
646  *    type of information requested
647  * @return
648  *   - (0) if successful.
649  *   - (-ENOTSUP) if information type not supported by the profile.
650  *   - (-EINVAL) if bad parameter.
651  */
652 int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size,
653                                      uint8_t *info, uint32_t size,
654                                      enum rte_pmd_i40e_package_info type);
655
656 /**
657  * rte_pmd_i40e_get_ddp_list - Get loaded profile list
658  * @param port
659  *    port id
660  * @param buff
661  *    buffer for response
662  * @param size
663  *    buffer size
664  * @return
665  *   - (0) if successful.
666  *   - (-ENODEV) if *port* invalid.
667  *   - (-EINVAL) if bad parameter.
668  */
669 int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size);
670
671 /**
672  * Update hardware defined ptype to software defined packet type
673  * mapping table.
674  *
675  * @param port
676  *    pointer to port identifier of the device.
677  * @param mapping_items
678  *    the base address of the mapping items array.
679  * @param count
680  *    number of mapping items.
681  * @param exclusive
682  *    the flag indicate different ptype mapping update method.
683  *    -(0) only overwrite referred PTYPE mapping,
684  *      keep other PTYPEs mapping unchanged.
685  *    -(!0) overwrite referred PTYPE mapping,
686  *      set other PTYPEs maps to PTYPE_UNKNOWN.
687  */
688 int rte_pmd_i40e_ptype_mapping_update(
689                         uint16_t port,
690                         struct rte_pmd_i40e_ptype_mapping *mapping_items,
691                         uint16_t count,
692                         uint8_t exclusive);
693
694 /**
695  * Reset hardware defined ptype to software defined ptype
696  * mapping table to default.
697  *
698  * @param port
699  *    pointer to port identifier of the device
700  */
701 int rte_pmd_i40e_ptype_mapping_reset(uint16_t port);
702
703 /**
704  * Get hardware defined ptype to software defined ptype
705  * mapping items.
706  *
707  * @param port
708  *    pointer to port identifier of the device.
709  * @param mapping_items
710  *    the base address of the array to store returned items.
711  * @param size
712  *    the size of the input array.
713  * @param count
714  *    the place to store the number of returned items.
715  * @param valid_only
716  *    -(0) return full mapping table.
717  *    -(!0) only return mapping items which packet_type != RTE_PTYPE_UNKNOWN.
718  */
719 int rte_pmd_i40e_ptype_mapping_get(
720                         uint16_t port,
721                         struct rte_pmd_i40e_ptype_mapping *mapping_items,
722                         uint16_t size,
723                         uint16_t *count,
724                         uint8_t valid_only);
725
726 /**
727  * Replace a specific or a group of software defined ptypes
728  * with a new one
729  *
730  * @param port
731  *    pointer to port identifier of the device
732  * @param target
733  *    the packet type to be replaced
734  * @param mask
735  *    -(0) target represent a specific software defined ptype.
736  *    -(!0) target is a mask to represent a group of software defined ptypes.
737  * @param pkt_type
738  *    the new packet type to overwrite
739  */
740 int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
741                                        uint32_t target,
742                                        uint8_t mask,
743                                        uint32_t pkt_type);
744
745 /**
746  * Add a VF MAC address.
747  *
748  * Add more MAC address for VF. The existing MAC addresses
749  * are still effective.
750  *
751  * @param port
752  *   The port identifier of the Ethernet device.
753  * @param vf_id
754  *   VF id.
755  * @param mac_addr
756  *   VF MAC address.
757  * @return
758  *   - (0) if successful.
759  *   - (-ENODEV) if *port* invalid.
760  *   - (-EINVAL) if *vf* or *mac_addr* is invalid.
761  */
762 int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id,
763                                  struct ether_addr *mac_addr);
764
765 #define RTE_PMD_I40E_PCTYPE_MAX         64
766 #define RTE_PMD_I40E_FLOW_TYPE_MAX      64
767
768 struct rte_pmd_i40e_flow_type_mapping {
769         uint16_t flow_type; /**< software defined flow type*/
770         uint64_t pctype;    /**< hardware defined pctype */
771 };
772
773 /**
774  * Update hardware defined pctype to software defined flow type
775  * mapping table.
776  *
777  * @param port
778  *    pointer to port identifier of the device.
779  * @param mapping_items
780  *    the base address of the mapping items array.
781  * @param count
782  *    number of mapping items.
783  * @param exclusive
784  *    the flag indicate different pctype mapping update method.
785  *    -(0) only overwrite referred PCTYPE mapping,
786  *      keep other PCTYPEs mapping unchanged.
787  *    -(!0) overwrite referred PCTYPE mapping,
788  *      set other PCTYPEs maps to PCTYPE_INVALID.
789  */
790 int rte_pmd_i40e_flow_type_mapping_update(
791                         uint16_t port,
792                         struct rte_pmd_i40e_flow_type_mapping *mapping_items,
793                         uint16_t count,
794                         uint8_t exclusive);
795
796 /**
797  * Get software defined flow type to hardware defined pctype
798  * mapping items.
799  *
800  * @param port
801  *    pointer to port identifier of the device.
802  * @param mapping_items
803  *    the base address of the array to store returned items.
804  *    array should be allocated by caller with minimum size of
805  *    RTE_PMD_I40E_FLOW_TYPE_MAX items
806  */
807 int rte_pmd_i40e_flow_type_mapping_get(
808                         uint16_t port,
809                         struct rte_pmd_i40e_flow_type_mapping *mapping_items);
810
811 /**
812  * Reset hardware defined pctype to software defined flow type
813  * mapping table to default.
814  *
815  * @param port
816  *    pointer to port identifier of the device
817  */
818 int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port);
819
820 /**
821  * On the PF, find VF index based on VF MAC address
822  *
823  * @param port
824  *    pointer to port identifier of the device
825  * @param vf_mac
826  *    the mac address of the vf to determine index of
827  * @return
828  *    The index of vfid If successful.
829  *    -EINVAL: vf mac address does not exist for this port
830  *    -ENOTSUP: i40e not supported for this port.
831  */
832 int rte_pmd_i40e_query_vfid_by_mac(uint16_t port,
833                                         const struct ether_addr *vf_mac);
834
835 /**
836  * Do RSS queue region configuration for that port as
837  * the command option type
838  *
839  * @param port_id
840  *    The port identifier of the Ethernet device.
841  * @param op_type
842  *    Queue region operation type
843  * @param arg
844  *    Queue region operation type specific data
845  */
846 int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,
847                         enum rte_pmd_i40e_queue_region_op op_type, void *arg);
848
849 #endif /* _PMD_I40E_H_ */