Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : : #ifndef __CNXK_ETHDEV_H__
5 : : #define __CNXK_ETHDEV_H__
6 : :
7 : : #include <math.h>
8 : : #include <stdint.h>
9 : :
10 : : #include <ethdev_driver.h>
11 : : #include <ethdev_pci.h>
12 : : #include <rte_compat.h>
13 : : #include <rte_kvargs.h>
14 : : #include <rte_mbuf.h>
15 : : #include <rte_mbuf_pool_ops.h>
16 : : #include <rte_mempool.h>
17 : : #include <rte_mtr_driver.h>
18 : : #include <rte_security.h>
19 : : #include <rte_security_driver.h>
20 : : #include <rte_tailq.h>
21 : : #include <rte_time.h>
22 : : #include <rte_tm_driver.h>
23 : :
24 : : #include "roc_api.h"
25 : : #include <cnxk_ethdev_dp.h>
26 : :
27 : : #define CNXK_ETH_DEV_PMD_VERSION "1.0"
28 : :
29 : : /* Used for struct cnxk_eth_dev::flags */
30 : : #define CNXK_LINK_CFG_IN_PROGRESS_F BIT_ULL(0)
31 : :
32 : : /* VLAN tag inserted by NIX_TX_VTAG_ACTION.
33 : : * In Tx space is always reserved for this in FRS.
34 : : */
35 : : #define CNXK_NIX_MAX_VTAG_INS 2
36 : : #define CNXK_NIX_MAX_VTAG_ACT_SIZE (4 * CNXK_NIX_MAX_VTAG_INS)
37 : :
38 : : /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
39 : : #define CNXK_NIX_L2_OVERHEAD (RTE_ETHER_HDR_LEN + \
40 : : RTE_ETHER_CRC_LEN + \
41 : : CNXK_NIX_MAX_VTAG_ACT_SIZE)
42 : :
43 : : #define CNXK_NIX_RX_MIN_DESC 16
44 : : #define CNXK_NIX_RX_MIN_DESC_ALIGN 16
45 : : #define CNXK_NIX_RX_NB_SEG_MAX 6
46 : : #define CNXK_NIX_RX_DEFAULT_RING_SZ 4096
47 : : /* Max supported SQB count */
48 : : #define CNXK_NIX_TX_MAX_SQB 512
49 : : /* LPB & SPB */
50 : : #define CNXK_NIX_NUM_POOLS_MAX 2
51 : :
52 : : #define CNXK_NIX_DEF_SQ_COUNT 512
53 : :
54 : : #define CNXK_NIX_RSS_L3_L4_SRC_DST \
55 : : (RTE_ETH_RSS_L3_SRC_ONLY | RTE_ETH_RSS_L3_DST_ONLY | \
56 : : RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY)
57 : :
58 : : #define CNXK_NIX_RSS_OFFLOAD \
59 : : (RTE_ETH_RSS_PORT | RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | \
60 : : RTE_ETH_RSS_TCP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_TUNNEL | \
61 : : RTE_ETH_RSS_L2_PAYLOAD | CNXK_NIX_RSS_L3_L4_SRC_DST | \
62 : : RTE_ETH_RSS_LEVEL_MASK | RTE_ETH_RSS_C_VLAN)
63 : :
64 : : #define CNXK_NIX_TX_OFFLOAD_CAPA \
65 : : (RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE | RTE_ETH_TX_OFFLOAD_MT_LOCKFREE | \
66 : : RTE_ETH_TX_OFFLOAD_VLAN_INSERT | RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \
67 : : RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM | \
68 : : RTE_ETH_TX_OFFLOAD_TCP_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM | \
69 : : RTE_ETH_TX_OFFLOAD_SCTP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_TSO | \
70 : : RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | \
71 : : RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \
72 : : RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_SECURITY)
73 : :
74 : : #define CNXK_NIX_RX_OFFLOAD_CAPA \
75 : : (RTE_ETH_RX_OFFLOAD_CHECKSUM | RTE_ETH_RX_OFFLOAD_SCTP_CKSUM | \
76 : : RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM | RTE_ETH_RX_OFFLOAD_SCATTER | \
77 : : RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM | RTE_ETH_RX_OFFLOAD_RSS_HASH | \
78 : : RTE_ETH_RX_OFFLOAD_TIMESTAMP | RTE_ETH_RX_OFFLOAD_VLAN_STRIP | \
79 : : RTE_ETH_RX_OFFLOAD_SECURITY)
80 : :
81 : : #define RSS_IPV4_ENABLE \
82 : : (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | \
83 : : RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
84 : : RTE_ETH_RSS_NONFRAG_IPV4_SCTP)
85 : :
86 : : #define RSS_IPV6_ENABLE \
87 : : (RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | \
88 : : RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
89 : : RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
90 : :
91 : : #define RSS_IPV6_EX_ENABLE \
92 : : (RTE_ETH_RSS_IPV6_EX | RTE_ETH_RSS_IPV6_TCP_EX | RTE_ETH_RSS_IPV6_UDP_EX)
93 : :
94 : : #define RSS_MAX_LEVELS 3
95 : :
96 : : #define RSS_IPV4_INDEX 0
97 : : #define RSS_IPV6_INDEX 1
98 : : #define RSS_TCP_INDEX 2
99 : : #define RSS_UDP_INDEX 3
100 : : #define RSS_SCTP_INDEX 4
101 : : #define RSS_DMAC_INDEX 5
102 : :
103 : : /* Default mark value used when none is provided. */
104 : : #define CNXK_NIX_MTR_COUNT_MAX 73 /* 64(leaf) + 8(mid) + 1(top) */
105 : :
106 : : /* Default cycle counter mask */
107 : : #define CNXK_CYCLECOUNTER_MASK 0xffffffffffffffffULL
108 : :
109 : : /* Fastpath lookup */
110 : : #define CNXK_NIX_FASTPATH_LOOKUP_MEM "cnxk_nix_fastpath_lookup_mem"
111 : :
112 : : struct cnxk_fc_cfg {
113 : : enum rte_eth_fc_mode mode;
114 : : uint8_t rx_pause;
115 : : uint8_t tx_pause;
116 : : };
117 : :
118 : : struct cnxk_pfc_cfg {
119 : : uint16_t class_en;
120 : : uint16_t pause_time;
121 : : uint16_t rx_pause_en;
122 : : uint16_t tx_pause_en;
123 : : };
124 : :
125 : : struct cnxk_eth_qconf {
126 : : union {
127 : : struct rte_eth_txconf tx;
128 : : struct rte_eth_rxconf rx;
129 : : } conf;
130 : : struct rte_mempool *mp;
131 : : uint16_t nb_desc;
132 : : uint8_t valid;
133 : : };
134 : :
135 : : struct cnxk_meter_node {
136 : : #define MAX_PRV_MTR_NODES 10
137 : : TAILQ_ENTRY(cnxk_meter_node) next;
138 : : /**< Pointer to the next flow meter structure. */
139 : : uint32_t id; /**< Usr mtr id. */
140 : : struct cnxk_mtr_profile_node *profile;
141 : : struct cnxk_mtr_policy_node *policy;
142 : : uint32_t bpf_id; /**< Hw mtr id. */
143 : : uint32_t rq_num;
144 : : uint32_t *rq_id;
145 : : uint16_t level;
146 : : uint32_t prev_id[MAX_PRV_MTR_NODES]; /**< Prev mtr id for chaining */
147 : : uint32_t prev_cnt;
148 : : uint32_t next_id; /**< Next mtr id for chaining */
149 : : bool is_prev;
150 : : bool is_next;
151 : : struct rte_mtr_params params;
152 : : struct roc_nix_bpf_objs profs;
153 : : bool is_used;
154 : : uint32_t ref_cnt;
155 : : };
156 : :
157 : : struct action_rss {
158 : : enum rte_eth_hash_function func;
159 : : uint32_t level;
160 : : uint64_t types;
161 : : uint32_t key_len;
162 : : uint32_t queue_num;
163 : : uint8_t *key;
164 : : uint16_t *queue;
165 : : };
166 : :
167 : : struct policy_actions {
168 : : uint32_t action_fate;
169 : : union {
170 : : uint16_t queue;
171 : : uint32_t mtr_id;
172 : : struct action_rss *rss_desc;
173 : : bool skip_red;
174 : : };
175 : : };
176 : :
177 : : struct cnxk_mtr_policy_node {
178 : : TAILQ_ENTRY(cnxk_mtr_policy_node) next;
179 : : /**< Pointer to the next flow meter structure. */
180 : : uint32_t id; /**< Policy id */
181 : : uint32_t mtr_id; /** Meter id */
182 : : struct rte_mtr_meter_policy_params policy;
183 : : struct policy_actions actions[RTE_COLORS];
184 : : uint32_t ref_cnt;
185 : : };
186 : :
187 : : struct cnxk_mtr_profile_node {
188 : : TAILQ_ENTRY(cnxk_mtr_profile_node) next;
189 : : struct rte_mtr_meter_profile profile; /**< Profile detail. */
190 : : uint32_t ref_cnt; /**< Use count. */
191 : : uint32_t id; /**< Profile id. */
192 : : };
193 : :
194 : : TAILQ_HEAD(cnxk_mtr_profiles, cnxk_mtr_profile_node);
195 : : TAILQ_HEAD(cnxk_mtr_policy, cnxk_mtr_policy_node);
196 : : TAILQ_HEAD(cnxk_mtr, cnxk_meter_node);
197 : :
198 : : /* Security session private data */
199 : : struct cnxk_eth_sec_sess {
200 : : /* List entry */
201 : : TAILQ_ENTRY(cnxk_eth_sec_sess) entry;
202 : :
203 : : /* Inbound SA is from NIX_RX_IPSEC_SA_BASE or
204 : : * Outbound SA from roc_nix_inl_outb_sa_base_get()
205 : : */
206 : : void *sa;
207 : :
208 : : /* SA index */
209 : : uint32_t sa_idx;
210 : :
211 : : /* SPI */
212 : : uint32_t spi;
213 : :
214 : : /* Back pointer to session */
215 : : struct rte_security_session *sess;
216 : :
217 : : /* Inbound */
218 : : bool inb;
219 : :
220 : : /* Inbound session on inl dev */
221 : : bool inl_dev;
222 : :
223 : : /* Out-Of-Place processing */
224 : : bool inb_oop;
225 : : };
226 : :
227 : : TAILQ_HEAD(cnxk_eth_sec_sess_list, cnxk_eth_sec_sess);
228 : :
229 : : /* Inbound security data */
230 : : struct cnxk_eth_dev_sec_inb {
231 : : /* IPSec inbound min SPI */
232 : : uint32_t min_spi;
233 : :
234 : : /* IPSec inbound max SPI */
235 : : uint32_t max_spi;
236 : :
237 : : /* Using inbound with inline device */
238 : : bool inl_dev;
239 : :
240 : : /* Device argument to disable inline device usage for inb */
241 : : bool no_inl_dev;
242 : :
243 : : /* Active sessions */
244 : : uint16_t nb_sess;
245 : :
246 : : /* List of sessions */
247 : : struct cnxk_eth_sec_sess_list list;
248 : :
249 : : /* DPTR for WRITE_SA microcode op */
250 : : void *sa_dptr;
251 : :
252 : : /* Number of oop sessions */
253 : : uint16_t nb_oop;
254 : :
255 : : /* Reassembly enabled */
256 : : bool reass_en;
257 : :
258 : : /* Lock to synchronize sa setup/release */
259 : : rte_spinlock_t lock;
260 : : };
261 : :
262 : : /* Outbound security data */
263 : : struct cnxk_eth_dev_sec_outb {
264 : : /* IPSec outbound max SA */
265 : : uint16_t max_sa;
266 : :
267 : : /* Per CPT LF descriptor count */
268 : : uint32_t nb_desc;
269 : :
270 : : /* SA Bitmap */
271 : : struct plt_bitmap *sa_bmap;
272 : :
273 : : /* SA bitmap memory */
274 : : void *sa_bmap_mem;
275 : :
276 : : /* SA base */
277 : : uint64_t sa_base;
278 : :
279 : : /* CPT LF base */
280 : : struct roc_cpt_lf *lf_base;
281 : :
282 : : /* Crypto queues => CPT lf count */
283 : : uint16_t nb_crypto_qs;
284 : :
285 : : /* FC sw mem */
286 : : uint64_t *fc_sw_mem;
287 : :
288 : : /* Active sessions */
289 : : uint16_t nb_sess;
290 : :
291 : : /* List of sessions */
292 : : struct cnxk_eth_sec_sess_list list;
293 : :
294 : : /* DPTR for WRITE_SA microcode op */
295 : : void *sa_dptr;
296 : :
297 : : /* Lock to synchronize sa setup/release */
298 : : rte_spinlock_t lock;
299 : :
300 : : /* Engine caps */
301 : : uint64_t cpt_eng_caps;
302 : : };
303 : :
304 : : /* MACsec session private data */
305 : : struct cnxk_macsec_sess {
306 : : /* List entry */
307 : : TAILQ_ENTRY(cnxk_macsec_sess) entry;
308 : :
309 : : /* Back pointer to session */
310 : : struct rte_security_session *sess;
311 : : enum mcs_direction dir;
312 : : uint64_t sci;
313 : : uint8_t secy_id;
314 : : uint8_t sc_id;
315 : : uint8_t flow_id;
316 : : };
317 : : TAILQ_HEAD(cnxk_macsec_sess_list, cnxk_macsec_sess);
318 : :
319 : : struct cnxk_eth_dev {
320 : : /* ROC NIX */
321 : : struct roc_nix nix;
322 : :
323 : : /* ROC NPC */
324 : : struct roc_npc npc;
325 : :
326 : : /* ROC RQs, SQs and CQs */
327 : : struct roc_nix_rq *rqs;
328 : : struct roc_nix_sq *sqs;
329 : : struct roc_nix_cq *cqs;
330 : :
331 : : /* Configured queue count */
332 : : uint16_t nb_rxq;
333 : : uint16_t nb_txq;
334 : : uint16_t nb_rxq_sso;
335 : : uint8_t configured;
336 : :
337 : : /* Max macfilter entries */
338 : : uint8_t dmac_filter_count;
339 : : uint8_t max_mac_entries;
340 : : bool dmac_filter_enable;
341 : : int *dmac_idx_map;
342 : :
343 : : uint16_t flags;
344 : : uint8_t ptype_disable;
345 : : bool scalar_ena;
346 : : bool tx_compl_ena;
347 : : bool tx_mark;
348 : : bool ptp_en;
349 : :
350 : : /* Pointer back to rte */
351 : : struct rte_eth_dev *eth_dev;
352 : :
353 : : /* HW capabilities / Limitations */
354 : : union {
355 : : struct {
356 : : uint64_t cq_min_4k : 1;
357 : : uint64_t ipsecd_drop_re_dis : 1;
358 : : uint64_t vec_drop_re_dis : 1;
359 : : };
360 : : uint64_t hwcap;
361 : : };
362 : :
363 : : /* Rx and Tx offload capabilities */
364 : : uint64_t rx_offload_capa;
365 : : uint64_t tx_offload_capa;
366 : : uint32_t speed_capa;
367 : : /* Configured Rx and Tx offloads */
368 : : uint64_t rx_offloads;
369 : : uint64_t tx_offloads;
370 : : /* Platform specific offload flags */
371 : : uint16_t rx_offload_flags;
372 : : uint16_t tx_offload_flags;
373 : :
374 : : /* ETHDEV RSS HF bitmask */
375 : : uint64_t ethdev_rss_hf;
376 : :
377 : : /* Saved qconf before lf realloc */
378 : : struct cnxk_eth_qconf *tx_qconf;
379 : : struct cnxk_eth_qconf *rx_qconf;
380 : :
381 : : /* Flow control configuration */
382 : : struct cnxk_pfc_cfg pfc_cfg;
383 : : struct cnxk_fc_cfg fc_cfg;
384 : :
385 : : /* PTP Counters */
386 : : struct cnxk_timesync_info tstamp;
387 : : struct rte_timecounter systime_tc;
388 : : struct rte_timecounter rx_tstamp_tc;
389 : : struct rte_timecounter tx_tstamp_tc;
390 : : double clk_freq_mult;
391 : : uint64_t clk_delta;
392 : :
393 : : /* Ingress policer */
394 : : enum roc_nix_bpf_color precolor_tbl[ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP];
395 : : enum rte_mtr_color_in_protocol proto;
396 : : struct cnxk_mtr_profiles mtr_profiles;
397 : : struct cnxk_mtr_policy mtr_policy;
398 : : struct cnxk_mtr mtr;
399 : :
400 : : /* Congestion Management */
401 : : struct rte_eth_cman_config cman_cfg;
402 : :
403 : : /* Rx burst for cleanup(Only Primary) */
404 : : eth_rx_burst_t rx_pkt_burst_no_offload;
405 : :
406 : : /* Default mac address */
407 : : uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
408 : :
409 : : /* LSO Tunnel format indices */
410 : : uint64_t lso_tun_fmt;
411 : :
412 : : /* Per queue statistics counters */
413 : : uint32_t txq_stat_map[RTE_ETHDEV_QUEUE_STAT_CNTRS];
414 : : uint32_t rxq_stat_map[RTE_ETHDEV_QUEUE_STAT_CNTRS];
415 : :
416 : : /* Security data */
417 : : struct cnxk_eth_dev_sec_inb inb;
418 : : struct cnxk_eth_dev_sec_outb outb;
419 : :
420 : : /* Reassembly dynfield/flag offsets */
421 : : int reass_dynfield_off;
422 : : int reass_dynflag_bit;
423 : :
424 : : /* MCS device */
425 : : struct cnxk_mcs_dev *mcs_dev;
426 : : struct cnxk_macsec_sess_list mcs_list;
427 : : };
428 : :
429 : : struct cnxk_eth_rxq_sp {
430 : : struct cnxk_eth_dev *dev;
431 : : struct cnxk_eth_qconf qconf;
432 : : uint16_t qid;
433 : : uint8_t tx_pause;
434 : : uint8_t tc;
435 : : } __plt_cache_aligned;
436 : :
437 : : struct cnxk_eth_txq_sp {
438 : : struct cnxk_eth_dev *dev;
439 : : struct cnxk_eth_qconf qconf;
440 : : uint16_t qid;
441 : : } __plt_cache_aligned;
442 : :
443 : : static inline struct cnxk_eth_dev *
444 : : cnxk_eth_pmd_priv(const struct rte_eth_dev *eth_dev)
445 : : {
446 [ # # # # : 0 : return eth_dev->data->dev_private;
# # # # #
# # # # #
# # # # #
# ]
447 : : }
448 : :
449 : : static inline struct cnxk_eth_rxq_sp *
450 : : cnxk_eth_rxq_to_sp(void *__rxq)
451 : : {
452 : 0 : return ((struct cnxk_eth_rxq_sp *)__rxq) - 1;
453 : : }
454 : :
455 : : static inline struct cnxk_eth_txq_sp *
456 : : cnxk_eth_txq_to_sp(void *__txq)
457 : : {
458 : 0 : return ((struct cnxk_eth_txq_sp *)__txq) - 1;
459 : : }
460 : :
461 : : /* Common ethdev ops */
462 : : extern struct eth_dev_ops cnxk_eth_dev_ops;
463 : :
464 : : /* Common flow ops */
465 : : extern struct rte_flow_ops cnxk_flow_ops;
466 : :
467 : : /* Common security ops */
468 : : extern struct rte_security_ops cnxk_eth_sec_ops;
469 : :
470 : : /* Common tm ops */
471 : : extern struct rte_tm_ops cnxk_tm_ops;
472 : :
473 : : /* Ops */
474 : : int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
475 : : struct rte_pci_device *pci_dev);
476 : : int cnxk_nix_remove(struct rte_pci_device *pci_dev);
477 : : int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
478 : : int cnxk_nix_sq_flush(struct rte_eth_dev *eth_dev);
479 : : int cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev,
480 : : struct rte_ether_addr *mc_addr_set,
481 : : uint32_t nb_mc_addr);
482 : : int cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
483 : : struct rte_ether_addr *addr, uint32_t index,
484 : : uint32_t pool);
485 : : void cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
486 : : int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
487 : : struct rte_ether_addr *addr);
488 : : int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
489 : : int cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev);
490 : : int cnxk_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
491 : : int cnxk_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
492 : : int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
493 : : struct rte_eth_dev_info *dev_info);
494 : : int cnxk_nix_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
495 : : struct rte_eth_burst_mode *mode);
496 : : int cnxk_nix_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
497 : : struct rte_eth_burst_mode *mode);
498 : : int cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
499 : : struct rte_eth_fc_conf *fc_conf);
500 : : int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
501 : : struct rte_eth_fc_conf *fc_conf);
502 : : int cnxk_nix_priority_flow_ctrl_queue_config(struct rte_eth_dev *eth_dev,
503 : : struct rte_eth_pfc_queue_conf *pfc_conf);
504 : : int cnxk_nix_priority_flow_ctrl_queue_info_get(struct rte_eth_dev *eth_dev,
505 : : struct rte_eth_pfc_queue_info *pfc_info);
506 : : int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev);
507 : : int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev);
508 : : int cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
509 : : struct rte_eth_dev_module_info *modinfo);
510 : : int cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
511 : : struct rte_dev_eeprom_info *info);
512 : : int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
513 : : uint16_t rx_queue_id);
514 : : int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
515 : : uint16_t rx_queue_id);
516 : : int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
517 : : int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
518 : : int cnxk_nix_flow_ops_get(struct rte_eth_dev *eth_dev,
519 : : const struct rte_flow_ops **ops);
520 : : int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
521 : : int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
522 : : uint16_t nb_desc, uint16_t fp_tx_q_sz,
523 : : const struct rte_eth_txconf *tx_conf);
524 : : int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
525 : : uint32_t nb_desc, uint16_t fp_rx_q_sz,
526 : : const struct rte_eth_rxconf *rx_conf,
527 : : struct rte_mempool *mp);
528 : : int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
529 : : void cnxk_nix_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t qid);
530 : : int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
531 : : int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
532 : : int cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev);
533 : : int cnxk_nix_timesync_disable(struct rte_eth_dev *eth_dev);
534 : : int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
535 : : struct timespec *timestamp,
536 : : uint32_t flags);
537 : : int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
538 : : struct timespec *timestamp);
539 : : int cnxk_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
540 : : struct timespec *ts);
541 : : int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
542 : : const struct timespec *ts);
543 : : int cnxk_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
544 : : int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
545 : : int cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock);
546 : :
547 : : uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
548 : : int cnxk_nix_tm_ops_get(struct rte_eth_dev *eth_dev, void *ops);
549 : : int cnxk_nix_tm_set_queue_rate_limit(struct rte_eth_dev *eth_dev,
550 : : uint16_t queue_idx, uint32_t tx_rate);
551 : : int cnxk_nix_tm_mark_vlan_dei(struct rte_eth_dev *eth_dev, int mark_green,
552 : : int mark_yellow, int mark_red,
553 : : struct rte_tm_error *error);
554 : : int cnxk_nix_tm_mark_ip_ecn(struct rte_eth_dev *eth_dev, int mark_green,
555 : : int mark_yellow, int mark_red,
556 : : struct rte_tm_error *error);
557 : : int cnxk_nix_tm_mark_ip_dscp(struct rte_eth_dev *eth_dev, int mark_green,
558 : : int mark_yellow, int mark_red,
559 : : struct rte_tm_error *error);
560 : :
561 : : /* MTR */
562 : : int cnxk_nix_mtr_ops_get(struct rte_eth_dev *dev, void *ops);
563 : :
564 : : /* RSS */
565 : : uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
566 : : uint8_t rss_level);
567 : : int cnxk_nix_reta_update(struct rte_eth_dev *eth_dev,
568 : : struct rte_eth_rss_reta_entry64 *reta_conf,
569 : : uint16_t reta_size);
570 : : int cnxk_nix_reta_query(struct rte_eth_dev *eth_dev,
571 : : struct rte_eth_rss_reta_entry64 *reta_conf,
572 : : uint16_t reta_size);
573 : : int cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
574 : : struct rte_eth_rss_conf *rss_conf);
575 : : int cnxk_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
576 : : struct rte_eth_rss_conf *rss_conf);
577 : : int cnxk_nix_eth_dev_priv_dump(struct rte_eth_dev *eth_dev, FILE *file);
578 : :
579 : : /* Link */
580 : : void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set);
581 : : void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
582 : : struct roc_nix_link_info *link);
583 : : void cnxk_eth_dev_link_status_get_cb(struct roc_nix *nix,
584 : : struct roc_nix_link_info *link);
585 : : void cnxk_eth_dev_q_err_cb(struct roc_nix *nix, void *data);
586 : : int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
587 : : int cnxk_nix_queue_stats_mapping(struct rte_eth_dev *dev, uint16_t queue_id,
588 : : uint8_t stat_idx, uint8_t is_rx);
589 : : int cnxk_nix_stats_reset(struct rte_eth_dev *dev);
590 : : int cnxk_nix_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
591 : : int cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev,
592 : : struct rte_eth_xstat *xstats, unsigned int n);
593 : : int cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
594 : : struct rte_eth_xstat_name *xstats_names,
595 : : unsigned int limit);
596 : : int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
597 : : const uint64_t *ids,
598 : : struct rte_eth_xstat_name *xstats_names,
599 : : unsigned int limit);
600 : : int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
601 : : uint64_t *values, unsigned int n);
602 : : int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
603 : : int cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
604 : : size_t fw_size);
605 : : void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
606 : : struct rte_eth_rxq_info *qinfo);
607 : : void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
608 : : struct rte_eth_txq_info *qinfo);
609 : :
610 : : /* Queue status */
611 : : int cnxk_nix_rx_descriptor_status(void *rxq, uint16_t offset);
612 : : int cnxk_nix_tx_descriptor_status(void *txq, uint16_t offset);
613 : : uint32_t cnxk_nix_rx_queue_count(void *rxq);
614 : :
615 : : /* Lookup configuration */
616 : : const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
617 : : void *cnxk_nix_fastpath_lookup_mem_get(void);
618 : :
619 : : /* Devargs */
620 : : int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
621 : : struct cnxk_eth_dev *dev);
622 : :
623 : : /* Debug */
624 : : int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
625 : : struct rte_dev_reg_info *regs);
626 : : /* Security */
627 : : int cnxk_eth_outb_sa_idx_get(struct cnxk_eth_dev *dev, uint32_t *idx_p,
628 : : uint32_t spi);
629 : : int cnxk_eth_outb_sa_idx_put(struct cnxk_eth_dev *dev, uint32_t idx);
630 : : int cnxk_nix_lookup_mem_sa_base_set(struct cnxk_eth_dev *dev);
631 : : int cnxk_nix_lookup_mem_sa_base_clear(struct cnxk_eth_dev *dev);
632 : : int cnxk_nix_lookup_mem_metapool_set(struct cnxk_eth_dev *dev);
633 : : int cnxk_nix_lookup_mem_metapool_clear(struct cnxk_eth_dev *dev);
634 : : __rte_internal
635 : : int cnxk_nix_inb_mode_set(struct cnxk_eth_dev *dev, bool use_inl_dev);
636 : : struct cnxk_eth_sec_sess *cnxk_eth_sec_sess_get_by_spi(struct cnxk_eth_dev *dev,
637 : : uint32_t spi, bool inb);
638 : : struct cnxk_eth_sec_sess *
639 : : cnxk_eth_sec_sess_get_by_sess(struct cnxk_eth_dev *dev,
640 : : struct rte_security_session *sess);
641 : : int cnxk_nix_inl_meta_pool_cb(uint64_t *aura_handle, uintptr_t *mpool, uint32_t buf_sz,
642 : : uint32_t nb_bufs, bool destroy, const char *mempool_name);
643 : : int cnxk_nix_inl_custom_meta_pool_cb(uintptr_t pmpool, uintptr_t *mpool, const char *mempool_name,
644 : : uint64_t *aura_handle, uint32_t buf_sz, uint32_t nb_bufs,
645 : : bool destroy);
646 : :
647 : : /* Congestion Management */
648 : : int cnxk_nix_cman_info_get(struct rte_eth_dev *dev, struct rte_eth_cman_info *info);
649 : :
650 : : int cnxk_nix_cman_config_init(struct rte_eth_dev *dev, struct rte_eth_cman_config *config);
651 : :
652 : : int cnxk_nix_cman_config_set(struct rte_eth_dev *dev, const struct rte_eth_cman_config *config);
653 : :
654 : : int cnxk_nix_cman_config_get(struct rte_eth_dev *dev, struct rte_eth_cman_config *config);
655 : :
656 : : int cnxk_mcs_dev_init(struct cnxk_eth_dev *dev, uint8_t mcs_idx);
657 : : void cnxk_mcs_dev_fini(struct cnxk_eth_dev *dev);
658 : :
659 : : struct cnxk_macsec_sess *cnxk_eth_macsec_sess_get_by_sess(struct cnxk_eth_dev *dev,
660 : : const struct rte_security_session *sess);
661 : : int cnxk_mcs_flow_configure(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
662 : : const struct rte_flow_item pattern[],
663 : : const struct rte_flow_action actions[], struct rte_flow_error *error,
664 : : void **mcs_flow);
665 : : int cnxk_mcs_flow_destroy(struct cnxk_eth_dev *eth_dev, void *mcs_flow);
666 : :
667 : : /* Other private functions */
668 : : int nix_recalc_mtu(struct rte_eth_dev *eth_dev);
669 : : int nix_mtr_validate(struct rte_eth_dev *dev, uint32_t id);
670 : : int nix_mtr_policy_act_get(struct rte_eth_dev *eth_dev, uint32_t id,
671 : : struct cnxk_mtr_policy_node **policy);
672 : : int nix_mtr_rq_update(struct rte_eth_dev *eth_dev, uint32_t id,
673 : : uint32_t queue_num, const uint16_t *queue);
674 : : int nix_mtr_chain_update(struct rte_eth_dev *eth_dev, uint32_t cur_id,
675 : : uint32_t prev_id, uint32_t next_id);
676 : : int nix_mtr_chain_reset(struct rte_eth_dev *eth_dev, uint32_t cur_id);
677 : : struct cnxk_meter_node *nix_get_mtr(struct rte_eth_dev *eth_dev,
678 : : uint32_t cur_id);
679 : : int nix_mtr_level_update(struct rte_eth_dev *eth_dev, uint32_t id,
680 : : uint32_t level);
681 : : int nix_mtr_capabilities_init(struct rte_eth_dev *eth_dev);
682 : : int nix_mtr_configure(struct rte_eth_dev *eth_dev, uint32_t id);
683 : : int nix_mtr_connect(struct rte_eth_dev *eth_dev, uint32_t id);
684 : : int nix_mtr_destroy(struct rte_eth_dev *eth_dev, uint32_t id,
685 : : struct rte_mtr_error *error);
686 : : int nix_mtr_color_action_validate(struct rte_eth_dev *eth_dev, uint32_t id,
687 : : uint32_t *prev_id, uint32_t *next_id,
688 : : struct cnxk_mtr_policy_node *policy,
689 : : int *tree_level);
690 : : int nix_priority_flow_ctrl_rq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
691 : : uint8_t tx_pause, uint8_t tc);
692 : : int nix_priority_flow_ctrl_sq_conf(struct rte_eth_dev *eth_dev, uint16_t qid,
693 : : uint8_t rx_pause, uint8_t tc);
694 : :
695 : : #endif /* __CNXK_ETHDEV_H__ */
|