DPDK  20.08.0
rte_pmd_i40e.h
Go to the documentation of this file.
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 
17 #include <rte_compat.h>
18 #include <rte_ethdev.h>
19 #include <rte_ether.h>
20 
29 };
30 
35  uint16_t vfid;
36  uint16_t msg_type;
37  uint16_t retval;
38  void *msg;
39  uint16_t msglen;
40 };
41 
46  RTE_PMD_I40E_PKG_OP_UNDEFINED = 0,
50  RTE_PMD_I40E_PKG_OP_MAX = 32
51 };
52 
57  RTE_PMD_I40E_PKG_INFO_UNDEFINED = 0,
58  RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER,
59  RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE,
60  RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES,
61  RTE_PMD_I40E_PKG_INFO_GLOBAL_MAX = 1024,
62  RTE_PMD_I40E_PKG_INFO_HEADER,
63  RTE_PMD_I40E_PKG_INFO_DEVID_NUM,
64  RTE_PMD_I40E_PKG_INFO_DEVID_LIST,
65  RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM,
66  RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST,
67  RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM,
68  RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST,
69  RTE_PMD_I40E_PKG_INFO_PTYPE_NUM,
70  RTE_PMD_I40E_PKG_INFO_PTYPE_LIST,
71  RTE_PMD_I40E_PKG_INFO_MAX = (int)0xFFFFFFFF
72 };
73 
78  RTE_PMD_I40E_RSS_QUEUE_REGION_UNDEFINED,
99  RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
100  RTE_PMD_I40E_RSS_QUEUE_REGION_OP_MAX
101 };
102 
103 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
104 #define RTE_PMD_I40E_PCTYPE_MAX 64
105 #define RTE_PMD_I40E_REGION_MAX_NUM 8
106 #define RTE_PMD_I40E_MAX_USER_PRIORITY 8
107 
113  uint8_t major;
114  uint8_t minor;
115  uint8_t update;
116  uint8_t draft;
117 };
118 
123  uint32_t vendor_dev_id;
124  uint32_t sub_vendor_dev_id;
125 };
126 
131  uint32_t track_id;
132  struct rte_pmd_i40e_ddp_version version;
133  uint8_t owner;
134  uint8_t reserved[7];
135  uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE];
136 };
137 
138 #define RTE_PMD_I40E_DDP_OWNER_UNKNOWN 0xFF
139 
144  uint32_t p_count;
145  struct rte_pmd_i40e_profile_info p_info[1];
146 };
147 
148 #define RTE_PMD_I40E_PROTO_NUM 6
149 #define RTE_PMD_I40E_PROTO_UNUSED 0xFF
150 
155  uint8_t proto_id;
156  char name[RTE_PMD_I40E_DDP_NAME_SIZE];
157 };
158 
163  uint8_t ptype_id;
164  uint8_t protocols[RTE_PMD_I40E_PROTO_NUM];
165 };
166 
172 #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000
173 
174 struct rte_pmd_i40e_ptype_mapping {
175  uint16_t hw_ptype;
176  uint32_t sw_ptype;
177 };
178 
184  uint8_t region_id;
189  uint8_t hw_flowtype;
193  uint8_t queue_num;
195  uint8_t user_priority;
196 };
197 
198 /* queue region info */
199 struct rte_pmd_i40e_queue_region_info {
201  uint8_t region_id;
203  uint8_t queue_start_index;
205  uint8_t queue_num;
207  uint8_t user_priority_num;
209  uint8_t user_priority[RTE_PMD_I40E_MAX_USER_PRIORITY];
211  uint8_t flowtype_num;
217  uint8_t hw_flowtype[RTE_PMD_I40E_PCTYPE_MAX];
218 };
219 
220 struct rte_pmd_i40e_queue_regions {
222  uint16_t queue_region_number;
223  struct rte_pmd_i40e_queue_region_info
224  region[RTE_PMD_I40E_REGION_MAX_NUM];
225 };
226 
231  RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT,
232  RTE_PMD_I40E_PKT_TEMPLATE_REJECT,
233  RTE_PMD_I40E_PKT_TEMPLATE_PASSTHRU,
234 };
235 
249 };
250 
256  uint16_t rx_queue;
266  uint8_t flex_off;
267 };
268 
274  uint16_t pctype;
276  void *packet;
278  uint32_t length;
279 };
280 
291  uint32_t soft_id;
292 };
293 
294 enum rte_pmd_i40e_inset_type {
295  INSET_NONE = 0,
296  INSET_HASH,
297  INSET_FDIR,
298  INSET_FDIR_FLX,
299 };
300 
301 struct rte_pmd_i40e_inset_mask {
302  uint8_t field_idx;
303  uint16_t mask;
304 };
305 
306 struct rte_pmd_i40e_inset {
307  uint64_t inset;
308  struct rte_pmd_i40e_inset_mask mask[2];
309 };
310 
327  uint16_t port,
328  const struct rte_pmd_i40e_pkt_template_conf *conf,
329  uint8_t add);
330 
343 int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf);
344 
360 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port,
361  uint16_t vf_id,
362  uint8_t on);
363 
379 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port,
380  uint16_t vf_id,
381  uint8_t on);
382 
396 int rte_pmd_i40e_set_tx_loopback(uint16_t port,
397  uint8_t on);
398 
414 int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port,
415  uint16_t vf_id,
416  uint8_t on);
417 
433 int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port,
434  uint16_t vf_id,
435  uint8_t on);
436 
457 int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
458  struct rte_ether_addr *mac_addr);
459 
474 int
475 rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,
476  struct rte_ether_addr *mac_addr);
477 
494 int
495 rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
496 
513 int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id,
514  uint16_t vlan_id);
515 
532 int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
533  uint8_t on);
534 
551 int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on);
552 
572 int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id,
573  uint64_t vf_mask, uint8_t on);
574 
597 int rte_pmd_i40e_get_vf_stats(uint16_t port,
598  uint16_t vf_id,
599  struct rte_eth_stats *stats);
600 
613 int rte_pmd_i40e_reset_vf_stats(uint16_t port,
614  uint16_t vf_id);
615 
638 int rte_pmd_i40e_set_vf_max_bw(uint16_t port,
639  uint16_t vf_id,
640  uint32_t bw);
641 
663 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port,
664  uint16_t vf_id,
665  uint8_t tc_num,
666  uint8_t *bw_weight);
667 
688 int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port,
689  uint16_t vf_id,
690  uint8_t tc_no,
691  uint32_t bw);
692 
706 int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map);
707 
727 int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
728  uint32_t size,
729  enum rte_pmd_i40e_package_op op);
730 
748 int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size,
749  uint8_t *info, uint32_t size,
750  enum rte_pmd_i40e_package_info type);
751 
765 int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size);
766 
785  uint16_t port,
786  struct rte_pmd_i40e_ptype_mapping *mapping_items,
787  uint16_t count,
788  uint8_t exclusive);
789 
797 int rte_pmd_i40e_ptype_mapping_reset(uint16_t port);
798 
816  uint16_t port,
817  struct rte_pmd_i40e_ptype_mapping *mapping_items,
818  uint16_t size,
819  uint16_t *count,
820  uint8_t valid_only);
821 
836 int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
837  uint32_t target,
838  uint8_t mask,
839  uint32_t pkt_type);
840 
858 int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id,
859  struct rte_ether_addr *mac_addr);
860 
861 #define RTE_PMD_I40E_PCTYPE_MAX 64
862 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64
863 
864 struct rte_pmd_i40e_flow_type_mapping {
865  uint16_t flow_type;
866  uint64_t pctype;
867 };
868 
887  uint16_t port,
888  struct rte_pmd_i40e_flow_type_mapping *mapping_items,
889  uint16_t count,
890  uint8_t exclusive);
891 
904  uint16_t port,
905  struct rte_pmd_i40e_flow_type_mapping *mapping_items);
906 
914 int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port);
915 
928 int rte_pmd_i40e_query_vfid_by_mac(uint16_t port,
929  const struct rte_ether_addr *vf_mac);
930 
942 int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,
943  enum rte_pmd_i40e_queue_region_op op_type, void *arg);
944 
945 int rte_pmd_i40e_cfg_hash_inset(uint16_t port,
946  uint64_t pctype, uint64_t inset);
947 
965 int rte_pmd_i40e_inset_get(uint16_t port, uint8_t pctype,
966  struct rte_pmd_i40e_inset *inset,
967  enum rte_pmd_i40e_inset_type inset_type);
968 
986 int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
987  struct rte_pmd_i40e_inset *inset,
988  enum rte_pmd_i40e_inset_type inset_type);
989 
1001 static inline int
1002 rte_pmd_i40e_inset_field_get(uint64_t inset, uint8_t field_idx)
1003 {
1004  uint8_t bit_idx;
1005 
1006  if (field_idx > 63)
1007  return 0;
1008 
1009  bit_idx = 63 - field_idx;
1010  if (inset & (1ULL << bit_idx))
1011  return 1;
1012 
1013  return 0;
1014 }
1015 
1027 static inline int
1028 rte_pmd_i40e_inset_field_set(uint64_t *inset, uint8_t field_idx)
1029 {
1030  uint8_t bit_idx;
1031 
1032  if (field_idx > 63)
1033  return -1;
1034 
1035  bit_idx = 63 - field_idx;
1036  *inset = *inset | (1ULL << bit_idx);
1037 
1038  return 0;
1039 }
1040 
1052 static inline int
1053 rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx)
1054 {
1055  uint8_t bit_idx;
1056 
1057  if (field_idx > 63)
1058  return -1;
1059 
1060  bit_idx = 63 - field_idx;
1061  *inset = *inset & ~(1ULL << bit_idx);
1062 
1063  return 0;
1064 }
1065 
1078 __rte_experimental
1079 int
1080 rte_pmd_i40e_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info);
1081 
1094 __rte_experimental
1095 int
1096 rte_pmd_i40e_get_fdir_stats(uint16_t port,
1097  struct rte_eth_fdir_stats *fdir_stat);
1098 
1111 __rte_experimental
1112 int
1113 rte_pmd_i40e_set_gre_key_len(uint16_t port, uint8_t len);
1114 
1129 __rte_experimental
1130 int
1131 rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
1132 
1133 #endif /* _PMD_I40E_H_ */
__rte_experimental int rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev)
int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, struct rte_ether_addr *mac_addr)
static int rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx)
enum rte_pmd_i40e_pkt_template_status report_status
Definition: rte_pmd_i40e.h:260
int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
int rte_pmd_i40e_get_vf_stats(uint16_t port, uint16_t vf_id, struct rte_eth_stats *stats)
int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port, uint16_t vf_id, uint8_t tc_no, uint32_t bw)
static int rte_pmd_i40e_inset_field_set(uint64_t *inset, uint8_t field_idx)
struct rte_pmd_i40e_pkt_template_action action
Definition: rte_pmd_i40e.h:289
int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id, uint16_t vlan_id)
int rte_pmd_i40e_inset_get(uint16_t port, uint8_t pctype, struct rte_pmd_i40e_inset *inset, enum rte_pmd_i40e_inset_type inset_type)
int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size, uint8_t *info, uint32_t size, enum rte_pmd_i40e_package_info type)
int rte_pmd_i40e_set_tx_loopback(uint16_t port, uint8_t on)
int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, uint8_t on)
rte_pmd_i40e_pkt_template_status
Definition: rte_pmd_i40e.h:240
int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on)
static int rte_pmd_i40e_inset_field_get(uint64_t inset, uint8_t field_idx)
rte_pmd_i40e_queue_region_op
Definition: rte_pmd_i40e.h:77
int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on)
int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_mac)
__rte_experimental int rte_pmd_i40e_set_gre_key_len(uint16_t port, uint8_t len)
int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id, enum rte_pmd_i40e_queue_region_op op_type, void *arg)
int rte_pmd_i40e_ptype_mapping_reset(uint16_t port)
int rte_pmd_i40e_reset_vf_stats(uint16_t port, uint16_t vf_id)
rte_pmd_i40e_pkt_template_behavior
Definition: rte_pmd_i40e.h:230
int rte_pmd_i40e_flow_type_mapping_update(uint16_t port, struct rte_pmd_i40e_flow_type_mapping *mapping_items, uint16_t count, uint8_t exclusive)
rte_pmd_i40e_package_info
Definition: rte_pmd_i40e.h:56
rte_pmd_i40e_package_op
Definition: rte_pmd_i40e.h:45
int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port)
__rte_experimental int rte_pmd_i40e_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info)
int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on)
int rte_pmd_i40e_flow_type_mapping_get(uint16_t port, struct rte_pmd_i40e_flow_type_mapping *mapping_items)
int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port, uint16_t vf_id, uint8_t tc_num, uint8_t *bw_weight)
int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype, struct rte_pmd_i40e_inset *inset, enum rte_pmd_i40e_inset_type inset_type)
int rte_pmd_i40e_flow_add_del_packet_template(uint16_t port, const struct rte_pmd_i40e_pkt_template_conf *conf, uint8_t add)
int rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on)
int rte_pmd_i40e_ptype_mapping_update(uint16_t port, struct rte_pmd_i40e_ptype_mapping *mapping_items, uint16_t count, uint8_t exclusive)
int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, struct rte_ether_addr *mac_addr)
int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff, uint32_t size, enum rte_pmd_i40e_package_op op)
int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf)
int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, struct rte_ether_addr *mac_addr)
int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size)
struct rte_pmd_i40e_pkt_template_input input
Definition: rte_pmd_i40e.h:287
int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, uint32_t target, uint8_t mask, uint32_t pkt_type)
int rte_pmd_i40e_set_vf_max_bw(uint16_t port, uint16_t vf_id, uint32_t bw)
int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map)
__rte_experimental int rte_pmd_i40e_get_fdir_stats(uint16_t port, struct rte_eth_fdir_stats *fdir_stat)
int rte_pmd_i40e_ptype_mapping_get(uint16_t port, struct rte_pmd_i40e_ptype_mapping *mapping_items, uint16_t size, uint16_t *count, uint8_t valid_only)
enum rte_pmd_i40e_pkt_template_behavior behavior
Definition: rte_pmd_i40e.h:258
rte_pmd_i40e_mb_event_rsp
Definition: rte_pmd_i40e.h:24
int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)