The PKO flow control register value encoded the DQ stride with "(PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16) ? 1 : 0", which clang reports as unreachable because PKO_DQ_FC_STRIDE is defined as PKO_DQ_FC_STRIDE_16.
The conditional documents nothing on its own: the reader has to work out that it is constant and then look up the register layout. Hard code the stride bit and add a static_assert() on the PKO_DQ_FC_STRIDE definition, so changing the stride fails the build instead of silently programming the wrong value. Signed-off-by: Stephen Hemminger <[email protected]> --- drivers/net/octeontx/base/octeontx_pkovf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c index 5326fe24b9..112b3a217b 100644 --- a/drivers/net/octeontx/base/octeontx_pkovf.c +++ b/drivers/net/octeontx/base/octeontx_pkovf.c @@ -2,6 +2,7 @@ * Copyright(c) 2017 Cavium, Inc */ +#include <assert.h> #include <stdbool.h> #include <string.h> #include <stdio.h> @@ -17,6 +18,12 @@ #include "octeontx_io.h" #include "octeontx_pkovf.h" +/* + * The DQ_FC_CONFIG STRIDE bit below is hard coded for a stride of 16. + */ +static_assert(PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16, + "PKO flow control stride must be 16"); + struct octeontx_pko_iomem { uint8_t *va; rte_iova_t iova; @@ -523,7 +530,7 @@ octeontx_pko_init_fc(const size_t pko_vf_count) (sizeof(struct octeontx_pko_fc_ctl_s) * dq_ix)) & ~0x7F; reg |= /* BASE */ (0x2 << 3) | /* HYST_BITS */ - (((PKO_DQ_FC_STRIDE == PKO_DQ_FC_STRIDE_16) ? 1 : 0) << 2) | + (1 << 2) | /* STRIDE: 16 */ (0x1 << 0); /* ENABLE */ octeontx_write64(reg, vf_bar0 + PKO_VF_DQ_FC_CONFIG); -- 2.53.0

