Skip to content

Commit 3a2140c

Browse files
Aarnav JPJerin Jacob
authored andcommitted
drivers: fix Klocwork issues
fixed klocwork suggested issues in cnxk component of drivers module Fixes: db5744d ("common/cnxk: support NIX debug for CN20K") Fixes: 3c31a74 ("common/cnxk: config CPT result address for CN20K") Fixes: 4b8eb5b ("common/cnxk: reserve CPT LF for Rx inject") Fixes: f410059 ("common/cnxk: support inline inbound queue") Fixes: 47cca25 ("net/cnxk: support Rx inject") Fixes: ac35d4b ("net/cnxk: support ingress meter pre-color") Cc: [email protected] Signed-off-by: Aarnav JP <[email protected]>
1 parent a8d7afd commit 3a2140c

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Aakash Sasidharan <[email protected]>
2+
Aarnav JP <[email protected]>
23
Aaro Koskinen <[email protected]>
34
Aaron Campbell <[email protected]>
45
Aaron Conole <[email protected]>

drivers/common/cnxk/roc_nix_debug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ nix_lf_rq_dump(__io struct nix_cn20k_rq_ctx_s *ctx, FILE *file)
769769

770770
nix_dump(file, "W2: xqe_hdr_split \t\t%d\nW2: xqe_imm_copy \t\t%d",
771771
ctx->xqe_hdr_split, ctx->xqe_imm_copy);
772-
nix_dump(file, "W2: band_prof_id\t\t%d\n",
773-
((ctx->band_prof_id_h << 10) | ctx->band_prof_id_l));
772+
nix_dump(file, "W2: band_prof_id\t\t0x%" PRIx64 "\n",
773+
(uint64_t)((ctx->band_prof_id_h << 10) | ctx->band_prof_id_l));
774774
nix_dump(file, "W2: xqe_imm_size \t\t%d\nW2: later_skip \t\t\t%d",
775775
ctx->xqe_imm_size, ctx->later_skip);
776776
nix_dump(file, "W2: sso_bp_ena\t\t%d\n", ctx->sso_bp_ena);

drivers/common/cnxk/roc_nix_inl.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ nix_inl_reass_inb_sa_tbl_setup(struct roc_nix *roc_nix)
581581
struct nix_inl_dev *inl_dev = NULL;
582582
uint64_t max_sa = 1, sa_pow2_sz;
583583
uint64_t sa_idx_w, lenm1_max;
584-
uint64_t res_addr_offset;
584+
uint64_t res_addr_offset = 0;
585585
uint64_t def_cptq = 0;
586586
size_t inb_sa_sz = 1;
587587
uint8_t profile_id;
@@ -626,12 +626,11 @@ nix_inl_reass_inb_sa_tbl_setup(struct roc_nix *roc_nix)
626626
inl_dev = idev->nix_inl_dev;
627627
if (inl_dev->nb_inb_cptlfs)
628628
def_cptq = inl_dev->nix_inb_qids[inl_dev->inb_cpt_lf_id];
629+
res_addr_offset = (uint64_t)(inl_dev->res_addr_offset & 0xFF) << 48;
630+
if (res_addr_offset)
631+
res_addr_offset |= (1UL << 56);
629632
}
630633

631-
res_addr_offset = (uint64_t)(inl_dev->res_addr_offset & 0xFF) << 48;
632-
if (res_addr_offset)
633-
res_addr_offset |= (1UL << 56);
634-
635634
lf_cfg->enable = 1;
636635
lf_cfg->profile_id = profile_id;
637636
lf_cfg->rx_inline_sa_base = (uintptr_t)nix->inb_sa_base[profile_id];
@@ -850,12 +849,12 @@ roc_nix_inl_inb_rx_inject_enable(struct roc_nix *roc_nix, bool inb_inl_dev)
850849

851850
if (inb_inl_dev) {
852851
inl_dev = idev->nix_inl_dev;
853-
if (inl_dev && inl_dev->attach_cptlf && inl_dev->rx_inj_ena &&
852+
if (inl_dev && inl_dev->attach_cptlf && inl_dev->rx_inj_ena && roc_nix &&
854853
roc_nix->rx_inj_ena)
855854
return true;
856855
}
857856

858-
return roc_nix->rx_inj_ena;
857+
return roc_nix ? roc_nix->rx_inj_ena : 0;
859858
}
860859

861860
uint32_t

drivers/net/cnxk/cn10k_ethdev_sec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,8 @@ cn10k_eth_sec_rx_inject_config(void *device, uint16_t port_id, bool enable)
13341334
roc_idev_nix_rx_inject_set(port_id, enable);
13351335

13361336
inl_lf = roc_nix_inl_inb_inj_lf_get(nix);
1337+
if (!inl_lf)
1338+
return -ENOTSUP;
13371339
sa_base = roc_nix_inl_inb_sa_base_get(nix, dev->inb.inl_dev);
13381340

13391341
inj_cfg = &dev->inj_cfg;

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)