Skip to content

Commit de9f09e

Browse files
rbhansaliJerin Jacob
authored andcommitted
common/cnxk: fix duplicate branch compiler warning
With compiler option '-Wduplicated-branches', getting few warnings such as "this condition has identical branches". Macros are updated to address these warnings. Bugzilla ID: 1811 Fixes: 0d9e323 ("common/cnxk: support for CN20K inline IPsec") Fixes: c045d2e ("common/cnxk: add CPT configuration") Cc: stable@dpdk.org Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
1 parent 58d1fbe commit de9f09e

File tree

6 files changed

+20
-27
lines changed

6 files changed

+20
-27
lines changed

drivers/common/cnxk/hw/rvu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
#define RVU_VF_MBOX_REGION (0xc0000ull) /* [CN10K, .) */
106106
#define RVU_VF_MSIX_PBAX(a) (0xf0000ull | (uint64_t)(a) << 3)
107107

108+
#define RVU_BLOCK_ADDRX_DISC(a) RVU_PF_BLOCK_ADDRX_DISC(a)
109+
108110
/* CN20k RVU mbox registers */
109111
#define RVU_MBOX_AF_AFPFX_TRIGX(a) (0x9000 | (a) << 3)
110112
#define RVU_MBOX_PF_PFAF_TRIGX(a) RVU_PF_PFAF_MBOXX(a)

drivers/common/cnxk/roc_cpt.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,9 @@ cpt_get_blkaddr(struct dev *dev)
677677
* attached to. Assume CPT LF's of only one block are attached
678678
* to a pffunc.
679679
*/
680-
if (dev_is_vf(dev))
681-
off = RVU_VF_BLOCK_ADDRX_DISC(RVU_BLOCK_ADDR_CPT1);
682-
else
683-
off = RVU_PF_BLOCK_ADDRX_DISC(RVU_BLOCK_ADDR_CPT1);
680+
681+
/* PF and VF block address offset is same, hence using common offset */
682+
off = RVU_BLOCK_ADDRX_DISC(RVU_BLOCK_ADDR_CPT1);
684683

685684
reg = plt_read64(dev->bar2 + off);
686685

drivers/common/cnxk/roc_nix_inl.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_INB_SA_SZ ==
1919
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_INB_SA_SZ == 1024);
2020
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ ==
2121
1UL << ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ_LOG2);
22+
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_INB_SA_SZ == ROC_NIX_INL_OW_IPSEC_INB_SA_SZ);
23+
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_INB_SA_SZ == ROC_NIX_INL_ON_IPSEC_INB_SA_SZ);
24+
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ == ROC_NIX_INL_OW_IPSEC_OUTB_SA_SZ);
25+
PLT_STATIC_ASSERT(ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ == ROC_NIX_INL_ON_IPSEC_OUTB_SA_SZ);
2226

2327
static int
2428
nix_inl_meta_aura_destroy(struct roc_nix *roc_nix)
@@ -427,12 +431,8 @@ nix_inl_inb_ipsec_sa_tbl_setup(struct roc_nix *roc_nix)
427431
/* CN9K SA size is different */
428432
if (roc_nix->custom_inb_sa)
429433
inb_sa_sz = ROC_NIX_INL_INB_CUSTOM_SA_SZ;
430-
else if (roc_model_is_cn9k())
431-
inb_sa_sz = ROC_NIX_INL_ON_IPSEC_INB_SA_SZ;
432-
else if (roc_model_is_cn10k())
433-
inb_sa_sz = ROC_NIX_INL_OT_IPSEC_INB_SA_SZ;
434434
else
435-
inb_sa_sz = ROC_NIX_INL_OW_IPSEC_INB_SA_SZ;
435+
inb_sa_sz = ROC_NIX_INL_IPSEC_INB_SA_SZ;
436436

437437
/* Alloc contiguous memory for Inbound SA's */
438438
nix->inb_sa_sz[profile_id] = inb_sa_sz;
@@ -1198,10 +1198,9 @@ nix_inl_eng_caps_get(struct nix *nix)
11981198
inst.rptr = (uint64_t)rptr;
11991199
inst.w4.s.opcode_major = ROC_LOADFVC_MAJOR_OP;
12001200
inst.w4.s.opcode_minor = ROC_LOADFVC_MINOR_OP;
1201-
if (roc_model_is_cn9k() || roc_model_is_cn10k())
1202-
inst.w7.s.egrp = ROC_LEGACY_CPT_DFLT_ENG_GRP_SE;
1203-
else
1204-
inst.w7.s.egrp = ROC_CPT_DFLT_ENG_GRP_SE;
1201+
1202+
/* SE engine group ID is same for all platform */
1203+
inst.w7.s.egrp = ROC_CPT_DFLT_ENG_GRP_SE;
12051204

