DPDK  21.11.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 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <rte_compat.h>
22 #include <rte_ethdev.h>
23 #include <rte_ether.h>
24 
33 };
34 
39  uint16_t vfid;
40  uint16_t msg_type;
41  uint16_t retval;
42  void *msg;
43  uint16_t msglen;
44 };
45 
50  RTE_PMD_I40E_PKG_OP_UNDEFINED = 0,
54  RTE_PMD_I40E_PKG_OP_MAX = 32
55 };
56 
61  RTE_PMD_I40E_PKG_INFO_UNDEFINED = 0,
62  RTE_PMD_I40E_PKG_INFO_GLOBAL_HEADER,
63  RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES_SIZE,
64  RTE_PMD_I40E_PKG_INFO_GLOBAL_NOTES,
65  RTE_PMD_I40E_PKG_INFO_GLOBAL_MAX = 1024,
66  RTE_PMD_I40E_PKG_INFO_HEADER,
67  RTE_PMD_I40E_PKG_INFO_DEVID_NUM,
68  RTE_PMD_I40E_PKG_INFO_DEVID_LIST,
69  RTE_PMD_I40E_PKG_INFO_PROTOCOL_NUM,
70  RTE_PMD_I40E_PKG_INFO_PROTOCOL_LIST,
71  RTE_PMD_I40E_PKG_INFO_PCTYPE_NUM,
72  RTE_PMD_I40E_PKG_INFO_PCTYPE_LIST,
73  RTE_PMD_I40E_PKG_INFO_PTYPE_NUM,
74  RTE_PMD_I40E_PKG_INFO_PTYPE_LIST,
75  RTE_PMD_I40E_PKG_INFO_MAX = (int)0xFFFFFFFF
76 };
77 
82  RTE_PMD_I40E_RSS_QUEUE_REGION_UNDEFINED,
103  RTE_PMD_I40E_RSS_QUEUE_REGION_INFO_GET,
104  RTE_PMD_I40E_RSS_QUEUE_REGION_OP_MAX
105 };
106 
107 #define RTE_PMD_I40E_DDP_NAME_SIZE 32
108 #define RTE_PMD_I40E_PCTYPE_MAX 64
109 #define RTE_PMD_I40E_REGION_MAX_NUM 8
110 #define RTE_PMD_I40E_MAX_USER_PRIORITY 8
111 
117  uint8_t major;
118  uint8_t minor;
119  uint8_t update;
120  uint8_t draft;
121 };
122 
127  uint32_t vendor_dev_id;
128  uint32_t sub_vendor_dev_id;
129 };
130 
135  uint32_t track_id;
136  struct rte_pmd_i40e_ddp_version version;
137  uint8_t owner;
138  uint8_t reserved[7];
139  uint8_t name[RTE_PMD_I40E_DDP_NAME_SIZE];
140 };
141 
142 #define RTE_PMD_I40E_DDP_OWNER_UNKNOWN 0xFF
143 
148  uint32_t p_count;
149  struct rte_pmd_i40e_profile_info p_info[1];
150 };
151 
152 #define RTE_PMD_I40E_PROTO_NUM 6
153 #define RTE_PMD_I40E_PROTO_UNUSED 0xFF
154 
159  uint8_t proto_id;
160  char name[RTE_PMD_I40E_DDP_NAME_SIZE];
161 };
162 
167  uint8_t ptype_id;
168  uint8_t protocols[RTE_PMD_I40E_PROTO_NUM];
169 };
170 
176 #define RTE_PMD_I40E_PTYPE_USER_DEFINE_MASK 0x80000000
177 
178 struct rte_pmd_i40e_ptype_mapping {
179  uint16_t hw_ptype;
180  uint32_t sw_ptype;
181 };
182 
188  uint8_t region_id;
193  uint8_t hw_flowtype;
197  uint8_t queue_num;
199  uint8_t user_priority;
200 };
201 
202 /* queue region info */
203 struct rte_pmd_i40e_queue_region_info {
205  uint8_t region_id;
207  uint8_t queue_start_index;
209  uint8_t queue_num;
211  uint8_t user_priority_num;
213  uint8_t user_priority[RTE_PMD_I40E_MAX_USER_PRIORITY];
215  uint8_t flowtype_num;
221  uint8_t hw_flowtype[RTE_PMD_I40E_PCTYPE_MAX];
222 };
223 
224 struct rte_pmd_i40e_queue_regions {
226  uint16_t queue_region_number;
227  struct rte_pmd_i40e_queue_region_info
228  region[RTE_PMD_I40E_REGION_MAX_NUM];
229 };
230 
235  RTE_PMD_I40E_PKT_TEMPLATE_ACCEPT,
236  RTE_PMD_I40E_PKT_TEMPLATE_REJECT,
237  RTE_PMD_I40E_PKT_TEMPLATE_PASSTHRU,
238 };
239 
253 };
254 
260  uint16_t rx_queue;
270  uint8_t flex_off;
271 };
272 
278  uint16_t pctype;
280  void *packet;
282  uint32_t length;
283 };
284 
295  uint32_t soft_id;
296 };
297 
298 enum rte_pmd_i40e_inset_type {
299  INSET_NONE = 0,
300  INSET_HASH,
301  INSET_FDIR,
302  INSET_FDIR_FLX,
303 };
304 
305 struct rte_pmd_i40e_inset_mask {
306  uint8_t field_idx;
307  uint16_t mask;
308 };
309 
310 struct rte_pmd_i40e_inset {
311  uint64_t inset;
312  struct rte_pmd_i40e_inset_mask mask[2];
313 };
314 
331  uint16_t port,
332  const struct rte_pmd_i40e_pkt_template_conf *conf,
333  uint8_t add);
334 
347 int rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf);
348 
364 int rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port,
365  uint16_t vf_id,
366  uint8_t on);
367 
383 int rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port,
384  uint16_t vf_id,
385  uint8_t on);
386 
400 int rte_pmd_i40e_set_tx_loopback(uint16_t port,
401  uint8_t on);
402 
418 int rte_pmd_i40e_set_vf_unicast_promisc(uint16_t port,
419  uint16_t vf_id,
420  uint8_t on);
421 
437 int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port,
438  uint16_t vf_id,
439  uint8_t on);
440 
461 int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,
462  struct rte_ether_addr *mac_addr);
463 
478 int
479 rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,
480  struct rte_ether_addr *mac_addr);
481 
498 int
499 rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on);
500 
517 int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id,
518  uint16_t vlan_id);
519 
536 int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id,
537  uint8_t on);
538 
555 int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on);
556 
576 int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id,
577  uint64_t vf_mask, uint8_t on);
578 
601 int rte_pmd_i40e_get_vf_stats(uint16_t port,
602  uint16_t vf_id,
603  struct rte_eth_stats *stats);
604 
617 int rte_pmd_i40e_reset_vf_stats(uint16_t port,
618  uint16_t vf_id);
619 
642 int rte_pmd_i40e_set_vf_max_bw(uint16_t port,
643  uint16_t vf_id,
644  uint32_t bw);
645 
667 int rte_pmd_i40e_set_vf_tc_bw_alloc(uint16_t port,
668  uint16_t vf_id,
669  uint8_t tc_num,
670  uint8_t *bw_weight);
671 
692 int rte_pmd_i40e_set_vf_tc_max_bw(uint16_t port,
693  uint16_t vf_id,
694  uint8_t tc_no,
695  uint32_t bw);
696 
710 int rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map);
711 
731 int rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
732  uint32_t size,
733  enum rte_pmd_i40e_package_op op);
734 
752 int rte_pmd_i40e_get_ddp_info(uint8_t *pkg, uint32_t pkg_size,
753  uint8_t *info, uint32_t size,
754  enum rte_pmd_i40e_package_info type);
755 
769 int rte_pmd_i40e_get_ddp_list(uint16_t port, uint8_t *buff, uint32_t size);
770 
789  uint16_t port,
790  struct rte_pmd_i40e_ptype_mapping *mapping_items,
791  uint16_t count,
792  uint8_t exclusive);
793 
801 int rte_pmd_i40e_ptype_mapping_reset(uint16_t port);
802 
820  uint16_t port,
821  struct rte_pmd_i40e_ptype_mapping *mapping_items,
822  uint16_t size,
823  uint16_t *count,
824  uint8_t valid_only);
825 
840 int rte_pmd_i40e_ptype_mapping_replace(uint16_t port,
841  uint32_t target,
842  uint8_t mask,
843  uint32_t pkt_type);
844 
862 int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id,
863  struct rte_ether_addr *mac_addr);
864 
865 #define RTE_PMD_I40E_PCTYPE_MAX 64
866 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64
867 
868 struct rte_pmd_i40e_flow_type_mapping {
869  uint16_t flow_type;
870  uint64_t pctype;
871 };
872 
891  uint16_t port,
892  struct rte_pmd_i40e_flow_type_mapping *mapping_items,
893  uint16_t count,
894  uint8_t exclusive);
895 
908  uint16_t port,
909  struct rte_pmd_i40e_flow_type_mapping *mapping_items);
910 
918 int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port);
919 
932 int rte_pmd_i40e_query_vfid_by_mac(uint16_t port,
933  const struct rte_ether_addr *vf_mac);
934 
946 int rte_pmd_i40e_rss_queue_region_conf(uint16_t port_id,
947  enum rte_pmd_i40e_queue_region_op op_type, void *arg);
948 
949 int rte_pmd_i40e_cfg_hash_inset(uint16_t port,
950  uint64_t pctype, uint64_t inset);
951 
969 int rte_pmd_i40e_inset_get(uint16_t port, uint8_t pctype,
970  struct rte_pmd_i40e_inset *inset,
971  enum rte_pmd_i40e_inset_type inset_type);
972 
990 int rte_pmd_i40e_inset_set(uint16_t port, uint8_t pctype,
991  struct rte_pmd_i40e_inset *inset,
992  enum rte_pmd_i40e_inset_type inset_type);
993 
1005 static inline int
1006 rte_pmd_i40e_inset_field_get(uint64_t inset, uint8_t field_idx)
1007 {
1008  uint8_t bit_idx;
1009 
1010  if (field_idx > 63)
1011  return 0;
1012 
1013  bit_idx = 63 - field_idx;
1014  if (inset & (1ULL << bit_idx))
1015  return 1;
1016 
1017  return 0;
1018 }
1019 
1031 static inline int
1032 rte_pmd_i40e_inset_field_set(uint64_t *inset, uint8_t field_idx)
1033 {
1034  uint8_t bit_idx;
1035 
1036  if (field_idx > 63)
1037  return -1;
1038 
1039  bit_idx = 63 - field_idx;
1040  *inset = *inset | (1ULL << bit_idx);
1041 
1042  return 0;
1043 }
1044 
1056 static inline int
1057 rte_pmd_i40e_inset_field_clear(uint64_t *inset, uint8_t field_idx)
1058 {
1059  uint8_t bit_idx;
1060 
1061  if (field_idx > 63)
1062  return -1;
1063 
1064  bit_idx = 63 - field_idx;
1065  *inset = *inset & ~(1ULL << bit_idx);
1066 
1067  return 0;
1068 }
1069 
1082 __rte_experimental
1083 int
1084 rte_pmd_i40e_get_fdir_info(uint16_t port, struct rte_eth_fdir_info *fdir_info);
1085 
1098 __rte_experimental
1099 int
1100 rte_pmd_i40e_get_fdir_stats(uint16_t port,
1101  struct rte_eth_fdir_stats *fdir_stat);
1102 
1115 __rte_experimental
1116 int
1117 rte_pmd_i40e_set_gre_key_len(uint16_t port, uint8_t len);
1118 
1133 __rte_experimental
1134 int
1135 rte_pmd_i40e_set_switch_dev(uint16_t port_id, struct rte_eth_dev *switch_dev);
1136 
1137 #ifdef __cplusplus
1138 }
1139 #endif
1140 
1141 #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)
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)
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:244
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:81
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:234
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:60
rte_pmd_i40e_package_op
Definition: rte_pmd_i40e.h:49
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)
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)
rte_pmd_i40e_mb_event_rsp
Definition: rte_pmd_i40e.h:28
int rte_pmd_i40e_set_vf_vlan_filter(uint16_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t on)