Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright 2015 6WIND S.A.
3 : : * Copyright 2015 Mellanox Technologies, Ltd
4 : : */
5 : :
6 : : #ifndef RTE_PMD_MLX5_H_
7 : : #define RTE_PMD_MLX5_H_
8 : :
9 : : #include <stddef.h>
10 : : #include <stdbool.h>
11 : : #include <stdint.h>
12 : : #include <limits.h>
13 : : #include <sys/queue.h>
14 : :
15 : : #include <rte_pci.h>
16 : : #include <rte_ether.h>
17 : : #include <ethdev_driver.h>
18 : : #include <rte_rwlock.h>
19 : : #include <rte_interrupts.h>
20 : : #include <rte_errno.h>
21 : : #include <rte_flow.h>
22 : : #include <rte_mtr.h>
23 : :
24 : : #include <mlx5_glue.h>
25 : : #include <mlx5_devx_cmds.h>
26 : : #include <mlx5_prm.h>
27 : : #include <mlx5_common_mp.h>
28 : : #include <mlx5_common_mr.h>
29 : : #include <mlx5_common_devx.h>
30 : : #include <mlx5_common_defs.h>
31 : :
32 : : #include "mlx5_defs.h"
33 : : #include "mlx5_utils.h"
34 : : #include "mlx5_os.h"
35 : : #include "mlx5_autoconf.h"
36 : : #include "rte_pmd_mlx5.h"
37 : : #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
38 : : #ifndef RTE_EXEC_ENV_WINDOWS
39 : : #define HAVE_MLX5_HWS_SUPPORT 1
40 : : #else
41 : : #define __be64 uint64_t
42 : : #endif
43 : : #include "hws/mlx5dr.h"
44 : : #endif
45 : :
46 : : #define MLX5_SH(dev) (((struct mlx5_priv *)(dev)->data->dev_private)->sh)
47 : :
48 : : #define MLX5_HW_INV_QUEUE UINT32_MAX
49 : :
50 : : /*
51 : : * The default ipool threshold value indicates which per_core_cache
52 : : * value to set.
53 : : */
54 : : #define MLX5_HW_IPOOL_SIZE_THRESHOLD (1 << 19)
55 : : /* The default min local cache size. */
56 : : #define MLX5_HW_IPOOL_CACHE_MIN (1 << 9)
57 : :
58 : : /*
59 : : * Number of modification commands.
60 : : * The maximal actions amount in FW is some constant, and it is 16 in the
61 : : * latest releases. In some old releases, it will be limited to 8.
62 : : * Since there is no interface to query the capacity, the maximal value should
63 : : * be used to allow PMD to create the flow. The validation will be done in the
64 : : * lower driver layer or FW. A failure will be returned if exceeds the maximal
65 : : * supported actions number on the root table.
66 : : * On non-root tables, there is no limitation, but 32 is enough right now.
67 : : */
68 : : #define MLX5_MAX_MODIFY_NUM 32
69 : : #define MLX5_ROOT_TBL_MODIFY_NUM 16
70 : :
71 : : /* Maximal number of flex items created on the port.*/
72 : : #define MLX5_PORT_FLEX_ITEM_NUM 4
73 : :
74 : : /* Maximal number of field/field parts to map into sample registers .*/
75 : : #define MLX5_FLEX_ITEM_MAPPING_NUM 32
76 : :
77 : : enum mlx5_ipool_index {
78 : : #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
79 : : MLX5_IPOOL_DECAP_ENCAP = 0, /* Pool for encap/decap resource. */
80 : : MLX5_IPOOL_PUSH_VLAN, /* Pool for push vlan resource. */
81 : : MLX5_IPOOL_TAG, /* Pool for tag resource. */
82 : : MLX5_IPOOL_PORT_ID, /* Pool for port id resource. */
83 : : MLX5_IPOOL_JUMP, /* Pool for SWS jump resource. */
84 : : /* Pool for HWS group. Jump action will be created internally. */
85 : : MLX5_IPOOL_HW_GRP = MLX5_IPOOL_JUMP,
86 : : MLX5_IPOOL_SAMPLE, /* Pool for sample resource. */
87 : : MLX5_IPOOL_DEST_ARRAY, /* Pool for destination array resource. */
88 : : MLX5_IPOOL_TUNNEL_ID, /* Pool for tunnel offload context */
89 : : MLX5_IPOOL_TNL_TBL_ID, /* Pool for tunnel table ID. */
90 : : #endif
91 : : MLX5_IPOOL_MTR, /* Pool for meter resource. */
92 : : MLX5_IPOOL_MCP, /* Pool for metadata resource. */
93 : : MLX5_IPOOL_HRXQ, /* Pool for hrxq resource. */
94 : : MLX5_IPOOL_MLX5_FLOW, /* Pool for mlx5 flow handle. */
95 : : MLX5_IPOOL_RTE_FLOW, /* Pool for rte_flow. */
96 : : MLX5_IPOOL_RSS_EXPANTION_FLOW_ID, /* Pool for Queue/RSS flow ID. */
97 : : MLX5_IPOOL_RSS_SHARED_ACTIONS, /* Pool for RSS shared actions. */
98 : : MLX5_IPOOL_MTR_POLICY, /* Pool for meter policy resource. */
99 : : MLX5_IPOOL_MAX,
100 : : };
101 : :
102 : : /*
103 : : * There are three reclaim memory mode supported.
104 : : * 0(none) means no memory reclaim.
105 : : * 1(light) means only PMD level reclaim.
106 : : * 2(aggressive) means both PMD and rdma-core level reclaim.
107 : : */
108 : : enum mlx5_reclaim_mem_mode {
109 : : MLX5_RCM_NONE, /* Don't reclaim memory. */
110 : : MLX5_RCM_LIGHT, /* Reclaim PMD level. */
111 : : MLX5_RCM_AGGR, /* Reclaim PMD and rdma-core level. */
112 : : };
113 : :
114 : : /* The type of flow. */
115 : : enum mlx5_flow_type {
116 : : MLX5_FLOW_TYPE_CTL, /* Control flow. */
117 : : MLX5_FLOW_TYPE_GEN, /* General flow. */
118 : : MLX5_FLOW_TYPE_MCP, /* MCP flow. */
119 : : MLX5_FLOW_TYPE_MAXI,
120 : : };
121 : :
122 : : /* The mode of delay drop for Rx queues. */
123 : : enum mlx5_delay_drop_mode {
124 : : MLX5_DELAY_DROP_NONE = 0, /* All disabled. */
125 : : MLX5_DELAY_DROP_STANDARD = RTE_BIT32(0), /* Standard queues enable. */
126 : : MLX5_DELAY_DROP_HAIRPIN = RTE_BIT32(1), /* Hairpin queues enable. */
127 : : };
128 : :
129 : : /* The HWS action type root/non-root. */
130 : : enum mlx5_hw_action_flag_type {
131 : : MLX5_HW_ACTION_FLAG_ROOT, /* Root action. */
132 : : MLX5_HW_ACTION_FLAG_NONE_ROOT, /* Non-root ation. */
133 : : MLX5_HW_ACTION_FLAG_MAX, /* Maximum action flag. */
134 : : };
135 : :
136 : : /* Hlist and list callback context. */
137 : : struct mlx5_flow_cb_ctx {
138 : : struct rte_eth_dev *dev;
139 : : struct rte_flow_error *error;
140 : : void *data;
141 : : void *data2;
142 : : };
143 : :
144 : : /* Device capabilities structure which isn't changed in any stage. */
145 : : struct mlx5_dev_cap {
146 : : int max_cq; /* Maximum number of supported CQs */
147 : : int max_qp; /* Maximum number of supported QPs. */
148 : : int max_qp_wr; /* Maximum number of outstanding WR on any WQ. */
149 : : int max_sge;
150 : : /* Maximum number of s/g per WR for SQ & RQ of QP for non RDMA Read
151 : : * operations.
152 : : */
153 : : int mps; /* Multi-packet send supported mode. */
154 : : uint32_t vf:1; /* This is a VF. */
155 : : uint32_t sf:1; /* This is a SF. */
156 : : uint32_t txpp_en:1; /* Tx packet pacing is supported. */
157 : : uint32_t mpls_en:1; /* MPLS over GRE/UDP is supported. */
158 : : uint32_t cqe_comp:1; /* CQE compression is supported. */
159 : : uint32_t hw_csum:1; /* Checksum offload is supported. */
160 : : uint32_t hw_padding:1; /* End alignment padding is supported. */
161 : : uint32_t dest_tir:1; /* Whether advanced DR API is available. */
162 : : uint32_t dv_esw_en:1; /* E-Switch DV flow is supported. */
163 : : uint32_t dv_flow_en:1; /* DV flow is supported. */
164 : : uint32_t swp:3; /* Tx generic tunnel checksum and TSO offload. */
165 : : uint32_t hw_vlan_strip:1; /* VLAN stripping is supported. */
166 : : uint32_t scatter_fcs_w_decap_disable:1;
167 : : /* HW has bug working with tunnel packet decap and scatter FCS. */
168 : : uint32_t hw_fcs_strip:1; /* FCS stripping is supported. */
169 : : uint32_t rt_timestamp:1; /* Realtime timestamp format. */
170 : : uint32_t rq_delay_drop_en:1; /* Enable RxQ delay drop. */
171 : : uint32_t tunnel_en:3;
172 : : /* Whether tunnel stateless offloads are supported. */
173 : : uint32_t ind_table_max_size;
174 : : /* Maximum receive WQ indirection table size. */
175 : : uint32_t tso:1; /* Whether TSO is supported. */
176 : : uint32_t tso_max_payload_sz; /* Maximum TCP payload for TSO. */
177 : : struct {
178 : : uint32_t enabled:1; /* Whether MPRQ is enabled. */
179 : : uint32_t log_min_stride_size; /* Log min size of a stride. */
180 : : uint32_t log_max_stride_size; /* Log max size of a stride. */
181 : : uint32_t log_min_stride_num; /* Log min num of strides. */
182 : : uint32_t log_max_stride_num; /* Log max num of strides. */
183 : : uint32_t log_min_stride_wqe_size;
184 : : /* Log min WQE size, (size of single stride)*(num of strides).*/
185 : : } mprq; /* Capability for Multi-Packet RQ. */
186 : : char fw_ver[64]; /* Firmware version of this device. */
187 : : };
188 : :
189 : : #define MLX5_MPESW_PORT_INVALID (-1)
190 : :
191 : : /** Data associated with devices to spawn. */
192 : : struct mlx5_dev_spawn_data {
193 : : uint32_t ifindex; /**< Network interface index. */
194 : : uint32_t max_port; /**< Device maximal port index. */
195 : : uint32_t phys_port; /**< Device physical port index. */
196 : : int pf_bond; /**< bonding device PF index. < 0 - no bonding */
197 : : int mpesw_port; /**< MPESW uplink index. Valid if mpesw_owner_port >= 0. */
198 : : struct mlx5_switch_info info; /**< Switch information. */
199 : : const char *phys_dev_name; /**< Name of physical device. */
200 : : struct rte_eth_dev *eth_dev; /**< Associated Ethernet device. */
201 : : struct rte_pci_device *pci_dev; /**< Backend PCI device. */
202 : : struct mlx5_common_device *cdev; /**< Backend common device. */
203 : : struct mlx5_bond_info *bond_info;
204 : : };
205 : :
206 : : /**
207 : : * Check if the port requested to be probed is MPESW physical device
208 : : * or a representor port.
209 : : *
210 : : * @param spawn
211 : : * Parameters of the probed port.
212 : : *
213 : : * @return
214 : : * True if the probed port is a physical device or representor in MPESW setup.
215 : : * False otherwise or MPESW was not configured.
216 : : */
217 : : static inline bool
218 : : mlx5_is_probed_port_on_mpesw_device(struct mlx5_dev_spawn_data *spawn)
219 : : {
220 [ # # # # : 0 : return spawn->mpesw_port >= 0;
# # ]
221 : : }
222 : :
223 : : /** Data associated with socket messages. */
224 : : struct mlx5_flow_dump_req {
225 : : uint32_t port_id; /**< There are plans in DPDK to extend port_id. */
226 : : uint64_t flow_id;
227 : : } __rte_packed;
228 : :
229 : : struct mlx5_flow_dump_ack {
230 : : int rc; /**< Return code. */
231 : : };
232 : :
233 : : LIST_HEAD(mlx5_dev_list, mlx5_dev_ctx_shared);
234 : :
235 : : /* Shared data between primary and secondary processes. */
236 : : struct mlx5_shared_data {
237 : : rte_spinlock_t lock;
238 : : /* Global spinlock for primary and secondary processes. */
239 : : int init_done; /* Whether primary has done initialization. */
240 : : unsigned int secondary_cnt; /* Number of secondary processes init'd. */
241 : : };
242 : :
243 : : /* Per-process data structure, not visible to other processes. */
244 : : struct mlx5_local_data {
245 : : int init_done; /* Whether a secondary has done initialization. */
246 : : };
247 : :
248 : : extern struct mlx5_shared_data *mlx5_shared_data;
249 : :
250 : : /* Dev ops structs */
251 : : extern const struct eth_dev_ops mlx5_dev_ops;
252 : : extern const struct eth_dev_ops mlx5_dev_sec_ops;
253 : : extern const struct eth_dev_ops mlx5_dev_ops_isolate;
254 : :
255 : : struct mlx5_counter_ctrl {
256 : : /* Name of the counter. */
257 : : char dpdk_name[RTE_ETH_XSTATS_NAME_SIZE];
258 : : /* Name of the counter on the device table. */
259 : : char ctr_name[RTE_ETH_XSTATS_NAME_SIZE];
260 : : uint32_t dev:1; /**< Nonzero for dev counters. */
261 : : };
262 : :
263 : : struct mlx5_xstats_ctrl {
264 : : /* Number of device stats. */
265 : : uint16_t stats_n;
266 : : /* Number of device stats, for the 2nd port in bond. */
267 : : uint16_t stats_n_2nd;
268 : : /* Number of device stats identified by PMD. */
269 : : uint16_t mlx5_stats_n;
270 : : /* Index in the device counters table. */
271 : : uint16_t dev_table_idx[MLX5_MAX_XSTATS];
272 : : /* Index in the output table. */
273 : : uint16_t xstats_o_idx[MLX5_MAX_XSTATS];
274 : : uint64_t base[MLX5_MAX_XSTATS];
275 : : uint64_t xstats[MLX5_MAX_XSTATS];
276 : : uint64_t hw_stats[MLX5_MAX_XSTATS];
277 : : struct mlx5_counter_ctrl info[MLX5_MAX_XSTATS];
278 : : /* Index in the device counters table, for the 2nd port in bond. */
279 : : uint16_t dev_table_idx_2nd[MLX5_MAX_XSTATS];
280 : : /* Index in the output table, for the 2nd port in bond. */
281 : : uint16_t xstats_o_idx_2nd[MLX5_MAX_XSTATS];
282 : : };
283 : :
284 : : struct mlx5_stats_ctrl {
285 : : /* Base for imissed counter. */
286 : : uint64_t imissed_base;
287 : : uint64_t imissed;
288 : : };
289 : :
290 : : /* Maximal size of coalesced segment for LRO is set in chunks of 256 Bytes. */
291 : : #define MLX5_LRO_SEG_CHUNK_SIZE 256u
292 : :
293 : : /* Maximal size of aggregated LRO packet. */
294 : : #define MLX5_MAX_LRO_SIZE (UINT8_MAX * MLX5_LRO_SEG_CHUNK_SIZE)
295 : :
296 : : /* Maximal number of segments to split. */
297 : : #define MLX5_MAX_RXQ_NSEG (1u << MLX5_MAX_LOG_RQ_SEGS)
298 : :
299 : : /*
300 : : * Port configuration structure.
301 : : * User device parameters disabled features.
302 : : * This structure contains all configurations coming from devargs which
303 : : * oriented to port. When probing again, devargs doesn't have to be compatible
304 : : * with primary devargs. It is updated for each port in spawn function.
305 : : */
306 : : struct mlx5_port_config {
307 : : unsigned int hw_vlan_insert:1; /* VLAN insertion in WQE is supported. */
308 : : unsigned int hw_padding:1; /* End alignment padding is supported. */
309 : : unsigned int cqe_comp:1; /* CQE compression is enabled. */
310 : : unsigned int enh_cqe_comp:1; /* Enhanced CQE compression is enabled. */
311 : : unsigned int cqe_comp_fmt:3; /* CQE compression format. */
312 : : unsigned int rx_vec_en:1; /* Rx vector is enabled. */
313 : : unsigned int std_delay_drop:1; /* Enable standard Rxq delay drop. */
314 : : unsigned int hp_delay_drop:1; /* Enable hairpin Rxq delay drop. */
315 : : struct {
316 : : unsigned int enabled:1; /* Whether MPRQ is enabled. */
317 : : unsigned int log_stride_num; /* Log number of strides. */
318 : : unsigned int log_stride_size; /* Log size of a stride. */
319 : : unsigned int max_memcpy_len;
320 : : /* Maximum packet size to memcpy Rx packets. */
321 : : unsigned int min_rxqs_num;
322 : : /* Rx queue count threshold to enable MPRQ. */
323 : : } mprq; /* Configurations for Multi-Packet RQ. */
324 : : int mps; /* Multi-packet send supported mode. */
325 : : unsigned int max_dump_files_num; /* Maximum dump files per queue. */
326 : : unsigned int log_hp_size; /* Single hairpin queue data size in total. */
327 : : unsigned int lro_timeout; /* LRO user configuration. */
328 : : int txqs_inline; /* Queue number threshold for inlining. */
329 : : int txq_inline_min; /* Minimal amount of data bytes to inline. */
330 : : int txq_inline_max; /* Max packet size for inlining with SEND. */
331 : : int txq_inline_mpw; /* Max packet size for inlining with eMPW. */
332 : : };
333 : :
334 : : /*
335 : : * Share context device configuration structure.
336 : : * User device parameters disabled features.
337 : : * This structure updated once for device in mlx5_alloc_shared_dev_ctx()
338 : : * function and cannot change even when probing again.
339 : : */
340 : : struct mlx5_sh_config {
341 : : int tx_pp; /* Timestamp scheduling granularity in nanoseconds. */
342 : : int tx_skew; /* Tx scheduling skew between WQE and data on wire. */
343 : : uint32_t reclaim_mode:2; /* Memory reclaim mode. */
344 : : uint32_t dv_esw_en:1; /* Enable E-Switch DV flow. */
345 : : /* Enable DV flow. 1 means SW steering, 2 means HW steering. */
346 : : uint32_t dv_flow_en:2; /* Enable DV flow. */
347 : : uint32_t dv_xmeta_en:3; /* Enable extensive flow metadata. */
348 : : uint32_t dv_miss_info:1; /* Restore packet after partial hw miss. */
349 : : uint32_t l3_vxlan_en:1; /* Enable L3 VXLAN flow creation. */
350 : : uint32_t vf_nl_en:1; /* Enable Netlink requests in VF mode. */
351 : : uint32_t lacp_by_user:1; /* Enable user to manage LACP traffic. */
352 : : uint32_t decap_en:1; /* Whether decap will be used or not. */
353 : : uint32_t hw_fcs_strip:1; /* FCS stripping is supported. */
354 : : uint32_t allow_duplicate_pattern:1;
355 : : uint32_t lro_allowed:1; /* Whether LRO is allowed. */
356 : : struct {
357 : : uint16_t service_core;
358 : : uint32_t cycle_time; /* query cycle time in milli-second. */
359 : : } cnt_svc; /* configure for HW steering's counter's service. */
360 : : /* Allow/Prevent the duplicate rules pattern. */
361 : : uint32_t fdb_def_rule:1; /* Create FDB default jump rule */
362 : : uint32_t repr_matching:1; /* Enable implicit vport matching in HWS FDB. */
363 : : };
364 : :
365 : : /* Structure for VF VLAN workaround. */
366 : : struct mlx5_vf_vlan {
367 : : uint32_t tag:12;
368 : : uint32_t created:1;
369 : : };
370 : :
371 : : /* Flow drop context necessary due to Verbs API. */
372 : : struct mlx5_drop {
373 : : struct mlx5_hrxq *hrxq; /* Hash Rx queue queue. */
374 : : struct mlx5_rxq_priv *rxq; /* Rx queue. */
375 : : };
376 : :
377 : : /* Loopback dummy queue resources required due to Verbs API. */
378 : : struct mlx5_lb_ctx {
379 : : struct ibv_qp *qp; /* QP object. */
380 : : void *ibv_cq; /* Completion queue. */
381 : : uint16_t refcnt; /* Reference count for representors. */
382 : : };
383 : :
384 : : /* HW steering queue job descriptor type. */
385 : : enum mlx5_hw_job_type {
386 : : MLX5_HW_Q_JOB_TYPE_CREATE, /* Flow create job type. */
387 : : MLX5_HW_Q_JOB_TYPE_DESTROY, /* Flow destroy job type. */
388 : : MLX5_HW_Q_JOB_TYPE_UPDATE, /* Flow update job type. */
389 : : MLX5_HW_Q_JOB_TYPE_QUERY, /* Flow query job type. */
390 : : MLX5_HW_Q_JOB_TYPE_UPDATE_QUERY, /* Flow update and query job type. */
391 : : MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_CREATE, /* Non-optimized flow create job type. */
392 : : MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_DESTROY, /* Non-optimized destroy create job type. */
393 : : MLX5_HW_Q_JOB_TYPE_RSZTBL_FLOW_MOVE, /* Move flow after table resize. */
394 : : };
395 : :
396 : : enum mlx5_hw_indirect_type {
397 : : MLX5_HW_INDIRECT_TYPE_LEGACY,
398 : : MLX5_HW_INDIRECT_TYPE_LIST
399 : : };
400 : :
401 : : #define MLX5_HW_MAX_ITEMS (16)
402 : :
403 : : /* HW steering flow management job descriptor. */
404 : : struct mlx5_hw_q_job {
405 : : uint32_t type; /* Job type. */
406 : : uint32_t indirect_type;
407 : : const void *action; /* Indirect action attached to the job. */
408 : : void *user_data; /* Job user data. */
409 : : struct {
410 : : /* User memory for query output */
411 : : void *user;
412 : : /* Data extracted from hardware */
413 : : void *hw;
414 : : } query;
415 : : };
416 : :
417 : : /* HW steering job descriptor LIFO pool. */
418 : : struct mlx5_hw_q {
419 : : uint32_t job_idx; /* Free job index. */
420 : : uint32_t size; /* Job LIFO queue size. */
421 : : uint32_t ongoing_flow_ops; /* Number of ongoing flow operations. */
422 : : struct mlx5_hw_q_job **job; /* LIFO header. */
423 : : struct rte_ring *indir_cq; /* Indirect action SW completion queue. */
424 : : struct rte_ring *indir_iq; /* Indirect action SW in progress queue. */
425 : : struct rte_ring *flow_transfer_pending;
426 : : struct rte_ring *flow_transfer_completed;
427 : : } __rte_cache_aligned;
428 : :
429 : :
430 : : #define MLX5_COUNTER_POOLS_MAX_NUM (1 << 15)
431 : : #define MLX5_COUNTERS_PER_POOL 512
432 : : #define MLX5_MAX_PENDING_QUERIES 4
433 : : #define MLX5_CNT_MR_ALLOC_BULK 64
434 : : #define MLX5_CNT_SHARED_OFFSET 0x80000000
435 : : #define IS_BATCH_CNT(cnt) (((cnt) & (MLX5_CNT_SHARED_OFFSET - 1)) >= \
436 : : MLX5_CNT_BATCH_OFFSET)
437 : : #define MLX5_CNT_SIZE (sizeof(struct mlx5_flow_counter))
438 : : #define MLX5_AGE_SIZE (sizeof(struct mlx5_age_param))
439 : :
440 : : #define MLX5_CNT_LEN(pool) \
441 : : (MLX5_CNT_SIZE + \
442 : : ((pool)->is_aged ? MLX5_AGE_SIZE : 0))
443 : : #define MLX5_POOL_GET_CNT(pool, index) \
444 : : ((struct mlx5_flow_counter *) \
445 : : ((uint8_t *)((pool) + 1) + (index) * (MLX5_CNT_LEN(pool))))
446 : : #define MLX5_CNT_ARRAY_IDX(pool, cnt) \
447 : : ((int)(((uint8_t *)(cnt) - (uint8_t *)((pool) + 1)) / \
448 : : MLX5_CNT_LEN(pool)))
449 : : #define MLX5_TS_MASK_SECS 8ull
450 : : /* timestamp wrapping in seconds, must be power of 2. */
451 : :
452 : : /*
453 : : * The pool index and offset of counter in the pool array makes up the
454 : : * counter index. In case the counter is from pool 0 and offset 0, it
455 : : * should plus 1 to avoid index 0, since 0 means invalid counter index
456 : : * currently.
457 : : */
458 : : #define MLX5_MAKE_CNT_IDX(pi, offset) \
459 : : ((pi) * MLX5_COUNTERS_PER_POOL + (offset) + 1)
460 : : #define MLX5_CNT_TO_AGE(cnt) \
461 : : ((struct mlx5_age_param *)((cnt) + 1))
462 : : /*
463 : : * The maximum single counter is 0x800000 as MLX5_CNT_BATCH_OFFSET
464 : : * defines. The pool size is 512, pool index should never reach
465 : : * INT16_MAX.
466 : : */
467 : : #define POOL_IDX_INVALID UINT16_MAX
468 : :
469 : : /* Age status. */
470 : : enum {
471 : : AGE_FREE, /* Initialized state. */
472 : : AGE_CANDIDATE, /* Counter assigned to flows. */
473 : : AGE_TMOUT, /* Timeout, wait for rte_flow_get_aged_flows and destroy. */
474 : : };
475 : :
476 : : enum mlx5_counter_type {
477 : : MLX5_COUNTER_TYPE_ORIGIN,
478 : : MLX5_COUNTER_TYPE_AGE,
479 : : MLX5_COUNTER_TYPE_MAX,
480 : : };
481 : :
482 : : /* Counter age parameter. */
483 : : struct mlx5_age_param {
484 : : uint16_t state; /**< Age state (atomically accessed). */
485 : : uint16_t port_id; /**< Port id of the counter. */
486 : : uint32_t timeout:24; /**< Aging timeout in seconds. */
487 : : uint32_t sec_since_last_hit;
488 : : /**< Time in seconds since last hit (atomically accessed). */
489 : : void *context; /**< Flow counter age context. */
490 : : };
491 : :
492 : : struct flow_counter_stats {
493 : : uint64_t hits;
494 : : uint64_t bytes;
495 : : };
496 : :
497 : : /* Shared counters information for counters. */
498 : : struct mlx5_flow_counter_shared {
499 : : union {
500 : : uint32_t refcnt; /* Only for shared action management. */
501 : : uint32_t id; /* User counter ID for legacy sharing. */
502 : : };
503 : : };
504 : :
505 : : struct mlx5_flow_counter_pool;
506 : : /* Generic counters information. */
507 : : struct mlx5_flow_counter {
508 : : union {
509 : : /*
510 : : * User-defined counter shared info is only used during
511 : : * counter active time. And aging counter sharing is not
512 : : * supported, so active shared counter will not be chained
513 : : * to the aging list. For shared counter, only when it is
514 : : * released, the TAILQ entry memory will be used, at that
515 : : * time, shared memory is not used anymore.
516 : : *
517 : : * Similarly to none-batch counter dcs, since it doesn't
518 : : * support aging, while counter is allocated, the entry
519 : : * memory is not used anymore. In this case, as bytes
520 : : * memory is used only when counter is allocated, and
521 : : * entry memory is used only when counter is free. The
522 : : * dcs pointer can be saved to these two different place
523 : : * at different stage. It will eliminate the individual
524 : : * counter extend struct.
525 : : */
526 : : TAILQ_ENTRY(mlx5_flow_counter) next;
527 : : /**< Pointer to the next flow counter structure. */
528 : : struct {
529 : : struct mlx5_flow_counter_shared shared_info;
530 : : /**< Shared counter information. */
531 : : void *dcs_when_active;
532 : : /*
533 : : * For non-batch mode, the dcs will be saved
534 : : * here when the counter is free.
535 : : */
536 : : };
537 : : };
538 : : union {
539 : : uint64_t hits; /**< Reset value of hits packets. */
540 : : struct mlx5_flow_counter_pool *pool; /**< Counter pool. */
541 : : };
542 : : union {
543 : : uint64_t bytes; /**< Reset value of bytes. */
544 : : void *dcs_when_free;
545 : : /*
546 : : * For non-batch mode, the dcs will be saved here
547 : : * when the counter is free.
548 : : */
549 : : };
550 : : void *action; /**< Pointer to the dv action. */
551 : : };
552 : :
553 : : TAILQ_HEAD(mlx5_counters, mlx5_flow_counter);
554 : :
555 : : /* Generic counter pool structure - query is in pool resolution. */
556 : : struct mlx5_flow_counter_pool {
557 : : TAILQ_ENTRY(mlx5_flow_counter_pool) next;
558 : : struct mlx5_counters counters[2]; /* Free counter list. */
559 : : struct mlx5_devx_obj *min_dcs;
560 : : /* The devx object of the minimum counter ID. */
561 : : uint64_t time_of_last_age_check;
562 : : /* System time (from rte_rdtsc()) read in the last aging check. */
563 : : uint32_t index:30; /* Pool index in container. */
564 : : uint32_t is_aged:1; /* Pool with aging counter. */
565 : : volatile uint32_t query_gen:1; /* Query round. */
566 : : rte_spinlock_t sl; /* The pool lock. */
567 : : rte_spinlock_t csl; /* The pool counter free list lock. */
568 : : struct mlx5_counter_stats_raw *raw;
569 : : struct mlx5_counter_stats_raw *raw_hw;
570 : : /* The raw on HW working. */
571 : : };
572 : :
573 : : /* Memory management structure for group of counter statistics raws. */
574 : : struct mlx5_counter_stats_mem_mng {
575 : : LIST_ENTRY(mlx5_counter_stats_mem_mng) next;
576 : : struct mlx5_counter_stats_raw *raws;
577 : : struct mlx5_pmd_wrapped_mr wm;
578 : : };
579 : :
580 : : /* Raw memory structure for the counter statistics values of a pool. */
581 : : struct mlx5_counter_stats_raw {
582 : : LIST_ENTRY(mlx5_counter_stats_raw) next;
583 : : struct mlx5_counter_stats_mem_mng *mem_mng;
584 : : volatile struct flow_counter_stats *data;
585 : : };
586 : :
587 : : TAILQ_HEAD(mlx5_counter_pools, mlx5_flow_counter_pool);
588 : :
589 : : /* Counter global management structure. */
590 : : struct mlx5_flow_counter_mng {
591 : : volatile uint16_t n_valid; /* Number of valid pools. */
592 : : uint16_t last_pool_idx; /* Last used pool index */
593 : : int min_id; /* The minimum counter ID in the pools. */
594 : : int max_id; /* The maximum counter ID in the pools. */
595 : : rte_spinlock_t pool_update_sl; /* The pool update lock. */
596 : : rte_spinlock_t csl[MLX5_COUNTER_TYPE_MAX];
597 : : /* The counter free list lock. */
598 : : struct mlx5_counters counters[MLX5_COUNTER_TYPE_MAX];
599 : : /* Free counter list. */
600 : : struct mlx5_flow_counter_pool **pools; /* Counter pool array. */
601 : : struct mlx5_counter_stats_mem_mng *mem_mng;
602 : : /* Hold the memory management for the next allocated pools raws. */
603 : : struct mlx5_counters flow_counters; /* Legacy flow counter list. */
604 : : uint8_t pending_queries;
605 : : uint16_t pool_index;
606 : : uint8_t query_thread_on;
607 : : bool counter_fallback; /* Use counter fallback management. */
608 : : LIST_HEAD(mem_mngs, mlx5_counter_stats_mem_mng) mem_mngs;
609 : : LIST_HEAD(stat_raws, mlx5_counter_stats_raw) free_stat_raws;
610 : : };
611 : :
612 : : /* ASO structures. */
613 : : #define MLX5_ASO_QUEUE_LOG_DESC 10
614 : :
615 : : struct mlx5_aso_cq {
616 : : uint16_t log_desc_n;
617 : : uint32_t cq_ci:24;
618 : : struct mlx5_devx_cq cq_obj;
619 : : uint64_t errors;
620 : : };
621 : :
622 : : struct mlx5_aso_sq_elem {
623 : : union {
624 : : struct {
625 : : struct mlx5_aso_age_pool *pool;
626 : : uint16_t burst_size;
627 : : };
628 : : struct mlx5_aso_mtr *mtr;
629 : : struct {
630 : : struct mlx5_aso_ct_action *ct;
631 : : char *query_data;
632 : : };
633 : : void *user_data;
634 : : struct mlx5_quota *quota_obj;
635 : : };
636 : : };
637 : :
638 : : struct mlx5_aso_sq {
639 : : uint16_t log_desc_n;
640 : : rte_spinlock_t sqsl;
641 : : struct mlx5_aso_cq cq;
642 : : struct mlx5_devx_sq sq_obj;
643 : : struct mlx5_pmd_mr mr;
644 : : volatile struct mlx5_aso_wqe *db;
645 : : uint16_t pi;
646 : : uint16_t db_pi;
647 : : uint32_t head;
648 : : uint32_t tail;
649 : : uint32_t sqn;
650 : : struct mlx5_aso_sq_elem elts[1 << MLX5_ASO_QUEUE_LOG_DESC];
651 : : uint16_t next; /* Pool index of the next pool to query. */
652 : : };
653 : :
654 : : struct mlx5_aso_age_action {
655 : : LIST_ENTRY(mlx5_aso_age_action) next;
656 : : void *dr_action;
657 : : uint32_t refcnt;
658 : : /* Following fields relevant only when action is active. */
659 : : uint16_t offset; /* Offset of ASO Flow Hit flag in DevX object. */
660 : : struct mlx5_age_param age_params;
661 : : };
662 : :
663 : : #define MLX5_ASO_AGE_ACTIONS_PER_POOL 512
664 : : #define MLX5_ASO_AGE_CONTAINER_RESIZE 64
665 : :
666 : : struct mlx5_aso_age_pool {
667 : : struct mlx5_devx_obj *flow_hit_aso_obj;
668 : : uint16_t index; /* Pool index in pools array. */
669 : : uint64_t time_of_last_age_check; /* In seconds. */
670 : : struct mlx5_aso_age_action actions[MLX5_ASO_AGE_ACTIONS_PER_POOL];
671 : : };
672 : :
673 : : LIST_HEAD(aso_age_list, mlx5_aso_age_action);
674 : :
675 : : struct mlx5_aso_age_mng {
676 : : struct mlx5_aso_age_pool **pools;
677 : : uint16_t n; /* Total number of pools. */
678 : : uint16_t next; /* Number of pools in use, index of next free pool. */
679 : : rte_rwlock_t resize_rwl; /* Lock for resize objects. */
680 : : rte_spinlock_t free_sl; /* Lock for free list access. */
681 : : struct aso_age_list free; /* Free age actions list - ready to use. */
682 : : struct mlx5_aso_sq aso_sq; /* ASO queue objects. */
683 : : };
684 : :
685 : : /* Management structure for geneve tlv option */
686 : : struct mlx5_geneve_tlv_option_resource {
687 : : struct mlx5_devx_obj *obj; /* Pointer to the geneve tlv opt object. */
688 : : rte_be16_t option_class; /* geneve tlv opt class.*/
689 : : uint8_t option_type; /* geneve tlv opt type.*/
690 : : uint8_t length; /* geneve tlv opt length. */
691 : : uint32_t refcnt; /* geneve tlv object reference counter */
692 : : };
693 : :
694 : :
695 : : #define MLX5_AGE_EVENT_NEW 1
696 : : #define MLX5_AGE_TRIGGER 2
697 : : #define MLX5_AGE_SET(age_info, BIT) \
698 : : ((age_info)->flags |= (1 << (BIT)))
699 : : #define MLX5_AGE_UNSET(age_info, BIT) \
700 : : ((age_info)->flags &= ~(1 << (BIT)))
701 : : #define MLX5_AGE_GET(age_info, BIT) \
702 : : ((age_info)->flags & (1 << (BIT)))
703 : : #define GET_PORT_AGE_INFO(priv) \
704 : : (&((priv)->sh->port[(priv)->dev_port - 1].age_info))
705 : : /* Current time in seconds. */
706 : : #define MLX5_CURR_TIME_SEC (rte_rdtsc() / rte_get_tsc_hz())
707 : :
708 : : /*
709 : : * HW steering queue oriented AGE info.
710 : : * It contains an array of rings, one for each HWS queue.
711 : : */
712 : : struct mlx5_hws_q_age_info {
713 : : uint16_t nb_rings; /* Number of aged-out ring lists. */
714 : : struct rte_ring *aged_lists[]; /* Aged-out lists. */
715 : : };
716 : :
717 : : /*
718 : : * HW steering AGE info.
719 : : * It has a ring list containing all aged out flow rules.
720 : : */
721 : : struct mlx5_hws_age_info {
722 : : struct rte_ring *aged_list; /* Aged out lists. */
723 : : };
724 : :
725 : : /* Aging information for per port. */
726 : : struct mlx5_age_info {
727 : : uint8_t flags; /* Indicate if is new event or need to be triggered. */
728 : : union {
729 : : /* SW/FW steering AGE info. */
730 : : struct {
731 : : struct mlx5_counters aged_counters;
732 : : /* Aged counter list. */
733 : : struct aso_age_list aged_aso;
734 : : /* Aged ASO actions list. */
735 : : rte_spinlock_t aged_sl; /* Aged flow list lock. */
736 : : };
737 : : struct {
738 : : struct mlx5_indexed_pool *ages_ipool;
739 : : union {
740 : : struct mlx5_hws_age_info hw_age;
741 : : /* HW steering AGE info. */
742 : : struct mlx5_hws_q_age_info *hw_q_age;
743 : : /* HW steering queue oriented AGE info. */
744 : : };
745 : : };
746 : : };
747 : : };
748 : :
749 : : /* Per port data of shared IB device. */
750 : : struct mlx5_dev_shared_port {
751 : : uint32_t ih_port_id;
752 : : uint32_t devx_ih_port_id;
753 : : uint32_t nl_ih_port_id;
754 : : /*
755 : : * Interrupt handler port_id. Used by shared interrupt
756 : : * handler to find the corresponding rte_eth device
757 : : * by IB port index. If value is equal or greater
758 : : * RTE_MAX_ETHPORTS it means there is no subhandler
759 : : * installed for specified IB port index.
760 : : */
761 : : struct mlx5_age_info age_info;
762 : : /* Aging information for per port. */
763 : : };
764 : :
765 : : /*
766 : : * Max number of actions per DV flow.
767 : : * See CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED
768 : : * in rdma-core file providers/mlx5/verbs.c.
769 : : */
770 : : #define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8
771 : :
772 : : /* ASO flow meter structures */
773 : : /* Modify this value if enum rte_mtr_color changes. */
774 : : #define RTE_MTR_DROPPED RTE_COLORS
775 : : /* Yellow is now supported. */
776 : : #define MLX5_MTR_RTE_COLORS (RTE_COLOR_YELLOW + 1)
777 : : /* table_id 22 bits in mlx5_flow_tbl_key so limit policy number. */
778 : : #define MLX5_MAX_SUB_POLICY_TBL_NUM 0x3FFFFF
779 : : #define MLX5_INVALID_POLICY_ID UINT32_MAX
780 : : /* Suffix table_id on MLX5_FLOW_TABLE_LEVEL_METER. */
781 : : #define MLX5_MTR_TABLE_ID_SUFFIX 1
782 : : /* Drop table_id on MLX5_FLOW_TABLE_LEVEL_METER. */
783 : : #define MLX5_MTR_TABLE_ID_DROP 2
784 : : /* Priority of the meter policy matcher. */
785 : : #define MLX5_MTR_POLICY_MATCHER_PRIO 0
786 : : /* Green & yellow color valid for now. */
787 : : #define MLX5_MTR_POLICY_MODE_ALL 0
788 : : /* Default policy. */
789 : : #define MLX5_MTR_POLICY_MODE_DEF 1
790 : : /* Only green color valid. */
791 : : #define MLX5_MTR_POLICY_MODE_OG 2
792 : : /* Only yellow color valid. */
793 : : #define MLX5_MTR_POLICY_MODE_OY 3
794 : :
795 : : enum mlx5_meter_domain {
796 : : MLX5_MTR_DOMAIN_INGRESS,
797 : : MLX5_MTR_DOMAIN_EGRESS,
798 : : MLX5_MTR_DOMAIN_TRANSFER,
799 : : MLX5_MTR_DOMAIN_MAX,
800 : : };
801 : : #define MLX5_MTR_DOMAIN_INGRESS_BIT (1 << MLX5_MTR_DOMAIN_INGRESS)
802 : : #define MLX5_MTR_DOMAIN_EGRESS_BIT (1 << MLX5_MTR_DOMAIN_EGRESS)
803 : : #define MLX5_MTR_DOMAIN_TRANSFER_BIT (1 << MLX5_MTR_DOMAIN_TRANSFER)
804 : : #define MLX5_MTR_ALL_DOMAIN_BIT (MLX5_MTR_DOMAIN_INGRESS_BIT | \
805 : : MLX5_MTR_DOMAIN_EGRESS_BIT | \
806 : : MLX5_MTR_DOMAIN_TRANSFER_BIT)
807 : :
808 : : /* The color tag rule structure. */
809 : : struct mlx5_sub_policy_color_rule {
810 : : void *rule;
811 : : /* The color rule. */
812 : : struct mlx5_flow_dv_matcher *matcher;
813 : : /* The color matcher. */
814 : : TAILQ_ENTRY(mlx5_sub_policy_color_rule) next_port;
815 : : /**< Pointer to the next color rule structure. */
816 : : int32_t src_port;
817 : : /* On which src port this rule applied. */
818 : : };
819 : :
820 : : TAILQ_HEAD(mlx5_sub_policy_color_rules, mlx5_sub_policy_color_rule);
821 : :
822 : : /*
823 : : * Meter sub-policy structure.
824 : : * Each RSS TIR in meter policy need its own sub-policy resource.
825 : : */
826 : : struct mlx5_flow_meter_sub_policy {
827 : : uint32_t main_policy_id:1;
828 : : /* Main policy id is same as this sub_policy id. */
829 : : uint32_t idx:31;
830 : : /* Index to sub_policy ipool entity. */
831 : : void *main_policy;
832 : : /* Point to struct mlx5_flow_meter_policy. */
833 : : struct mlx5_flow_tbl_resource *tbl_rsc;
834 : : /* The sub-policy table resource. */
835 : : uint32_t rix_hrxq[MLX5_MTR_RTE_COLORS];
836 : : /* Index to TIR resource. */
837 : : struct mlx5_flow_tbl_resource *jump_tbl[MLX5_MTR_RTE_COLORS];
838 : : /* Meter jump/drop table. */
839 : : struct mlx5_sub_policy_color_rules color_rules[RTE_COLORS];
840 : : /* List for the color rules. */
841 : : };
842 : :
843 : : struct mlx5_meter_policy_acts {
844 : : uint8_t actions_n;
845 : : /* Number of actions. */
846 : : void *dv_actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
847 : : /* Action list. */
848 : : };
849 : :
850 : : struct mlx5_meter_policy_action_container {
851 : : uint32_t rix_mark;
852 : : /* Index to the mark action. */
853 : : struct mlx5_flow_dv_modify_hdr_resource *modify_hdr;
854 : : /* Pointer to modify header resource in cache. */
855 : : uint8_t fate_action;
856 : : /* Fate action type. */
857 : : union {
858 : : struct rte_flow_action *rss;
859 : : /* Rss action configuration. */
860 : : uint32_t rix_port_id_action;
861 : : /* Index to port ID action resource. */
862 : : void *dr_jump_action[MLX5_MTR_DOMAIN_MAX];
863 : : /* Jump/drop action per color. */
864 : : uint16_t queue;
865 : : /* Queue action configuration. */
866 : : struct {
867 : : uint32_t next_mtr_id;
868 : : /* The next meter id. */
869 : : void *next_sub_policy;
870 : : /* Next meter's sub-policy. */
871 : : };
872 : : };
873 : : };
874 : :
875 : : /* Flow meter policy parameter structure. */
876 : : struct mlx5_flow_meter_policy {
877 : : uint32_t is_rss:1;
878 : : /* Is RSS policy table. */
879 : : uint32_t ingress:1;
880 : : /* Rule applies to ingress domain. */
881 : : uint32_t egress:1;
882 : : /* Rule applies to egress domain. */
883 : : uint32_t transfer:1;
884 : : /* Rule applies to transfer domain. */
885 : : uint32_t is_queue:1;
886 : : /* Is queue action in policy table. */
887 : : uint32_t is_hierarchy:1;
888 : : /* Is meter action in policy table. */
889 : : uint32_t match_port:1;
890 : : /* If policy flows match src port. */
891 : : uint32_t hierarchy_match_port:1;
892 : : /* Is any meter in hierarchy contains policy flow that matches src port. */
893 : : uint32_t skip_r:1;
894 : : /* If red color policy is skipped. */
895 : : uint32_t skip_y:1;
896 : : /* If yellow color policy is skipped. */
897 : : uint32_t skip_g:1;
898 : : /* If green color policy is skipped. */
899 : : uint32_t mark:1;
900 : : /* If policy contains mark action. */
901 : : uint32_t initialized:1;
902 : : /* Initialized. */
903 : : uint16_t group;
904 : : /* The group. */
905 : : rte_spinlock_t sl;
906 : : uint32_t ref_cnt;
907 : : /* Use count. */
908 : : struct rte_flow_pattern_template *hws_item_templ;
909 : : /* Hardware steering item templates. */
910 : : struct rte_flow_actions_template *hws_act_templ[MLX5_MTR_DOMAIN_MAX];
911 : : /* Hardware steering action templates. */
912 : : struct rte_flow_template_table *hws_flow_table[MLX5_MTR_DOMAIN_MAX];
913 : : /* Hardware steering tables. */
914 : : struct rte_flow *hws_flow_rule[MLX5_MTR_DOMAIN_MAX][RTE_COLORS];
915 : : /* Hardware steering rules. */
916 : : struct mlx5_meter_policy_action_container act_cnt[MLX5_MTR_RTE_COLORS];
917 : : /* Policy actions container. */
918 : : void *dr_drop_action[MLX5_MTR_DOMAIN_MAX];
919 : : /* drop action for red color. */
920 : : uint16_t sub_policy_num;
921 : : /* Count sub policy tables, 3 bits per domain. */
922 : : struct mlx5_flow_meter_sub_policy **sub_policys[MLX5_MTR_DOMAIN_MAX];
923 : : /* Sub policy table array must be the end of struct. */
924 : : };
925 : :
926 : : /* The maximum sub policy is relate to struct mlx5_rss_hash_fields[]. */
927 : : #define MLX5_MTR_RSS_MAX_SUB_POLICY 7
928 : : #define MLX5_MTR_SUB_POLICY_NUM_SHIFT 3
929 : : #define MLX5_MTR_SUB_POLICY_NUM_MASK 0x7
930 : : #define MLX5_MTRS_DEFAULT_RULE_PRIORITY 0xFFFF
931 : : #define MLX5_MTR_CHAIN_MAX_NUM 8
932 : :
933 : : /* Flow meter default policy parameter structure.
934 : : * Policy index 0 is reserved by default policy table.
935 : : * Action per color as below:
936 : : * green - do nothing, yellow - do nothing, red - drop
937 : : */
938 : : struct mlx5_flow_meter_def_policy {
939 : : struct mlx5_flow_meter_sub_policy sub_policy;
940 : : /* Policy rules jump to other tables. */
941 : : void *dr_jump_action[RTE_COLORS];
942 : : /* Jump action per color. */
943 : : };
944 : :
945 : : /* Meter parameter structure. */
946 : : struct mlx5_flow_meter_info {
947 : : uint32_t meter_id;
948 : : /**< Meter id. */
949 : : uint32_t policy_id;
950 : : /* Policy id, the first sub_policy idx. */
951 : : struct mlx5_flow_meter_profile *profile;
952 : : /**< Meter profile parameters. */
953 : : rte_spinlock_t sl; /**< Meter action spinlock. */
954 : : /** Set of stats counters to be enabled.
955 : : * @see enum rte_mtr_stats_type
956 : : */
957 : : uint32_t bytes_dropped:1;
958 : : /** Set bytes dropped stats to be enabled. */
959 : : uint32_t pkts_dropped:1;
960 : : /** Set packets dropped stats to be enabled. */
961 : : uint32_t active_state:1;
962 : : /**< Meter hw active state. */
963 : : uint32_t shared:1;
964 : : /**< Meter shared or not. */
965 : : uint32_t is_enable:1;
966 : : /**< Meter disable/enable state. */
967 : : uint32_t ingress:1;
968 : : /**< Rule applies to egress traffic. */
969 : : uint32_t egress:1;
970 : : /**
971 : : * Instead of simply matching the properties of traffic as it would
972 : : * appear on a given DPDK port ID, enabling this attribute transfers
973 : : * a flow rule to the lowest possible level of any device endpoints
974 : : * found in the pattern.
975 : : *
976 : : * When supported, this effectively enables an application to
977 : : * re-route traffic not necessarily intended for it (e.g. coming
978 : : * from or addressed to different physical ports, VFs or
979 : : * applications) at the device level.
980 : : *
981 : : * It complements the behavior of some pattern items such as
982 : : * RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT and is meaningless without them.
983 : : *
984 : : * When transferring flow rules, ingress and egress attributes keep
985 : : * their original meaning, as if processing traffic emitted or
986 : : * received by the application.
987 : : */
988 : : uint32_t transfer:1;
989 : : uint32_t def_policy:1;
990 : : uint32_t initialized:1;
991 : : /* Meter points to default policy. */
992 : : uint32_t color_aware:1;
993 : : /* Meter is color aware mode. */
994 : : void *drop_rule[MLX5_MTR_DOMAIN_MAX];
995 : : /* Meter drop rule in drop table. */
996 : : uint32_t drop_cnt;
997 : : /**< Color counter for drop. */
998 : : uint32_t ref_cnt;
999 : : /**< Use count. */
1000 : : struct mlx5_indexed_pool *flow_ipool;
1001 : : /**< Index pool for flow id. */
1002 : : void *meter_action_g;
1003 : : /**< Flow meter action. */
1004 : : void *meter_action_y;
1005 : : /**< Flow meter action for yellow init_color. */
1006 : : uint32_t meter_offset;
1007 : : /**< Flow meter offset. */
1008 : : uint16_t group;
1009 : : /**< Flow meter group. */
1010 : : };
1011 : :
1012 : : /* PPS(packets per second) map to BPS(Bytes per second).
1013 : : * HW treat packet as 128bytes in PPS mode
1014 : : */
1015 : : #define MLX5_MTRS_PPS_MAP_BPS_SHIFT 7
1016 : :
1017 : : /* RFC2697 parameter structure. */
1018 : : struct mlx5_flow_meter_srtcm_rfc2697_prm {
1019 : : rte_be32_t cbs_cir;
1020 : : /*
1021 : : * bit 24-28: cbs_exponent, bit 16-23 cbs_mantissa,
1022 : : * bit 8-12: cir_exponent, bit 0-7 cir_mantissa.
1023 : : */
1024 : : rte_be32_t ebs_eir;
1025 : : /*
1026 : : * bit 24-28: ebs_exponent, bit 16-23 ebs_mantissa,
1027 : : * bit 8-12: eir_exponent, bit 0-7 eir_mantissa.
1028 : : */
1029 : : };
1030 : :
1031 : : /* Flow meter profile structure. */
1032 : : struct mlx5_flow_meter_profile {
1033 : : TAILQ_ENTRY(mlx5_flow_meter_profile) next;
1034 : : /**< Pointer to the next flow meter structure. */
1035 : : uint32_t id; /**< Profile id. */
1036 : : struct rte_mtr_meter_profile profile; /**< Profile detail. */
1037 : : union {
1038 : : struct mlx5_flow_meter_srtcm_rfc2697_prm srtcm_prm;
1039 : : /**< srtcm_rfc2697 struct. */
1040 : : };
1041 : : uint32_t ref_cnt; /**< Use count. */
1042 : : uint32_t g_support:1; /**< If G color will be generated. */
1043 : : uint32_t y_support:1; /**< If Y color will be generated. */
1044 : : uint32_t initialized:1; /**< Initialized. */
1045 : : };
1046 : :
1047 : : /* 2 meters in each ASO cache line */
1048 : : #define MLX5_MTRS_CONTAINER_RESIZE 64
1049 : : /*
1050 : : * The pool index and offset of meter in the pool array makes up the
1051 : : * meter index. In case the meter is from pool 0 and offset 0, it
1052 : : * should plus 1 to avoid index 0, since 0 means invalid meter index
1053 : : * currently.
1054 : : */
1055 : : #define MLX5_MAKE_MTR_IDX(pi, offset) \
1056 : : ((pi) * MLX5_ASO_MTRS_PER_POOL + (offset) + 1)
1057 : :
1058 : : /*aso flow meter state*/
1059 : : enum mlx5_aso_mtr_state {
1060 : : ASO_METER_FREE, /* In free list. */
1061 : : ASO_METER_WAIT, /* ACCESS_ASO WQE in progress. */
1062 : : ASO_METER_WAIT_ASYNC, /* CQE will be handled by async pull. */
1063 : : ASO_METER_READY, /* CQE received. */
1064 : : };
1065 : :
1066 : : /*aso flow meter type*/
1067 : : enum mlx5_aso_mtr_type {
1068 : : ASO_METER_INDIRECT,
1069 : : ASO_METER_DIRECT,
1070 : : };
1071 : :
1072 : : /* Generic aso_flow_meter information. */
1073 : : struct mlx5_aso_mtr {
1074 : : union {
1075 : : LIST_ENTRY(mlx5_aso_mtr) next;
1076 : : struct mlx5_aso_mtr_pool *pool;
1077 : : };
1078 : : enum mlx5_aso_mtr_type type;
1079 : : struct mlx5_flow_meter_info fm;
1080 : : /**< Pointer to the next aso flow meter structure. */
1081 : : uint8_t state; /**< ASO flow meter state. */
1082 : : uint32_t offset;
1083 : : enum rte_color init_color;
1084 : : };
1085 : :
1086 : : /* Generic aso_flow_meter pool structure. */
1087 : : struct mlx5_aso_mtr_pool {
1088 : : struct mlx5_aso_mtr mtrs[MLX5_ASO_MTRS_PER_POOL];
1089 : : /*Must be the first in pool*/
1090 : : struct mlx5_devx_obj *devx_obj;
1091 : : /* The devx object of the minimum aso flow meter ID. */
1092 : : struct mlx5dr_action *action; /* HWS action. */
1093 : : struct mlx5_indexed_pool *idx_pool; /* HWS index pool. */
1094 : : uint32_t index; /* Pool index in management structure. */
1095 : : uint32_t nb_sq; /* Number of ASO SQ. */
1096 : : struct mlx5_aso_sq *sq; /* ASO SQs. */
1097 : : };
1098 : :
1099 : : LIST_HEAD(aso_meter_list, mlx5_aso_mtr);
1100 : : /* Pools management structure for ASO flow meter pools. */
1101 : : struct mlx5_aso_mtr_pools_mng {
1102 : : volatile uint16_t n_valid; /* Number of valid pools. */
1103 : : uint16_t n; /* Number of pools. */
1104 : : rte_spinlock_t mtrsl; /* The ASO flow meter free list lock. */
1105 : : rte_rwlock_t resize_mtrwl; /* Lock for resize objects. */
1106 : : struct aso_meter_list meters; /* Free ASO flow meter list. */
1107 : : struct mlx5_aso_sq sq; /*SQ using by ASO flow meter. */
1108 : : struct mlx5_aso_mtr_pool **pools; /* ASO flow meter pool array. */
1109 : : };
1110 : :
1111 : : /* Bulk management structure for ASO flow meter. */
1112 : : struct mlx5_mtr_bulk {
1113 : : uint32_t size; /* Number of ASO objects. */
1114 : : struct mlx5dr_action *action; /* HWS action */
1115 : : struct mlx5_devx_obj *devx_obj; /* DEVX object. */
1116 : : struct mlx5_aso_mtr *aso; /* Array of ASO objects. */
1117 : : };
1118 : :
1119 : : /* Meter management structure for global flow meter resource. */
1120 : : struct mlx5_flow_mtr_mng {
1121 : : struct mlx5_aso_mtr_pools_mng pools_mng;
1122 : : /* Pools management structure for ASO flow meter pools. */
1123 : : struct mlx5_flow_meter_def_policy *def_policy[MLX5_MTR_DOMAIN_MAX];
1124 : : /* Default policy table. */
1125 : : uint32_t def_policy_id;
1126 : : /* Default policy id. */
1127 : : uint32_t def_policy_ref_cnt;
1128 : : /** def_policy meter use count. */
1129 : : struct mlx5_flow_tbl_resource *drop_tbl[MLX5_MTR_DOMAIN_MAX];
1130 : : /* Meter drop table. */
1131 : : struct mlx5_flow_dv_matcher *
1132 : : drop_matcher[MLX5_MTR_DOMAIN_MAX][MLX5_REG_BITS];
1133 : : /* Matcher meter in drop table. */
1134 : : struct mlx5_flow_dv_matcher *def_matcher[MLX5_MTR_DOMAIN_MAX];
1135 : : /* Default matcher in drop table. */
1136 : : void *def_rule[MLX5_MTR_DOMAIN_MAX];
1137 : : /* Default rule in drop table. */
1138 : : uint8_t max_mtr_bits;
1139 : : /* Indicate how many bits are used by meter id at the most. */
1140 : : uint8_t max_mtr_flow_bits;
1141 : : /* Indicate how many bits are used by meter flow id at the most. */
1142 : : };
1143 : :
1144 : : /* Table key of the hash organization. */
1145 : : union mlx5_flow_tbl_key {
1146 : : struct {
1147 : : /* Table ID should be at the lowest address. */
1148 : : uint32_t level; /**< Level of the table. */
1149 : : uint32_t id:22; /**< ID of the table. */
1150 : : uint32_t dummy:1; /**< Dummy table for DV API. */
1151 : : uint32_t is_fdb:1; /**< 1 - FDB, 0 - NIC TX/RX. */
1152 : : uint32_t is_egress:1; /**< 1 - egress, 0 - ingress. */
1153 : : uint32_t reserved:7; /**< must be zero for comparison. */
1154 : : };
1155 : : uint64_t v64; /**< full 64bits value of key */
1156 : : };
1157 : :
1158 : : /* Table structure. */
1159 : : struct mlx5_flow_tbl_resource {
1160 : : void *obj; /**< Pointer to DR table object. */
1161 : : };
1162 : :
1163 : : #define MLX5_MAX_TABLES UINT16_MAX
1164 : : #define MLX5_HAIRPIN_TX_TABLE (UINT16_MAX - 1)
1165 : : /* Reserve the last two tables for metadata register copy. */
1166 : : #define MLX5_FLOW_MREG_ACT_TABLE_GROUP (MLX5_MAX_TABLES - 1)
1167 : : #define MLX5_FLOW_MREG_CP_TABLE_GROUP (MLX5_MAX_TABLES - 2)
1168 : : /* Tables for metering splits should be added here. */
1169 : : #define MLX5_FLOW_TABLE_LEVEL_METER (MLX5_MAX_TABLES - 3)
1170 : : #define MLX5_FLOW_TABLE_LEVEL_POLICY (MLX5_MAX_TABLES - 4)
1171 : : #define MLX5_MAX_TABLES_EXTERNAL MLX5_FLOW_TABLE_LEVEL_POLICY
1172 : : #define MLX5_FLOW_TABLE_HWS_POLICY (MLX5_MAX_TABLES - 10)
1173 : : #define MLX5_MAX_TABLES_FDB UINT16_MAX
1174 : : #define MLX5_FLOW_TABLE_FACTOR 10
1175 : :
1176 : : /* ID generation structure. */
1177 : : struct mlx5_flow_id_pool {
1178 : : uint32_t *free_arr; /**< Pointer to the a array of free values. */
1179 : : uint32_t base_index;
1180 : : /**< The next index that can be used without any free elements. */
1181 : : uint32_t *curr; /**< Pointer to the index to pop. */
1182 : : uint32_t *last; /**< Pointer to the last element in the empty array. */
1183 : : uint32_t max_id; /**< Maximum id can be allocated from the pool. */
1184 : : };
1185 : :
1186 : : /* Tx pacing queue structure - for Clock and Rearm queues. */
1187 : : struct mlx5_txpp_wq {
1188 : : /* Completion Queue related data.*/
1189 : : struct mlx5_devx_cq cq_obj;
1190 : : uint32_t cq_ci:24;
1191 : : uint32_t arm_sn:2;
1192 : : /* Send Queue related data.*/
1193 : : struct mlx5_devx_sq sq_obj;
1194 : : uint16_t sq_size; /* Number of WQEs in the queue. */
1195 : : uint16_t sq_ci; /* Next WQE to execute. */
1196 : : };
1197 : :
1198 : : /* Tx packet pacing internal timestamp. */
1199 : : struct mlx5_txpp_ts {
1200 : : uint64_t ci_ts;
1201 : : uint64_t ts;
1202 : : };
1203 : :
1204 : : /* Tx packet pacing structure. */
1205 : : struct mlx5_dev_txpp {
1206 : : pthread_mutex_t mutex; /* Pacing create/destroy mutex. */
1207 : : uint32_t refcnt; /* Pacing reference counter. */
1208 : : uint32_t freq; /* Timestamp frequency, Hz. */
1209 : : uint32_t tick; /* Completion tick duration in nanoseconds. */
1210 : : uint32_t test; /* Packet pacing test mode. */
1211 : : int32_t skew; /* Scheduling skew. */
1212 : : struct rte_intr_handle *intr_handle; /* Periodic interrupt. */
1213 : : void *echan; /* Event Channel. */
1214 : : struct mlx5_txpp_wq clock_queue; /* Clock Queue. */
1215 : : struct mlx5_txpp_wq rearm_queue; /* Clock Queue. */
1216 : : void *pp; /* Packet pacing context. */
1217 : : uint16_t pp_id; /* Packet pacing context index. */
1218 : : uint16_t ts_n; /* Number of captured timestamps. */
1219 : : uint16_t ts_p; /* Pointer to statistics timestamp. */
1220 : : struct mlx5_txpp_ts *tsa; /* Timestamps sliding window stats. */
1221 : : struct mlx5_txpp_ts ts; /* Cached completion id/timestamp. */
1222 : : uint32_t sync_lost:1; /* ci/timestamp synchronization lost. */
1223 : : /* Statistics counters. */
1224 : : uint64_t err_miss_int; /* Missed service interrupt. */
1225 : : uint64_t err_rearm_queue; /* Rearm Queue errors. */
1226 : : uint64_t err_clock_queue; /* Clock Queue errors. */
1227 : : uint64_t err_ts_past; /* Timestamp in the past. */
1228 : : uint64_t err_ts_future; /* Timestamp in the distant future. */
1229 : : uint64_t err_ts_order; /* Timestamp not in ascending order. */
1230 : : };
1231 : :
1232 : : /* Sample ID information of eCPRI flex parser structure. */
1233 : : struct mlx5_ecpri_parser_profile {
1234 : : uint32_t num; /* Actual number of samples. */
1235 : : uint32_t ids[8]; /* Sample IDs for this profile. */
1236 : : uint8_t offset[8]; /* Bytes offset of each parser. */
1237 : : void *obj; /* Flex parser node object. */
1238 : : };
1239 : :
1240 : : /* Max member ports per bonding device. */
1241 : : #define MLX5_BOND_MAX_PORTS 2
1242 : :
1243 : : /* Bonding device information. */
1244 : : struct mlx5_bond_info {
1245 : : int n_port; /* Number of bond member ports. */
1246 : : uint32_t ifindex;
1247 : : char ifname[MLX5_NAMESIZE + 1];
1248 : : struct {
1249 : : char ifname[MLX5_NAMESIZE + 1];
1250 : : uint32_t ifindex;
1251 : : struct rte_pci_addr pci_addr;
1252 : : } ports[MLX5_BOND_MAX_PORTS];
1253 : : };
1254 : :
1255 : : /* Number of connection tracking objects per pool: must be a power of 2. */
1256 : : #define MLX5_ASO_CT_ACTIONS_PER_POOL 64
1257 : :
1258 : : /* Generate incremental and unique CT index from pool and offset. */
1259 : : #define MLX5_MAKE_CT_IDX(pool, offset) \
1260 : : ((pool) * MLX5_ASO_CT_ACTIONS_PER_POOL + (offset) + 1)
1261 : :
1262 : : /* ASO Conntrack state. */
1263 : : enum mlx5_aso_ct_state {
1264 : : ASO_CONNTRACK_FREE, /* Inactive, in the free list. */
1265 : : ASO_CONNTRACK_WAIT, /* WQE sent in the SQ. */
1266 : : ASO_CONNTRACK_WAIT_ASYNC, /* CQE will be handled by async pull. */
1267 : : ASO_CONNTRACK_READY, /* CQE received w/o error. */
1268 : : ASO_CONNTRACK_QUERY, /* WQE for query sent. */
1269 : : ASO_CONNTRACK_MAX, /* Guard. */
1270 : : };
1271 : :
1272 : : /* Generic ASO connection tracking structure. */
1273 : : struct mlx5_aso_ct_action {
1274 : : union {
1275 : : /* SWS mode struct. */
1276 : : struct {
1277 : : /* Pointer to the next ASO CT. Used only in SWS. */
1278 : : LIST_ENTRY(mlx5_aso_ct_action) next;
1279 : : };
1280 : : /* HWS mode struct. */
1281 : : struct {
1282 : : /* Pointer to action pool. Used only in HWS. */
1283 : : struct mlx5_aso_ct_pool *pool;
1284 : : };
1285 : : };
1286 : : /* General action object for original dir. */
1287 : : void *dr_action_orig;
1288 : : /* General action object for reply dir. */
1289 : : void *dr_action_rply;
1290 : : uint32_t refcnt; /* Action used count in device flows. */
1291 : : uint32_t offset; /* Offset of ASO CT in DevX objects bulk. */
1292 : : uint16_t peer; /* The only peer port index could also use this CT. */
1293 : : enum mlx5_aso_ct_state state; /* ASO CT state. */
1294 : : bool is_original; /* The direction of the DR action to be used. */
1295 : : };
1296 : :
1297 : : /* CT action object state update. */
1298 : : #define MLX5_ASO_CT_UPDATE_STATE(c, s) \
1299 : : __atomic_store_n(&((c)->state), (s), __ATOMIC_RELAXED)
1300 : :
1301 : : #ifdef PEDANTIC
1302 : : #pragma GCC diagnostic ignored "-Wpedantic"
1303 : : #endif
1304 : :
1305 : : /* ASO connection tracking software pool definition. */
1306 : : struct mlx5_aso_ct_pool {
1307 : : uint16_t index; /* Pool index in pools array. */
1308 : : /* Free ASO CT index in the pool. Used by HWS. */
1309 : : struct mlx5_indexed_pool *cts;
1310 : : struct mlx5_devx_obj *devx_obj;
1311 : : union {
1312 : : void *dummy_action;
1313 : : /* Dummy action to increase the reference count in the driver. */
1314 : : struct mlx5dr_action *dr_action;
1315 : : /* HWS action. */
1316 : : };
1317 : : struct mlx5_aso_sq *sq; /* Async ASO SQ. */
1318 : : struct mlx5_aso_sq *shared_sq; /* Shared ASO SQ. */
1319 : : struct mlx5_aso_ct_action actions[];
1320 : : /* CT action structures bulk. */
1321 : : };
1322 : :
1323 : : LIST_HEAD(aso_ct_list, mlx5_aso_ct_action);
1324 : :
1325 : : #define MLX5_ASO_CT_SQ_NUM 16
1326 : :
1327 : : /* Pools management structure for ASO connection tracking pools. */
1328 : : struct mlx5_aso_ct_pools_mng {
1329 : : struct mlx5_aso_ct_pool **pools;
1330 : : uint16_t n; /* Total number of pools. */
1331 : : uint16_t next; /* Number of pools in use, index of next free pool. */
1332 : : uint32_t nb_sq; /* Number of ASO SQ. */
1333 : : rte_spinlock_t ct_sl; /* The ASO CT free list lock. */
1334 : : rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */
1335 : : struct aso_ct_list free_cts; /* Free ASO CT objects list. */
1336 : : struct mlx5_aso_sq aso_sqs[]; /* ASO queue objects. */
1337 : : };
1338 : :
1339 : : #ifdef PEDANTIC
1340 : : #pragma GCC diagnostic error "-Wpedantic"
1341 : : #endif
1342 : :
1343 : : /* LAG attr. */
1344 : : struct mlx5_lag {
1345 : : uint8_t tx_remap_affinity[16]; /* The PF port number of affinity */
1346 : : uint8_t affinity_mode; /* TIS or hash based affinity */
1347 : : };
1348 : :
1349 : : /* DevX flex parser context. */
1350 : : struct mlx5_flex_parser_devx {
1351 : : struct mlx5_list_entry entry; /* List element at the beginning. */
1352 : : uint32_t num_samples;
1353 : : uint8_t anchor_id;
1354 : : void *devx_obj;
1355 : : struct mlx5_devx_graph_node_attr devx_conf;
1356 : : uint32_t sample_ids[MLX5_GRAPH_NODE_SAMPLE_NUM];
1357 : : struct mlx5_devx_match_sample_info_query_attr sample_info[MLX5_GRAPH_NODE_SAMPLE_NUM];
1358 : : };
1359 : :
1360 : : /* Pattern field descriptor - how to translate flex pattern into samples. */
1361 : : __extension__
1362 : : struct mlx5_flex_pattern_field {
1363 : : uint16_t width:6;
1364 : : uint16_t shift:5;
1365 : : uint16_t reg_id:5;
1366 : : };
1367 : :
1368 : : #define MLX5_INVALID_SAMPLE_REG_ID 0x1F
1369 : :
1370 : : /* Port flex item context. */
1371 : : struct mlx5_flex_item {
1372 : : struct mlx5_flex_parser_devx *devx_fp; /* DevX flex parser object. */
1373 : : uint32_t refcnt; /* Atomically accessed refcnt by flows. */
1374 : : enum rte_flow_item_flex_tunnel_mode tunnel_mode; /* Tunnel mode. */
1375 : : uint32_t mapnum; /* Number of pattern translation entries. */
1376 : : struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM];
1377 : : };
1378 : :
1379 : : /*
1380 : : * Sample an IPv6 address and the first dword of SRv6 header.
1381 : : * Then it is 16 + 4 = 20 bytes which is 5 dwords.
1382 : : */
1383 : : #define MLX5_SRV6_SAMPLE_NUM 5
1384 : : /* Mlx5 internal flex parser profile structure. */
1385 : : struct mlx5_internal_flex_parser_profile {
1386 : : uint32_t refcnt;
1387 : : struct mlx5_flex_item flex; /* Hold map info for modify field. */
1388 : : };
1389 : :
1390 : : struct mlx5_send_to_kernel_action {
1391 : : void *action;
1392 : : void *tbl;
1393 : : };
1394 : :
1395 : : #define HWS_CNT_ASO_SQ_NUM 4
1396 : :
1397 : : struct mlx5_hws_aso_mng {
1398 : : uint16_t sq_num;
1399 : : struct mlx5_aso_sq sqs[HWS_CNT_ASO_SQ_NUM];
1400 : : };
1401 : :
1402 : : struct mlx5_hws_cnt_svc_mng {
1403 : : uint32_t refcnt;
1404 : : uint32_t service_core;
1405 : : uint32_t query_interval;
1406 : : rte_thread_t service_thread;
1407 : : uint8_t svc_running;
1408 : : struct mlx5_hws_aso_mng aso_mng __rte_cache_aligned;
1409 : : };
1410 : :
1411 : : #define MLX5_FLOW_HW_TAGS_MAX 12
1412 : : #define MLX5_FLOW_NAT64_REGS_MAX 3
1413 : :
1414 : : struct mlx5_dev_registers {
1415 : : enum modify_reg aso_reg;
1416 : : enum modify_reg hw_avl_tags[MLX5_FLOW_HW_TAGS_MAX];
1417 : : enum modify_reg nat64_regs[MLX5_FLOW_NAT64_REGS_MAX];
1418 : : };
1419 : :
1420 : : #if defined(HAVE_MLX5DV_DR) && \
1421 : : (defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER) || \
1422 : : defined(HAVE_MLX5_DR_CREATE_ACTION_ASO))
1423 : : #define HAVE_MLX5_DR_CREATE_ACTION_ASO_EXT
1424 : : #endif
1425 : :
1426 : : struct mlx5_geneve_tlv_options;
1427 : :
1428 : : enum mlx5_ipv6_tc_support {
1429 : : MLX5_IPV6_TC_UNKNOWN = 0,
1430 : : MLX5_IPV6_TC_FALLBACK,
1431 : : MLX5_IPV6_TC_OK,
1432 : : };
1433 : :
1434 : : struct mlx5_common_nic_config {
1435 : : enum mlx5_ipv6_tc_support ipv6_tc_fallback;
1436 : : /* Whether ipv6 traffic class should use old value. */
1437 : : };
1438 : :
1439 : : /**
1440 : : * Physical device structure.
1441 : : * This device is created once per NIC to manage recourses shared by all ports
1442 : : * under same physical device.
1443 : : */
1444 : : struct mlx5_physical_device {
1445 : : LIST_ENTRY(mlx5_physical_device) next;
1446 : : struct mlx5_dev_ctx_shared *sh; /* Created on sherd context. */
1447 : : uint64_t guid; /* System image guid, the uniq ID of physical device. */
1448 : : struct mlx5_geneve_tlv_options *tlv_options;
1449 : : struct mlx5_common_nic_config config;
1450 : : uint32_t refcnt;
1451 : : };
1452 : :
1453 : : /*
1454 : : * Shared Infiniband device context for Master/Representors
1455 : : * which belong to same IB device with multiple IB ports.
1456 : : **/
1457 : : struct mlx5_dev_ctx_shared {
1458 : : LIST_ENTRY(mlx5_dev_ctx_shared) next;
1459 : : uint32_t refcnt;
1460 : : uint32_t esw_mode:1; /* Whether is E-Switch mode. */
1461 : : uint32_t flow_hit_aso_en:1; /* Flow Hit ASO is supported. */
1462 : : uint32_t steering_format_version:4;
1463 : : /* Indicates the device steering logic format. */
1464 : : uint32_t meter_aso_en:1; /* Flow Meter ASO is supported. */
1465 : : uint32_t ct_aso_en:1; /* Connection Tracking ASO is supported. */
1466 : : uint32_t tunnel_header_0_1:1; /* tunnel_header_0_1 is supported. */
1467 : : uint32_t tunnel_header_2_3:1; /* tunnel_header_2_3 is supported. */
1468 : : uint32_t misc5_cap:1; /* misc5 matcher parameter is supported. */
1469 : : uint32_t dr_root_drop_action_en:1; /* DR drop action is usable on root tables. */
1470 : : uint32_t drop_action_check_flag:1; /* Check Flag for drop action. */
1471 : : uint32_t flow_priority_check_flag:1; /* Check Flag for flow priority. */
1472 : : uint32_t metadata_regc_check_flag:1; /* Check Flag for metadata REGC. */
1473 : : uint32_t shared_mark_enabled:1;
1474 : : /* If mark action is enabled on Rxqs (shared E-Switch domain). */
1475 : : uint32_t lag_rx_port_affinity_en:1;
1476 : : /* lag_rx_port_affinity is supported. */
1477 : : uint32_t hws_max_log_bulk_sz:5;
1478 : : /* Log of minimal HWS counters created hard coded. */
1479 : : uint32_t hws_max_nb_counters; /* Maximal number for HWS counters. */
1480 : : uint32_t max_port; /* Maximal IB device port index. */
1481 : : struct mlx5_bond_info bond; /* Bonding information. */
1482 : : struct mlx5_common_device *cdev; /* Backend mlx5 device. */
1483 : : struct mlx5_physical_device *phdev; /* Backend physical device. */
1484 : : uint32_t tdn; /* Transport Domain number. */
1485 : : char ibdev_name[MLX5_FS_NAME_MAX]; /* SYSFS dev name. */
1486 : : char ibdev_path[MLX5_FS_PATH_MAX]; /* SYSFS dev path for secondary */
1487 : : struct mlx5_dev_cap dev_cap; /* Device capabilities. */
1488 : : struct mlx5_sh_config config; /* Device configuration. */
1489 : : int numa_node; /* Numa node of backing physical device. */
1490 : : /* Packet pacing related structure. */
1491 : : struct mlx5_dev_txpp txpp;
1492 : : /* Shared DV/DR flow data section. */
1493 : : uint32_t dv_meta_mask; /* flow META metadata supported mask. */
1494 : : uint32_t dv_mark_mask; /* flow MARK metadata supported mask. */
1495 : : uint32_t dv_regc0_mask; /* available bits of metadata reg_c[0]. */
1496 : : void *fdb_domain; /* FDB Direct Rules name space handle. */
1497 : : void *rx_domain; /* RX Direct Rules name space handle. */
1498 : : void *tx_domain; /* TX Direct Rules name space handle. */
1499 : : #ifndef RTE_ARCH_64
1500 : : rte_spinlock_t uar_lock_cq; /* CQs share a common distinct UAR. */
1501 : : rte_spinlock_t uar_lock[MLX5_UAR_PAGE_NUM_MAX];
1502 : : /* UAR same-page access control required in 32bit implementations. */
1503 : : #endif
1504 : : union {
1505 : : struct mlx5_hlist *flow_tbls; /* SWS flow table. */
1506 : : struct mlx5_hlist *groups; /* HWS flow group. */
1507 : : };
1508 : : struct mlx5_flow_tunnel_hub *tunnel_hub;
1509 : : /* Direct Rules tables for FDB, NIC TX+RX */
1510 : : void *dr_drop_action; /* Pointer to DR drop action, any domain. */
1511 : : void *pop_vlan_action; /* Pointer to DR pop VLAN action. */
1512 : : #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
1513 : : struct mlx5_send_to_kernel_action send_to_kernel_action[MLX5DR_TABLE_TYPE_MAX];
1514 : : #endif
1515 : : struct mlx5_hlist *encaps_decaps; /* Encap/decap action hash list. */
1516 : : struct mlx5_hlist *modify_cmds;
1517 : : struct mlx5_hlist *tag_table;
1518 : : struct mlx5_list *port_id_action_list; /* Port ID action list. */
1519 : : struct mlx5_list *push_vlan_action_list; /* Push VLAN actions. */
1520 : : struct mlx5_list *sample_action_list; /* List of sample actions. */
1521 : : struct mlx5_list *dest_array_list;
1522 : : struct mlx5_list *flex_parsers_dv; /* Flex Item parsers. */
1523 : : /* List of destination array actions. */
1524 : : struct mlx5_flow_counter_mng sws_cmng;
1525 : : /* SW steering counters management structure. */
1526 : : void *default_miss_action; /* Default miss action. */
1527 : : struct mlx5_indexed_pool *ipool[MLX5_IPOOL_MAX];
1528 : : struct mlx5_indexed_pool *mdh_ipools[MLX5_MAX_MODIFY_NUM];
1529 : : /* Shared interrupt handler section. */
1530 : : struct rte_intr_handle *intr_handle; /* Interrupt handler for device. */
1531 : : struct rte_intr_handle *intr_handle_devx; /* DEVX interrupt handler. */
1532 : : struct rte_intr_handle *intr_handle_nl; /* Netlink interrupt handler. */
1533 : : void *devx_comp; /* DEVX async comp obj. */
1534 : : struct mlx5_devx_obj *tis[16]; /* TIS object. */
1535 : : struct mlx5_devx_obj *td; /* Transport domain. */
1536 : : struct mlx5_lag lag; /* LAG attributes */
1537 : : struct mlx5_uar tx_uar; /* DevX UAR for Tx and Txpp and ASO SQs. */
1538 : : struct mlx5_uar rx_uar; /* DevX UAR for Rx. */
1539 : : struct mlx5_proc_priv *pppriv; /* Pointer to primary private process. */
1540 : : struct mlx5_ecpri_parser_profile ecpri_parser;
1541 : : struct mlx5_internal_flex_parser_profile srh_flex_parser; /* srh flex parser structure. */
1542 : : /* Flex parser profiles information. */
1543 : : LIST_HEAD(shared_rxqs, mlx5_rxq_ctrl) shared_rxqs; /* Shared RXQs. */
1544 : : struct mlx5_aso_age_mng *aso_age_mng;
1545 : : /* Management data for aging mechanism using ASO Flow Hit. */
1546 : : struct mlx5_geneve_tlv_option_resource *geneve_tlv_option_resource;
1547 : : /* Management structure for geneve tlv option */
1548 : : rte_spinlock_t geneve_tlv_opt_sl; /* Lock for geneve tlv resource */
1549 : : struct mlx5_flow_mtr_mng *mtrmng;
1550 : : /* Meter management structure. */
1551 : : struct mlx5_aso_ct_pools_mng *ct_mng; /* Management data for ASO CT in HWS only. */
1552 : : struct mlx5_lb_ctx self_lb; /* QP to enable self loopback for Devx. */
1553 : : unsigned int flow_max_priority;
1554 : : enum modify_reg flow_mreg_c[MLX5_MREG_C_NUM];
1555 : : /* Availability of mreg_c's. */
1556 : : void *devx_channel_lwm;
1557 : : struct rte_intr_handle *intr_handle_lwm;
1558 : : pthread_mutex_t lwm_config_lock;
1559 : : uint32_t host_shaper_rate:8;
1560 : : uint32_t lwm_triggered:1;
1561 : : struct mlx5_hws_cnt_svc_mng *cnt_svc;
1562 : : rte_spinlock_t cpool_lock;
1563 : : LIST_HEAD(hws_cpool_list, mlx5_hws_cnt_pool) hws_cpool_list; /* Count pool list. */
1564 : : struct mlx5_dev_registers registers;
1565 : : struct mlx5_dev_shared_port port[]; /* per device port data array. */
1566 : : };
1567 : :
1568 : : /*
1569 : : * Per-process private structure.
1570 : : * Caution, secondary process may rebuild the struct during port start.
1571 : : */
1572 : : struct mlx5_proc_priv {
1573 : : void *hca_bar;
1574 : : /* Mapped HCA PCI BAR area. */
1575 : : size_t uar_table_sz;
1576 : : /* Size of UAR register table. */
1577 : : struct mlx5_uar_data uar_table[];
1578 : : /* Table of UAR registers for each process. */
1579 : : };
1580 : :
1581 : : /* MTR profile list. */
1582 : : TAILQ_HEAD(mlx5_mtr_profiles, mlx5_flow_meter_profile);
1583 : : /* MTR list. */
1584 : : TAILQ_HEAD(mlx5_legacy_flow_meters, mlx5_legacy_flow_meter);
1585 : :
1586 : : struct mlx5_mtr_config {
1587 : : uint32_t nb_meters; /**< Number of configured meters */
1588 : : uint32_t nb_meter_profiles; /**< Number of configured meter profiles */
1589 : : uint32_t nb_meter_policies; /**< Number of configured meter policies */
1590 : : };
1591 : :
1592 : : /* RSS description. */
1593 : : struct mlx5_flow_rss_desc {
1594 : : bool symmetric_hash_function; /**< Symmetric hash function */
1595 : : uint32_t level;
1596 : : uint32_t queue_num; /**< Number of entries in @p queue. */
1597 : : uint64_t types; /**< Specific RSS hash types (see RTE_ETH_RSS_*). */
1598 : : uint64_t hash_fields; /* Verbs Hash fields. */
1599 : : uint8_t key[MLX5_RSS_HASH_KEY_LEN]; /**< RSS hash key. */
1600 : : uint32_t key_len; /**< RSS hash key len. */
1601 : : uint32_t hws_flags; /**< HW steering action. */
1602 : : uint32_t tunnel; /**< Queue in tunnel. */
1603 : : uint32_t shared_rss; /**< Shared RSS index. */
1604 : : struct mlx5_ind_table_obj *ind_tbl;
1605 : : /**< Indirection table for shared RSS hash RX queues. */
1606 : : union {
1607 : : uint16_t *queue; /**< Destination queues. */
1608 : : const uint16_t *const_q; /**< Const pointer convert. */
1609 : : };
1610 : : };
1611 : :
1612 : : #define MLX5_PROC_PRIV(port_id) \
1613 : : ((struct mlx5_proc_priv *)rte_eth_devices[port_id].process_private)
1614 : :
1615 : : /* Verbs/DevX Rx queue elements. */
1616 : : struct mlx5_rxq_obj {
1617 : : LIST_ENTRY(mlx5_rxq_obj) next; /* Pointer to the next element. */
1618 : : struct mlx5_rxq_ctrl *rxq_ctrl; /* Back pointer to parent. */
1619 : : int fd; /* File descriptor for event channel */
1620 : : union {
1621 : : struct {
1622 : : void *wq; /* Work Queue. */
1623 : : void *ibv_cq; /* Completion Queue. */
1624 : : void *ibv_channel;
1625 : : };
1626 : : struct mlx5_devx_obj *rq; /* DevX RQ object for hairpin. */
1627 : : struct {
1628 : : struct mlx5_devx_rmp devx_rmp; /* RMP for shared RQ. */
1629 : : struct mlx5_devx_cq cq_obj; /* DevX CQ object. */
1630 : : void *devx_channel;
1631 : : };
1632 : : };
1633 : : };
1634 : :
1635 : : /* Indirection table. */
1636 : : struct mlx5_ind_table_obj {
1637 : : LIST_ENTRY(mlx5_ind_table_obj) next; /* Pointer to the next element. */
1638 : : uint32_t refcnt; /* Reference counter. */
1639 : : union {
1640 : : void *ind_table; /**< Indirection table. */
1641 : : struct mlx5_devx_obj *rqt; /* DevX RQT object. */
1642 : : };
1643 : : uint32_t queues_n; /**< Number of queues in the list. */
1644 : : uint16_t *queues; /**< Queue list. */
1645 : : };
1646 : :
1647 : : /* Hash Rx queue. */
1648 : : __extension__
1649 : : struct mlx5_hrxq {
1650 : : struct mlx5_list_entry entry; /* List entry. */
1651 : : uint32_t standalone:1; /* This object used in shared action. */
1652 : : struct mlx5_ind_table_obj *ind_table; /* Indirection table. */
1653 : : union {
1654 : : void *qp; /* Verbs queue pair. */
1655 : : struct mlx5_devx_obj *tir; /* DevX TIR object. */
1656 : : };
1657 : : #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
1658 : : void *action; /* DV QP action pointer. */
1659 : : #endif
1660 : : bool symmetric_hash_function; /* Symmetric hash function */
1661 : : uint32_t hws_flags; /* Hw steering flags. */
1662 : : uint64_t hash_fields; /* Verbs Hash fields. */
1663 : : uint32_t rss_key_len; /* Hash key length in bytes. */
1664 : : uint32_t idx; /* Hash Rx queue index. */
1665 : : uint8_t rss_key[]; /* Hash key. */
1666 : : };
1667 : :
1668 : : /* Verbs/DevX Tx queue elements. */
1669 : : struct mlx5_txq_obj {
1670 : : LIST_ENTRY(mlx5_txq_obj) next; /* Pointer to the next element. */
1671 : : struct mlx5_txq_ctrl *txq_ctrl; /* Pointer to the control queue. */
1672 : : union {
1673 : : struct {
1674 : : void *cq; /* Completion Queue. */
1675 : : void *qp; /* Queue Pair. */
1676 : : };
1677 : : struct {
1678 : : struct mlx5_devx_obj *sq;
1679 : : /* DevX object for Sx queue. */
1680 : : struct mlx5_devx_obj *tis; /* The TIS object. */
1681 : : void *umem_buf_wq_buffer;
1682 : : void *umem_obj_wq_buffer;
1683 : : };
1684 : : struct {
1685 : : struct rte_eth_dev *dev;
1686 : : struct mlx5_devx_cq cq_obj;
1687 : : /* DevX CQ object and its resources. */
1688 : : struct mlx5_devx_sq sq_obj;
1689 : : /* DevX SQ object and its resources. */
1690 : : };
1691 : : };
1692 : : };
1693 : :
1694 : : enum mlx5_rxq_modify_type {
1695 : : MLX5_RXQ_MOD_ERR2RST, /* modify state from error to reset. */
1696 : : MLX5_RXQ_MOD_RST2RDY, /* modify state from reset to ready. */
1697 : : MLX5_RXQ_MOD_RDY2ERR, /* modify state from ready to error. */
1698 : : MLX5_RXQ_MOD_RDY2RST, /* modify state from ready to reset. */
1699 : : MLX5_RXQ_MOD_RDY2RDY, /* modify state from ready to ready. */
1700 : : };
1701 : :
1702 : : enum mlx5_txq_modify_type {
1703 : : MLX5_TXQ_MOD_RST2RDY, /* modify state from reset to ready. */
1704 : : MLX5_TXQ_MOD_RDY2RST, /* modify state from ready to reset. */
1705 : : MLX5_TXQ_MOD_ERR2RDY, /* modify state from error to ready. */
1706 : : };
1707 : :
1708 : : struct mlx5_rxq_priv;
1709 : : struct mlx5_priv;
1710 : :
1711 : : /* HW objects operations structure. */
1712 : : struct mlx5_obj_ops {
1713 : : int (*rxq_obj_modify_vlan_strip)(struct mlx5_rxq_priv *rxq, int on);
1714 : : int (*rxq_obj_new)(struct mlx5_rxq_priv *rxq);
1715 : : int (*rxq_event_get)(struct mlx5_rxq_obj *rxq_obj);
1716 : : int (*rxq_obj_modify)(struct mlx5_rxq_priv *rxq, uint8_t type);
1717 : : void (*rxq_obj_release)(struct mlx5_rxq_priv *rxq);
1718 : : int (*rxq_event_get_lwm)(struct mlx5_priv *priv, int *rxq_idx, int *port_id);
1719 : : int (*ind_table_new)(struct rte_eth_dev *dev, const unsigned int log_n,
1720 : : struct mlx5_ind_table_obj *ind_tbl);
1721 : : int (*ind_table_modify)(struct rte_eth_dev *dev,
1722 : : const unsigned int log_n,
1723 : : const uint16_t *queues, const uint32_t queues_n,
1724 : : struct mlx5_ind_table_obj *ind_tbl);
1725 : : void (*ind_table_destroy)(struct mlx5_ind_table_obj *ind_tbl);
1726 : : int (*hrxq_new)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
1727 : : int tunnel __rte_unused);
1728 : : int (*hrxq_modify)(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
1729 : : const uint8_t *rss_key,
1730 : : uint64_t hash_fields,
1731 : : bool symmetric_hash_function,
1732 : : const struct mlx5_ind_table_obj *ind_tbl);
1733 : : void (*hrxq_destroy)(struct mlx5_hrxq *hrxq);
1734 : : int (*drop_action_create)(struct rte_eth_dev *dev);
1735 : : void (*drop_action_destroy)(struct rte_eth_dev *dev);
1736 : : int (*txq_obj_new)(struct rte_eth_dev *dev, uint16_t idx);
1737 : : int (*txq_obj_modify)(struct mlx5_txq_obj *obj,
1738 : : enum mlx5_txq_modify_type type, uint8_t dev_port);
1739 : : void (*txq_obj_release)(struct mlx5_txq_obj *txq_obj);
1740 : : int (*lb_dummy_queue_create)(struct rte_eth_dev *dev);
1741 : : void (*lb_dummy_queue_release)(struct rte_eth_dev *dev);
1742 : : };
1743 : :
1744 : : #define MLX5_RSS_HASH_FIELDS_LEN RTE_DIM(mlx5_rss_hash_fields)
1745 : :
1746 : : enum mlx5_hw_ctrl_flow_type {
1747 : : MLX5_HW_CTRL_FLOW_TYPE_GENERAL,
1748 : : MLX5_HW_CTRL_FLOW_TYPE_SQ_MISS_ROOT,
1749 : : MLX5_HW_CTRL_FLOW_TYPE_SQ_MISS,
1750 : : MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_JUMP,
1751 : : MLX5_HW_CTRL_FLOW_TYPE_TX_META_COPY,
1752 : : MLX5_HW_CTRL_FLOW_TYPE_TX_REPR_MATCH,
1753 : : MLX5_HW_CTRL_FLOW_TYPE_LACP_RX,
1754 : : MLX5_HW_CTRL_FLOW_TYPE_DEFAULT_RX_RSS,
1755 : : };
1756 : :
1757 : : /** Additional info about control flow rule. */
1758 : : struct mlx5_hw_ctrl_flow_info {
1759 : : /** Determines the kind of control flow rule. */
1760 : : enum mlx5_hw_ctrl_flow_type type;
1761 : : union {
1762 : : /**
1763 : : * If control flow is a SQ miss flow (root or not),
1764 : : * then fields contains matching SQ number.
1765 : : */
1766 : : uint32_t esw_mgr_sq;
1767 : : /**
1768 : : * If control flow is a Tx representor matching,
1769 : : * then fields contains matching SQ number.
1770 : : */
1771 : : uint32_t tx_repr_sq;
1772 : : };
1773 : : };
1774 : :
1775 : : /** Entry for tracking control flow rules in HWS. */
1776 : : struct mlx5_hw_ctrl_flow {
1777 : : LIST_ENTRY(mlx5_hw_ctrl_flow) next;
1778 : : /**
1779 : : * Owner device is a port on behalf of which flow rule was created.
1780 : : *
1781 : : * It's different from the port which really created the flow rule
1782 : : * if and only if flow rule is created on transfer proxy port
1783 : : * on behalf of representor port.
1784 : : */
1785 : : struct rte_eth_dev *owner_dev;
1786 : : /** Pointer to flow rule handle. */
1787 : : struct rte_flow *flow;
1788 : : /** Additional information about the control flow rule. */
1789 : : struct mlx5_hw_ctrl_flow_info info;
1790 : : };
1791 : :
1792 : : /*
1793 : : * Flow rule structure for flow engine mode control, focus on group 0.
1794 : : * Apply to all supported domains.
1795 : : */
1796 : : struct mlx5_dv_flow_info {
1797 : : LIST_ENTRY(mlx5_dv_flow_info) next;
1798 : : uint32_t orig_prio; /* prio set by user */
1799 : : uint32_t flow_idx_high_prio;
1800 : : /* flow index owned by standby mode. priority is lower unless DUP flags. */
1801 : : uint32_t flow_idx_low_prio;
1802 : : struct rte_flow_item *items;
1803 : : struct rte_flow_action *actions;
1804 : : struct rte_flow_attr attr;
1805 : : };
1806 : :
1807 : : struct rte_pmd_mlx5_flow_engine_mode_info {
1808 : : enum rte_pmd_mlx5_flow_engine_mode mode;
1809 : : uint32_t mode_flag;
1810 : : /* The list is maintained in insertion order. */
1811 : : LIST_HEAD(hot_up_info, mlx5_dv_flow_info) hot_upgrade;
1812 : : };
1813 : : /* HW Steering port configuration passed to rte_flow_configure(). */
1814 : : struct mlx5_flow_hw_attr {
1815 : : struct rte_flow_port_attr port_attr;
1816 : : uint16_t nb_queue;
1817 : : struct rte_flow_queue_attr *queue_attr;
1818 : : };
1819 : :
1820 : : struct mlx5_flow_hw_ctrl_rx;
1821 : :
1822 : : enum mlx5_quota_state {
1823 : : MLX5_QUOTA_STATE_FREE, /* quota not in use */
1824 : : MLX5_QUOTA_STATE_READY, /* quota is ready */
1825 : : MLX5_QUOTA_STATE_WAIT /* quota waits WR completion */
1826 : : };
1827 : :
1828 : : struct mlx5_quota {
1829 : : uint8_t state; /* object state */
1830 : : uint8_t mode; /* metering mode */
1831 : : /**
1832 : : * Keep track of application update types.
1833 : : * PMD does not allow 2 consecutive ADD updates.
1834 : : */
1835 : : enum rte_flow_update_quota_op last_update;
1836 : : };
1837 : :
1838 : : /* Bulk management structure for flow quota. */
1839 : : struct mlx5_quota_ctx {
1840 : : struct mlx5dr_action *dr_action; /* HWS action */
1841 : : struct mlx5_devx_obj *devx_obj; /* DEVX ranged object. */
1842 : : struct mlx5_pmd_mr mr; /* MR for READ from MTR ASO */
1843 : : struct mlx5_aso_mtr_dseg **read_buf; /* Buffers for READ */
1844 : : struct mlx5_aso_sq *sq; /* SQs for sync/async ACCESS_ASO WRs */
1845 : : struct mlx5_indexed_pool *quota_ipool; /* Manage quota objects */
1846 : : };
1847 : :
1848 : : struct mlx5_priv {
1849 : : struct rte_eth_dev_data *dev_data; /* Pointer to device data. */
1850 : : struct mlx5_dev_ctx_shared *sh; /* Shared device context. */
1851 : : uint32_t dev_port; /* Device port number. */
1852 : : struct rte_pci_device *pci_dev; /* Backend PCI device. */
1853 : : struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */
1854 : : BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES);
1855 : : /* Bit-field of MAC addresses owned by the PMD. */
1856 : : uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */
1857 : : unsigned int vlan_filter_n; /* Number of configured VLAN filters. */
1858 : : /* Device properties. */
1859 : : uint16_t mtu; /* Configured MTU. */
1860 : : unsigned int isolated:1; /* Whether isolated mode is enabled. */
1861 : : unsigned int representor:1; /* Device is a port representor. */
1862 : : unsigned int master:1; /* Device is a E-Switch master. */
1863 : : unsigned int txpp_en:1; /* Tx packet pacing enabled. */
1864 : : unsigned int sampler_en:1; /* Whether support sampler. */
1865 : : unsigned int mtr_en:1; /* Whether support meter. */
1866 : : unsigned int mtr_reg_share:1; /* Whether support meter REG_C share. */
1867 : : unsigned int lb_used:1; /* Loopback queue is referred to. */
1868 : : unsigned int rmv_notified:1; /* Notified about removal event */
1869 : : uint32_t mark_enabled:1; /* If mark action is enabled on rxqs. */
1870 : : uint32_t num_lag_ports:4; /* Number of ports can be bonded. */
1871 : : uint32_t tunnel_enabled:1; /* If tunnel offloading is enabled on rxqs. */
1872 : : uint16_t domain_id; /* Switch domain identifier. */
1873 : : uint16_t vport_id; /* Associated VF vport index (if any). */
1874 : : uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
1875 : : uint32_t vport_meta_mask; /* Used for vport index field match mask. */
1876 : : uint16_t representor_id; /* UINT16_MAX if not a representor. */
1877 : : int32_t pf_bond; /* >=0, representor owner PF index in bonding. */
1878 : : int32_t mpesw_owner; /* >=0, representor owner PF index in MPESW. */
1879 : : int32_t mpesw_port; /* Related port index of MPESW device. < 0 - no MPESW. */
1880 : : bool mpesw_uplink; /* If true, port is an uplink port. */
1881 : : unsigned int if_index; /* Associated kernel network device index. */
1882 : : /* RX/TX queues. */
1883 : : unsigned int rxqs_n; /* RX queues array size. */
1884 : : unsigned int txqs_n; /* TX queues array size. */
1885 : : struct mlx5_external_rxq *ext_rxqs; /* External RX queues array. */
1886 : : struct mlx5_rxq_priv *(*rxq_privs)[]; /* RX queue non-shared data. */
1887 : : struct mlx5_txq_data *(*txqs)[]; /* TX queues. */
1888 : : struct rte_mempool *mprq_mp; /* Mempool for Multi-Packet RQ. */
1889 : : struct rte_eth_rss_conf rss_conf; /* RSS configuration. */
1890 : : unsigned int (*reta_idx)[]; /* RETA index table. */
1891 : : unsigned int reta_idx_n; /* RETA index size. */
1892 : : struct mlx5_drop drop_queue; /* Flow drop queues. */
1893 : : void *root_drop_action; /* Pointer to root drop action. */
1894 : : rte_spinlock_t hw_ctrl_lock;
1895 : : LIST_HEAD(hw_ctrl_flow, mlx5_hw_ctrl_flow) hw_ctrl_flows;
1896 : : LIST_HEAD(hw_ext_ctrl_flow, mlx5_hw_ctrl_flow) hw_ext_ctrl_flows;
1897 : : struct mlx5_flow_hw_ctrl_fdb *hw_ctrl_fdb;
1898 : : struct rte_flow_pattern_template *hw_tx_repr_tagging_pt;
1899 : : struct rte_flow_actions_template *hw_tx_repr_tagging_at;
1900 : : struct rte_flow_template_table *hw_tx_repr_tagging_tbl;
1901 : : struct mlx5_indexed_pool *flows[MLX5_FLOW_TYPE_MAXI];
1902 : : /* RTE Flow rules. */
1903 : : uint32_t ctrl_flows; /* Control flow rules. */
1904 : : rte_spinlock_t flow_list_lock;
1905 : : struct mlx5_obj_ops obj_ops; /* HW objects operations. */
1906 : : LIST_HEAD(rxq, mlx5_rxq_ctrl) rxqsctrl; /* DPDK Rx queues. */
1907 : : LIST_HEAD(rxqobj, mlx5_rxq_obj) rxqsobj; /* Verbs/DevX Rx queues. */
1908 : : struct mlx5_list *hrxqs; /* Hash Rx queues. */
1909 : : LIST_HEAD(txq, mlx5_txq_ctrl) txqsctrl; /* DPDK Tx queues. */
1910 : : LIST_HEAD(txqobj, mlx5_txq_obj) txqsobj; /* Verbs/DevX Tx queues. */
1911 : : /* Indirection tables. */
1912 : : LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;
1913 : : /* Standalone indirect tables. */
1914 : : LIST_HEAD(stdl_ind_tables, mlx5_ind_table_obj) standalone_ind_tbls;
1915 : : /* Objects created with indirect list action */
1916 : : LIST_HEAD(indirect_list, mlx5_indirect_list) indirect_list_head;
1917 : : /* Pointer to next element. */
1918 : : rte_rwlock_t ind_tbls_lock;
1919 : : uint32_t refcnt; /**< Reference counter. */
1920 : : /**< Verbs modify header action object. */
1921 : : uint8_t ft_type; /**< Flow table type, Rx or Tx. */
1922 : : uint32_t max_lro_msg_size;
1923 : : uint32_t link_speed_capa; /* Link speed capabilities. */
1924 : : struct mlx5_xstats_ctrl xstats_ctrl; /* Extended stats control. */
1925 : : struct mlx5_stats_ctrl stats_ctrl; /* Stats control. */
1926 : : struct mlx5_port_config config; /* Port configuration. */
1927 : : /* Context for Verbs allocator. */
1928 : : int nl_socket_rdma; /* Netlink socket (NETLINK_RDMA). */
1929 : : int nl_socket_route; /* Netlink socket (NETLINK_ROUTE). */
1930 : : struct mlx5_nl_vlan_vmwa_context *vmwa_context; /* VLAN WA context. */
1931 : : struct mlx5_hlist *mreg_cp_tbl;
1932 : : /* Hash table of Rx metadata register copy table. */
1933 : : struct mlx5_mtr_config mtr_config; /* Meter configuration */
1934 : : uint8_t mtr_sfx_reg; /* Meter prefix-suffix flow match REG_C. */
1935 : : struct mlx5_legacy_flow_meters flow_meters; /* MTR list. */
1936 : : struct mlx5_l3t_tbl *mtr_profile_tbl; /* Meter index lookup table. */
1937 : : struct mlx5_flow_meter_profile *mtr_profile_arr; /* Profile array. */
1938 : : struct mlx5_l3t_tbl *policy_idx_tbl; /* Policy index lookup table. */
1939 : : struct mlx5_flow_meter_policy *mtr_policy_arr; /* Policy array. */
1940 : : struct mlx5_l3t_tbl *mtr_idx_tbl; /* Meter index lookup table. */
1941 : : struct mlx5_mtr_bulk mtr_bulk; /* Meter index mapping for HWS */
1942 : : struct mlx5_quota_ctx quota_ctx; /* Quota index mapping for HWS */
1943 : : uint8_t skip_default_rss_reta; /* Skip configuration of default reta. */
1944 : : uint8_t fdb_def_rule; /* Whether fdb jump to table 1 is configured. */
1945 : : struct mlx5_mp_id mp_id; /* ID of a multi-process process */
1946 : : LIST_HEAD(fdir, mlx5_fdir_flow) fdir_flows; /* fdir flows. */
1947 : : rte_spinlock_t shared_act_sl; /* Shared actions spinlock. */
1948 : : uint32_t rss_shared_actions; /* RSS shared actions. */
1949 : : struct mlx5_devx_obj *q_counters; /* DevX queue counter object. */
1950 : : uint32_t counter_set_id; /* Queue counter ID to set in DevX objects. */
1951 : : uint32_t lag_affinity_idx; /* LAG mode queue 0 affinity starting. */
1952 : : rte_spinlock_t flex_item_sl; /* Flex item list spinlock. */
1953 : : struct mlx5_flex_item flex_item[MLX5_PORT_FLEX_ITEM_NUM];
1954 : : /* Flex items have been created on the port. */
1955 : : uint32_t flex_item_map; /* Map of allocated flex item elements. */
1956 : : uint32_t nb_queue; /* HW steering queue number. */
1957 : : struct mlx5_hws_cnt_pool *hws_cpool; /* HW steering's counter pool. */
1958 : : uint32_t hws_mark_refcnt; /* HWS mark action reference counter. */
1959 : : struct rte_pmd_mlx5_flow_engine_mode_info mode_info; /* Process set flow engine info. */
1960 : : struct mlx5_flow_hw_attr *hw_attr; /* HW Steering port configuration. */
1961 : : #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
1962 : : /* Item template list. */
1963 : : LIST_HEAD(flow_hw_itt, rte_flow_pattern_template) flow_hw_itt;
1964 : : /* Action template list. */
1965 : : LIST_HEAD(flow_hw_at, rte_flow_actions_template) flow_hw_at;
1966 : : struct mlx5dr_context *dr_ctx; /**< HW steering DR context. */
1967 : : /* Pointer to the GENEVE TLV options. */
1968 : : struct mlx5_geneve_tlv_options *tlv_options;
1969 : : /* HW steering queue polling mechanism job descriptor LIFO. */
1970 : : uint32_t hws_strict_queue:1;
1971 : : /**< Whether all operations strictly happen on the same HWS queue. */
1972 : : uint32_t hws_age_req:1; /**< Whether this port has AGE indexed pool. */
1973 : : struct mlx5_hw_q *hw_q;
1974 : : /* HW steering rte flow table list header. */
1975 : : LIST_HEAD(flow_hw_tbl, rte_flow_template_table) flow_hw_tbl;
1976 : : /* HW steering rte flow group list header */
1977 : : LIST_HEAD(flow_hw_grp, mlx5_flow_group) flow_hw_grp;
1978 : : struct mlx5dr_action *hw_push_vlan[MLX5DR_TABLE_TYPE_MAX];
1979 : : struct mlx5dr_action *hw_pop_vlan[MLX5DR_TABLE_TYPE_MAX];
1980 : : struct mlx5dr_action **hw_vport;
1981 : : /* HW steering global drop action. */
1982 : : struct mlx5dr_action *hw_drop[2];
1983 : : /* HW steering global tag action. */
1984 : : struct mlx5dr_action *hw_tag[2];
1985 : : /* HW steering global default miss action. */
1986 : : struct mlx5dr_action *hw_def_miss;
1987 : : /* HW steering global send to kernel action. */
1988 : : struct mlx5dr_action *hw_send_to_kernel[MLX5DR_TABLE_TYPE_MAX];
1989 : : /* HW steering create ongoing rte flow table list header. */
1990 : : LIST_HEAD(flow_hw_tbl_ongo, rte_flow_template_table) flow_hw_tbl_ongo;
1991 : : struct mlx5_indexed_pool *acts_ipool; /* Action data indexed pool. */
1992 : : struct mlx5_aso_ct_pools_mng *ct_mng;
1993 : : /* Management data for ASO connection tracking. */
1994 : : struct mlx5_aso_ct_pool *hws_ctpool; /* HW steering's CT pool. */
1995 : : struct mlx5_aso_mtr_pool *hws_mpool; /* HW steering's Meter pool. */
1996 : : struct mlx5_flow_hw_ctrl_rx *hw_ctrl_rx;
1997 : : /**< HW steering templates used to create control flow rules. */
1998 : :
1999 : : struct rte_flow_actions_template *action_template_drop[MLX5DR_TABLE_TYPE_MAX];
2000 : :
2001 : : /*
2002 : : * The NAT64 action can be shared among matchers per domain.
2003 : : * [0]: RTE_FLOW_NAT64_6TO4, [1]: RTE_FLOW_NAT64_4TO6
2004 : : * Todo: consider to add *_MAX macro.
2005 : : */
2006 : : struct mlx5dr_action *action_nat64[MLX5DR_TABLE_TYPE_MAX][2];
2007 : :
2008 : : #endif
2009 : : struct rte_eth_dev *shared_host; /* Host device for HW steering. */
2010 : : uint16_t shared_refcnt; /* HW steering host reference counter. */
2011 : : };
2012 : :
2013 : : #define PORT_ID(priv) ((priv)->dev_data->port_id)
2014 : : #define ETH_DEV(priv) (&rte_eth_devices[PORT_ID(priv)])
2015 : : #define CTRL_QUEUE_ID(priv) ((priv)->nb_queue - 1)
2016 : :
2017 : : struct rte_hairpin_peer_info {
2018 : : uint32_t qp_id;
2019 : : uint32_t vhca_id;
2020 : : uint16_t peer_q;
2021 : : uint16_t tx_explicit;
2022 : : uint16_t manual_bind;
2023 : : };
2024 : :
2025 : : #define BUF_SIZE 1024
2026 : : enum dr_dump_rec_type {
2027 : : DR_DUMP_REC_TYPE_PMD_PKT_REFORMAT = 4410,
2028 : : DR_DUMP_REC_TYPE_PMD_MODIFY_HDR = 4420,
2029 : : DR_DUMP_REC_TYPE_PMD_COUNTER = 4430,
2030 : : };
2031 : :
2032 : : #if defined(HAVE_MLX5_HWS_SUPPORT)
2033 : : static __rte_always_inline struct mlx5_hw_q_job *
2034 : : flow_hw_job_get(struct mlx5_priv *priv, uint32_t queue)
2035 : : {
2036 : : MLX5_ASSERT(priv->hw_q[queue].job_idx <= priv->hw_q[queue].size);
2037 : 0 : return priv->hw_q[queue].job_idx ?
2038 [ # # # # : 0 : priv->hw_q[queue].job[--priv->hw_q[queue].job_idx] : NULL;
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # # ]
2039 : : }
2040 : :
2041 : : static __rte_always_inline void
2042 : : flow_hw_job_put(struct mlx5_priv *priv, struct mlx5_hw_q_job *job, uint32_t queue)
2043 : : {
2044 : : MLX5_ASSERT(priv->hw_q[queue].job_idx < priv->hw_q[queue].size);
2045 [ # # ]: 0 : priv->hw_q[queue].job[priv->hw_q[queue].job_idx++] = job;
2046 : 0 : }
2047 : :
2048 : : struct mlx5_hw_q_job *
2049 : : mlx5_flow_action_job_init(struct mlx5_priv *priv, uint32_t queue,
2050 : : const struct rte_flow_action_handle *handle,
2051 : : void *user_data, void *query_data,
2052 : : enum mlx5_hw_job_type type,
2053 : : struct rte_flow_error *error);
2054 : : #endif
2055 : :
2056 : : /**
2057 : : * Indicates whether HW objects operations can be created by DevX.
2058 : : *
2059 : : * This function is used for both:
2060 : : * Before creation - deciding whether to create HW objects operations by DevX.
2061 : : * After creation - indicator if HW objects operations were created by DevX.
2062 : : *
2063 : : * @param sh
2064 : : * Pointer to shared device context.
2065 : : *
2066 : : * @return
2067 : : * True if HW objects were created by DevX, False otherwise.
2068 : : */
2069 : : static inline bool
2070 : : mlx5_devx_obj_ops_en(struct mlx5_dev_ctx_shared *sh)
2071 : : {
2072 : : /*
2073 : : * When advanced DR API is available and DV flow is supported and
2074 : : * DevX is supported, HW objects operations are created by DevX.
2075 : : */
2076 [ # # # # : 0 : return (sh->cdev->config.devx && sh->config.dv_flow_en &&
# # # # #
# # # # #
# # ]
2077 : : sh->dev_cap.dest_tir);
2078 : : }
2079 : :
2080 : : /**
2081 : : * Check if the port is either MPESW physical device or a representor port.
2082 : : *
2083 : : * @param priv
2084 : : * Pointer to port's private data.
2085 : : *
2086 : : * @return
2087 : : * True if the port is a physical device or representor in MPESW setup.
2088 : : * False otherwise or MPESW was not configured.
2089 : : */
2090 : : static inline bool
2091 : : mlx5_is_port_on_mpesw_device(struct mlx5_priv *priv)
2092 : : {
2093 [ # # ]: 0 : return priv->mpesw_port >= 0;
2094 : : }
2095 : :
2096 : : /* mlx5.c */
2097 : :
2098 : : int mlx5_getenv_int(const char *);
2099 : : int mlx5_proc_priv_init(struct rte_eth_dev *dev);
2100 : : void mlx5_proc_priv_uninit(struct rte_eth_dev *dev);
2101 : : int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev,
2102 : : struct rte_eth_udp_tunnel *udp_tunnel);
2103 : : uint16_t mlx5_eth_find_next(uint16_t port_id, struct rte_device *odev);
2104 : : int mlx5_dev_close(struct rte_eth_dev *dev);
2105 : : int mlx5_net_remove(struct mlx5_common_device *cdev);
2106 : : bool mlx5_is_hpf(struct rte_eth_dev *dev);
2107 : : bool mlx5_is_sf_repr(struct rte_eth_dev *dev);
2108 : : void mlx5_age_event_prepare(struct mlx5_dev_ctx_shared *sh);
2109 : : int mlx5_lwm_setup(struct mlx5_priv *priv);
2110 : : void mlx5_lwm_unset(struct mlx5_dev_ctx_shared *sh);
2111 : :
2112 : : /* Macro to iterate over all valid ports for mlx5 driver. */
2113 : : #define MLX5_ETH_FOREACH_DEV(port_id, dev) \
2114 : : for (port_id = mlx5_eth_find_next(0, dev); \
2115 : : port_id < RTE_MAX_ETHPORTS; \
2116 : : port_id = mlx5_eth_find_next(port_id + 1, dev))
2117 : : void mlx5_rt_timestamp_config(struct mlx5_dev_ctx_shared *sh,
2118 : : struct mlx5_hca_attr *hca_attr);
2119 : : struct mlx5_dev_ctx_shared *
2120 : : mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
2121 : : struct mlx5_kvargs_ctrl *mkvlist);
2122 : : void mlx5_free_shared_dev_ctx(struct mlx5_dev_ctx_shared *sh);
2123 : : int mlx5_dev_ctx_shared_mempool_subscribe(struct rte_eth_dev *dev);
2124 : : void mlx5_free_table_hash_list(struct mlx5_priv *priv);
2125 : : int mlx5_alloc_table_hash_list(struct mlx5_priv *priv);
2126 : : void mlx5_set_min_inline(struct mlx5_priv *priv);
2127 : : void mlx5_set_metadata_mask(struct rte_eth_dev *dev);
2128 : : int mlx5_probe_again_args_validate(struct mlx5_common_device *cdev,
2129 : : struct mlx5_kvargs_ctrl *mkvlist);
2130 : : int mlx5_port_args_config(struct mlx5_priv *priv,
2131 : : struct mlx5_kvargs_ctrl *mkvlist,
2132 : : struct mlx5_port_config *config);
2133 : : void mlx5_port_args_set_used(const char *name, uint16_t port_id,
2134 : : struct mlx5_kvargs_ctrl *mkvlist);
2135 : : bool mlx5_flex_parser_ecpri_exist(struct rte_eth_dev *dev);
2136 : : int mlx5_flex_parser_ecpri_alloc(struct rte_eth_dev *dev);
2137 : : void mlx5_flow_counter_mode_config(struct rte_eth_dev *dev);
2138 : : int mlx5_flow_aso_age_mng_init(struct mlx5_dev_ctx_shared *sh);
2139 : : int mlx5_aso_flow_mtrs_mng_init(struct mlx5_dev_ctx_shared *sh);
2140 : : int mlx5_flow_aso_ct_mng_init(struct mlx5_dev_ctx_shared *sh);
2141 : : struct mlx5_physical_device *
2142 : : mlx5_get_locked_physical_device(struct mlx5_priv *priv);
2143 : : void mlx5_unlock_physical_device(void);
2144 : :
2145 : : /* mlx5_ethdev.c */
2146 : :
2147 : : int mlx5_dev_configure(struct rte_eth_dev *dev);
2148 : : int mlx5_representor_info_get(struct rte_eth_dev *dev,
2149 : : struct rte_eth_representor_info *info);
2150 : : #define MLX5_REPRESENTOR_ID(pf, type, repr) \
2151 : : (((pf) << 14) + ((type) << 12) + ((repr) & 0xfff))
2152 : : #define MLX5_REPRESENTOR_REPR(repr_id) \
2153 : : ((repr_id) & 0xfff)
2154 : : #define MLX5_REPRESENTOR_TYPE(repr_id) \
2155 : : (((repr_id) >> 12) & 3)
2156 : : uint16_t mlx5_representor_id_encode(const struct mlx5_switch_info *info,
2157 : : enum rte_eth_representor_type hpf_type);
2158 : : int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info);
2159 : : int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size);
2160 : : const uint32_t *mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev,
2161 : : size_t *no_of_elements);
2162 : : int mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
2163 : : int mlx5_hairpin_cap_get(struct rte_eth_dev *dev,
2164 : : struct rte_eth_hairpin_cap *cap);
2165 : : eth_rx_burst_t mlx5_select_rx_function(struct rte_eth_dev *dev);
2166 : : struct mlx5_priv *mlx5_port_to_eswitch_info(uint16_t port, bool valid);
2167 : : struct mlx5_priv *mlx5_dev_to_eswitch_info(struct rte_eth_dev *dev);
2168 : : int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);
2169 : :
2170 : : /* mlx5_ethdev_os.c */
2171 : :
2172 : : int mlx5_get_ifname(const struct rte_eth_dev *dev,
2173 : : char (*ifname)[MLX5_NAMESIZE]);
2174 : : unsigned int mlx5_ifindex(const struct rte_eth_dev *dev);
2175 : : int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]);
2176 : : int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
2177 : : int mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
2178 : : int mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock);
2179 : : int mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete);
2180 : : int mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev,
2181 : : struct rte_eth_fc_conf *fc_conf);
2182 : : int mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev,
2183 : : struct rte_eth_fc_conf *fc_conf);
2184 : : void mlx5_dev_interrupt_handler(void *arg);
2185 : : void mlx5_dev_interrupt_handler_devx(void *arg);
2186 : : void mlx5_dev_interrupt_handler_nl(void *arg);
2187 : : int mlx5_set_link_down(struct rte_eth_dev *dev);
2188 : : int mlx5_set_link_up(struct rte_eth_dev *dev);
2189 : : int mlx5_is_removed(struct rte_eth_dev *dev);
2190 : : int mlx5_sysfs_switch_info(unsigned int ifindex,
2191 : : struct mlx5_switch_info *info);
2192 : : void mlx5_translate_port_name(const char *port_name_in,
2193 : : struct mlx5_switch_info *port_info_out);
2194 : : int mlx5_sysfs_bond_info(unsigned int pf_ifindex, unsigned int *ifindex,
2195 : : char *ifname);
2196 : : int mlx5_get_module_info(struct rte_eth_dev *dev,
2197 : : struct rte_eth_dev_module_info *modinfo);
2198 : : int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
2199 : : struct rte_dev_eeprom_info *info);
2200 : : int mlx5_os_read_dev_stat(struct mlx5_priv *priv,
2201 : : const char *ctr_name, uint64_t *stat);
2202 : : int mlx5_os_read_dev_counters(struct rte_eth_dev *dev, bool bond_master, uint64_t *stats);
2203 : : int mlx5_os_get_stats_n(struct rte_eth_dev *dev, bool bond_master,
2204 : : uint16_t *n_stats, uint16_t *n_stats_sec);
2205 : : void mlx5_os_stats_init(struct rte_eth_dev *dev);
2206 : : int mlx5_get_flag_dropless_rq(struct rte_eth_dev *dev);
2207 : :
2208 : : /* mlx5_mac.c */
2209 : :
2210 : : void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
2211 : : int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
2212 : : uint32_t index, uint32_t vmdq);
2213 : : int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr);
2214 : : int mlx5_set_mc_addr_list(struct rte_eth_dev *dev,
2215 : : struct rte_ether_addr *mc_addr_set,
2216 : : uint32_t nb_mc_addr);
2217 : :
2218 : : /* mlx5_rss.c */
2219 : :
2220 : : int mlx5_rss_hash_update(struct rte_eth_dev *dev,
2221 : : struct rte_eth_rss_conf *rss_conf);
2222 : : int mlx5_rss_hash_conf_get(struct rte_eth_dev *dev,
2223 : : struct rte_eth_rss_conf *rss_conf);
2224 : : int mlx5_rss_reta_index_resize(struct rte_eth_dev *dev, unsigned int reta_size);
2225 : : int mlx5_dev_rss_reta_query(struct rte_eth_dev *dev,
2226 : : struct rte_eth_rss_reta_entry64 *reta_conf,
2227 : : uint16_t reta_size);
2228 : : int mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
2229 : : struct rte_eth_rss_reta_entry64 *reta_conf,
2230 : : uint16_t reta_size);
2231 : :
2232 : : /* mlx5_rxmode.c */
2233 : :
2234 : : int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
2235 : : int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
2236 : : int mlx5_allmulticast_enable(struct rte_eth_dev *dev);
2237 : : int mlx5_allmulticast_disable(struct rte_eth_dev *dev);
2238 : :
2239 : : /* mlx5_stats.c */
2240 : :
2241 : : int mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
2242 : : int mlx5_stats_reset(struct rte_eth_dev *dev);
2243 : : int mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
2244 : : unsigned int n);
2245 : : int mlx5_xstats_reset(struct rte_eth_dev *dev);
2246 : : int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
2247 : : struct rte_eth_xstat_name *xstats_names,
2248 : : unsigned int n);
2249 : :
2250 : : /* mlx5_vlan.c */
2251 : :
2252 : : int mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
2253 : : void mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);
2254 : : int mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask);
2255 : :
2256 : : /* mlx5_vlan_os.c */
2257 : :
2258 : : void mlx5_vlan_vmwa_exit(void *ctx);
2259 : : void mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,
2260 : : struct mlx5_vf_vlan *vf_vlan);
2261 : : void mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,
2262 : : struct mlx5_vf_vlan *vf_vlan);
2263 : : void *mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex);
2264 : :
2265 : : /* mlx5_trigger.c */
2266 : :
2267 : : int mlx5_dev_start(struct rte_eth_dev *dev);
2268 : : int mlx5_dev_stop(struct rte_eth_dev *dev);
2269 : : int mlx5_traffic_enable(struct rte_eth_dev *dev);
2270 : : void mlx5_traffic_disable(struct rte_eth_dev *dev);
2271 : : int mlx5_traffic_restart(struct rte_eth_dev *dev);
2272 : : int mlx5_hairpin_queue_peer_update(struct rte_eth_dev *dev, uint16_t peer_queue,
2273 : : struct rte_hairpin_peer_info *current_info,
2274 : : struct rte_hairpin_peer_info *peer_info,
2275 : : uint32_t direction);
2276 : : int mlx5_hairpin_queue_peer_bind(struct rte_eth_dev *dev, uint16_t cur_queue,
2277 : : struct rte_hairpin_peer_info *peer_info,
2278 : : uint32_t direction);
2279 : : int mlx5_hairpin_queue_peer_unbind(struct rte_eth_dev *dev, uint16_t cur_queue,
2280 : : uint32_t direction);
2281 : : int mlx5_hairpin_bind(struct rte_eth_dev *dev, uint16_t rx_port);
2282 : : int mlx5_hairpin_unbind(struct rte_eth_dev *dev, uint16_t rx_port);
2283 : : int mlx5_hairpin_get_peer_ports(struct rte_eth_dev *dev, uint16_t *peer_ports,
2284 : : size_t len, uint32_t direction);
2285 : :
2286 : : /* mlx5_flow.c */
2287 : :
2288 : : int mlx5_flow_discover_mreg_c(struct rte_eth_dev *eth_dev);
2289 : : bool mlx5_flow_ext_mreg_supported(struct rte_eth_dev *dev);
2290 : : void mlx5_flow_print(struct rte_flow *flow);
2291 : : int mlx5_flow_validate(struct rte_eth_dev *dev,
2292 : : const struct rte_flow_attr *attr,
2293 : : const struct rte_flow_item items[],
2294 : : const struct rte_flow_action actions[],
2295 : : struct rte_flow_error *error);
2296 : : struct rte_flow *mlx5_flow_create(struct rte_eth_dev *dev,
2297 : : const struct rte_flow_attr *attr,
2298 : : const struct rte_flow_item items[],
2299 : : const struct rte_flow_action actions[],
2300 : : struct rte_flow_error *error);
2301 : : int mlx5_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
2302 : : struct rte_flow_error *error);
2303 : : void mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type,
2304 : : bool active);
2305 : : int mlx5_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error);
2306 : : int mlx5_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow,
2307 : : const struct rte_flow_action *action, void *data,
2308 : : struct rte_flow_error *error);
2309 : : int mlx5_flow_isolate(struct rte_eth_dev *dev, int enable,
2310 : : struct rte_flow_error *error);
2311 : : int mlx5_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops);
2312 : : int mlx5_flow_start_default(struct rte_eth_dev *dev);
2313 : : void mlx5_flow_stop_default(struct rte_eth_dev *dev);
2314 : : int mlx5_flow_verify(struct rte_eth_dev *dev);
2315 : : int mlx5_ctrl_flow_source_queue(struct rte_eth_dev *dev, uint32_t sq_num);
2316 : : int mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,
2317 : : struct rte_flow_item_eth *eth_spec,
2318 : : struct rte_flow_item_eth *eth_mask,
2319 : : struct rte_flow_item_vlan *vlan_spec,
2320 : : struct rte_flow_item_vlan *vlan_mask);
2321 : : int mlx5_ctrl_flow(struct rte_eth_dev *dev,
2322 : : struct rte_flow_item_eth *eth_spec,
2323 : : struct rte_flow_item_eth *eth_mask);
2324 : : int mlx5_flow_lacp_miss(struct rte_eth_dev *dev);
2325 : : struct rte_flow *mlx5_flow_create_esw_table_zero_flow(struct rte_eth_dev *dev);
2326 : : uint32_t mlx5_flow_create_devx_sq_miss_flow(struct rte_eth_dev *dev,
2327 : : uint32_t sq_num);
2328 : : void mlx5_flow_async_pool_query_handle(struct mlx5_dev_ctx_shared *sh,
2329 : : uint64_t async_id, int status);
2330 : : void mlx5_set_query_alarm(struct mlx5_dev_ctx_shared *sh);
2331 : : void mlx5_flow_query_alarm(void *arg);
2332 : : uint32_t mlx5_counter_alloc(struct rte_eth_dev *dev);
2333 : : void mlx5_counter_free(struct rte_eth_dev *dev, uint32_t cnt);
2334 : : int mlx5_counter_query(struct rte_eth_dev *dev, uint32_t cnt,
2335 : : bool clear, uint64_t *pkts, uint64_t *bytes, void **action);
2336 : : int mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow,
2337 : : FILE *file, struct rte_flow_error *error);
2338 : : int save_dump_file(const unsigned char *data, uint32_t size,
2339 : : uint32_t type, uint64_t id, void *arg, FILE *file);
2340 : : int mlx5_flow_query_counter(struct rte_eth_dev *dev, struct rte_flow *flow,
2341 : : struct rte_flow_query_count *count, struct rte_flow_error *error);
2342 : : #ifdef HAVE_IBV_FLOW_DV_SUPPORT
2343 : : int mlx5_flow_dev_dump_ipool(struct rte_eth_dev *dev, struct rte_flow *flow,
2344 : : FILE *file, struct rte_flow_error *error);
2345 : : #endif
2346 : : int mlx5_flow_rx_metadata_negotiate(struct rte_eth_dev *dev,
2347 : : uint64_t *features);
2348 : : void mlx5_flow_rxq_dynf_set(struct rte_eth_dev *dev);
2349 : : int mlx5_flow_get_aged_flows(struct rte_eth_dev *dev, void **contexts,
2350 : : uint32_t nb_contexts, struct rte_flow_error *error);
2351 : : int mlx5_validate_action_ct(struct rte_eth_dev *dev,
2352 : : const struct rte_flow_action_conntrack *conntrack,
2353 : : struct rte_flow_error *error);
2354 : :
2355 : : int mlx5_flow_get_q_aged_flows(struct rte_eth_dev *dev, uint32_t queue_id,
2356 : : void **contexts, uint32_t nb_contexts,
2357 : : struct rte_flow_error *error);
2358 : :
2359 : : /* mlx5_mp_os.c */
2360 : :
2361 : : int mlx5_mp_os_primary_handle(const struct rte_mp_msg *mp_msg,
2362 : : const void *peer);
2363 : : int mlx5_mp_os_secondary_handle(const struct rte_mp_msg *mp_msg,
2364 : : const void *peer);
2365 : : void mlx5_mp_os_req_start_rxtx(struct rte_eth_dev *dev);
2366 : : void mlx5_mp_os_req_stop_rxtx(struct rte_eth_dev *dev);
2367 : : int mlx5_mp_os_req_queue_control(struct rte_eth_dev *dev, uint16_t queue_id,
2368 : : enum mlx5_mp_req_type req_type);
2369 : :
2370 : : /* mlx5_socket.c */
2371 : :
2372 : : int mlx5_pmd_socket_init(void);
2373 : : void mlx5_pmd_socket_uninit(void);
2374 : :
2375 : : /* mlx5_flow_meter.c */
2376 : :
2377 : : int mlx5_flow_meter_init(struct rte_eth_dev *dev,
2378 : : uint32_t nb_meters,
2379 : : uint32_t nb_meter_profiles,
2380 : : uint32_t nb_meter_policies,
2381 : : uint32_t nb_queues);
2382 : : void mlx5_flow_meter_uninit(struct rte_eth_dev *dev);
2383 : : int mlx5_flow_meter_ops_get(struct rte_eth_dev *dev, void *arg);
2384 : : struct mlx5_flow_meter_info *mlx5_flow_meter_find(struct mlx5_priv *priv,
2385 : : uint32_t meter_id, uint32_t *mtr_idx);
2386 : : struct mlx5_flow_meter_info *
2387 : : flow_dv_meter_find_by_idx(struct mlx5_priv *priv, uint32_t idx);
2388 : : int mlx5_flow_meter_attach(struct mlx5_priv *priv,
2389 : : struct mlx5_flow_meter_info *fm,
2390 : : const struct rte_flow_attr *attr,
2391 : : struct rte_flow_error *error);
2392 : : void mlx5_flow_meter_detach(struct mlx5_priv *priv,
2393 : : struct mlx5_flow_meter_info *fm);
2394 : : struct mlx5_flow_meter_policy *mlx5_flow_meter_policy_find
2395 : : (struct rte_eth_dev *dev,
2396 : : uint32_t policy_id,
2397 : : uint32_t *policy_idx);
2398 : : struct mlx5_flow_meter_info *
2399 : : mlx5_flow_meter_hierarchy_next_meter(struct mlx5_priv *priv,
2400 : : struct mlx5_flow_meter_policy *policy,
2401 : : uint32_t *mtr_idx);
2402 : : struct mlx5_flow_meter_policy *
2403 : : mlx5_flow_meter_hierarchy_get_final_policy(struct rte_eth_dev *dev,
2404 : : struct mlx5_flow_meter_policy *policy);
2405 : : int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
2406 : : struct rte_mtr_error *error);
2407 : : void mlx5_flow_meter_rxq_flush(struct rte_eth_dev *dev);
2408 : :
2409 : : /* mlx5_os.c */
2410 : :
2411 : : struct rte_pci_driver;
2412 : : int mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh);
2413 : : void mlx5_os_free_shared_dr(struct mlx5_priv *priv);
2414 : : int mlx5_os_net_probe(struct mlx5_common_device *cdev,
2415 : : struct mlx5_kvargs_ctrl *mkvlist);
2416 : : void mlx5_os_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh);
2417 : : void mlx5_os_dev_shared_handler_uninstall(struct mlx5_dev_ctx_shared *sh);
2418 : : void mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
2419 : : int mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
2420 : : uint32_t index);
2421 : : int mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, unsigned int iface_idx,
2422 : : struct rte_ether_addr *mac_addr,
2423 : : int vf_index);
2424 : : int mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable);
2425 : : int mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable);
2426 : : int mlx5_os_set_nonblock_channel_fd(int fd);
2427 : : void mlx5_os_mac_addr_flush(struct rte_eth_dev *dev);
2428 : : void mlx5_os_net_cleanup(void);
2429 : :
2430 : : /* mlx5_txpp.c */
2431 : :
2432 : : int mlx5_txpp_start(struct rte_eth_dev *dev);
2433 : : void mlx5_txpp_stop(struct rte_eth_dev *dev);
2434 : : int mlx5_txpp_read_clock(struct rte_eth_dev *dev, uint64_t *timestamp);
2435 : : int mlx5_txpp_xstats_get(struct rte_eth_dev *dev,
2436 : : struct rte_eth_xstat *stats,
2437 : : unsigned int n, unsigned int n_used);
2438 : : int mlx5_txpp_xstats_reset(struct rte_eth_dev *dev);
2439 : : int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev,
2440 : : struct rte_eth_xstat_name *xstats_names,
2441 : : unsigned int n, unsigned int n_used);
2442 : : void mlx5_txpp_interrupt_handler(void *cb_arg);
2443 : : int mlx5_txpp_map_hca_bar(struct rte_eth_dev *dev);
2444 : : void mlx5_txpp_unmap_hca_bar(struct rte_eth_dev *dev);
2445 : :
2446 : : /* mlx5_rxtx.c */
2447 : :
2448 : : eth_tx_burst_t mlx5_select_tx_function(struct rte_eth_dev *dev);
2449 : :
2450 : : /* mlx5_flow_aso.c */
2451 : :
2452 : : int mlx5_aso_mtr_queue_init(struct mlx5_dev_ctx_shared *sh,
2453 : : struct mlx5_aso_mtr_pool *hws_pool,
2454 : : struct mlx5_aso_mtr_pools_mng *pool_mng,
2455 : : uint32_t nb_queues);
2456 : : void mlx5_aso_mtr_queue_uninit(struct mlx5_dev_ctx_shared *sh,
2457 : : struct mlx5_aso_mtr_pool *hws_pool,
2458 : : struct mlx5_aso_mtr_pools_mng *pool_mng);
2459 : : int mlx5_aso_queue_init(struct mlx5_dev_ctx_shared *sh,
2460 : : enum mlx5_access_aso_opc_mod aso_opc_mode,
2461 : : uint32_t nb_queues);
2462 : : int mlx5_aso_flow_hit_queue_poll_start(struct mlx5_dev_ctx_shared *sh);
2463 : : int mlx5_aso_flow_hit_queue_poll_stop(struct mlx5_dev_ctx_shared *sh);
2464 : : void mlx5_aso_queue_uninit(struct mlx5_dev_ctx_shared *sh,
2465 : : enum mlx5_access_aso_opc_mod aso_opc_mod);
2466 : : int mlx5_aso_meter_update_by_wqe(struct mlx5_priv *priv, uint32_t queue,
2467 : : struct mlx5_aso_mtr *mtr,
2468 : : struct mlx5_mtr_bulk *bulk,
2469 : : struct mlx5_hw_q_job *job, bool push);
2470 : : int mlx5_aso_mtr_wait(struct mlx5_priv *priv,
2471 : : struct mlx5_aso_mtr *mtr, bool is_tmpl_api);
2472 : : int mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, uint32_t queue,
2473 : : struct mlx5_aso_ct_action *ct,
2474 : : const struct rte_flow_action_conntrack *profile,
2475 : : void *user_data,
2476 : : bool push);
2477 : : int mlx5_aso_ct_wait_ready(struct mlx5_dev_ctx_shared *sh, uint32_t queue,
2478 : : struct mlx5_aso_ct_action *ct);
2479 : : int mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, uint32_t queue,
2480 : : struct mlx5_aso_ct_action *ct,
2481 : : struct rte_flow_action_conntrack *profile,
2482 : : void *user_data, bool push);
2483 : : int mlx5_aso_ct_available(struct mlx5_dev_ctx_shared *sh, uint32_t queue,
2484 : : struct mlx5_aso_ct_action *ct);
2485 : : uint32_t
2486 : : mlx5_get_supported_sw_parsing_offloads(const struct mlx5_hca_attr *attr);
2487 : : uint32_t
2488 : : mlx5_get_supported_tunneling_offloads(const struct mlx5_hca_attr *attr);
2489 : :
2490 : : void mlx5_aso_ct_obj_analyze(struct rte_flow_action_conntrack *profile,
2491 : : char *wdata);
2492 : : void mlx5_aso_push_wqe(struct mlx5_dev_ctx_shared *sh,
2493 : : struct mlx5_aso_sq *sq);
2494 : : int mlx5_aso_pull_completion(struct mlx5_aso_sq *sq,
2495 : : struct rte_flow_op_result res[],
2496 : : uint16_t n_res);
2497 : : int mlx5_aso_cnt_queue_init(struct mlx5_dev_ctx_shared *sh);
2498 : : void mlx5_aso_cnt_queue_uninit(struct mlx5_dev_ctx_shared *sh);
2499 : : int mlx5_aso_cnt_query(struct mlx5_dev_ctx_shared *sh,
2500 : : struct mlx5_hws_cnt_pool *cpool);
2501 : : int mlx5_aso_ct_queue_init(struct mlx5_dev_ctx_shared *sh,
2502 : : struct mlx5_aso_ct_pools_mng *ct_mng,
2503 : : uint32_t nb_queues);
2504 : : int mlx5_aso_ct_queue_uninit(struct mlx5_dev_ctx_shared *sh,
2505 : : struct mlx5_aso_ct_pools_mng *ct_mng);
2506 : : int
2507 : : mlx5_aso_sq_create(struct mlx5_common_device *cdev, struct mlx5_aso_sq *sq,
2508 : : void *uar, uint16_t log_desc_n);
2509 : : void
2510 : : mlx5_aso_destroy_sq(struct mlx5_aso_sq *sq);
2511 : : void
2512 : : mlx5_aso_mtr_init_sq(struct mlx5_aso_sq *sq);
2513 : : void
2514 : : mlx5_aso_cqe_err_handle(struct mlx5_aso_sq *sq);
2515 : :
2516 : : /* mlx5_flow_flex.c */
2517 : :
2518 : : struct rte_flow_item_flex_handle *
2519 : : flow_dv_item_create(struct rte_eth_dev *dev,
2520 : : const struct rte_flow_item_flex_conf *conf,
2521 : : struct rte_flow_error *error);
2522 : : int flow_dv_item_release(struct rte_eth_dev *dev,
2523 : : const struct rte_flow_item_flex_handle *flex_handle,
2524 : : struct rte_flow_error *error);
2525 : : int mlx5_flex_item_port_init(struct rte_eth_dev *dev);
2526 : : void mlx5_flex_item_port_cleanup(struct rte_eth_dev *dev);
2527 : : void mlx5_flex_flow_translate_item(struct rte_eth_dev *dev, void *matcher,
2528 : : void *key, const struct rte_flow_item *item,
2529 : : bool is_inner);
2530 : : int mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp,
2531 : : uint32_t idx, uint32_t *pos,
2532 : : bool is_inner, uint32_t *def);
2533 : : int mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item,
2534 : : void *flex, uint32_t byte_off,
2535 : : bool is_mask, bool tunnel, uint32_t *value);
2536 : : int mlx5_flex_acquire_index(struct rte_eth_dev *dev,
2537 : : struct rte_flow_item_flex_handle *handle,
2538 : : bool acquire);
2539 : : int mlx5_flex_release_index(struct rte_eth_dev *dev, int index);
2540 : :
2541 : : /* Flex parser list callbacks. */
2542 : : struct mlx5_list_entry *mlx5_flex_parser_create_cb(void *list_ctx, void *ctx);
2543 : : int mlx5_flex_parser_match_cb(void *list_ctx,
2544 : : struct mlx5_list_entry *iter, void *ctx);
2545 : : void mlx5_flex_parser_remove_cb(void *list_ctx, struct mlx5_list_entry *entry);
2546 : : struct mlx5_list_entry *mlx5_flex_parser_clone_cb(void *list_ctx,
2547 : : struct mlx5_list_entry *entry,
2548 : : void *ctx);
2549 : : void mlx5_flex_parser_clone_free_cb(void *tool_ctx,
2550 : : struct mlx5_list_entry *entry);
2551 : :
2552 : : int
2553 : : mlx5_flow_quota_destroy(struct rte_eth_dev *dev);
2554 : : int
2555 : : mlx5_flow_quota_init(struct rte_eth_dev *dev, uint32_t nb_quotas);
2556 : : struct rte_flow_action_handle *
2557 : : mlx5_quota_alloc(struct rte_eth_dev *dev, uint32_t queue,
2558 : : const struct rte_flow_action_quota *conf,
2559 : : struct mlx5_hw_q_job *job, bool push,
2560 : : struct rte_flow_error *error);
2561 : : void
2562 : : mlx5_quota_async_completion(struct rte_eth_dev *dev, uint32_t queue,
2563 : : struct mlx5_hw_q_job *job);
2564 : : int
2565 : : mlx5_quota_query_update(struct rte_eth_dev *dev, uint32_t queue,
2566 : : struct rte_flow_action_handle *handle,
2567 : : const struct rte_flow_action *update,
2568 : : struct rte_flow_query_quota *query,
2569 : : struct mlx5_hw_q_job *async_job, bool push,
2570 : : struct rte_flow_error *error);
2571 : : int mlx5_quota_query(struct rte_eth_dev *dev, uint32_t queue,
2572 : : const struct rte_flow_action_handle *handle,
2573 : : struct rte_flow_query_quota *query,
2574 : : struct mlx5_hw_q_job *async_job, bool push,
2575 : : struct rte_flow_error *error);
2576 : :
2577 : : int mlx5_alloc_srh_flex_parser(struct rte_eth_dev *dev);
2578 : :
2579 : : void mlx5_free_srh_flex_parser(struct rte_eth_dev *dev);
2580 : : #endif /* RTE_PMD_MLX5_H_ */
|