1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2021 Marvell.
8 #define NIX_MAX_BPF_COUNT_LEAF_LAYER 64
9 #define NIX_MAX_BPF_COUNT_MID_LAYER 8
10 #define NIX_MAX_BPF_COUNT_TOP_LAYER 1
12 #define NIX_BPF_PRECOLOR_GEN_TABLE_SIZE 16
13 #define NIX_BPF_PRECOLOR_VLAN_TABLE_SIZE 16
14 #define NIX_BPF_PRECOLOR_DSCP_TABLE_SIZE 64
16 #define NIX_BPF_LEVEL_F_MASK \
17 (ROC_NIX_BPF_LEVEL_F_LEAF | ROC_NIX_BPF_LEVEL_F_MID | \
18 ROC_NIX_BPF_LEVEL_F_TOP)
20 #define NIX_RD_STATS(val) plt_read64(nix->base + NIX_LF_RX_STATX(val))
21 #define NIX_RST_STATS(val) plt_write64(0, nix->base + NIX_LF_RX_STATX(val))
23 static uint8_t sw_to_hw_lvl_map[] = {NIX_RX_BAND_PROF_LAYER_LEAF,
24 NIX_RX_BAND_PROF_LAYER_MIDDLE,
25 NIX_RX_BAND_PROF_LAYER_TOP};
27 static inline struct mbox *
28 get_mbox(struct roc_nix *roc_nix)
30 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
31 struct dev *dev = &nix->dev;
36 static inline uint64_t
37 meter_rate_to_nix(uint64_t value, uint64_t *exponent_p, uint64_t *mantissa_p,
38 uint64_t *div_exp_p, uint32_t timeunit_p)
40 uint64_t div_exp, exponent, mantissa;
41 uint32_t time_ns = timeunit_p;
44 if (value < NIX_BPF_RATE(time_ns, 0, 0, 0) ||
45 value > NIX_BPF_RATE(time_ns, NIX_BPF_MAX_RATE_EXPONENT,
46 NIX_BPF_MAX_RATE_MANTISSA, 0))
50 exponent = NIX_BPF_MAX_RATE_EXPONENT;
51 mantissa = NIX_BPF_MAX_RATE_MANTISSA;
53 while (value < (NIX_BPF_RATE(time_ns, exponent, 0, 0)))
56 while (value < (NIX_BPF_RATE(time_ns, exponent, mantissa, 0)))
59 if (div_exp > NIX_BPF_MAX_RATE_DIV_EXP ||
60 exponent > NIX_BPF_MAX_RATE_EXPONENT ||
61 mantissa > NIX_BPF_MAX_RATE_MANTISSA)
67 *exponent_p = exponent;
69 *mantissa_p = mantissa;
71 /* Calculate real rate value */
72 return NIX_BPF_RATE(time_ns, exponent, mantissa, div_exp);
75 static inline uint64_t
76 meter_burst_to_nix(uint64_t value, uint64_t *exponent_p, uint64_t *mantissa_p)
78 uint64_t exponent, mantissa;
80 if (value < NIX_BPF_BURST_MIN || value > NIX_BPF_BURST_MAX)
83 /* Calculate burst exponent and mantissa using
84 * the following formula:
86 * value = (((256 + mantissa) << (exponent + 1)
90 exponent = NIX_BPF_MAX_BURST_EXPONENT;
91 mantissa = NIX_BPF_MAX_BURST_MANTISSA;
93 while (value < (1ull << (exponent + 1)))
96 while (value < ((256 + mantissa) << (exponent + 1)) / 256)
99 if (exponent > NIX_BPF_MAX_BURST_EXPONENT ||
100 mantissa > NIX_BPF_MAX_BURST_MANTISSA)
104 *exponent_p = exponent;
106 *mantissa_p = mantissa;
108 return NIX_BPF_BURST(exponent, mantissa);
112 nix_lf_bpf_dump(__io struct nix_band_prof_s *bpf)
114 plt_dump("W0: cir_mantissa \t\t\t%d\nW0: pebs_mantissa \t\t\t0x%03x",
115 bpf->cir_mantissa, bpf->pebs_mantissa);
116 plt_dump("W0: peir_mantissa \t\t\t\t%d\nW0: cbs_exponent \t\t\t%d",
117 bpf->peir_mantissa, bpf->cbs_exponent);
118 plt_dump("W0: cir_exponent \t\t\t%d\nW0: pebs_exponent \t\t\t%d",
119 bpf->cir_exponent, bpf->pebs_exponent);
120 plt_dump("W0: peir_exponent \t\t\t%d\n", bpf->peir_exponent);
121 plt_dump("W0: tnl_ena \t\t\t%d\n", bpf->tnl_ena);
122 plt_dump("W0: icolor \t\t\t%d\n", bpf->icolor);
123 plt_dump("W0: pc_mode \t\t\t%d\n", bpf->pc_mode);
124 plt_dump("W1: hl_en \t\t%d\nW1: band_prof_id \t\t%d", bpf->hl_en,
126 plt_dump("W1: meter_algo \t\t%d\nW1: rc_action \t\t%d", bpf->meter_algo,
128 plt_dump("W1: yc_action \t\t\t%d\nW1: gc_action \t\t\t%d",
129 bpf->yc_action, bpf->gc_action);
130 plt_dump("W1: adjust_mantissa\t\t\t%d\nW1: adjust_exponent \t\t\t%d",
131 bpf->adjust_mantissa, bpf->adjust_exponent);
132 plt_dump("W1: rdiv \t\t\t%d\n", bpf->rdiv);
133 plt_dump("W1: l_select \t\t%d\nW2: lmode \t\t%d", bpf->l_sellect,
135 plt_dump("W1: cbs_mantissa \t\t\t%d\n", bpf->cbs_mantissa);
136 plt_dump("W2: tsa \t\t\t0x%" PRIx64 "\n", (uint64_t)bpf->ts);
137 plt_dump("W3: c_accum \t\t%d\nW3: pe_accum \t\t%d", bpf->c_accum,
139 plt_dump("W4: green_pkt_pass \t\t\t0x%" PRIx64 "",
140 (uint64_t)bpf->green_pkt_pass);
141 plt_dump("W5: yellow_pkt_pass \t\t\t0x%" PRIx64 "",
142 (uint64_t)bpf->yellow_pkt_pass);
143 plt_dump("W6: red_pkt_pass \t\t\t0x%" PRIx64 "",
144 (uint64_t)bpf->red_pkt_pass);
145 plt_dump("W7: green_octs_pass \t\t\t0x%" PRIx64 "",
146 (uint64_t)bpf->green_octs_pass);
147 plt_dump("W8: yellow_octs_pass \t\t\t0x%" PRIx64 "",
148 (uint64_t)bpf->yellow_octs_pass);
149 plt_dump("W9: red_octs_pass \t\t\t0x%" PRIx64 "",
150 (uint64_t)bpf->red_octs_pass);
151 plt_dump("W10: green_pkt_drop \t\t\t0x%" PRIx64 "",
152 (uint64_t)bpf->green_pkt_drop);
153 plt_dump("W11: yellow_pkt_drop \t\t\t0x%" PRIx64 "",
154 (uint64_t)bpf->yellow_pkt_drop);
155 plt_dump("W12: red_pkt_drop \t\t\t0x%" PRIx64 "",
156 (uint64_t)bpf->red_pkt_drop);
157 plt_dump("W13: green_octs_drop \t\t\t0x%" PRIx64 "",
158 (uint64_t)bpf->green_octs_drop);
159 plt_dump("W14: yellow_octs_drop \t\t\t0x%" PRIx64 "",
160 (uint64_t)bpf->yellow_octs_drop);
161 plt_dump("W15: red_octs_drop \t\t\t0x%" PRIx64 "",
162 (uint64_t)bpf->red_octs_drop);
166 nix_precolor_conv_table_write(struct roc_nix *roc_nix, uint64_t val,
169 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
172 addr = PLT_PTR_ADD(nix->base, off);
173 plt_write64(val, addr);
177 nix_precolor_vlan_table_update(struct roc_nix *roc_nix,
178 struct roc_nix_bpf_precolor *tbl)
184 for (i = 0; i < tbl->count; i++)
185 val |= (((uint64_t)tbl->color[i]) << (2 * i));
187 if (tbl->mode == ROC_NIX_BPF_PC_MODE_VLAN_INNER) {
188 off = NIX_LF_RX_VLAN1_COLOR_CONV;
191 off = NIX_LF_RX_VLAN0_COLOR_CONV;
195 nix_precolor_conv_table_write(roc_nix, val, off);
200 nix_precolor_inner_dscp_table_update(struct roc_nix *roc_nix,
201 struct roc_nix_bpf_precolor *tbl)
203 uint64_t val_lo = 0, val_hi = 0, i, j;
205 for (i = 0, j = 0; i < (tbl->count / 2); i++, j++)
206 val_lo |= (((uint64_t)tbl->color[i]) << (2 * j));
208 for (j = 0; i < tbl->count; i++, j++)
209 val_hi |= (((uint64_t)tbl->color[i]) << (2 * j));
211 nix_precolor_conv_table_write(roc_nix, val_lo,
212 NIX_LF_RX_IIP_COLOR_CONV_LO);
213 nix_precolor_conv_table_write(roc_nix, val_hi,
214 NIX_LF_RX_IIP_COLOR_CONV_HI);
220 nix_precolor_outer_dscp_table_update(struct roc_nix *roc_nix,
221 struct roc_nix_bpf_precolor *tbl)
223 uint64_t val_lo = 0, val_hi = 0, i, j;
225 for (i = 0, j = 0; i < (tbl->count / 2); i++, j++)
226 val_lo |= (((uint64_t)tbl->color[i]) << (2 * j));
228 for (j = 0; i < tbl->count; i++, j++)
229 val_hi |= (((uint64_t)tbl->color[i]) << (2 * j));
231 nix_precolor_conv_table_write(roc_nix, val_lo,
232 NIX_LF_RX_OIP_COLOR_CONV_LO);
233 nix_precolor_conv_table_write(roc_nix, val_hi,
234 NIX_LF_RX_OIP_COLOR_CONV_HI);
240 nix_precolor_gen_table_update(struct roc_nix *roc_nix,
241 struct roc_nix_bpf_precolor *tbl)
247 for (i = 0; i < tbl->count; i++)
248 val |= (((uint64_t)tbl->color[i]) << (2 * i));
250 if (tbl->mode == ROC_NIX_BPF_PC_MODE_GEN_INNER) {
251 off = NIX_LF_RX_GEN_COLOR_CONVX(1);
254 off = NIX_LF_RX_GEN_COLOR_CONVX(0);
258 nix_precolor_conv_table_write(roc_nix, val, off);
263 roc_nix_bpf_level_to_idx(enum roc_nix_bpf_level_flag level_f)
267 if (level_f & ROC_NIX_BPF_LEVEL_F_LEAF)
269 else if (level_f & ROC_NIX_BPF_LEVEL_F_MID)
271 else if (level_f & ROC_NIX_BPF_LEVEL_F_TOP)
274 idx = ROC_NIX_BPF_LEVEL_IDX_INVALID;
279 roc_nix_bpf_stats_to_idx(enum roc_nix_bpf_stats level_f)
283 if (level_f & ROC_NIX_BPF_GREEN_PKT_F_PASS)
285 else if (level_f & ROC_NIX_BPF_GREEN_OCTS_F_PASS)
287 else if (level_f & ROC_NIX_BPF_GREEN_PKT_F_DROP)
289 else if (level_f & ROC_NIX_BPF_GREEN_OCTS_F_DROP)
291 else if (level_f & ROC_NIX_BPF_YELLOW_PKT_F_PASS)
293 else if (level_f & ROC_NIX_BPF_YELLOW_OCTS_F_PASS)
295 else if (level_f & ROC_NIX_BPF_YELLOW_PKT_F_DROP)
297 else if (level_f & ROC_NIX_BPF_YELLOW_OCTS_F_DROP)
299 else if (level_f & ROC_NIX_BPF_RED_PKT_F_PASS)
301 else if (level_f & ROC_NIX_BPF_RED_OCTS_F_PASS)
303 else if (level_f & ROC_NIX_BPF_RED_PKT_F_DROP)
305 else if (level_f & ROC_NIX_BPF_RED_OCTS_F_DROP)
308 idx = ROC_NIX_BPF_STATS_MAX;
313 roc_nix_bpf_timeunit_get(struct roc_nix *roc_nix, uint32_t *time_unit)
315 struct nix_bandprof_get_hwinfo_rsp *rsp;
316 struct mbox *mbox = get_mbox(roc_nix);
320 if (roc_model_is_cn9k())
321 return NIX_ERR_HW_NOTSUP;
323 req = mbox_alloc_msg_nix_bandprof_get_hwinfo(mbox);
327 rc = mbox_process_msg(mbox, (void *)&rsp);
331 *time_unit = rsp->policer_timeunit;
338 roc_nix_bpf_count_get(struct roc_nix *roc_nix, uint8_t lvl_mask,
339 uint16_t count[ROC_NIX_BPF_LEVEL_MAX])
341 uint8_t mask = lvl_mask & NIX_BPF_LEVEL_F_MASK;
342 struct nix_bandprof_get_hwinfo_rsp *rsp;
343 struct mbox *mbox = get_mbox(roc_nix);
344 uint8_t leaf_idx, mid_idx, top_idx;
348 if (roc_model_is_cn9k())
349 return NIX_ERR_HW_NOTSUP;
352 return NIX_ERR_PARAM;
354 req = mbox_alloc_msg_nix_bandprof_get_hwinfo(mbox);
358 rc = mbox_process_msg(mbox, (void *)&rsp);
362 leaf_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_LEAF);
363 mid_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_MID);
364 top_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_TOP);
366 if (leaf_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID)
367 count[leaf_idx] = rsp->prof_count[sw_to_hw_lvl_map[leaf_idx]];
369 if (mid_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID)
370 count[mid_idx] = rsp->prof_count[sw_to_hw_lvl_map[mid_idx]];
372 if (top_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID)
373 count[top_idx] = rsp->prof_count[sw_to_hw_lvl_map[top_idx]];
380 roc_nix_bpf_alloc(struct roc_nix *roc_nix, uint8_t lvl_mask,
381 uint16_t per_lvl_cnt[ROC_NIX_BPF_LEVEL_MAX],
382 struct roc_nix_bpf_objs *profs)
384 uint8_t mask = lvl_mask & NIX_BPF_LEVEL_F_MASK;
385 struct mbox *mbox = get_mbox(roc_nix);
386 struct nix_bandprof_alloc_req *req;
387 struct nix_bandprof_alloc_rsp *rsp;
388 uint8_t leaf_idx, mid_idx, top_idx;
391 if (roc_model_is_cn9k())
392 return NIX_ERR_HW_NOTSUP;
395 return NIX_ERR_PARAM;
397 leaf_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_LEAF);
398 mid_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_MID);
399 top_idx = roc_nix_bpf_level_to_idx(mask & ROC_NIX_BPF_LEVEL_F_TOP);
401 if ((leaf_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) &&
402 (per_lvl_cnt[leaf_idx] > NIX_MAX_BPF_COUNT_LEAF_LAYER))
403 return NIX_ERR_INVALID_RANGE;
405 if ((mid_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) &&
406 (per_lvl_cnt[mid_idx] > NIX_MAX_BPF_COUNT_MID_LAYER))
407 return NIX_ERR_INVALID_RANGE;
409 if ((top_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) &&
410 (per_lvl_cnt[top_idx] > NIX_MAX_BPF_COUNT_TOP_LAYER))
411 return NIX_ERR_INVALID_RANGE;
413 req = mbox_alloc_msg_nix_bandprof_alloc(mbox);
417 if (leaf_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
418 req->prof_count[sw_to_hw_lvl_map[leaf_idx]] =
419 per_lvl_cnt[leaf_idx];
422 if (mid_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
423 req->prof_count[sw_to_hw_lvl_map[mid_idx]] =
424 per_lvl_cnt[mid_idx];
427 if (top_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
428 req->prof_count[sw_to_hw_lvl_map[top_idx]] =
429 per_lvl_cnt[top_idx];
432 rc = mbox_process_msg(mbox, (void *)&rsp);
436 if (leaf_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
437 profs[leaf_idx].level = leaf_idx;
438 profs[leaf_idx].count =
439 rsp->prof_count[sw_to_hw_lvl_map[leaf_idx]];
440 for (i = 0; i < profs[leaf_idx].count; i++) {
441 profs[leaf_idx].ids[i] =
442 rsp->prof_idx[sw_to_hw_lvl_map[leaf_idx]][i];
446 if (mid_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
447 profs[mid_idx].level = mid_idx;
448 profs[mid_idx].count =
449 rsp->prof_count[sw_to_hw_lvl_map[mid_idx]];
450 for (i = 0; i < profs[mid_idx].count; i++) {
451 profs[mid_idx].ids[i] =
452 rsp->prof_idx[sw_to_hw_lvl_map[mid_idx]][i];
456 if (top_idx != ROC_NIX_BPF_LEVEL_IDX_INVALID) {
457 profs[top_idx].level = top_idx;
458 profs[top_idx].count =
459 rsp->prof_count[sw_to_hw_lvl_map[top_idx]];
460 for (i = 0; i < profs[top_idx].count; i++) {
461 profs[top_idx].ids[i] =
462 rsp->prof_idx[sw_to_hw_lvl_map[top_idx]][i];
471 roc_nix_bpf_free(struct roc_nix *roc_nix, struct roc_nix_bpf_objs *profs,
474 struct mbox *mbox = get_mbox(roc_nix);
475 struct nix_bandprof_free_req *req;
479 if (num_prof >= NIX_RX_BAND_PROF_LAYER_MAX)
480 return NIX_ERR_INVALID_RANGE;
482 req = mbox_alloc_msg_nix_bandprof_free(mbox);
486 for (i = 0; i < num_prof; i++) {
487 level = sw_to_hw_lvl_map[profs[i].level];
488 req->prof_count[level] = profs[i].count;
489 for (j = 0; j < profs[i].count; j++)
490 req->prof_idx[level][j] = profs[i].ids[j];
493 return mbox_process(mbox);
497 roc_nix_bpf_free_all(struct roc_nix *roc_nix)
499 struct mbox *mbox = get_mbox(roc_nix);
500 struct nix_bandprof_free_req *req;
502 req = mbox_alloc_msg_nix_bandprof_free(mbox);
506 req->free_all = true;
507 return mbox_process(mbox);
511 roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t id,
512 enum roc_nix_bpf_level_flag lvl_flag,
513 struct roc_nix_bpf_cfg *cfg)
515 uint64_t exponent_p = 0, mantissa_p = 0, div_exp_p = 0;
516 struct mbox *mbox = get_mbox(roc_nix);
517 struct nix_cn10k_aq_enq_req *aq;
518 uint32_t policer_timeunit;
522 if (roc_model_is_cn9k())
523 return NIX_ERR_HW_NOTSUP;
526 return NIX_ERR_PARAM;
528 rc = roc_nix_bpf_timeunit_get(roc_nix, &policer_timeunit);
532 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
533 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
534 return NIX_ERR_PARAM;
536 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
539 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14) | id;
540 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
541 aq->op = NIX_AQ_INSTOP_WRITE;
543 aq->prof.adjust_exponent = NIX_BPF_DEFAULT_ADJUST_EXPONENT;
544 aq->prof.adjust_mantissa = NIX_BPF_DEFAULT_ADJUST_MANTISSA;
545 if (cfg->lmode == ROC_NIX_BPF_LMODE_BYTE)
546 aq->prof.adjust_mantissa = NIX_BPF_DEFAULT_ADJUST_MANTISSA / 2;
548 aq->prof_mask.adjust_exponent = ~(aq->prof_mask.adjust_exponent);
549 aq->prof_mask.adjust_mantissa = ~(aq->prof_mask.adjust_mantissa);
552 case ROC_NIX_BPF_ALGO_2697:
553 meter_rate_to_nix(cfg->algo2697.cir, &exponent_p, &mantissa_p,
554 &div_exp_p, policer_timeunit);
555 aq->prof.cir_mantissa = mantissa_p;
556 aq->prof.cir_exponent = exponent_p;
558 meter_burst_to_nix(cfg->algo2697.cbs, &exponent_p, &mantissa_p);
559 aq->prof.cbs_mantissa = mantissa_p;
560 aq->prof.cbs_exponent = exponent_p;
562 meter_burst_to_nix(cfg->algo2697.ebs, &exponent_p, &mantissa_p);
563 aq->prof.pebs_mantissa = mantissa_p;
564 aq->prof.pebs_exponent = exponent_p;
566 aq->prof_mask.cir_mantissa = ~(aq->prof_mask.cir_mantissa);
567 aq->prof_mask.cbs_mantissa = ~(aq->prof_mask.cbs_mantissa);
568 aq->prof_mask.pebs_mantissa = ~(aq->prof_mask.pebs_mantissa);
569 aq->prof_mask.cir_exponent = ~(aq->prof_mask.cir_exponent);
570 aq->prof_mask.cbs_exponent = ~(aq->prof_mask.cbs_exponent);
571 aq->prof_mask.pebs_exponent = ~(aq->prof_mask.pebs_exponent);
574 case ROC_NIX_BPF_ALGO_2698:
575 meter_rate_to_nix(cfg->algo2698.cir, &exponent_p, &mantissa_p,
576 &div_exp_p, policer_timeunit);
577 aq->prof.cir_mantissa = mantissa_p;
578 aq->prof.cir_exponent = exponent_p;
580 meter_rate_to_nix(cfg->algo2698.pir, &exponent_p, &mantissa_p,
581 &div_exp_p, policer_timeunit);
582 aq->prof.peir_mantissa = mantissa_p;
583 aq->prof.peir_exponent = exponent_p;
585 meter_burst_to_nix(cfg->algo2698.cbs, &exponent_p, &mantissa_p);
586 aq->prof.cbs_mantissa = mantissa_p;
587 aq->prof.cbs_exponent = exponent_p;
589 meter_burst_to_nix(cfg->algo2698.pbs, &exponent_p, &mantissa_p);
590 aq->prof.pebs_mantissa = mantissa_p;
591 aq->prof.pebs_exponent = exponent_p;
593 aq->prof_mask.cir_mantissa = ~(aq->prof_mask.cir_mantissa);
594 aq->prof_mask.peir_mantissa = ~(aq->prof_mask.peir_mantissa);
595 aq->prof_mask.cbs_mantissa = ~(aq->prof_mask.cbs_mantissa);
596 aq->prof_mask.pebs_mantissa = ~(aq->prof_mask.pebs_mantissa);
597 aq->prof_mask.cir_exponent = ~(aq->prof_mask.cir_exponent);
598 aq->prof_mask.peir_exponent = ~(aq->prof_mask.peir_exponent);
599 aq->prof_mask.cbs_exponent = ~(aq->prof_mask.cbs_exponent);
600 aq->prof_mask.pebs_exponent = ~(aq->prof_mask.pebs_exponent);
603 case ROC_NIX_BPF_ALGO_4115:
604 meter_rate_to_nix(cfg->algo4115.cir, &exponent_p, &mantissa_p,
605 &div_exp_p, policer_timeunit);
606 aq->prof.cir_mantissa = mantissa_p;
607 aq->prof.cir_exponent = exponent_p;
609 meter_rate_to_nix(cfg->algo4115.eir, &exponent_p, &mantissa_p,
610 &div_exp_p, policer_timeunit);
611 aq->prof.peir_mantissa = mantissa_p;
612 aq->prof.peir_exponent = exponent_p;
614 meter_burst_to_nix(cfg->algo4115.cbs, &exponent_p, &mantissa_p);
615 aq->prof.cbs_mantissa = mantissa_p;
616 aq->prof.cbs_exponent = exponent_p;
618 meter_burst_to_nix(cfg->algo4115.ebs, &exponent_p, &mantissa_p);
619 aq->prof.pebs_mantissa = mantissa_p;
620 aq->prof.pebs_exponent = exponent_p;
622 aq->prof_mask.cir_mantissa = ~(aq->prof_mask.cir_mantissa);
623 aq->prof_mask.peir_mantissa = ~(aq->prof_mask.peir_mantissa);
624 aq->prof_mask.cbs_mantissa = ~(aq->prof_mask.cbs_mantissa);
625 aq->prof_mask.pebs_mantissa = ~(aq->prof_mask.pebs_mantissa);
627 aq->prof_mask.cir_exponent = ~(aq->prof_mask.cir_exponent);
628 aq->prof_mask.peir_exponent = ~(aq->prof_mask.peir_exponent);
629 aq->prof_mask.cbs_exponent = ~(aq->prof_mask.cbs_exponent);
630 aq->prof_mask.pebs_exponent = ~(aq->prof_mask.pebs_exponent);
634 return NIX_ERR_PARAM;
637 aq->prof.lmode = cfg->lmode;
638 aq->prof.icolor = cfg->icolor;
639 aq->prof.meter_algo = cfg->alg;
640 aq->prof.pc_mode = cfg->pc_mode;
641 aq->prof.tnl_ena = cfg->tnl_ena;
642 aq->prof.gc_action = cfg->action[ROC_NIX_BPF_COLOR_GREEN];
643 aq->prof.yc_action = cfg->action[ROC_NIX_BPF_COLOR_YELLOW];
644 aq->prof.rc_action = cfg->action[ROC_NIX_BPF_COLOR_RED];
646 aq->prof_mask.lmode = ~(aq->prof_mask.lmode);
647 aq->prof_mask.icolor = ~(aq->prof_mask.icolor);
648 aq->prof_mask.meter_algo = ~(aq->prof_mask.meter_algo);
649 aq->prof_mask.pc_mode = ~(aq->prof_mask.pc_mode);
650 aq->prof_mask.tnl_ena = ~(aq->prof_mask.tnl_ena);
651 aq->prof_mask.gc_action = ~(aq->prof_mask.gc_action);
652 aq->prof_mask.yc_action = ~(aq->prof_mask.yc_action);
653 aq->prof_mask.rc_action = ~(aq->prof_mask.rc_action);
655 return mbox_process(mbox);
659 roc_nix_bpf_ena_dis(struct roc_nix *roc_nix, uint16_t id, struct roc_nix_rq *rq,
662 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
663 struct mbox *mbox = get_mbox(roc_nix);
664 struct nix_cn10k_aq_enq_req *aq;
667 if (roc_model_is_cn9k())
668 return NIX_ERR_HW_NOTSUP;
670 if (rq->qid >= nix->nb_rx_queues)
671 return NIX_ERR_QUEUE_INVALID_RANGE;
673 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
677 aq->ctype = NIX_AQ_CTYPE_RQ;
678 aq->op = NIX_AQ_INSTOP_WRITE;
680 aq->rq.policer_ena = enable;
681 aq->rq_mask.policer_ena = ~(aq->rq_mask.policer_ena);
683 aq->rq.band_prof_id = id;
684 aq->rq_mask.band_prof_id = ~(aq->rq_mask.band_prof_id);
687 rc = mbox_process(mbox);
698 roc_nix_bpf_dump(struct roc_nix *roc_nix, uint16_t id,
699 enum roc_nix_bpf_level_flag lvl_flag)
701 struct mbox *mbox = get_mbox(roc_nix);
702 struct nix_cn10k_aq_enq_rsp *rsp;
703 struct nix_cn10k_aq_enq_req *aq;
707 if (roc_model_is_cn9k())
708 return NIX_ERR_HW_NOTSUP;
710 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
711 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
712 return NIX_ERR_PARAM;
714 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
717 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14 | id);
718 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
719 aq->op = NIX_AQ_INSTOP_READ;
720 rc = mbox_process_msg(mbox, (void *)&rsp);
722 plt_dump("============= band prof id =%d ===============", id);
723 nix_lf_bpf_dump(&rsp->prof);
730 roc_nix_bpf_pre_color_tbl_setup(struct roc_nix *roc_nix, uint16_t id,
731 enum roc_nix_bpf_level_flag lvl_flag,
732 struct roc_nix_bpf_precolor *tbl)
734 struct mbox *mbox = get_mbox(roc_nix);
735 struct nix_cn10k_aq_enq_req *aq;
736 uint8_t pc_mode, tn_ena;
740 if (!tbl || !tbl->count)
741 return NIX_ERR_PARAM;
743 if (roc_model_is_cn9k())
744 return NIX_ERR_HW_NOTSUP;
746 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
747 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
748 return NIX_ERR_PARAM;
751 case ROC_NIX_BPF_PC_MODE_VLAN_INNER:
752 case ROC_NIX_BPF_PC_MODE_VLAN_OUTER:
753 if (tbl->count != NIX_BPF_PRECOLOR_VLAN_TABLE_SIZE) {
754 plt_err("Table size must be %d",
755 NIX_BPF_PRECOLOR_VLAN_TABLE_SIZE);
759 tn_ena = nix_precolor_vlan_table_update(roc_nix, tbl);
760 pc_mode = NIX_RX_BAND_PROF_PC_MODE_VLAN;
762 case ROC_NIX_BPF_PC_MODE_DSCP_INNER:
763 if (tbl->count != NIX_BPF_PRECOLOR_DSCP_TABLE_SIZE) {
764 plt_err("Table size must be %d",
765 NIX_BPF_PRECOLOR_DSCP_TABLE_SIZE);
769 tn_ena = nix_precolor_inner_dscp_table_update(roc_nix, tbl);
770 pc_mode = NIX_RX_BAND_PROF_PC_MODE_DSCP;
772 case ROC_NIX_BPF_PC_MODE_DSCP_OUTER:
773 if (tbl->count != NIX_BPF_PRECOLOR_DSCP_TABLE_SIZE) {
774 plt_err("Table size must be %d",
775 NIX_BPF_PRECOLOR_DSCP_TABLE_SIZE);
779 tn_ena = nix_precolor_outer_dscp_table_update(roc_nix, tbl);
780 pc_mode = NIX_RX_BAND_PROF_PC_MODE_DSCP;
782 case ROC_NIX_BPF_PC_MODE_GEN_INNER:
783 case ROC_NIX_BPF_PC_MODE_GEN_OUTER:
784 if (tbl->count != NIX_BPF_PRECOLOR_GEN_TABLE_SIZE) {
785 plt_err("Table size must be %d",
786 NIX_BPF_PRECOLOR_GEN_TABLE_SIZE);
791 tn_ena = nix_precolor_gen_table_update(roc_nix, tbl);
792 pc_mode = NIX_RX_BAND_PROF_PC_MODE_GEN;
799 /* Update corresponding bandwidth profile too */
800 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
803 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14) | id;
804 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
805 aq->op = NIX_AQ_INSTOP_WRITE;
806 aq->prof.pc_mode = pc_mode;
807 aq->prof.tnl_ena = tn_ena;
808 aq->prof_mask.pc_mode = ~(aq->prof_mask.pc_mode);
809 aq->prof_mask.tnl_ena = ~(aq->prof_mask.tnl_ena);
811 return mbox_process(mbox);
818 roc_nix_bpf_connect(struct roc_nix *roc_nix,
819 enum roc_nix_bpf_level_flag lvl_flag, uint16_t src_id,
822 struct mbox *mbox = get_mbox(roc_nix);
823 struct nix_cn10k_aq_enq_req *aq;
826 if (roc_model_is_cn9k())
827 return NIX_ERR_HW_NOTSUP;
829 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
830 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
831 return NIX_ERR_PARAM;
833 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
836 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14) | src_id;
837 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
838 aq->op = NIX_AQ_INSTOP_WRITE;
840 if (dst_id == ROC_NIX_BPF_ID_INVALID) {
841 aq->prof.hl_en = false;
842 aq->prof_mask.hl_en = ~(aq->prof_mask.hl_en);
844 aq->prof.hl_en = true;
845 aq->prof.band_prof_id = dst_id;
846 aq->prof_mask.hl_en = ~(aq->prof_mask.hl_en);
847 aq->prof_mask.band_prof_id = ~(aq->prof_mask.band_prof_id);
850 return mbox_process(mbox);
854 roc_nix_bpf_stats_read(struct roc_nix *roc_nix, uint16_t id, uint64_t mask,
855 enum roc_nix_bpf_level_flag lvl_flag,
856 uint64_t stats[ROC_NIX_BPF_STATS_MAX])
858 uint8_t yellow_pkt_pass, yellow_octs_pass, yellow_pkt_drop;
859 uint8_t green_octs_drop, yellow_octs_drop, red_octs_drop;
860 uint8_t green_pkt_pass, green_octs_pass, green_pkt_drop;
861 uint8_t red_pkt_pass, red_octs_pass, red_pkt_drop;
862 struct mbox *mbox = get_mbox(roc_nix);
863 struct nix_cn10k_aq_enq_rsp *rsp;
864 struct nix_cn10k_aq_enq_req *aq;
868 if (roc_model_is_cn9k())
869 return NIX_ERR_HW_NOTSUP;
871 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
872 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
873 return NIX_ERR_PARAM;
875 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
878 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14 | id);
879 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
880 aq->op = NIX_AQ_INSTOP_READ;
881 rc = mbox_process_msg(mbox, (void *)&rsp);
886 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_PASS);
888 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS);
890 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_DROP);
892 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP);
894 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS);
896 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS);
898 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP);
900 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP);
902 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_PASS);
904 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_PASS);
906 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_DROP);
908 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_DROP);
910 if (green_pkt_pass != ROC_NIX_BPF_STATS_MAX)
911 stats[green_pkt_pass] = rsp->prof.green_pkt_pass;
913 if (green_octs_pass != ROC_NIX_BPF_STATS_MAX)
914 stats[green_octs_pass] = rsp->prof.green_octs_pass;
916 if (green_pkt_drop != ROC_NIX_BPF_STATS_MAX)
917 stats[green_pkt_drop] = rsp->prof.green_pkt_drop;
919 if (green_octs_drop != ROC_NIX_BPF_STATS_MAX)
920 stats[green_octs_drop] = rsp->prof.green_octs_pass;
922 if (yellow_pkt_pass != ROC_NIX_BPF_STATS_MAX)
923 stats[yellow_pkt_pass] = rsp->prof.yellow_pkt_pass;
925 if (yellow_octs_pass != ROC_NIX_BPF_STATS_MAX)
926 stats[yellow_octs_pass] = rsp->prof.yellow_octs_pass;
928 if (yellow_pkt_drop != ROC_NIX_BPF_STATS_MAX)
929 stats[yellow_pkt_drop] = rsp->prof.yellow_pkt_drop;
931 if (yellow_octs_drop != ROC_NIX_BPF_STATS_MAX)
932 stats[yellow_octs_drop] = rsp->prof.yellow_octs_drop;
934 if (red_pkt_pass != ROC_NIX_BPF_STATS_MAX)
935 stats[red_pkt_pass] = rsp->prof.red_pkt_pass;
937 if (red_octs_pass != ROC_NIX_BPF_STATS_MAX)
938 stats[red_octs_pass] = rsp->prof.red_octs_pass;
940 if (red_pkt_drop != ROC_NIX_BPF_STATS_MAX)
941 stats[red_pkt_drop] = rsp->prof.red_pkt_drop;
943 if (red_octs_drop != ROC_NIX_BPF_STATS_MAX)
944 stats[red_octs_drop] = rsp->prof.red_octs_drop;
950 roc_nix_bpf_stats_reset(struct roc_nix *roc_nix, uint16_t id, uint64_t mask,
951 enum roc_nix_bpf_level_flag lvl_flag)
953 struct mbox *mbox = get_mbox(roc_nix);
954 struct nix_cn10k_aq_enq_req *aq;
957 if (roc_model_is_cn9k())
958 return NIX_ERR_HW_NOTSUP;
960 level_idx = roc_nix_bpf_level_to_idx(lvl_flag);
961 if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID)
962 return NIX_ERR_PARAM;
964 aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
967 aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14 | id);
968 aq->ctype = NIX_AQ_CTYPE_BAND_PROF;
969 aq->op = NIX_AQ_INSTOP_WRITE;
971 if (mask & ROC_NIX_BPF_GREEN_PKT_F_PASS) {
972 aq->prof.green_pkt_pass = 0;
973 aq->prof_mask.green_pkt_pass = ~(aq->prof_mask.green_pkt_pass);
975 if (mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS) {
976 aq->prof.green_octs_pass = 0;
977 aq->prof_mask.green_octs_pass =
978 ~(aq->prof_mask.green_octs_pass);
980 if (mask & ROC_NIX_BPF_GREEN_PKT_F_DROP) {
981 aq->prof.green_pkt_drop = 0;
982 aq->prof_mask.green_pkt_drop = ~(aq->prof_mask.green_pkt_drop);
984 if (mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP) {
985 aq->prof.green_octs_drop = 0;
986 aq->prof_mask.green_octs_drop =
987 ~(aq->prof_mask.green_octs_drop);
989 if (mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS) {
990 aq->prof.yellow_pkt_pass = 0;
991 aq->prof_mask.yellow_pkt_pass =
992 ~(aq->prof_mask.yellow_pkt_pass);
994 if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS) {
995 aq->prof.yellow_octs_pass = 0;
996 aq->prof_mask.yellow_octs_pass =
997 ~(aq->prof_mask.yellow_octs_pass);
999 if (mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP) {
1000 aq->prof.yellow_pkt_drop = 0;
1001 aq->prof_mask.yellow_pkt_drop =
1002 ~(aq->prof_mask.yellow_pkt_drop);
1004 if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP) {
1005 aq->prof.yellow_octs_drop = 0;
1006 aq->prof_mask.yellow_octs_drop =
1007 ~(aq->prof_mask.yellow_octs_drop);
1009 if (mask & ROC_NIX_BPF_RED_PKT_F_PASS) {
1010 aq->prof.red_pkt_pass = 0;
1011 aq->prof_mask.red_pkt_pass = ~(aq->prof_mask.red_pkt_pass);
1013 if (mask & ROC_NIX_BPF_RED_OCTS_F_PASS) {
1014 aq->prof.red_octs_pass = 0;
1015 aq->prof_mask.red_octs_pass = ~(aq->prof_mask.red_octs_pass);
1017 if (mask & ROC_NIX_BPF_RED_PKT_F_DROP) {
1018 aq->prof.red_pkt_drop = 0;
1019 aq->prof_mask.red_pkt_drop = ~(aq->prof_mask.red_pkt_drop);
1021 if (mask & ROC_NIX_BPF_RED_OCTS_F_DROP) {
1022 aq->prof.red_octs_drop = 0;
1023 aq->prof_mask.red_octs_drop = ~(aq->prof_mask.red_octs_drop);
1026 return mbox_process(mbox);
1030 roc_nix_bpf_lf_stats_read(struct roc_nix *roc_nix, uint64_t mask,
1031 uint64_t stats[ROC_NIX_BPF_STATS_MAX])
1033 uint8_t yellow_pkt_pass, yellow_octs_pass, yellow_pkt_drop;
1034 uint8_t green_octs_drop, yellow_octs_drop, red_octs_drop;
1035 uint8_t green_pkt_pass, green_octs_pass, green_pkt_drop;
1036 uint8_t red_pkt_pass, red_octs_pass, red_pkt_drop;
1037 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1040 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_PASS);
1042 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS);
1044 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_DROP);
1046 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP);
1048 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS);
1050 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS);
1052 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP);
1054 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP);
1056 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_PASS);
1058 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_PASS);
1060 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_DROP);
1062 roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_DROP);
1064 if (green_pkt_pass != ROC_NIX_BPF_STATS_MAX) {
1065 stats[green_pkt_pass] =
1066 NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_OCTS_PASSED);
1069 if (green_octs_pass != ROC_NIX_BPF_STATS_MAX) {
1070 stats[green_octs_pass] =
1071 NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_PKTS_PASSED);
1074 if (green_pkt_drop != ROC_NIX_BPF_STATS_MAX) {
1075 stats[green_pkt_drop] =
1076 NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_OCTS_DROP);
1079 if (green_octs_drop != ROC_NIX_BPF_STATS_MAX) {
1080 stats[green_octs_drop] =
1081 NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_PKTS_DROP);
1084 if (yellow_pkt_pass != ROC_NIX_BPF_STATS_MAX) {
1085 stats[yellow_pkt_pass] =
1086 NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_PKTS_PASSED);
1089 if (yellow_octs_pass != ROC_NIX_BPF_STATS_MAX) {
1090 stats[yellow_octs_pass] =
1091 NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_OCTS_PASSED);
1094 if (yellow_pkt_drop != ROC_NIX_BPF_STATS_MAX) {
1095 stats[yellow_pkt_drop] =
1096 NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_PKTS_DROP);
1099 if (yellow_octs_drop != ROC_NIX_BPF_STATS_MAX) {
1100 stats[yellow_octs_drop] =
1101 NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_OCTS_DROP);
1104 if (red_pkt_pass != ROC_NIX_BPF_STATS_MAX) {
1105 stats[red_pkt_pass] =
1106 NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_OCTS_PASSED);
1109 if (red_octs_pass != ROC_NIX_BPF_STATS_MAX) {
1110 stats[red_octs_pass] =
1111 NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_PKTS_PASSED);
1114 if (red_pkt_drop != ROC_NIX_BPF_STATS_MAX) {
1115 stats[red_pkt_drop] =
1116 NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_OCTS_DROP);
1119 if (red_octs_drop != ROC_NIX_BPF_STATS_MAX) {
1120 stats[red_octs_drop] =
1121 NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_PKTS_DROP);
1128 roc_nix_bpf_lf_stats_reset(struct roc_nix *roc_nix, uint64_t mask)
1130 struct nix *nix = roc_nix_to_nix_priv(roc_nix);
1132 if (mask & ROC_NIX_BPF_GREEN_PKT_F_PASS)
1133 NIX_RST_STATS(ROC_NIX_BPF_GREEN_PKT_F_PASS);
1134 if (mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS)
1135 NIX_RST_STATS(ROC_NIX_BPF_GREEN_OCTS_F_PASS);
1136 if (mask & ROC_NIX_BPF_GREEN_PKT_F_DROP)
1137 NIX_RST_STATS(ROC_NIX_BPF_GREEN_PKT_F_DROP);
1138 if (mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP)
1139 NIX_RST_STATS(ROC_NIX_BPF_GREEN_OCTS_F_DROP);
1140 if (mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS)
1141 NIX_RST_STATS(ROC_NIX_BPF_YELLOW_PKT_F_PASS);
1142 if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS)
1143 NIX_RST_STATS(ROC_NIX_BPF_YELLOW_OCTS_F_PASS);
1144 if (mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP)
1145 NIX_RST_STATS(ROC_NIX_BPF_YELLOW_PKT_F_DROP);
1146 if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP)
1147 NIX_RST_STATS(ROC_NIX_BPF_YELLOW_OCTS_F_DROP);
1148 if (mask & ROC_NIX_BPF_RED_PKT_F_PASS)
1149 NIX_RST_STATS(ROC_NIX_BPF_RED_PKT_F_PASS);
1150 if (mask & ROC_NIX_BPF_RED_OCTS_F_PASS)
1151 NIX_RST_STATS(ROC_NIX_BPF_RED_OCTS_F_PASS);
1152 if (mask & ROC_NIX_BPF_RED_PKT_F_DROP)
1153 NIX_RST_STATS(ROC_NIX_BPF_RED_PKT_F_DROP);
1154 if (mask & ROC_NIX_BPF_RED_OCTS_F_DROP)
1155 NIX_RST_STATS(ROC_NIX_BPF_RED_OCTS_F_DROP);