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