4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _I40E_ETHDEV_H_
35 #define _I40E_ETHDEV_H_
37 #include <rte_eth_ctrl.h>
39 #define I40E_VLAN_TAG_SIZE 4
41 #define I40E_AQ_LEN 32
42 #define I40E_AQ_BUF_SZ 4096
43 /* Number of queues per TC should be one of 1, 2, 4, 8, 16, 32, 64 */
44 #define I40E_MAX_Q_PER_TC 64
45 #define I40E_NUM_DESC_DEFAULT 512
46 #define I40E_NUM_DESC_ALIGN 32
47 #define I40E_BUF_SIZE_MIN 1024
48 #define I40E_FRAME_SIZE_MAX 9728
49 #define I40E_QUEUE_BASE_ADDR_UNIT 128
50 /* number of VSIs and queue default setting */
51 #define I40E_MAX_QP_NUM_PER_VF 16
52 #define I40E_DEFAULT_QP_NUM_FDIR 1
53 #define I40E_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))
54 #define I40E_VFTA_SIZE (4096 / I40E_UINT32_BIT_SIZE)
56 * vlan_id is a 12 bit number.
57 * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
58 * 2^5 = 32. The val of lower 5 bits specifies the bit in the 32bit element.
59 * The higher 7 bit val specifies VFTA array index.
61 #define I40E_VFTA_BIT(vlan_id) (1 << ((vlan_id) & 0x1F))
62 #define I40E_VFTA_IDX(vlan_id) ((vlan_id) >> 5)
64 /* Default TC traffic in case DCB is not enabled */
65 #define I40E_DEFAULT_TCMAP 0x1
66 #define I40E_FDIR_QUEUE_ID 0
68 /* Always assign pool 0 to main VSI, VMDQ will start from 1 */
69 #define I40E_VMDQ_POOL_BASE 1
71 #define I40E_DEFAULT_RX_FREE_THRESH 32
72 #define I40E_DEFAULT_RX_PTHRESH 8
73 #define I40E_DEFAULT_RX_HTHRESH 8
74 #define I40E_DEFAULT_RX_WTHRESH 0
76 #define I40E_DEFAULT_TX_FREE_THRESH 32
77 #define I40E_DEFAULT_TX_PTHRESH 32
78 #define I40E_DEFAULT_TX_HTHRESH 0
79 #define I40E_DEFAULT_TX_WTHRESH 0
80 #define I40E_DEFAULT_TX_RSBIT_THRESH 32
82 /* Bit shift and mask */
83 #define I40E_4_BIT_WIDTH (CHAR_BIT / 2)
84 #define I40E_4_BIT_MASK RTE_LEN2MASK(I40E_4_BIT_WIDTH, uint8_t)
85 #define I40E_8_BIT_WIDTH CHAR_BIT
86 #define I40E_8_BIT_MASK UINT8_MAX
87 #define I40E_16_BIT_WIDTH (CHAR_BIT * 2)
88 #define I40E_16_BIT_MASK UINT16_MAX
89 #define I40E_32_BIT_WIDTH (CHAR_BIT * 4)
90 #define I40E_32_BIT_MASK UINT32_MAX
91 #define I40E_48_BIT_WIDTH (CHAR_BIT * 6)
92 #define I40E_48_BIT_MASK RTE_LEN2MASK(I40E_48_BIT_WIDTH, uint64_t)
94 /* Linux PF host with virtchnl version 1.1 */
95 #define PF_IS_V11(vf) \
96 (((vf)->version_major == I40E_VIRTCHNL_VERSION_MAJOR) && \
97 ((vf)->version_minor == 1))
99 /* index flex payload per layer */
100 enum i40e_flxpld_layer_idx {
101 I40E_FLXPLD_L2_IDX = 0,
102 I40E_FLXPLD_L3_IDX = 1,
103 I40E_FLXPLD_L4_IDX = 2,
104 I40E_MAX_FLXPLD_LAYER = 3,
106 #define I40E_MAX_FLXPLD_FIED 3 /* max number of flex payload fields */
107 #define I40E_FDIR_BITMASK_NUM_WORD 2 /* max number of bitmask words */
108 #define I40E_FDIR_MAX_FLEXWORD_NUM 8 /* max number of flexpayload words */
109 #define I40E_FDIR_MAX_FLEX_LEN 16 /* len in bytes of flex payload */
110 #define I40E_INSET_MASK_NUM_REG 2 /* number of input set mask registers */
113 #define I40E_FLAG_RSS (1ULL << 0)
114 #define I40E_FLAG_DCB (1ULL << 1)
115 #define I40E_FLAG_VMDQ (1ULL << 2)
116 #define I40E_FLAG_SRIOV (1ULL << 3)
117 #define I40E_FLAG_HEADER_SPLIT_DISABLED (1ULL << 4)
118 #define I40E_FLAG_HEADER_SPLIT_ENABLED (1ULL << 5)
119 #define I40E_FLAG_FDIR (1ULL << 6)
120 #define I40E_FLAG_VXLAN (1ULL << 7)
121 #define I40E_FLAG_RSS_AQ_CAPABLE (1ULL << 8)
122 #define I40E_FLAG_ALL (I40E_FLAG_RSS | \
126 I40E_FLAG_HEADER_SPLIT_DISABLED | \
127 I40E_FLAG_HEADER_SPLIT_ENABLED | \
130 I40E_FLAG_RSS_AQ_CAPABLE)
132 #define I40E_RSS_OFFLOAD_ALL ( \
133 ETH_RSS_FRAG_IPV4 | \
134 ETH_RSS_NONFRAG_IPV4_TCP | \
135 ETH_RSS_NONFRAG_IPV4_UDP | \
136 ETH_RSS_NONFRAG_IPV4_SCTP | \
137 ETH_RSS_NONFRAG_IPV4_OTHER | \
138 ETH_RSS_FRAG_IPV6 | \
139 ETH_RSS_NONFRAG_IPV6_TCP | \
140 ETH_RSS_NONFRAG_IPV6_UDP | \
141 ETH_RSS_NONFRAG_IPV6_SCTP | \
142 ETH_RSS_NONFRAG_IPV6_OTHER | \
145 /* All bits of RSS hash enable */
146 #define I40E_RSS_HENA_ALL ( \
147 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \
148 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \
149 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \
150 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \
151 (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV4) | \
152 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \
153 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \
154 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \
155 (1ULL << I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \
156 (1ULL << I40E_FILTER_PCTYPE_FRAG_IPV6) | \
157 (1ULL << I40E_FILTER_PCTYPE_FCOE_OX) | \
158 (1ULL << I40E_FILTER_PCTYPE_FCOE_RX) | \
159 (1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \
160 (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD))
162 #define I40E_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET
163 #define I40E_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET
168 * MAC filter structure
170 struct i40e_mac_filter_info {
171 enum rte_mac_filter_type filter_type;
172 struct ether_addr mac_addr;
175 TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter);
177 /* MAC filter list structure */
178 struct i40e_mac_filter {
179 TAILQ_ENTRY(i40e_mac_filter) next;
180 struct i40e_mac_filter_info mac_info;
183 TAILQ_HEAD(i40e_vsi_list_head, i40e_vsi_list);
187 /* VSI list structure */
188 struct i40e_vsi_list {
189 TAILQ_ENTRY(i40e_vsi_list) list;
190 struct i40e_vsi *vsi;
193 struct i40e_rx_queue;
194 struct i40e_tx_queue;
196 /* Structure that defines a VEB */
198 struct i40e_vsi_list_head head;
199 struct i40e_vsi *associate_vsi; /* Associate VSI who owns the VEB */
200 uint16_t seid; /* The seid of VEB itself */
201 uint16_t uplink_seid; /* The uplink seid of this VEB */
203 struct i40e_eth_stats stats;
206 /* i40e MACVLAN filter structure */
207 struct i40e_macvlan_filter {
208 struct ether_addr macaddr;
209 enum rte_mac_filter_type filter_type;
213 /* Bandwidth limit information */
214 struct i40e_bw_info {
215 uint16_t bw_limit; /* BW Limit (0 = disabled) */
216 uint8_t bw_max_quanta; /* Max Quanta when BW limit is enabled */
218 /* Relative TC credits across VSIs */
219 uint8_t bw_ets_share_credits[I40E_MAX_TRAFFIC_CLASS];
220 /* TC BW limit credits within VSI */
221 uint8_t bw_ets_limit_credits[I40E_MAX_TRAFFIC_CLASS];
222 /* TC BW limit max quanta within VSI */
223 uint8_t bw_ets_max_quanta[I40E_MAX_TRAFFIC_CLASS];
227 * Structure that defines a VSI, associated with a adapter.
230 struct i40e_adapter *adapter; /* Backreference to associated adapter */
231 struct i40e_aqc_vsi_properties_data info; /* VSI properties */
233 struct i40e_eth_stats eth_stats_offset;
234 struct i40e_eth_stats eth_stats;
236 * When drivers loaded, only a default main VSI exists. In case new VSI
237 * needs to add, HW needs to know the layout that VSIs are organized.
238 * Besides that, VSI isan element and can't switch packets, which needs
239 * to add new component VEB to perform switching. So, a new VSI needs
240 * to specify the the uplink VSI (Parent VSI) before created. The
241 * uplink VSI will check whether it had a VEB to switch packets. If no,
242 * it will try to create one. Then, uplink VSI will move the new VSI
243 * into its' sib_vsi_list to manage all the downlink VSI.
244 * sib_vsi_list: the VSI list that shared the same uplink VSI.
245 * parent_vsi : the uplink VSI. It's NULL for main VSI.
246 * veb : the VEB associates with the VSI.
248 struct i40e_vsi_list sib_vsi_list; /* sibling vsi list */
249 struct i40e_vsi *parent_vsi;
250 struct i40e_veb *veb; /* Associated veb, could be null */
252 enum i40e_vsi_type type; /* VSI types */
253 uint16_t vlan_num; /* Total VLAN number */
254 uint16_t mac_num; /* Total mac number */
255 uint32_t vfta[I40E_VFTA_SIZE]; /* VLAN bitmap */
256 struct i40e_mac_filter_list mac_list; /* macvlan filter list */
257 /* specific VSI-defined parameters, SRIOV stored the vf_id */
259 uint16_t seid; /* The seid of VSI itself */
260 uint16_t uplink_seid; /* The uplink seid of this VSI */
261 uint16_t nb_qps; /* Number of queue pairs VSI can occupy */
262 uint16_t nb_used_qps; /* Number of queue pairs VSI uses */
263 uint16_t max_macaddrs; /* Maximum number of MAC addresses */
264 uint16_t base_queue; /* The first queue index of this VSI */
266 * The offset to visit VSI related register, assigned by HW when
270 uint16_t msix_intr; /* The MSIX interrupt binds to VSI */
271 uint16_t nb_msix; /* The max number of msix vector */
272 uint8_t enabled_tc; /* The traffic class enabled */
273 struct i40e_bw_info bw_info; /* VSI bandwidth information */
277 LIST_ENTRY(pool_entry) next;
282 LIST_HEAD(res_list, pool_entry);
284 struct i40e_res_pool_info {
285 uint32_t base; /* Resource start index */
286 uint32_t num_alloc; /* Allocated resource number */
287 uint32_t num_free; /* Total available resource number */
288 struct res_list alloc_list; /* Allocated resource list */
289 struct res_list free_list; /* Available resource list */
293 I40E_VF_INACTIVE = 0,
300 * Structure to store private data for PF host.
304 struct i40e_vsi *vsi;
305 enum I40E_VF_STATE state; /* The number of queue pairs availiable */
306 uint16_t vf_idx; /* VF index in pf->vfs */
307 uint16_t lan_nb_qps; /* Actual queues allocated */
308 uint16_t reset_cnt; /* Total vf reset times */
312 * Structure to store private data for flow control.
314 struct i40e_fc_conf {
315 uint16_t pause_time; /* Flow control pause timer */
316 /* FC high water 0-7 for pfc and 8 for lfc unit:kilobytes */
317 uint32_t high_water[I40E_MAX_TRAFFIC_CLASS + 1];
318 /* FC low water 0-7 for pfc and 8 for lfc unit:kilobytes */
319 uint32_t low_water[I40E_MAX_TRAFFIC_CLASS + 1];
323 * Structure to store private data for VMDQ instance
325 struct i40e_vmdq_info {
327 struct i40e_vsi *vsi;
331 * Structure to store flex pit for flow diretor.
333 struct i40e_fdir_flex_pit {
334 uint8_t src_offset; /* offset in words from the beginning of payload */
335 uint8_t size; /* size in words */
336 uint8_t dst_offset; /* offset in words of flexible payload */
339 struct i40e_fdir_flex_mask {
340 uint8_t word_mask; /**< Bit i enables word i of flexible payload */
344 } bitmask[I40E_FDIR_BITMASK_NUM_WORD];
347 #define I40E_FILTER_PCTYPE_MAX 64
349 * A structure used to define fields of a FDIR related info.
351 struct i40e_fdir_info {
352 struct i40e_vsi *fdir_vsi; /* pointer to fdir VSI structure */
353 uint16_t match_counter_index; /* Statistic counter index used for fdir*/
354 struct i40e_tx_queue *txq;
355 struct i40e_rx_queue *rxq;
356 void *prg_pkt; /* memory for fdir program packet */
357 uint64_t dma_addr; /* physic address of packet memory*/
359 * the rule how bytes stream is extracted as flexible payload
360 * for each payload layer, the setting can up to three elements
362 struct i40e_fdir_flex_pit flex_set[I40E_MAX_FLXPLD_LAYER * I40E_MAX_FLXPLD_FIED];
363 struct i40e_fdir_flex_mask flex_mask[I40E_FILTER_PCTYPE_MAX];
366 #define I40E_MIRROR_MAX_ENTRIES_PER_RULE 64
367 #define I40E_MAX_MIRROR_RULES 64
369 * Mirror rule structure
371 struct i40e_mirror_rule {
372 TAILQ_ENTRY(i40e_mirror_rule) rules;
374 uint16_t index; /* the sw index of mirror rule */
375 uint16_t id; /* the rule id assigned by firmware */
376 uint16_t dst_vsi_seid; /* destination vsi for this mirror rule. */
377 uint16_t num_entries;
378 /* the info stores depend on the rule type.
379 If type is I40E_MIRROR_TYPE_VLAN, vlan ids are stored here.
380 If type is I40E_MIRROR_TYPE_VPORT_*, vsi's seid are stored.
382 uint16_t entries[I40E_MIRROR_MAX_ENTRIES_PER_RULE];
385 TAILQ_HEAD(i40e_mirror_rule_list, i40e_mirror_rule);
388 * Structure to store private data specific for PF instance.
391 struct i40e_adapter *adapter; /* The adapter this PF associate to */
392 struct i40e_vsi *main_vsi; /* pointer to main VSI structure */
393 uint16_t mac_seid; /* The seid of the MAC of this PF */
394 uint16_t main_vsi_seid; /* The seid of the main VSI */
395 uint16_t max_num_vsi;
396 struct i40e_res_pool_info qp_pool; /*Queue pair pool */
397 struct i40e_res_pool_info msix_pool; /* MSIX interrupt pool */
399 struct i40e_hw_port_stats stats_offset;
400 struct i40e_hw_port_stats stats;
403 struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
404 struct ether_addr dev_addr; /* PF device mac address */
405 uint64_t flags; /* PF featuer flags */
406 /* All kinds of queue pair setting for different VSIs */
407 struct i40e_pf_vf *vfs;
409 /* Each of below queue pairs should be power of 2 since it's the
410 precondition after TC configuration applied */
411 uint16_t lan_nb_qp_max;
412 uint16_t lan_nb_qps; /* The number of queue pairs of LAN */
413 uint16_t lan_qp_offset;
414 uint16_t vmdq_nb_qp_max;
415 uint16_t vmdq_nb_qps; /* The number of queue pairs of VMDq */
416 uint16_t vmdq_qp_offset;
417 uint16_t vf_nb_qp_max;
418 uint16_t vf_nb_qps; /* The number of queue pairs of VF */
419 uint16_t vf_qp_offset;
420 uint16_t fdir_nb_qps; /* The number of queue pairs of Flow Director */
421 uint16_t fdir_qp_offset;
423 uint16_t hash_lut_size; /* The size of hash lookup table */
424 /* store VXLAN UDP ports */
425 uint16_t vxlan_ports[I40E_MAX_PF_UDP_OFFLOAD_PORTS];
426 uint16_t vxlan_bitmap; /* Vxlan bit mask */
428 /* VMDQ related info */
429 uint16_t max_nb_vmdq_vsi; /* Max number of VMDQ VSIs supported */
430 uint16_t nb_cfg_vmdq_vsi; /* number of VMDQ VSIs configured */
431 struct i40e_vmdq_info *vmdq;
433 struct i40e_fdir_info fdir; /* flow director info */
434 struct i40e_fc_conf fc_conf; /* Flow control conf */
435 struct i40e_mirror_rule_list mirror_list;
436 uint16_t nb_mirror_rule; /* The number of mirror rules */
440 PFMSG_LINK_CHANGE = 0x1,
441 PFMSG_RESET_IMPENDING = 0x2,
442 PFMSG_DRIVER_CLOSE = 0x4,
445 struct i40e_vsi_vlan_pvid_info {
446 uint16_t on; /* Enable or disable pvid */
448 uint16_t pvid; /* Valid in case 'on' is set to set pvid */
450 /* Valid in case 'on' is cleared. 'tagged' will reject tagged packets,
451 * while 'untagged' will reject untagged packets.
459 struct i40e_vf_rx_queues {
460 uint64_t rx_dma_addr;
461 uint32_t rx_ring_len;
465 struct i40e_vf_tx_queues {
466 uint64_t tx_dma_addr;
467 uint32_t tx_ring_len;
471 * Structure to store private data specific for VF instance.
474 struct i40e_adapter *adapter; /* The adapter this VF associate to */
475 struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
476 uint16_t num_queue_pairs;
477 uint16_t max_pkt_len; /* Maximum packet length */
478 bool promisc_unicast_enabled;
479 bool promisc_multicast_enabled;
481 uint32_t version_major; /* Major version number */
482 uint32_t version_minor; /* Minor version number */
483 uint16_t promisc_flags; /* Promiscuous setting */
484 uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */
490 volatile uint32_t pend_cmd; /* pending command not finished yet */
491 u16 pend_msg; /* flags indicates events from pf not handled yet */
494 struct i40e_virtchnl_vf_resource *vf_res; /* All VSIs */
495 struct i40e_virtchnl_vsi_resource *vsi_res; /* LAN VSI */
501 * Structure to store private data for each PF/VF instance.
503 struct i40e_adapter {
504 /* Common for both PF and VF */
506 struct rte_eth_dev *eth_dev;
508 /* Specific for PF or VF */
515 bool rx_bulk_alloc_allowed;
517 bool tx_simple_allowed;
521 int i40e_dev_switch_queues(struct i40e_pf *pf, bool on);
522 int i40e_vsi_release(struct i40e_vsi *vsi);
523 struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
524 enum i40e_vsi_type type,
525 struct i40e_vsi *uplink_vsi,
526 uint16_t user_param);
527 int i40e_switch_rx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on);
528 int i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on);
529 int i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan);
530 int i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan);
531 int i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *filter);
532 int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr);
533 void i40e_update_vsi_stats(struct i40e_vsi *vsi);
534 void i40e_pf_disable_irq0(struct i40e_hw *hw);
535 void i40e_pf_enable_irq0(struct i40e_hw *hw);
536 int i40e_dev_link_update(struct rte_eth_dev *dev,
537 __rte_unused int wait_to_complete);
538 void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi);
539 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
540 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
541 struct i40e_vsi_vlan_pvid_info *info);
542 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
543 uint64_t i40e_config_hena(uint64_t flags);
544 uint64_t i40e_parse_hena(uint64_t flags);
545 enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
546 enum i40e_status_code i40e_fdir_setup_rx_resources(struct i40e_pf *pf);
547 int i40e_fdir_setup(struct i40e_pf *pf);
548 const struct rte_memzone *i40e_memzone_reserve(const char *name,
551 int i40e_fdir_configure(struct rte_eth_dev *dev);
552 void i40e_fdir_teardown(struct i40e_pf *pf);
553 enum i40e_filter_pctype i40e_flowtype_to_pctype(uint16_t flow_type);
554 uint16_t i40e_pctype_to_flowtype(enum i40e_filter_pctype pctype);
555 int i40e_fdir_ctrl_func(struct rte_eth_dev *dev,
556 enum rte_filter_op filter_op,
558 int i40e_select_filter_input_set(struct i40e_hw *hw,
559 struct rte_eth_input_set_conf *conf,
560 enum rte_filter_type filter);
561 int i40e_filter_inset_select(struct i40e_hw *hw,
562 struct rte_eth_input_set_conf *conf,
563 enum rte_filter_type filter);
565 void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
566 struct rte_eth_rxq_info *qinfo);
567 void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
568 struct rte_eth_txq_info *qinfo);
570 /* I40E_DEV_PRIVATE_TO */
571 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
572 (&((struct i40e_adapter *)adapter)->pf)
573 #define I40E_DEV_PRIVATE_TO_HW(adapter) \
574 (&((struct i40e_adapter *)adapter)->hw)
575 #define I40E_DEV_PRIVATE_TO_ADAPTER(adapter) \
576 ((struct i40e_adapter *)adapter)
578 /* I40EVF_DEV_PRIVATE_TO */
579 #define I40EVF_DEV_PRIVATE_TO_VF(adapter) \
580 (&((struct i40e_adapter *)adapter)->vf)
582 static inline struct i40e_vsi *
583 i40e_get_vsi_from_adapter(struct i40e_adapter *adapter)
590 hw = I40E_DEV_PRIVATE_TO_HW(adapter);
591 if (hw->mac.type == I40E_MAC_VF) {
592 struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(adapter);
595 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(adapter);
599 #define I40E_DEV_PRIVATE_TO_MAIN_VSI(adapter) \
600 i40e_get_vsi_from_adapter((struct i40e_adapter *)adapter)
603 #define I40E_VSI_TO_HW(vsi) \
604 (&(((struct i40e_vsi *)vsi)->adapter->hw))
605 #define I40E_VSI_TO_PF(vsi) \
606 (&(((struct i40e_vsi *)vsi)->adapter->pf))
607 #define I40E_VSI_TO_VF(vsi) \
608 (&(((struct i40e_vsi *)vsi)->adapter->vf))
609 #define I40E_VSI_TO_DEV_DATA(vsi) \
610 (((struct i40e_vsi *)vsi)->adapter->pf.dev_data)
611 #define I40E_VSI_TO_ETH_DEV(vsi) \
612 (((struct i40e_vsi *)vsi)->adapter->eth_dev)
615 #define I40E_PF_TO_HW(pf) \
616 (&(((struct i40e_pf *)pf)->adapter->hw))
617 #define I40E_PF_TO_ADAPTER(pf) \
618 ((struct i40e_adapter *)pf->adapter)
621 #define I40E_VF_TO_HW(vf) \
622 (&(((struct i40e_vf *)vf)->adapter->hw))
625 i40e_init_adminq_parameter(struct i40e_hw *hw)
627 hw->aq.num_arq_entries = I40E_AQ_LEN;
628 hw->aq.num_asq_entries = I40E_AQ_LEN;
629 hw->aq.arq_buf_size = I40E_AQ_BUF_SZ;
630 hw->aq.asq_buf_size = I40E_AQ_BUF_SZ;
634 i40e_align_floor(int n)
638 return 1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n));
641 #define I40E_VALID_FLOW(flow_type) \
642 ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \
643 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
644 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || \
645 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || \
646 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER || \
647 (flow_type) == RTE_ETH_FLOW_FRAG_IPV6 || \
648 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || \
649 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || \
650 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || \
651 (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER || \
652 (flow_type) == RTE_ETH_FLOW_L2_PAYLOAD)
654 #define I40E_VALID_PCTYPE(pctype) \
655 ((pctype) == I40E_FILTER_PCTYPE_FRAG_IPV4 || \
656 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_TCP || \
657 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_UDP || \
658 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP || \
659 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || \
660 (pctype) == I40E_FILTER_PCTYPE_FRAG_IPV6 || \
661 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || \
662 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || \
663 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || \
664 (pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || \
665 (pctype) == I40E_FILTER_PCTYPE_L2_PAYLOAD)
667 #endif /* _I40E_ETHDEV_H_ */