12061205
/* Use 1 min timeout for the poll */
12071206
const uint64_t timeout = plt_tsc_cycles() + 60 * plt_tsc_hz();
@@ -1614,13 +1613,7 @@ roc_nix_inl_outb_init(struct roc_nix *roc_nix)
16141613
if (!roc_nix->ipsec_out_max_sa)
16151614
goto skip_sa_alloc;
16161615

1617-
/* CN9K SA size is different */
1618-
if (roc_model_is_cn9k())
1619-
sa_sz = ROC_NIX_INL_ON_IPSEC_OUTB_SA_SZ;
1620-
else if (roc_model_is_cn10k())
1621-
sa_sz = ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ;
1622-
else
1623-
sa_sz = ROC_NIX_INL_OW_IPSEC_OUTB_SA_SZ;
1616+
sa_sz = ROC_NIX_INL_IPSEC_OUTB_SA_SZ;
16241617

16251618
/* Alloc contiguous memory of outbound SA */
16261619
sa_base = plt_zmalloc(sa_sz * roc_nix->ipsec_out_max_sa,

drivers/common/cnxk/roc_nix_inl_dev.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,8 @@ nix_inl_nix_setup(struct nix_inl_dev *inl_dev)
837837
/* CN9K SA is different */
838838
if (inl_dev->custom_inb_sa)
839839
inb_sa_sz = ROC_NIX_INL_INB_CUSTOM_SA_SZ;
840-
else if (roc_model_is_cn9k())
841-
inb_sa_sz = ROC_NIX_INL_ON_IPSEC_INB_SA_SZ;
842-
else if (roc_model_is_cn10k())
843-
inb_sa_sz = ROC_NIX_INL_OT_IPSEC_INB_SA_SZ;
844840
else
845-
inb_sa_sz = ROC_NIX_INL_OW_IPSEC_INB_SA_SZ;
841+
inb_sa_sz = ROC_NIX_INL_OT_IPSEC_INB_SA_SZ;
846842

847843
/* Alloc contiguous memory for Inbound SA's */
848844
inl_dev->inb_sa_sz[profile_id] = inb_sa_sz;

drivers/common/cnxk/roc_nix_inl_dp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
(ROC_NIX_INL_OW_IPSEC_OUTB_HW_SZ + ROC_NIX_INL_OW_IPSEC_OUTB_SW_RSVD)
4242
#define ROC_NIX_INL_OW_IPSEC_OUTB_SA_SZ_LOG2 9
4343

44+
#define ROC_NIX_INL_IPSEC_INB_SA_SZ ROC_NIX_INL_OT_IPSEC_INB_SA_SZ
45+
#define ROC_NIX_INL_IPSEC_OUTB_SA_SZ ROC_NIX_INL_OT_IPSEC_OUTB_SA_SZ
46+
4447
/* Alignment of SA Base */
4548
#define ROC_NIX_INL_SA_BASE_ALIGN BIT_ULL(16)
4649

drivers/common/cnxk/roc_nix_priv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#define NIX_CQ_SEC_THRESH_LEVEL_REF1 (20 * 256 / 100)
2424
#define NIX_CQ_BP_THRESH_LEVEL_REF1 (60 * 256 / 100)
2525
#define NIX_CQ_SEC_BP_THRESH_LEVEL_REF1 (50 * 256 / 100)
26-
#define NIX_CQ_LBP_THRESH_FRAC_REF1 (80 * 16 / 100)
26+
#define NIX_CQ_LBP_THRESH_FRAC_REF1 (80 * 16 / 100.0)
2727

2828
/* Apply LBP at 75% of actual BP */
29-
#define NIX_CQ_LBP_THRESH_FRAC (75 * 16 / 100)
29+
#define NIX_CQ_LBP_THRESH_FRAC (75 * 16 / 100.0)
3030
#define NIX_CQ_FULL_ERRATA_SKID (1024ull * 256)
3131
#define NIX_RQ_AURA_BP_THRESH(percent, limit, shift) ((((limit) * (percent)) / 100) >> (shift))
3232

0 commit comments

Comments
 (0)