Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #ifndef _ROC_NIX_H_
6 : : #define _ROC_NIX_H_
7 : :
8 : : /* Constants */
9 : : #define ROC_NIX_BPF_PER_PFFUNC 64
10 : : #define ROC_NIX_BPF_ID_INVALID 0xFFFF
11 : : #define ROC_NIX_BPF_LEVEL_IDX_INVALID 0xFF
12 : : #define ROC_NIX_BPF_LEVEL_MAX 3
13 : : #define ROC_NIX_BPF_STATS_MAX 12
14 : : #define ROC_NIX_MTR_ID_INVALID UINT32_MAX
15 : : #define ROC_NIX_PFC_CLASS_INVALID UINT8_MAX
16 : : #define ROC_NIX_SQB_THRESH 30U
17 : : #define ROC_NIX_SQB_SLACK 12U
18 : : #define ROC_NIX_AURA_THRESH 95U
19 : :
20 : : /* Reserved interface types for BPID allocation */
21 : : #define ROC_NIX_INTF_TYPE_CGX 0
22 : : #define ROC_NIX_INTF_TYPE_LBK 1
23 : : #define ROC_NIX_INTF_TYPE_SDP 2
24 : : #define ROC_NIX_INTF_TYPE_CPT 3
25 : : #define ROC_NIX_INTF_TYPE_RSVD 4
26 : :
27 : : /* Application based types for BPID allocation, start from end (255 unused rsvd) */
28 : : #define ROC_NIX_INTF_TYPE_CPT_NIX 254
29 : : #define ROC_NIX_INTF_TYPE_SSO 253
30 : :
31 : : enum roc_nix_rss_reta_sz {
32 : : ROC_NIX_RSS_RETA_SZ_64 = 64,
33 : : ROC_NIX_RSS_RETA_SZ_128 = 128,
34 : : ROC_NIX_RSS_RETA_SZ_256 = 256,
35 : : };
36 : :
37 : : enum roc_nix_sq_max_sqe_sz {
38 : : roc_nix_maxsqesz_w16 = NIX_MAXSQESZ_W16,
39 : : roc_nix_maxsqesz_w8 = NIX_MAXSQESZ_W8,
40 : : };
41 : :
42 : : enum roc_nix_fc_mode {
43 : : ROC_NIX_FC_NONE = 0,
44 : : ROC_NIX_FC_RX,
45 : : ROC_NIX_FC_TX,
46 : : ROC_NIX_FC_FULL
47 : : };
48 : :
49 : : enum roc_nix_vlan_type {
50 : : ROC_NIX_VLAN_TYPE_INNER = 0x01,
51 : : ROC_NIX_VLAN_TYPE_OUTER = 0x02,
52 : : };
53 : :
54 : : enum roc_nix_bpf_level_flag {
55 : : ROC_NIX_BPF_LEVEL_F_LEAF = BIT(0),
56 : : ROC_NIX_BPF_LEVEL_F_MID = BIT(1),
57 : : ROC_NIX_BPF_LEVEL_F_TOP = BIT(2),
58 : : };
59 : :
60 : : enum roc_nix_bpf_precolor_tbl_size {
61 : : ROC_NIX_BPF_PRECOLOR_TBL_SIZE_GEN = 16,
62 : : ROC_NIX_BPF_PRECOLOR_TBL_SIZE_VLAN = 16,
63 : : ROC_NIX_BPF_PRECOLOR_TBL_SIZE_DSCP = 64,
64 : : };
65 : :
66 : : enum roc_nix_bpf_pc_mode {
67 : : ROC_NIX_BPF_PC_MODE_VLAN_INNER,
68 : : ROC_NIX_BPF_PC_MODE_VLAN_OUTER,
69 : : ROC_NIX_BPF_PC_MODE_DSCP_INNER,
70 : : ROC_NIX_BPF_PC_MODE_DSCP_OUTER,
71 : : ROC_NIX_BPF_PC_MODE_GEN_INNER,
72 : : ROC_NIX_BPF_PC_MODE_GEN_OUTER
73 : : };
74 : :
75 : : enum roc_nix_bpf_color {
76 : : ROC_NIX_BPF_COLOR_GREEN,
77 : : ROC_NIX_BPF_COLOR_YELLOW,
78 : : ROC_NIX_BPF_COLOR_RED,
79 : : ROC_NIX_BPF_COLOR_MAX
80 : : };
81 : :
82 : : enum roc_nix_bpf_algo {
83 : : ROC_NIX_BPF_ALGO_NONE,
84 : : ROC_NIX_BPF_ALGO_2698,
85 : : ROC_NIX_BPF_ALGO_4115,
86 : : ROC_NIX_BPF_ALGO_2697
87 : : };
88 : :
89 : : enum roc_nix_bpf_lmode { ROC_NIX_BPF_LMODE_BYTE, ROC_NIX_BPF_LMODE_PACKET };
90 : :
91 : : enum roc_nix_bpf_action {
92 : : ROC_NIX_BPF_ACTION_PASS,
93 : : ROC_NIX_BPF_ACTION_DROP,
94 : : ROC_NIX_BPF_ACTION_RED
95 : : };
96 : :
97 : : enum roc_nix_bpf_stats {
98 : : ROC_NIX_BPF_GREEN_PKT_F_PASS = BIT_ULL(0),
99 : : ROC_NIX_BPF_GREEN_OCTS_F_PASS = BIT_ULL(1),
100 : : ROC_NIX_BPF_GREEN_PKT_F_DROP = BIT_ULL(2),
101 : : ROC_NIX_BPF_GREEN_OCTS_F_DROP = BIT_ULL(3),
102 : : ROC_NIX_BPF_YELLOW_PKT_F_PASS = BIT_ULL(4),
103 : : ROC_NIX_BPF_YELLOW_OCTS_F_PASS = BIT_ULL(5),
104 : : ROC_NIX_BPF_YELLOW_PKT_F_DROP = BIT_ULL(6),
105 : : ROC_NIX_BPF_YELLOW_OCTS_F_DROP = BIT_ULL(7),
106 : : ROC_NIX_BPF_RED_PKT_F_PASS = BIT_ULL(8),
107 : : ROC_NIX_BPF_RED_OCTS_F_PASS = BIT_ULL(9),
108 : : ROC_NIX_BPF_RED_PKT_F_DROP = BIT_ULL(10),
109 : : ROC_NIX_BPF_RED_OCTS_F_DROP = BIT_ULL(11),
110 : : };
111 : :
112 : : struct roc_nix_bpf_cfg {
113 : : enum roc_nix_bpf_algo alg;
114 : : enum roc_nix_bpf_lmode lmode;
115 : : enum roc_nix_bpf_color icolor;
116 : : enum roc_nix_bpf_pc_mode pc_mode;
117 : : bool tnl_ena;
118 : : union {
119 : : /* Valid when *alg* is set to ROC_NIX_BPF_ALGO_2697. */
120 : : struct {
121 : : uint64_t cir;
122 : : uint64_t cbs;
123 : : uint64_t ebs;
124 : : } algo2697;
125 : :
126 : : /* Valid when *alg* is set to ROC_NIX_BPF_ALGO_2698. */
127 : : struct {
128 : : uint64_t cir;
129 : : uint64_t pir;
130 : : uint64_t cbs;
131 : : uint64_t pbs;
132 : : } algo2698;
133 : :
134 : : /* Valid when *alg* is set to ROC_NIX_BPF_ALGO_4115. */
135 : : struct {
136 : : uint64_t cir;
137 : : uint64_t eir;
138 : : uint64_t cbs;
139 : : uint64_t ebs;
140 : : } algo4115;
141 : : };
142 : :
143 : : enum roc_nix_bpf_action action[ROC_NIX_BPF_COLOR_MAX];
144 : :
145 : : /* Reserved for future config*/
146 : : uint32_t rsvd[3];
147 : : };
148 : :
149 : : struct roc_nix_bpf_objs {
150 : : uint16_t level;
151 : : uint16_t count;
152 : : uint16_t ids[ROC_NIX_BPF_PER_PFFUNC];
153 : : };
154 : :
155 : : struct roc_nix_bpf_precolor {
156 : : #define ROC_NIX_BPF_PRE_COLOR_MAX 64
157 : : uint8_t count;
158 : : enum roc_nix_bpf_pc_mode mode;
159 : : enum roc_nix_bpf_color color[ROC_NIX_BPF_PRE_COLOR_MAX];
160 : : };
161 : :
162 : : struct roc_nix_vlan_config {
163 : : uint32_t type;
164 : : union {
165 : : struct {
166 : : uint32_t vtag_inner;
167 : : uint32_t vtag_outer;
168 : : } vlan;
169 : :
170 : : struct {
171 : : int idx_inner;
172 : : int idx_outer;
173 : : } mcam;
174 : : };
175 : : };
176 : :
177 : : struct roc_nix_fc_cfg {
178 : : #define ROC_NIX_FC_RXCHAN_CFG 0
179 : : #define ROC_NIX_FC_CQ_CFG 1
180 : : #define ROC_NIX_FC_TM_CFG 2
181 : : #define ROC_NIX_FC_RQ_CFG 3
182 : : uint8_t type;
183 : : union {
184 : : struct {
185 : : bool enable;
186 : : } rxchan_cfg;
187 : :
188 : : struct {
189 : : uint32_t rq;
190 : : uint16_t tc;
191 : : uint16_t cq_drop;
192 : : bool enable;
193 : : } cq_cfg;
194 : :
195 : : struct {
196 : : uint32_t rq;
197 : : uint16_t tc;
198 : : uint16_t cq_drop;
199 : : uint64_t pool;
200 : : uint64_t spb_pool;
201 : : uint64_t pool_drop_pct;
202 : : uint64_t spb_pool_drop_pct;
203 : : bool enable;
204 : : } rq_cfg;
205 : :
206 : : struct {
207 : : uint32_t sq;
208 : : uint16_t tc;
209 : : bool enable;
210 : : } tm_cfg;
211 : : };
212 : : };
213 : :
214 : : struct roc_nix_pfc_cfg {
215 : : enum roc_nix_fc_mode mode;
216 : : /* For SET, tc must be [0, 15].
217 : : * For GET, TC will represent bitmap
218 : : */
219 : : uint16_t tc;
220 : : };
221 : :
222 : : struct roc_nix_eeprom_info {
223 : : #define ROC_NIX_EEPROM_SIZE 256
224 : : uint16_t sff_id;
225 : : uint8_t buf[ROC_NIX_EEPROM_SIZE];
226 : : };
227 : :
228 : : /* Range to adjust PTP frequency. Valid range is
229 : : * (-ROC_NIX_PTP_FREQ_ADJUST, ROC_NIX_PTP_FREQ_ADJUST)
230 : : */
231 : : #define ROC_NIX_PTP_FREQ_ADJUST (1 << 9)
232 : :
233 : : /* NIX LF RX offload configuration flags.
234 : : * These are input flags to roc_nix_lf_alloc:rx_cfg
235 : : */
236 : : #define ROC_NIX_LF_RX_CFG_DROP_RE BIT_ULL(32)
237 : : #define ROC_NIX_LF_RX_CFG_L2_LEN_ERR BIT_ULL(33)
238 : : #define ROC_NIX_LF_RX_CFG_IP6_UDP_OPT BIT_ULL(34)
239 : : #define ROC_NIX_LF_RX_CFG_DIS_APAD BIT_ULL(35)
240 : : #define ROC_NIX_LF_RX_CFG_CSUM_IL4 BIT_ULL(36)
241 : : #define ROC_NIX_LF_RX_CFG_CSUM_OL4 BIT_ULL(37)
242 : : #define ROC_NIX_LF_RX_CFG_LEN_IL4 BIT_ULL(38)
243 : : #define ROC_NIX_LF_RX_CFG_LEN_IL3 BIT_ULL(39)
244 : : #define ROC_NIX_LF_RX_CFG_LEN_OL4 BIT_ULL(40)
245 : : #define ROC_NIX_LF_RX_CFG_LEN_OL3 BIT_ULL(41)
246 : : #define ROC_NIX_LF_RX_CFG_APAD_MODE BIT_ULL(42)
247 : :
248 : : #define ROC_NIX_LF_RX_CFG_RX_ERROR_MASK 0xFFFFFFFFFFF80000
249 : : #define ROC_NIX_RE_PARTIAL BIT_ULL(1)
250 : : #define ROC_NIX_RE_JABBER BIT_ULL(2)
251 : : #define ROC_NIX_RE_CRC8_PCH BIT_ULL(5)
252 : : #define ROC_NIX_RE_CNC_INV BIT_ULL(6)
253 : : #define ROC_NIX_RE_FCS BIT_ULL(7)
254 : : #define ROC_NIX_RE_FCS_RCV BIT_ULL(8)
255 : : #define ROC_NIX_RE_TERMINATE BIT_ULL(9)
256 : : #define ROC_NIX_RE_MACSEC BIT_ULL(10)
257 : : #define ROC_NIX_RE_RX_CTL BIT_ULL(11)
258 : : #define ROC_NIX_RE_SKIP BIT_ULL(12)
259 : : #define ROC_NIX_RE_DMAPKT BIT_ULL(15)
260 : : #define ROC_NIX_RE_UNDERSIZE BIT_ULL(16)
261 : : #define ROC_NIX_RE_OVERSIZE BIT_ULL(17)
262 : : #define ROC_NIX_RE_OL2_LENMISM BIT_ULL(18)
263 : :
264 : : /* Group 0 will be used for RSS, 1 -7 will be used for npc_flow RSS action*/
265 : : #define ROC_NIX_RSS_GROUP_DEFAULT 0
266 : : #define ROC_NIX_RSS_GRPS 8
267 : : #define ROC_NIX_RSS_RETA_MAX ROC_NIX_RSS_RETA_SZ_256
268 : : #define ROC_NIX_RSS_KEY_LEN 48 /* 352 Bits */
269 : : #define ROC_NIX_RSS_MCAM_IDX_DEFAULT (-1)
270 : :
271 : : #define ROC_NIX_VWQE_MAX_SIZE_LOG2 11
272 : : #define ROC_NIX_VWQE_MIN_SIZE_LOG2 2
273 : :
274 : : struct roc_nix_stats {
275 : : /* Rx */
276 : : uint64_t rx_octs;
277 : : uint64_t rx_ucast;
278 : : uint64_t rx_bcast;
279 : : uint64_t rx_mcast;
280 : : uint64_t rx_drop;
281 : : uint64_t rx_drop_octs;
282 : : uint64_t rx_fcs;
283 : : uint64_t rx_err;
284 : : uint64_t rx_drop_bcast;
285 : : uint64_t rx_drop_mcast;
286 : : uint64_t rx_drop_l3_bcast;
287 : : uint64_t rx_drop_l3_mcast;
288 : : /* Tx */
289 : : uint64_t tx_ucast;
290 : : uint64_t tx_bcast;
291 : : uint64_t tx_mcast;
292 : : uint64_t tx_drop;
293 : : uint64_t tx_octs;
294 : : };
295 : :
296 : : struct roc_nix_stats_queue {
297 : : union {
298 : : struct {
299 : : /* Rx */
300 : : uint64_t rx_pkts;
301 : : uint64_t rx_octs;
302 : : uint64_t rx_drop_pkts;
303 : : uint64_t rx_drop_octs;
304 : : uint64_t rx_error_pkts;
305 : : };
306 : : struct {
307 : : /* Tx */
308 : : uint64_t tx_pkts;
309 : : uint64_t tx_octs;
310 : : uint64_t tx_drop_pkts;
311 : : uint64_t tx_drop_octs;
312 : : uint64_t tx_age_drop_pkts;
313 : : uint64_t tx_age_drop_octs;
314 : : };
315 : : };
316 : : };
317 : :
318 : : struct roc_nix_rq {
319 : : /* Input parameters */
320 : : uint16_t qid;
321 : : uint16_t cqid; /* Not valid when SSO is enabled */
322 : : uint16_t bpf_id;
323 : : uint64_t aura_handle;
324 : : bool ipsech_ena;
325 : : uint16_t first_skip;
326 : : uint16_t later_skip;
327 : : uint16_t wqe_skip;
328 : : uint16_t lpb_size;
329 : : uint32_t tag_mask;
330 : : uint32_t flow_tag_width;
331 : : uint8_t tt; /* Valid when SSO is enabled */
332 : : uint16_t hwgrp; /* Valid when SSO is enabled */
333 : : bool sso_ena;
334 : : bool vwqe_ena;
335 : : uint64_t spb_aura_handle; /* Valid when SPB is enabled */
336 : : uint16_t spb_size; /* Valid when SPB is enabled */
337 : : bool spb_ena;
338 : : uint8_t vwqe_first_skip;
339 : : uint32_t vwqe_max_sz_exp;
340 : : uint64_t vwqe_wait_tmo;
341 : : uint64_t vwqe_aura_handle;
342 : : /* Average LPB aura level drop threshold for RED */
343 : : uint8_t red_drop;
344 : : /* Average LPB aura level pass threshold for RED */
345 : : uint8_t red_pass;
346 : : /* Average SPB aura level drop threshold for RED */
347 : : uint8_t spb_red_drop;
348 : : /* Average SPB aura level pass threshold for RED */
349 : : uint8_t xqe_red_pass;
350 : : /* Average xqe level drop threshold for RED */
351 : : uint8_t xqe_red_drop;
352 : : /* Average xqe level pass threshold for RED */
353 : : uint8_t spb_red_pass;
354 : : /* LPB aura drop enable */
355 : : bool lpb_drop_ena;
356 : : /* SPB aura drop enable */
357 : : bool spb_drop_ena;
358 : : /* End of Input parameters */
359 : : struct roc_nix *roc_nix;
360 : : uint64_t meta_aura_handle;
361 : : uint16_t inl_dev_refs;
362 : : uint8_t tc;
363 : : };
364 : :
365 : : struct roc_nix_cq {
366 : : /* Input parameters */
367 : : uint16_t qid;
368 : : uint32_t nb_desc;
369 : : uint8_t stash_thresh;
370 : : /* End of Input parameters */
371 : : uint16_t drop_thresh;
372 : : struct roc_nix *roc_nix;
373 : : uintptr_t door;
374 : : int64_t *status;
375 : : uint64_t wdata;
376 : : void *desc_base;
377 : : uint32_t qmask;
378 : : uint32_t head;
379 : : };
380 : :
381 : : struct roc_nix_sq {
382 : : /* Input parameters */
383 : : enum roc_nix_sq_max_sqe_sz max_sqe_sz;
384 : : uint32_t nb_desc;
385 : : uint16_t qid;
386 : : uint16_t cqid;
387 : : uint16_t cq_drop_thresh;
388 : : bool sso_ena;
389 : : bool cq_ena;
390 : : uint8_t fc_hyst_bits;
391 : : /* End of Input parameters */
392 : : uint16_t sqes_per_sqb_log2;
393 : : struct roc_nix *roc_nix;
394 : : uint64_t aura_handle;
395 : : int16_t nb_sqb_bufs_adj;
396 : : uint16_t nb_sqb_bufs;
397 : : uint16_t aura_sqb_bufs;
398 : : plt_iova_t io_addr;
399 : : void *lmt_addr;
400 : : void *sqe_mem;
401 : : void *fc;
402 : : uint8_t tc;
403 : : bool enable;
404 : : };
405 : :
406 : : struct roc_nix_link_info {
407 : : uint64_t status : 1;
408 : : uint64_t full_duplex : 1;
409 : : uint64_t lmac_type_id : 4;
410 : : uint64_t speed : 20;
411 : : uint64_t autoneg : 1;
412 : : uint64_t fec : 2;
413 : : uint64_t port : 8;
414 : : };
415 : :
416 : : /** Maximum name length for extended statistics counters */
417 : : #define ROC_NIX_XSTATS_NAME_SIZE 64
418 : :
419 : : struct roc_nix_xstat {
420 : : uint64_t id; /**< The index in xstats name array. */
421 : : uint64_t value; /**< The statistic counter value. */
422 : : };
423 : :
424 : : struct roc_nix_xstat_name {
425 : : char name[ROC_NIX_XSTATS_NAME_SIZE];
426 : : };
427 : :
428 : : struct roc_nix_ipsec_cfg {
429 : : uint32_t sa_size;
430 : : uint32_t tag_const;
431 : : plt_iova_t iova;
432 : : uint16_t max_sa;
433 : : uint8_t tt;
434 : : };
435 : :
436 : : /* Link status update callback */
437 : : typedef void (*link_status_t)(struct roc_nix *roc_nix,
438 : : struct roc_nix_link_info *link);
439 : :
440 : : /* PTP info update callback */
441 : : typedef int (*ptp_info_update_t)(struct roc_nix *roc_nix, bool enable);
442 : :
443 : : /* Queue Error get callback */
444 : : typedef void (*q_err_get_t)(struct roc_nix *roc_nix, void *data);
445 : :
446 : : /* Link status get callback */
447 : : typedef void (*link_info_get_t)(struct roc_nix *roc_nix,
448 : : struct roc_nix_link_info *link);
449 : :
450 : : TAILQ_HEAD(roc_nix_list, roc_nix);
451 : :
452 : : struct roc_nix {
453 : : /* Input parameters */
454 : : struct plt_pci_device *pci_dev;
455 : : uint16_t port_id;
456 : : bool rss_tag_as_xor;
457 : : uint16_t max_sqb_count;
458 : : enum roc_nix_rss_reta_sz reta_sz;
459 : : bool enable_loop;
460 : : bool tx_compl_ena;
461 : : bool hw_vlan_ins;
462 : : uint8_t lock_rx_ctx;
463 : : uint16_t sqb_slack;
464 : : uint16_t outb_nb_crypto_qs;
465 : : uint32_t outb_nb_desc;
466 : : uint32_t ipsec_in_min_spi;
467 : : uint32_t ipsec_in_max_spi;
468 : : uint32_t ipsec_out_max_sa;
469 : : uint32_t dwrr_mtu;
470 : : bool ipsec_out_sso_pffunc;
471 : : bool custom_sa_action;
472 : : bool local_meta_aura_ena;
473 : : uint32_t meta_buf_sz;
474 : : bool force_rx_aura_bp;
475 : : bool custom_meta_aura_ena;
476 : : bool rx_inj_ena;
477 : : bool custom_inb_sa;
478 : : bool use_write_sa;
479 : : uint32_t root_sched_weight;
480 : : uint16_t inb_cfg_param1;
481 : : uint16_t inb_cfg_param2;
482 : : /* End of input parameters */
483 : : /* LMT line base for "Per Core Tx LMT line" mode*/
484 : : uintptr_t lmt_base;
485 : : bool io_enabled;
486 : : bool rx_ptp_ena;
487 : : uint16_t cints;
488 : : uint32_t buf_sz;
489 : : uint64_t meta_aura_handle;
490 : : uintptr_t meta_mempool;
491 : : uint16_t rep_cnt;
492 : : uint16_t rep_pfvf_map[MAX_PFVF_REP];
493 : : bool reass_ena;
494 : : TAILQ_ENTRY(roc_nix) next;
495 : :
496 : : #define ROC_NIX_MEM_SZ (6 * 1112)
497 : : uint8_t reserved[ROC_NIX_MEM_SZ] __plt_cache_aligned;
498 : : } __plt_cache_aligned;
499 : :
500 : : enum roc_nix_lso_tun_type {
501 : : ROC_NIX_LSO_TUN_V4V4,
502 : : ROC_NIX_LSO_TUN_V4V6,
503 : : ROC_NIX_LSO_TUN_V6V4,
504 : : ROC_NIX_LSO_TUN_V6V6,
505 : : ROC_NIX_LSO_TUN_MAX,
506 : : };
507 : :
508 : : /* Restrict CN9K sched weight to have a minimum quantum */
509 : : #define ROC_NIX_CN9K_TM_RR_WEIGHT_MAX 255u
510 : :
511 : : /* NIX TM Inlines */
512 : : static inline uint64_t
513 : : roc_nix_tm_max_sched_wt_get(void)
514 : : {
515 [ # # # # : 0 : if (roc_model_is_cn9k())
# # # # ]
516 : : return ROC_NIX_CN9K_TM_RR_WEIGHT_MAX;
517 : : else
518 : 0 : return NIX_TM_RR_WEIGHT_MAX;
519 : : }
520 : :
521 : : static inline uint64_t
522 : : roc_nix_tm_max_shaper_burst_get(void)
523 : : {
524 [ # # ]: 0 : if (roc_model_is_cn9k())
525 : : return NIX_CN9K_TM_MAX_SHAPER_BURST;
526 : : else
527 : 0 : return NIX_TM_MAX_SHAPER_BURST;
528 : : }
529 : :
530 : : /* Dev */
531 : : int __roc_api roc_nix_dev_init(struct roc_nix *roc_nix);
532 : : int __roc_api roc_nix_dev_fini(struct roc_nix *roc_nix);
533 : :
534 : : /* Type */
535 : : bool __roc_api roc_nix_is_lbk(struct roc_nix *roc_nix);
536 : : bool __roc_api roc_nix_is_esw(struct roc_nix *roc_nix);
537 : : bool __roc_api roc_nix_is_sdp(struct roc_nix *roc_nix);
538 : : bool __roc_api roc_nix_is_pf(struct roc_nix *roc_nix);
539 : : bool __roc_api roc_nix_is_vf_or_sdp(struct roc_nix *roc_nix);
540 : : int __roc_api roc_nix_get_base_chan(struct roc_nix *roc_nix);
541 : : uint8_t __roc_api roc_nix_get_rx_chan_cnt(struct roc_nix *roc_nix);
542 : : int __roc_api roc_nix_get_pf(struct roc_nix *roc_nix);
543 : : int __roc_api roc_nix_get_vf(struct roc_nix *roc_nix);
544 : : uint16_t __roc_api roc_nix_get_pf_func(struct roc_nix *roc_nix);
545 : : uint16_t __roc_api roc_nix_get_vwqe_interval(struct roc_nix *roc_nix);
546 : : int __roc_api roc_nix_max_pkt_len(struct roc_nix *roc_nix);
547 : :
548 : : /* LF ops */
549 : : int __roc_api roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq,
550 : : uint32_t nb_txq, uint64_t rx_cfg);
551 : : int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix);
552 : : int __roc_api roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix,
553 : : struct roc_nix_ipsec_cfg *cfg, bool enb);
554 : : int __roc_api roc_nix_cpt_ctx_cache_sync(struct roc_nix *roc_nix);
555 : : int __roc_api roc_nix_rx_drop_re_set(struct roc_nix *roc_nix, bool ena);
556 : :
557 : : /* Debug */
558 : : int __roc_api roc_nix_lf_get_reg_count(struct roc_nix *roc_nix);
559 : : int __roc_api roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data);
560 : : int __roc_api roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file);
561 : : void __roc_api roc_nix_cqe_dump(FILE *file, const struct nix_cqe_hdr_s *cq);
562 : : void __roc_api roc_nix_rq_dump(struct roc_nix_rq *rq, FILE *file);
563 : : void __roc_api roc_nix_cq_dump(struct roc_nix_cq *cq, FILE *file);
564 : : void __roc_api roc_nix_sq_dump(struct roc_nix_sq *sq, FILE *file);
565 : : int __roc_api roc_nix_sq_desc_dump(struct roc_nix *roc_nix, uint16_t q, uint16_t offset,
566 : : uint16_t num, FILE *file);
567 : : void __roc_api roc_nix_tm_dump(struct roc_nix *roc_nix, FILE *file);
568 : : void __roc_api roc_nix_dump(struct roc_nix *roc_nix, FILE *file);
569 : :
570 : : /* IRQ */
571 : : void __roc_api roc_nix_rx_queue_intr_enable(struct roc_nix *roc_nix,
572 : : uint16_t rxq_id);
573 : : void __roc_api roc_nix_rx_queue_intr_disable(struct roc_nix *roc_nix,
574 : : uint16_t rxq_id);
575 : : void __roc_api roc_nix_err_intr_ena_dis(struct roc_nix *roc_nix, bool enb);
576 : : void __roc_api roc_nix_ras_intr_ena_dis(struct roc_nix *roc_nix, bool enb);
577 : : int __roc_api roc_nix_register_queue_irqs(struct roc_nix *roc_nix);
578 : : void __roc_api roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix);
579 : : int __roc_api roc_nix_register_cq_irqs(struct roc_nix *roc_nix);
580 : : void __roc_api roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix);
581 : :
582 : : /* Traffic Management */
583 : : #define ROC_NIX_TM_SHAPER_PROFILE_NONE UINT32_MAX
584 : : #define ROC_NIX_TM_NODE_ID_INVALID UINT32_MAX
585 : :
586 : : enum roc_nix_tm_tree {
587 : : ROC_NIX_TM_DEFAULT = 0,
588 : : ROC_NIX_TM_RLIMIT,
589 : : ROC_NIX_TM_PFC,
590 : : ROC_NIX_TM_USER,
591 : : ROC_NIX_TM_TREE_MAX,
592 : : };
593 : :
594 : : enum roc_tm_node_level {
595 : : ROC_TM_LVL_ROOT = 0,
596 : : ROC_TM_LVL_SCH1,
597 : : ROC_TM_LVL_SCH2,
598 : : ROC_TM_LVL_SCH3,
599 : : ROC_TM_LVL_SCH4,
600 : : ROC_TM_LVL_QUEUE,
601 : : ROC_TM_LVL_MAX,
602 : : };
603 : :
604 : : /*
605 : : * TM runtime hierarchy init API.
606 : : */
607 : : int __roc_api roc_nix_tm_init(struct roc_nix *roc_nix);
608 : : void __roc_api roc_nix_tm_fini(struct roc_nix *roc_nix);
609 : : int __roc_api roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable);
610 : : int __roc_api roc_nix_tm_sq_flush_spin(struct roc_nix_sq *sq);
611 : :
612 : : /*
613 : : * TM User hierarchy API.
614 : : */
615 : :
616 : : struct roc_nix_tm_node {
617 : : #define ROC_NIX_TM_NODE_SZ (128)
618 : : uint8_t reserved[ROC_NIX_TM_NODE_SZ];
619 : :
620 : : uint32_t id;
621 : : uint32_t parent_id;
622 : : uint32_t priority;
623 : : uint32_t weight;
624 : : uint32_t shaper_profile_id;
625 : : uint16_t lvl;
626 : : bool pkt_mode;
627 : : bool pkt_mode_set;
628 : : /* Function to free this memory */
629 : : void (*free_fn)(void *node);
630 : : };
631 : :
632 : : struct roc_nix_tm_shaper_profile {
633 : : #define ROC_NIX_TM_SHAPER_PROFILE_SZ (128)
634 : : uint8_t reserved[ROC_NIX_TM_SHAPER_PROFILE_SZ];
635 : :
636 : : uint32_t id;
637 : : uint64_t commit_rate;
638 : : uint64_t commit_sz;
639 : : uint64_t peak_rate;
640 : : uint64_t peak_sz;
641 : : int32_t pkt_len_adj;
642 : : bool pkt_mode;
643 : : int8_t accuracy;
644 : : uint8_t red_algo;
645 : : /* Function to free this memory */
646 : : void (*free_fn)(void *profile);
647 : : };
648 : :
649 : : enum roc_nix_tm_node_stats_type {
650 : : ROC_NIX_TM_NODE_PKTS_DROPPED,
651 : : ROC_NIX_TM_NODE_BYTES_DROPPED,
652 : : ROC_NIX_TM_NODE_GREEN_PKTS,
653 : : ROC_NIX_TM_NODE_GREEN_BYTES,
654 : : ROC_NIX_TM_NODE_YELLOW_PKTS,
655 : : ROC_NIX_TM_NODE_YELLOW_BYTES,
656 : : ROC_NIX_TM_NODE_RED_PKTS,
657 : : ROC_NIX_TM_NODE_RED_BYTES,
658 : : ROC_NIX_TM_NODE_STATS_MAX,
659 : : };
660 : :
661 : : struct roc_nix_tm_node_stats {
662 : : uint64_t stats[ROC_NIX_TM_NODE_STATS_MAX];
663 : : };
664 : :
665 : : enum roc_nix_tm_mark {
666 : : ROC_NIX_TM_MARK_VLAN_DEI,
667 : : ROC_NIX_TM_MARK_IPV4_DSCP,
668 : : ROC_NIX_TM_MARK_IPV4_ECN,
669 : : ROC_NIX_TM_MARK_IPV6_DSCP,
670 : : ROC_NIX_TM_MARK_IPV6_ECN,
671 : : ROC_NIX_TM_MARK_MAX
672 : : };
673 : :
674 : : enum roc_nix_tm_mark_color {
675 : : ROC_NIX_TM_MARK_COLOR_Y,
676 : : ROC_NIX_TM_MARK_COLOR_R,
677 : : ROC_NIX_TM_MARK_COLOR_Y_R,
678 : : ROC_NIX_TM_MARK_COLOR_MAX
679 : : };
680 : :
681 : : int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix,
682 : : struct roc_nix_tm_node *roc_node);
683 : : int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id,
684 : : bool free);
685 : : int __roc_api roc_nix_tm_free_resources(struct roc_nix *roc_nix, bool hw_only);
686 : : int __roc_api roc_nix_tm_node_suspend_resume(struct roc_nix *roc_nix,
687 : : uint32_t node_id, bool suspend);
688 : : int __roc_api roc_nix_tm_node_parent_update(struct roc_nix *roc_nix,
689 : : uint32_t node_id,
690 : : uint32_t new_parent_id,
691 : : uint32_t priority, uint32_t weight);
692 : : int __roc_api roc_nix_tm_node_shaper_update(struct roc_nix *roc_nix,
693 : : uint32_t node_id,
694 : : uint32_t profile_id,
695 : : bool force_update);
696 : : int __roc_api roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix,
697 : : uint32_t node_id, bool pkt_mode);
698 : : int __roc_api roc_nix_tm_shaper_profile_add(
699 : : struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *profile);
700 : : int __roc_api roc_nix_tm_shaper_profile_update(
701 : : struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *profile);
702 : : int __roc_api roc_nix_tm_shaper_profile_delete(struct roc_nix *roc_nix,
703 : : uint32_t id);
704 : :
705 : : int __roc_api roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl,
706 : : uint16_t discontig, uint16_t contig);
707 : : uint16_t __roc_api roc_nix_tm_leaf_cnt(struct roc_nix *roc_nix);
708 : :
709 : : struct roc_nix_tm_node *__roc_api roc_nix_tm_node_get(struct roc_nix *roc_nix,
710 : : uint32_t node_id);
711 : : struct roc_nix_tm_node *__roc_api
712 : : roc_nix_tm_node_next(struct roc_nix *roc_nix, struct roc_nix_tm_node *__prev);
713 : : struct roc_nix_tm_shaper_profile *__roc_api
714 : : roc_nix_tm_shaper_profile_get(struct roc_nix *roc_nix, uint32_t profile_id);
715 : : struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_next(
716 : : struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *__prev);
717 : :
718 : : int __roc_api roc_nix_tm_node_stats_get(struct roc_nix *roc_nix,
719 : : uint32_t node_id, bool clear,
720 : : struct roc_nix_tm_node_stats *stats);
721 : : /*
722 : : * TM ratelimit tree API.
723 : : */
724 : : int __roc_api roc_nix_tm_rlimit_sq(struct roc_nix *roc_nix, uint16_t qid, uint64_t rate);
725 : :
726 : : /*
727 : : * TM PFC tree ratelimit API.
728 : : */
729 : : int __roc_api roc_nix_tm_pfc_rlimit_sq(struct roc_nix *roc_nix, uint16_t qid, uint64_t rate);
730 : :
731 : : /*
732 : : * TM hierarchy enable/disable API.
733 : : */
734 : : int __roc_api roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix);
735 : : int __roc_api roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix,
736 : : enum roc_nix_tm_tree tree,
737 : : bool xmit_enable);
738 : : int __roc_api roc_nix_tm_hierarchy_xmit_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree);
739 : :
740 : :
741 : : /*
742 : : * TM utilities API.
743 : : */
744 : : int __roc_api roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id);
745 : : bool __roc_api roc_nix_tm_root_has_sp(struct roc_nix *roc_nix);
746 : : void __roc_api roc_nix_tm_rsrc_max(bool pf, uint16_t schq[ROC_TM_LVL_MAX]);
747 : : int __roc_api roc_nix_tm_rsrc_count(struct roc_nix *roc_nix,
748 : : uint16_t schq[ROC_TM_LVL_MAX]);
749 : : int __roc_api roc_nix_tm_node_name_get(struct roc_nix *roc_nix,
750 : : uint32_t node_id, char *buf,
751 : : size_t buflen);
752 : : int __roc_api roc_nix_smq_flush(struct roc_nix *roc_nix);
753 : : int __roc_api roc_nix_tm_max_prio(struct roc_nix *roc_nix, int lvl);
754 : : int __roc_api roc_nix_tm_lvl_is_leaf(struct roc_nix *roc_nix, int lvl);
755 : : void __roc_api
756 : : roc_nix_tm_shaper_default_red_algo(struct roc_nix_tm_node *node,
757 : : struct roc_nix_tm_shaper_profile *profile);
758 : : int __roc_api roc_nix_tm_lvl_cnt_get(struct roc_nix *roc_nix);
759 : : int __roc_api roc_nix_tm_lvl_have_link_access(struct roc_nix *roc_nix, int lvl);
760 : : int __roc_api roc_nix_tm_prepare_rate_limited_tree(struct roc_nix *roc_nix);
761 : : int __roc_api roc_nix_tm_pfc_prepare_tree(struct roc_nix *roc_nix);
762 : : bool __roc_api roc_nix_tm_is_user_hierarchy_enabled(struct roc_nix *nix);
763 : : int __roc_api roc_nix_tm_tree_type_get(struct roc_nix *nix);
764 : : int __roc_api roc_nix_tm_mark_config(struct roc_nix *roc_nix,
765 : : enum roc_nix_tm_mark type, int mark_yellow,
766 : : int mark_red);
767 : : uint64_t __roc_api roc_nix_tm_mark_format_get(struct roc_nix *roc_nix,
768 : : uint64_t *flags);
769 : : int __roc_api roc_nix_tm_egress_link_cfg_set(struct roc_nix *roc_nix, uint64_t dst_pf_func,
770 : : bool enable);
771 : :
772 : : /* Ingress Policer API */
773 : : int __roc_api roc_nix_bpf_timeunit_get(struct roc_nix *roc_nix,
774 : : uint32_t *time_unit);
775 : :
776 : : int __roc_api
777 : : roc_nix_bpf_count_get(struct roc_nix *roc_nix, uint8_t lvl_mask,
778 : : uint16_t count[ROC_NIX_BPF_LEVEL_MAX] /* Out */);
779 : :
780 : : int __roc_api roc_nix_bpf_alloc(struct roc_nix *roc_nix, uint8_t lvl_mask,
781 : : uint16_t per_lvl_cnt[ROC_NIX_BPF_LEVEL_MAX],
782 : : struct roc_nix_bpf_objs *profs /* Out */);
783 : :
784 : : int __roc_api roc_nix_bpf_free(struct roc_nix *roc_nix,
785 : : struct roc_nix_bpf_objs *profs,
786 : : uint8_t num_prof);
787 : :
788 : : int __roc_api roc_nix_bpf_free_all(struct roc_nix *roc_nix);
789 : :
790 : : int __roc_api roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t id,
791 : : enum roc_nix_bpf_level_flag lvl_flag,
792 : : struct roc_nix_bpf_cfg *cfg);
793 : :
794 : : int __roc_api roc_nix_bpf_ena_dis(struct roc_nix *roc_nix, uint16_t id,
795 : : struct roc_nix_rq *rq, bool enable);
796 : :
797 : : int __roc_api roc_nix_bpf_dump(struct roc_nix *roc_nix, uint16_t id,
798 : : enum roc_nix_bpf_level_flag lvl_flag);
799 : :
800 : : int __roc_api roc_nix_bpf_pre_color_tbl_setup(
801 : : struct roc_nix *roc_nix, uint16_t id,
802 : : enum roc_nix_bpf_level_flag lvl_flag, struct roc_nix_bpf_precolor *tbl);
803 : :
804 : : /* Use ROC_NIX_BPF_ID_INVALID as dst_id to disconnect */
805 : : int __roc_api roc_nix_bpf_connect(struct roc_nix *roc_nix,
806 : : enum roc_nix_bpf_level_flag lvl_flag,
807 : : uint16_t src_id, uint16_t dst_id);
808 : :
809 : : int __roc_api
810 : : roc_nix_bpf_stats_read(struct roc_nix *roc_nix, uint16_t id, uint64_t mask,
811 : : enum roc_nix_bpf_level_flag lvl_flag,
812 : : uint64_t stats[ROC_NIX_BPF_STATS_MAX] /* Out */);
813 : :
814 : : int __roc_api roc_nix_bpf_stats_reset(struct roc_nix *roc_nix, uint16_t id,
815 : : uint64_t mask,
816 : : enum roc_nix_bpf_level_flag lvl_flag);
817 : :
818 : : int __roc_api
819 : : roc_nix_bpf_lf_stats_read(struct roc_nix *roc_nix, uint64_t mask,
820 : : uint64_t stats[ROC_NIX_BPF_STATS_MAX] /* Out */);
821 : :
822 : : int __roc_api roc_nix_bpf_lf_stats_reset(struct roc_nix *roc_nix,
823 : : uint64_t mask);
824 : :
825 : : uint8_t __roc_api
826 : : roc_nix_bpf_level_to_idx(enum roc_nix_bpf_level_flag lvl_flag);
827 : :
828 : : uint8_t __roc_api roc_nix_bpf_stats_to_idx(enum roc_nix_bpf_stats lvl_flag);
829 : :
830 : : /* MAC */
831 : : int __roc_api roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start);
832 : : int __roc_api roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix,
833 : : bool start);
834 : : int __roc_api roc_nix_mac_loopback_enable(struct roc_nix *roc_nix, bool enable);
835 : : int __roc_api roc_nix_mac_addr_set(struct roc_nix *roc_nix,
836 : : const uint8_t addr[]);
837 : : int __roc_api roc_nix_mac_max_entries_get(struct roc_nix *roc_nix);
838 : : int __roc_api roc_nix_mac_addr_add(struct roc_nix *roc_nix, uint8_t addr[]);
839 : : int __roc_api roc_nix_mac_addr_del(struct roc_nix *roc_nix, uint32_t index);
840 : : int __roc_api roc_nix_mac_promisc_mode_enable(struct roc_nix *roc_nix,
841 : : int enable);
842 : : int __roc_api roc_nix_mac_link_state_set(struct roc_nix *roc_nix, uint8_t up);
843 : : int __roc_api roc_nix_mac_link_info_set(struct roc_nix *roc_nix,
844 : : struct roc_nix_link_info *link_info);
845 : : int __roc_api roc_nix_mac_link_info_get(struct roc_nix *roc_nix,
846 : : struct roc_nix_link_info *link_info);
847 : : int __roc_api roc_nix_mac_mtu_set(struct roc_nix *roc_nix, uint16_t mtu);
848 : : int __roc_api roc_nix_mac_max_rx_len_set(struct roc_nix *roc_nix,
849 : : uint16_t maxlen);
850 : : int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix,
851 : : link_status_t link_update);
852 : : void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix);
853 : : int __roc_api roc_nix_mac_link_info_get_cb_register(
854 : : struct roc_nix *roc_nix, link_info_get_t link_info_get);
855 : : void __roc_api roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix);
856 : : int __roc_api roc_nix_q_err_cb_register(struct roc_nix *roc_nix, q_err_get_t sq_err_handle);
857 : : void __roc_api roc_nix_q_err_cb_unregister(struct roc_nix *roc_nix);
858 : : int __roc_api roc_nix_mac_stats_reset(struct roc_nix *roc_nix);
859 : :
860 : : /* Ops */
861 : : int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix,
862 : : uint64_t switch_header_type,
863 : : uint8_t pre_l2_size_offset,
864 : : uint8_t pre_l2_size_offset_mask,
865 : : uint8_t pre_l2_size_shift_dir);
866 : : int __roc_api roc_nix_lso_fmt_setup(struct roc_nix *roc_nix);
867 : : int __roc_api roc_nix_lso_fmt_get(struct roc_nix *roc_nix,
868 : : uint8_t udp_tun[ROC_NIX_LSO_TUN_MAX],
869 : : uint8_t tun[ROC_NIX_LSO_TUN_MAX]);
870 : : int __roc_api roc_nix_lso_custom_fmt_setup(struct roc_nix *roc_nix,
871 : : struct nix_lso_format *fields,
872 : : uint16_t nb_fields);
873 : :
874 : : int __roc_api roc_nix_eeprom_info_get(struct roc_nix *roc_nix,
875 : : struct roc_nix_eeprom_info *info);
876 : :
877 : : /* Flow control */
878 : : int __roc_api roc_nix_fc_config_set(struct roc_nix *roc_nix,
879 : : struct roc_nix_fc_cfg *fc_cfg);
880 : :
881 : : int __roc_api roc_nix_fc_config_get(struct roc_nix *roc_nix,
882 : : struct roc_nix_fc_cfg *fc_cfg);
883 : :
884 : : int __roc_api roc_nix_fc_mode_set(struct roc_nix *roc_nix,
885 : : enum roc_nix_fc_mode mode);
886 : :
887 : : int __roc_api roc_nix_pfc_mode_set(struct roc_nix *roc_nix,
888 : : struct roc_nix_pfc_cfg *pfc_cfg);
889 : :
890 : : int __roc_api roc_nix_pfc_mode_get(struct roc_nix *roc_nix,
891 : : struct roc_nix_pfc_cfg *pfc_cfg);
892 : :
893 : : uint16_t __roc_api roc_nix_chan_count_get(struct roc_nix *roc_nix);
894 : :
895 : : enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix);
896 : :
897 : : void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena,
898 : : uint8_t force, uint8_t tc, uint64_t drop_percent);
899 : : int __roc_api roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type,
900 : : uint8_t bp_cnt, uint16_t *bpids);
901 : : int __roc_api roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt,
902 : : uint16_t *bpids);
903 : : int __roc_api roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan,
904 : : bool is_cpt, uint64_t *cfg);
905 : : int __roc_api roc_nix_rx_chan_cfg_set(struct roc_nix *roc_nix, uint16_t chan,
906 : : bool is_cpt, uint64_t val);
907 : : int __roc_api roc_nix_chan_bpid_set(struct roc_nix *roc_nix, uint16_t chan,
908 : : uint64_t bpid, int ena, bool cpt_chan);
909 : :
910 : : /* NPC */
911 : : int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable);
912 : :
913 : : int __roc_api roc_nix_npc_mac_addr_set(struct roc_nix *roc_nix, uint8_t addr[]);
914 : :
915 : : int __roc_api roc_nix_npc_mac_addr_get(struct roc_nix *roc_nix, uint8_t *addr);
916 : :
917 : : int __roc_api roc_nix_npc_rx_ena_dis(struct roc_nix *roc_nix, bool enable);
918 : :
919 : : int __roc_api roc_nix_npc_mcast_config(struct roc_nix *roc_nix,
920 : : bool mcast_enable, bool prom_enable);
921 : :
922 : : /* RSS */
923 : : void __roc_api roc_nix_rss_key_default_fill(struct roc_nix *roc_nix,
924 : : uint8_t key[ROC_NIX_RSS_KEY_LEN]);
925 : : void __roc_api roc_nix_rss_key_set(struct roc_nix *roc_nix,
926 : : const uint8_t key[ROC_NIX_RSS_KEY_LEN]);
927 : : void __roc_api roc_nix_rss_key_get(struct roc_nix *roc_nix,
928 : : uint8_t key[ROC_NIX_RSS_KEY_LEN]);
929 : : int __roc_api roc_nix_rss_reta_set(struct roc_nix *roc_nix, uint8_t group,
930 : : uint16_t reta[ROC_NIX_RSS_RETA_MAX]);
931 : : int __roc_api roc_nix_rss_reta_get(struct roc_nix *roc_nix, uint8_t group,
932 : : uint16_t reta[ROC_NIX_RSS_RETA_MAX]);
933 : : int __roc_api roc_nix_rss_flowkey_set(struct roc_nix *roc_nix, uint8_t *alg_idx,
934 : : uint32_t flowkey, uint8_t group,
935 : : int mcam_index);
936 : : int __roc_api roc_nix_rss_default_setup(struct roc_nix *roc_nix,
937 : : uint32_t flowkey);
938 : :
939 : : /* Stats */
940 : : int __roc_api roc_nix_stats_get(struct roc_nix *roc_nix,
941 : : struct roc_nix_stats *stats);
942 : : int __roc_api roc_nix_stats_reset(struct roc_nix *roc_nix);
943 : : int __roc_api roc_nix_stats_queue_get(struct roc_nix *roc_nix, uint16_t qid,
944 : : bool is_rx,
945 : : struct roc_nix_stats_queue *qstats);
946 : : int __roc_api roc_nix_stats_queue_reset(struct roc_nix *roc_nix, uint16_t qid,
947 : : bool is_rx);
948 : : int __roc_api roc_nix_num_xstats_get(struct roc_nix *roc_nix);
949 : : int __roc_api roc_nix_xstats_get(struct roc_nix *roc_nix,
950 : : struct roc_nix_xstat *xstats, unsigned int n);
951 : : int __roc_api roc_nix_xstats_names_get(struct roc_nix *roc_nix,
952 : : struct roc_nix_xstat_name *xstats_names,
953 : : unsigned int limit);
954 : :
955 : : /* Queue */
956 : : int __roc_api roc_nix_rq_init(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
957 : : bool ena);
958 : : int __roc_api roc_nix_rq_modify(struct roc_nix *roc_nix, struct roc_nix_rq *rq,
959 : : bool ena);
960 : : int __roc_api roc_nix_rq_cman_config(struct roc_nix *roc_nix, struct roc_nix_rq *rq);
961 : : int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable);
962 : : int __roc_api roc_nix_rq_is_sso_enable(struct roc_nix *roc_nix, uint32_t qid);
963 : : int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq);
964 : : int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq);
965 : : int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq);
966 : : void __roc_api roc_nix_cq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid,
967 : : uint32_t *head, uint32_t *tail);
968 : : int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq);
969 : : int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq);
970 : : int __roc_api roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable);
971 : : void __roc_api roc_nix_sq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid,
972 : : uint32_t *head, uint32_t *tail);
973 : :
974 : : /* PTP */
975 : : int __roc_api roc_nix_ptp_rx_ena_dis(struct roc_nix *roc_nix, int enable);
976 : : int __roc_api roc_nix_ptp_tx_ena_dis(struct roc_nix *roc_nix, int enable);
977 : : int __roc_api roc_nix_ptp_clock_read(struct roc_nix *roc_nix, uint64_t *clock,
978 : : uint64_t *tsc, uint8_t is_pmu);
979 : : int __roc_api roc_nix_ptp_sync_time_adjust(struct roc_nix *roc_nix,
980 : : int64_t delta);
981 : : int __roc_api roc_nix_ptp_info_cb_register(struct roc_nix *roc_nix,
982 : : ptp_info_update_t ptp_update);
983 : : void __roc_api roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix);
984 : : bool __roc_api roc_nix_ptp_is_enable(struct roc_nix *roc_nix);
985 : :
986 : : /* VLAN */
987 : : int __roc_api
988 : : roc_nix_vlan_mcam_entry_read(struct roc_nix *roc_nix, uint32_t index,
989 : : void **rsp);
990 : : int __roc_api roc_nix_vlan_mcam_entry_write(struct roc_nix *roc_nix, uint32_t index, void *entry,
991 : : uint8_t intf, uint8_t enable);
992 : : int __roc_api roc_nix_vlan_mcam_entry_alloc_and_write(struct roc_nix *roc_nix, void *entry,
993 : : uint8_t intf, uint8_t priority,
994 : : uint8_t ref_entry);
995 : : int __roc_api roc_nix_vlan_mcam_entry_free(struct roc_nix *roc_nix,
996 : : uint32_t index);
997 : : int __roc_api roc_nix_vlan_mcam_entry_ena_dis(struct roc_nix *roc_nix,
998 : : uint32_t index, const int enable);
999 : : int __roc_api roc_nix_vlan_strip_vtag_ena_dis(struct roc_nix *roc_nix,
1000 : : bool enable);
1001 : : int __roc_api roc_nix_vlan_insert_ena_dis(struct roc_nix *roc_nix,
1002 : : struct roc_nix_vlan_config *vlan_cfg,
1003 : : uint64_t *mcam_index, bool enable);
1004 : : int __roc_api roc_nix_vlan_tpid_set(struct roc_nix *roc_nix, uint32_t type,
1005 : : uint16_t tpid);
1006 : :
1007 : : /* MCAST*/
1008 : : int __roc_api roc_nix_mcast_mcam_entry_alloc(struct roc_nix *roc_nix,
1009 : : uint16_t nb_entries,
1010 : : uint8_t priority,
1011 : : uint16_t index[]);
1012 : : int __roc_api roc_nix_mcast_mcam_entry_free(struct roc_nix *roc_nix,
1013 : : uint32_t index);
1014 : : int __roc_api roc_nix_mcast_mcam_entry_write(struct roc_nix *roc_nix, void *entry, uint32_t index,
1015 : : uint8_t intf, uint64_t action);
1016 : : int __roc_api roc_nix_mcast_mcam_entry_ena_dis(struct roc_nix *roc_nix, uint32_t index,
1017 : : bool enable);
1018 : : int __roc_api roc_nix_mcast_list_setup(struct mbox *mbox, uint8_t intf, int nb_entries,
1019 : : uint16_t *pf_funcs, uint16_t *channels, uint32_t *rqs,
1020 : : uint32_t *grp_index, uint32_t *start_index);
1021 : : int __roc_api roc_nix_mcast_list_free(struct mbox *mbox, uint32_t mcast_grp_index);
1022 : : int __roc_api roc_nix_max_rep_count(struct roc_nix *roc_nix);
1023 : : #endif /* _ROC_NIX_H_ */
|