Skip to content

Commit db4c93a

Browse files
Aarnav JPJerin Jacob
authored andcommitted
net/cnxk: fix invalid default pre color
While converting to HW specific icolor, check for invalid default pre color. Fixes: ac35d4b ("net/cnxk: support ingress meter pre-color") Cc: [email protected] Signed-off-by: Aarnav JP <[email protected]>
1 parent e385134 commit db4c93a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/cnxk/cnxk_ethdev_mtr.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,13 @@ nix_mtr_config_map(struct cnxk_meter_node *mtr, struct roc_nix_bpf_cfg *cfg)
12611261

12621262
cfg->alg = alg_map[profile->profile.alg];
12631263
cfg->lmode = profile->profile.packet_mode;
1264-
cfg->icolor = color_map[mtr->params.default_input_color];
1264+
int idx = mtr->params.default_input_color;
1265+
1266+
/* Index validation */
1267+
if (idx >= RTE_COLORS)
1268+
cfg->icolor = ROC_NIX_BPF_COLOR_GREEN;
1269+
else
1270+
cfg->icolor = color_map[idx];
12651271

12661272
switch (RTE_MTR_COLOR_IN_PROTO_OUTER_IP) {
12671273
case RTE_MTR_COLOR_IN_PROTO_OUTER_IP:

0 commit comments

Comments
 (0)