[PATCH 1/8] common/cnxk: fix shift offset for tl3 length disable

2021-12-09 Thread Nithin Dabilpuram
Fix shift offset for length disable flag in NIXX_AF_TL3X_SHAPE
register to be 24 instead of zero similar to other level SHAPE
registers. Also mask unused bits in adjust value.

Fixes: 0885429c3028 ("common/cnxk: add NIX TM hierarchy enable/disable")

Signed-off-by: Nithin Dabilpuram 
Signed-off-by: Satha Rao 
---
 drivers/common/cnxk/roc_nix_tm_utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_nix_tm_utils.c 
b/drivers/common/cnxk/roc_nix_tm_utils.c
index 543adf9..9e80c2a 100644
--- a/drivers/common/cnxk/roc_nix_tm_utils.c
+++ b/drivers/common/cnxk/roc_nix_tm_utils.c
@@ -642,6 +642,7 @@ nix_tm_shaper_reg_prep(struct nix_tm_node *node,
else if (profile)
adjust = profile->pkt_len_adj;
 
+   adjust &= 0x1FF;
plt_tm_dbg("Shaper config node %s(%u) lvl %u id %u, "
   "pir %" PRIu64 "(%" PRIu64 "B),"
   " cir %" PRIu64 "(%" PRIu64 "B)"
@@ -708,7 +709,7 @@ nix_tm_shaper_reg_prep(struct nix_tm_node *node,
/* Configure RED algo */
reg[k] = NIX_AF_TL3X_SHAPE(schq);
regval[k] = (adjust | (uint64_t)node->red_algo << 9 |
-(uint64_t)node->pkt_mode);
+(uint64_t)node->pkt_mode << 24);
k++;
 
break;
-- 
2.8.4



[PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup

2021-12-09 Thread Nithin Dabilpuram
From: Gowrishankar Muthukrishnan 

In shaper profiles cleanup, KW reports infinite loop although existing
loop condition is alright. False positive may be due to tqh_first not
checked in loop, hence switching to FOREACH_SAFE to make KW happy.

Signed-off-by: Gowrishankar Muthukrishnan 
Signed-off-by: Shijith Thotton 
---
 drivers/common/cnxk/roc_nix_tm.c   | 8 
 drivers/common/cnxk/roc_platform.h | 2 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index b3d8ebd..fe9e83f 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -17,16 +17,16 @@ bitmap_ctzll(uint64_t slab)
 void
 nix_tm_clear_shaper_profiles(struct nix *nix)
 {
-   struct nix_tm_shaper_profile *shaper_profile;
+   struct nix_tm_shaper_profile *shaper_profile, *tmp;
+   struct nix_tm_shaper_profile_list *list;
 
-   shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list);
-   while (shaper_profile != NULL) {
+   list = &nix->shaper_profile_list;
+   PLT_TAILQ_FOREACH_SAFE(shaper_profile, list, shaper, tmp) {
if (shaper_profile->ref_cnt)
plt_warn("Shaper profile %u has non zero references",
 shaper_profile->id);
TAILQ_REMOVE(&nix->shaper_profile_list, shaper_profile, shaper);
nix_tm_shaper_profile_free(shaper_profile);
-   shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list);
}
 }
 
diff --git a/drivers/common/cnxk/roc_platform.h 
b/drivers/common/cnxk/roc_platform.h
index 61d4781..3648e84 100644
--- a/drivers/common/cnxk/roc_platform.h
+++ b/drivers/common/cnxk/roc_platform.h
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "roc_bits.h"
@@ -53,6 +54,7 @@
 #define BITMASK_ULL GENMASK_ULL
 #define PLT_ALIGN_CEIL  RTE_ALIGN_CEIL
 #define PLT_INITRTE_INIT
+#define PLT_TAILQ_FOREACH_SAFE  RTE_TAILQ_FOREACH_SAFE
 
 /** Divide ceil */
 #define PLT_DIV_CEIL(x, y) \
-- 
2.8.4



[PATCH 3/8] common/cnxk: change order of frag sizes and infos

2021-12-09 Thread Nithin Dabilpuram
Change the order of frag sizes and infos to match HW
implementation.

Signed-off-by: Nithin Dabilpuram 
Signed-off-by: Vidya Sagar Velumuri 
---
 drivers/common/cnxk/hw/cpt.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/common/cnxk/hw/cpt.h b/drivers/common/cnxk/hw/cpt.h
index 919f842..99a900c 100644
--- a/drivers/common/cnxk/hw/cpt.h
+++ b/drivers/common/cnxk/hw/cpt.h
@@ -286,10 +286,10 @@ struct cpt_frag_info_s {
union {
uint64_t u64;
struct {
-   union cpt_frag_info f3;
-   union cpt_frag_info f2;
-   union cpt_frag_info f1;
union cpt_frag_info f0;
+   union cpt_frag_info f1;
+   union cpt_frag_info f2;
+   union cpt_frag_info f3;
};
} w0;
 
@@ -297,10 +297,10 @@ struct cpt_frag_info_s {
union {
uint64_t u64;
struct {
-   uint16_t frag_size3;
-   uint16_t frag_size2;
-   uint16_t frag_size1;
uint16_t frag_size0;
+   uint16_t frag_size1;
+   uint16_t frag_size2;
+   uint16_t frag_size3;
};
} w1;
 };
-- 
2.8.4



[PATCH 4/8] common/cnxk: reset stale values on error debug registers

2021-12-09 Thread Nithin Dabilpuram
From: Harman Kalra 

LF's error debug registers like NIX_LF_SQ_OP_ERR_DBG,
NIX_LF_MNQ_ERR_DBG, NIX_LF_SEND_ERR_DBG captures debug
info for an error detected during LMT operation or meta
enqueue or after meta enqueue granted respectively. HW
sets a valid bit when info is captured and SW is expected
to clear this valid bit by writing 1, else these registers
will show stale values of first interrupt when occurred and
will never update with subsequent interrupts.

Signed-off-by: Harman Kalra 
---
 drivers/common/cnxk/roc_nix_irq.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_nix_irq.c 
b/drivers/common/cnxk/roc_nix_irq.c
index a5cd9d4..7dcd533 100644
--- a/drivers/common/cnxk/roc_nix_irq.c
+++ b/drivers/common/cnxk/roc_nix_irq.c
@@ -202,9 +202,12 @@ nix_lf_sq_debug_reg(struct nix *nix, uint32_t off)
uint64_t reg;
 
reg = plt_read64(nix->base + off);
-   if (reg & BIT_ULL(44))
+   if (reg & BIT_ULL(44)) {
plt_err("SQ=%d err_code=0x%x", (int)((reg >> 8) & 0xf),
(uint8_t)(reg & 0xff));
+   /* Clear valid bit */
+   plt_write64(BIT_ULL(44), nix->base + off);
+   }
 }
 
 static void
-- 
2.8.4



[PATCH 5/8] common/cnxk: always use single qint with NIX

2021-12-09 Thread Nithin Dabilpuram
From: Harman Kalra 

An errata exists whereby, in certain cases NIX may use an
incorrect QINT_IDX for SQ interrupts. As a result, the
interrupt may not be delivered to software, or may not be
associated with the correct SQ.
When NIX uses an incorrect QINT_IDX :
1. NIX_LF_QINT(0..63)_CNT[COUNT] will be incremented for
incorrect QINT.
2. NIX_LF_QINT(0..63)_INT[INTR] will be set for incorrect
QINT.

Signed-off-by: Harman Kalra 
---
 drivers/common/cnxk/roc_nix_queue.c | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_queue.c 
b/drivers/common/cnxk/roc_nix_queue.c
index c8c8401..4455fc1 100644
--- a/drivers/common/cnxk/roc_nix_queue.c
+++ b/drivers/common/cnxk/roc_nix_queue.c
@@ -680,7 +680,11 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, 
uint32_t rr_quantum,
aq->sq.sq_int_ena |= BIT(NIX_SQINT_MNQ_ERR);
 
/* Many to one reduction */
-   aq->sq.qint_idx = sq->qid % nix->qints;
+   /* Assigning QINT 0 to all the SQs, an errata exists where NIXTX can
+* send incorrect QINT_IDX when reporting queue interrupt (QINT). This
+* might result in software missing the interrupt.
+*/
+   aq->sq.qint_idx = 0;
 }
 
 static int
@@ -779,8 +783,11 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t 
rr_quantum,
aq->sq.sq_int_ena |= BIT(NIX_SQINT_SEND_ERR);
aq->sq.sq_int_ena |= BIT(NIX_SQINT_MNQ_ERR);
 
-   /* Many to one reduction */
-   aq->sq.qint_idx = sq->qid % nix->qints;
+   /* Assigning QINT 0 to all the SQs, an errata exists where NIXTX can
+* send incorrect QINT_IDX when reporting queue interrupt (QINT). This
+* might result in software missing the interrupt.
+*/
+   aq->sq.qint_idx = 0;
 }
 
 static int
-- 
2.8.4



[PATCH 6/8] common/cnxk: handle issues from static analysis

2021-12-09 Thread Nithin Dabilpuram
From: Gowrishankar Muthukrishnan 

Handle issues reported by static analysis tool such as
null pointer dereferences, variable initialization, etc.

Signed-off-by: Gowrishankar Muthukrishnan 
Signed-off-by: Nithin Dabilpuram 
---
 drivers/common/cnxk/roc_cpt.c   |  7 +++--
 drivers/common/cnxk/roc_dev.c   | 21 -
 drivers/common/cnxk/roc_nix_debug.c |  6 
 drivers/common/cnxk/roc_nix_fc.c| 12 
 drivers/common/cnxk/roc_nix_queue.c | 61 ++---
 drivers/common/cnxk/roc_nix_stats.c | 18 +++
 drivers/common/cnxk/roc_nix_tm.c|  8 -
 7 files changed, 125 insertions(+), 8 deletions(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index 8f8e6d3..0e2dc45 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -385,6 +385,9 @@ cpt_lfs_alloc(struct dev *dev, uint8_t eng_grpmsk, uint8_t 
blkaddr,
return -EINVAL;
 
req = mbox_alloc_msg_cpt_lf_alloc(mbox);
+   if (!req)
+   return -ENOSPC;
+
req->nix_pf_func = 0;
if (inl_dev_sso && nix_inl_dev_pffunc_get())
req->sso_pf_func = nix_inl_dev_pffunc_get();
@@ -812,9 +815,9 @@ roc_cpt_eng_grp_add(struct roc_cpt *roc_cpt, enum 
cpt_eng_type eng_type)
 void
 roc_cpt_iq_disable(struct roc_cpt_lf *lf)
 {
+   volatile union cpt_lf_q_grp_ptr grp_ptr = {.u = 0x0};
+   volatile union cpt_lf_inprog lf_inprog = {.u = 0x0};
union cpt_lf_ctl lf_ctl = {.u = 0x0};
-   union cpt_lf_q_grp_ptr grp_ptr;
-   union cpt_lf_inprog lf_inprog;
int timeout = 20;
int cnt;
 
diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c
index 926a916..9a86969 100644
--- a/drivers/common/cnxk/roc_dev.c
+++ b/drivers/common/cnxk/roc_dev.c
@@ -57,7 +57,7 @@ pf_af_sync_msg(struct dev *dev, struct mbox_msghdr **rsp)
struct mbox *mbox = dev->mbox;
struct mbox_dev *mdev = &mbox->dev[0];
 
-   volatile uint64_t int_status;
+   volatile uint64_t int_status = 0;
struct mbox_msghdr *msghdr;
uint64_t off;
int rc = 0;
@@ -152,6 +152,11 @@ af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg)
/* Reserve PF/VF mbox message */
size = PLT_ALIGN(size, MBOX_MSG_ALIGN);
rsp = mbox_alloc_msg(&dev->mbox_vfpf, vf, size);
+   if (!rsp) {
+   plt_err("Failed to reserve VF%d message", vf);
+   continue;
+   }
+
mbox_rsp_init(msg->id, rsp);
 
/* Copy message from AF<->PF mbox to PF<->VF mbox */
@@ -236,6 +241,12 @@ vf_pf_process_msgs(struct dev *dev, uint16_t vf)
BIT_ULL(vf % max_bits);
rsp = (struct ready_msg_rsp *)mbox_alloc_msg(
mbox, vf, sizeof(*rsp));
+   if (!rsp) {
+   plt_err("Failed to alloc VF%d READY message",
+   vf);
+   continue;
+   }
+
mbox_rsp_init(msg->id, rsp);
 
/* PF/VF function ID */
@@ -988,6 +999,9 @@ dev_setup_shared_lmt_region(struct mbox *mbox, bool 
valid_iova, uint64_t iova)
struct lmtst_tbl_setup_req *req;
 
req = mbox_alloc_msg_lmtst_tbl_setup(mbox);
+   if (!req)
+   return -ENOSPC;
+
/* This pcifunc is defined with primary pcifunc whose LMT address
 * will be shared. If call contains valid IOVA, following pcifunc
 * field is of no use.
@@ -1061,6 +1075,11 @@ dev_lmt_setup(struct dev *dev)
 */
if (!dev->disable_shared_lmt) {
idev = idev_get_cfg();
+   if (!idev) {
+   errno = EFAULT;
+   goto free;
+   }
+
if (!__atomic_load_n(&idev->lmt_pf_func, __ATOMIC_ACQUIRE)) {
idev->lmt_base_addr = dev->lmt_base;
idev->lmt_pf_func = dev->pf_func;
diff --git a/drivers/common/cnxk/roc_nix_debug.c 
b/drivers/common/cnxk/roc_nix_debug.c
index 266935a..7dc54f3 100644
--- a/drivers/common/cnxk/roc_nix_debug.c
+++ b/drivers/common/cnxk/roc_nix_debug.c
@@ -323,6 +323,9 @@ nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid, 
__io void **ctx_p)
int rc;
 
aq = mbox_alloc_msg_nix_aq_enq(mbox);
+   if (!aq)
+   return -ENOSPC;
+
aq->qidx = qid;
aq->ctype = ctype;
aq->op = NIX_AQ_INSTOP_READ;
@@ -341,6 +344,9 @@ nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid, 
__io void **ctx_p)
struct nix_cn10k_aq_enq_req *aq;
 
aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
+   if (!aq)
+   return -ENOSPC;
+

[PATCH 7/8] net/cnxk: improve inbound inline error handling for cn9k

2021-12-09 Thread Nithin Dabilpuram
Improve inbound inline error handling for CN9K in terms of
packet delivered to application for different kinds of errors.

Also update udp ports to be used for UDP encapsulation support.

Signed-off-by: Nithin Dabilpuram 
---
 drivers/common/cnxk/cnxk_security.c |  6 +
 drivers/common/cnxk/roc_ie_on.h | 16 +++-
 drivers/net/cnxk/cn9k_rx.h  | 50 +++--
 3 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/cnxk_security.c 
b/drivers/common/cnxk/cnxk_security.c
index 30562b4..8b4dd1c 100644
--- a/drivers/common/cnxk/cnxk_security.c
+++ b/drivers/common/cnxk/cnxk_security.c
@@ -710,6 +710,12 @@ cnxk_onf_ipsec_outb_sa_fill(struct roc_onf_ipsec_outb_sa 
*sa,
return -EINVAL;
}
 
+   /* Update udp encap ports */
+   if (ipsec_xfrm->options.udp_encap == 1) {
+   sa->udp_src = 4500;
+   sa->udp_dst = 4500;
+   }
+
 skip_tunnel_info:
rte_wmb();
 
diff --git a/drivers/common/cnxk/roc_ie_on.h b/drivers/common/cnxk/roc_ie_on.h
index 53591c6..376e698 100644
--- a/drivers/common/cnxk/roc_ie_on.h
+++ b/drivers/common/cnxk/roc_ie_on.h
@@ -188,7 +188,21 @@ struct roc_ie_on_inb_sa {
 #define ROC_IE_ONF_MAJOR_OP_PROCESS_INBOUND_IPSEC  0x26UL
 
 /* Ucode completion codes */
-#define ROC_IE_ONF_UCC_SUCCESS 0
+#define ROC_IE_ON_UCC_SUCCESS0
+#define ROC_IE_ON_UCC_ENC_TYPE_ERR   0xB1
+#define ROC_IE_ON_UCC_IP_VER_ERR 0xB2
+#define ROC_IE_ON_UCC_PROTO_ERR  0xB3
+#define ROC_IE_ON_UCC_CTX_INVALID0xB4
+#define ROC_IE_ON_UCC_CTX_DIR_MISMATCH   0xB5
+#define ROC_IE_ON_UCC_IP_PAYLOAD_TYPE_ERR 0xB6
+#define ROC_IE_ON_UCC_CTX_FLAG_MISMATCH  0xB7
+#define ROC_IE_ON_UCC_SPI_MISMATCH   0xBE
+#define ROC_IE_ON_UCC_IP_CHKSUM_ERR  0xBF
+#define ROC_IE_ON_UCC_AUTH_ERR   0xC3
+#define ROC_IE_ON_UCC_PADDING_INVALID0xC4
+#define ROC_IE_ON_UCC_SA_MISMATCH0xCC
+#define ROC_IE_ON_UCC_L2_HDR_INFO_ERR0xCF
+#define ROC_IE_ON_UCC_L2_HDR_LEN_ERR 0xE0
 
 struct roc_ie_onf_sa_ctl {
uint32_t spi;
diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h
index 225bb41..cbb6299 100644
--- a/drivers/net/cnxk/cn9k_rx.h
+++ b/drivers/net/cnxk/cn9k_rx.h
@@ -211,6 +211,52 @@ ipsec_antireplay_check(struct roc_onf_ipsec_inb_sa *sa,
return rc;
 }
 
+static inline uint64_t
+nix_rx_sec_mbuf_err_update(const union nix_rx_parse_u *rx, uint16_t res,
+  uint64_t *rearm_val, uint16_t *len)
+{
+   uint8_t uc_cc = res >> 8;
+   uint8_t cc = res & 0xFF;
+   uint64_t data_off;
+   uint64_t ol_flags;
+   uint16_t m_len;
+
+   if (unlikely(cc != CPT_COMP_GOOD))
+   return RTE_MBUF_F_RX_SEC_OFFLOAD |
+  RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+
+   data_off = *rearm_val & (BIT_ULL(16) - 1);
+   m_len = rx->cn9k.pkt_lenm1 + 1;
+
+   switch (uc_cc) {
+   case ROC_IE_ON_UCC_IP_PAYLOAD_TYPE_ERR:
+   case ROC_IE_ON_UCC_AUTH_ERR:
+   case ROC_IE_ON_UCC_PADDING_INVALID:
+   /* Adjust data offset to start at copied L2 */
+   data_off += ROC_ONF_IPSEC_INB_SPI_SEQ_SZ +
+   ROC_ONF_IPSEC_INB_MAX_L2_SZ;
+   ol_flags = RTE_MBUF_F_RX_SEC_OFFLOAD |
+  RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+   break;
+   case ROC_IE_ON_UCC_CTX_INVALID:
+   case ROC_IE_ON_UCC_SPI_MISMATCH:
+   case ROC_IE_ON_UCC_SA_MISMATCH:
+   /* Return as normal packet */
+   ol_flags = 0;
+   break;
+   default:
+   /* Return as error packet after updating packet lengths */
+   ol_flags = RTE_MBUF_F_RX_SEC_OFFLOAD |
+  RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+   break;
+   }
+
+   *len = m_len;
+   *rearm_val = *rearm_val & ~(BIT_ULL(16) - 1);
+   *rearm_val |= data_off;
+   return ol_flags;
+}
+
 static __rte_always_inline uint64_t
 nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m,
   uintptr_t sa_base, uint64_t *rearm_val, uint16_t *len)
@@ -236,8 +282,8 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, 
struct rte_mbuf *m,
 
rte_prefetch0((void *)data);
 
-   if (unlikely(res != (CPT_COMP_GOOD | ROC_IE_ONF_UCC_SUCCESS << 8)))
-   return RTE_MBUF_F_RX_SEC_OFFLOAD | 
RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED;
+   if (unlikely(res != (CPT_COMP_GOOD | ROC_IE_ON_UCC_SUCCESS << 8)))
+   return nix_rx_sec_mbuf_err_update(rx, res, rearm_val, len);
 
data += lcptr;
/* 20 bits of tag would have the SPI */
-- 
2.8.4



[PATCH 8/8] net/cnxk: synchronize inline session create and destroy

2021-12-09 Thread Nithin Dabilpuram
Synchronize inline session create and destroy using spinlock.
Also move security related error prints outside the spinlock.

Signed-off-by: Nithin Dabilpuram 
---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 35 ---
 drivers/net/cnxk/cn9k_ethdev_sec.c  | 34 +++---
 drivers/net/cnxk/cnxk_ethdev.c  |  7 +--
 drivers/net/cnxk/cnxk_ethdev.h  |  6 ++
 4 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c 
b/drivers/net/cnxk/cn10k_ethdev_sec.c
index 235c168..12cec0a 100644
--- a/drivers/net/cnxk/cn10k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn10k_ethdev_sec.c
@@ -238,6 +238,8 @@ cn10k_eth_sec_session_create(void *device,
struct rte_crypto_sym_xform *crypto;
struct cnxk_eth_sec_sess *eth_sec;
bool inbound, inl_dev;
+   rte_spinlock_t *lock;
+   char tbuf[128] = {0};
int rc = 0;
 
if (conf->action_type != RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)
@@ -272,6 +274,9 @@ cn10k_eth_sec_session_create(void *device,
memset(eth_sec, 0, sizeof(struct cnxk_eth_sec_sess));
sess_priv.u64 = 0;
 
+   lock = inbound ? &dev->inb.lock : &dev->outb.lock;
+   rte_spinlock_lock(lock);
+
/* Acquire lock on inline dev for inbound */
if (inbound && inl_dev)
roc_nix_inl_dev_lock();
@@ -287,12 +292,14 @@ cn10k_eth_sec_session_create(void *device,
/* Get Inbound SA from NIX_RX_IPSEC_SA_BASE */
sa = roc_nix_inl_inb_sa_get(&dev->nix, inl_dev, ipsec->spi);
if (!sa && dev->inb.inl_dev) {
-   plt_err("Failed to create ingress sa, inline dev "
-   "not found or spi not in range");
+   snprintf(tbuf, sizeof(tbuf),
+"Failed to create ingress sa, inline dev "
+"not found or spi not in range");
rc = -ENOTSUP;
goto mempool_put;
} else if (!sa) {
-   plt_err("Failed to create ingress sa");
+   snprintf(tbuf, sizeof(tbuf),
+"Failed to create ingress sa");
rc = -EFAULT;
goto mempool_put;
}
@@ -301,8 +308,9 @@ cn10k_eth_sec_session_create(void *device,
 
/* Check if SA is already in use */
if (inb_sa->w2.s.valid) {
-   plt_err("Inbound SA with SPI %u already in use",
-   ipsec->spi);
+   snprintf(tbuf, sizeof(tbuf),
+"Inbound SA with SPI %u already in use",
+ipsec->spi);
rc = -EBUSY;
goto mempool_put;
}
@@ -313,7 +321,8 @@ cn10k_eth_sec_session_create(void *device,
/* Fill inbound sa params */
rc = cnxk_ot_ipsec_inb_sa_fill(inb_sa_dptr, ipsec, crypto);
if (rc) {
-   plt_err("Failed to init inbound sa, rc=%d", rc);
+   snprintf(tbuf, sizeof(tbuf),
+"Failed to init inbound sa, rc=%d", rc);
goto mempool_put;
}
 
@@ -371,7 +380,8 @@ cn10k_eth_sec_session_create(void *device,
/* Fill outbound sa params */
rc = cnxk_ot_ipsec_outb_sa_fill(outb_sa_dptr, ipsec, crypto);
if (rc) {
-   plt_err("Failed to init outbound sa, rc=%d", rc);
+   snprintf(tbuf, sizeof(tbuf),
+"Failed to init outbound sa, rc=%d", rc);
rc |= cnxk_eth_outb_sa_idx_put(dev, sa_idx);
goto mempool_put;
}
@@ -409,6 +419,7 @@ cn10k_eth_sec_session_create(void *device,
}
if (inbound && inl_dev)
roc_nix_inl_dev_unlock();
+   rte_spinlock_unlock(lock);
 
plt_nix_dbg("Created %s session with spi=%u, sa_idx=%u inl_dev=%u",
inbound ? "inbound" : "outbound", eth_sec->spi,
@@ -422,7 +433,11 @@ cn10k_eth_sec_session_create(void *device,
 mempool_put:
if (inbound && inl_dev)
roc_nix_inl_dev_unlock();
+   rte_spinlock_unlock(lock);
+
rte_mempool_put(mempool, eth_sec);
+   if (rc)
+   plt_err("%s", tbuf);
return rc;
 }
 
@@ -433,12 +448,16 @@ cn10k_eth_sec_session_destroy(void *device, struct 
rte_security_session *sess)
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
struct cnxk_eth_sec_sess *eth_sec;
struct rte_mempool *mp;
+   rte_spinlock_t *lock;
void *sa_dptr;
 
eth_sec = cnxk_eth_sec_sess_get_by_sess(dev, sess);
if (!eth_sec)
return -ENOENT;
 
+   lock = eth_s

RE: 20.11.4 patches review and test

2021-12-09 Thread Jiang, YuX
> -Original Message-
> From: Xueming Li 
> Sent: Tuesday, December 7, 2021 12:15 AM
> To: sta...@dpdk.org
> Cc: xuemi...@nvidia.com; dev@dpdk.org; Abhishek Marathe
> ; Ali Alnubani ;
> Walker, Benjamin ; David Christensen
> ; Govindharajan, Hariprasad
> ; Hemant Agrawal
> ; Stokes, Ian ; Jerin
> Jacob ; Mcnamara, John ;
> Ju-Hyoung Lee ; Kevin Traynor
> ; Luca Boccassi ; Pei Zhang
> ; Xu, Qian Q ; Raslan
> Darawsheh ; Thomas Monjalon
> ; Peng, Yuan ; Chen,
> Zhaoyan 
> Subject: 20.11.4 patches review and test
> 
> Hi all,
> 
> Here is a list of patches targeted for stable release 20.11.4.
> 
> The planned date for the final release is 31th December.
> 
> Please help with testing and validation of your use cases and report any
> issues/results with reply-all to this mail. For the final release the fixes 
> and
> reported validations will be added to the release notes.
> 
> A release candidate tarball can be found at:
> 
> https://dpdk.org/browse/dpdk-stable/tag/?id=v20.11.4-rc1
> 
> These patches are located at branch 20.11 of dpdk-stable repo:
> https://dpdk.org/browse/dpdk-stable/
> 
> Thanks.
> 
> Xueming Li 
> 
Update the test status for Intel part. Till now dpdk20.11.4-rc1 test execution 
rate is 80%. Currently, find three bugs, two bugs have fix now.
# Basic Intel(R) NIC testing
* Build or compile:  
*Build: cover the build test combination with latest GCC/Clang/ICC 
version and the popular OS revision such as Ubuntu20.04, Fedora34, RHEL8.4, etc.
- All test done.
- Two bugs are found in 20.11.4-rc1.
- dpdk-20.11.4]kernel/linux/kni/rte_kni.ko build failed 
on OpenSuse15.3 with gcc7.5.0&clang11.0.1
- fix link: 
http://inbox.dpdk.org/stable/20211208103410.835542-1-ferruh.yi...@intel.com/T/#u
 , verify passed by Intel
- https://bugs.dpdk.org/show_bug.cgi?id=894  
[dpdk-20.11.4] lib/librte_eal.a.p/librte_eal_common_rte_random.c.obj build 
failed on WIN10 with clang8.0.0
- fix link: 
http://inbox.dpdk.org/stable/20211207141644.369624-1-dmitry.kozl...@gmail.com/T/#u,
 verify passed by Intel
* PF(i40e, ixgbe): test scenarios including 
RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc. 
- All test done. No new issue is found. 
* VF(i40e, ixgbe): test scenarios including 
VF-RTE_FLOW/TSO/Jumboframe/checksum offload/VLAN/VXLAN, etc.
- All test done. No new issue is found. 
* PF/VF(ice): test scenarios including Switch features/Package 
Management/Flow Director/Advanced Tx/Advanced RSS/ACL/DCF/Share code 
update/Flexible Descriptor, etc.
- Execution rate is 80%. No new issue is found.
* Intel NIC single core/NIC performance: test scenarios including PF/VF 
single core performance test, RFC2544 Zero packet loss performance test, etc.
- Execution rate is 50%. No big performance drop.
* IPsec: test scenarios including ipsec/ipsec-gw/ipsec library basic 
test - QAT&SW/FIB library, etc.
- All passed.   
# Basic cryptodev and virtio testing
* Virtio: both function and performance test are covered. Such as 
PVP/Virtio_loopback/virtio-user loopback/virtio-net VM2VM perf testing/VMAWARE 
ESXI 7.0u3, etc.
- Execution rate is 80%. No new issue is found.
* Cryptodev: 
*Function test: test scenarios including Cryptodev API 
testing/CompressDev ISA-L/QAT/ZLIB PMD Testing/FIPS, etc.
- All test done.
- One new bug about "[dpdk-LTS-20.11.4-rc1] 
cryptodev_qat_asym_autotest is failing" is found, Intel dev is under 
investigating.
bad commit id is commit 
2f2c2b5b7e7ae4942b4b3686bce2eb856fee447d
Author: Przemyslaw Zegan 

Date: Wed Nov 3 15:08:23 2021 +
common/qat: fix queue pairs number
*Performance test: test scenarios including Thoughput 
Performance /Cryptodev Latency, etc.
- All test done.


[PATCH] net/ice: fix error forwarding IPv6 VXLAN packet

2021-12-09 Thread Kevin Liu
In ice_txd_enable_offload(), when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

This patch fix the bug that the checksum engine can forward tunnle
packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")

Signed-off-by: Kevin Liu 
---
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h 
b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
uint32_t td_offset = 0;
 
/* Tx Checksum Offload */
-   /* SET MACLEN */
-   td_offset |= (tx_pkt->l2_len >> 1) <<
+   /*Tunnel package usage outer len enable L2/L3 checksum offload*/
+   if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+   /* SET MACLEN */
+   td_offset |= (tx_pkt->outer_l2_len >> 1) <<
ICE_TX_DESC_LEN_MACLEN_S;
 
-   /* Enable L3 checksum offload */
-   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
-   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
-   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
+   /* Enable L3 checksum offload */
+   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   }
+   } else {
+   /* SET MACLEN */
+   td_offset |= (tx_pkt->l2_len >> 1) <<
+   ICE_TX_DESC_LEN_MACLEN_S;
+
+   /* Enable L3 checksum offload */
+   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   }
}
 
/* Enable L4 checksum offloads */
-- 
2.25.1



[PATCH] net/ice: fix error forwarding IPv6 VXLAN packet

2021-12-09 Thread Kevin Liu
In ice_txd_enable_offload(), when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

This patch fix the bug that the checksum engine can forward tunnle
packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")

Signed-off-by: Kevin Liu 
---
 drivers/net/ice/ice_rxtx_vec_common.h | 52 +++
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ice/ice_rxtx_vec_common.h 
b/drivers/net/ice/ice_rxtx_vec_common.h
index dfe60c81d9..8ff01046e1 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -364,23 +364,45 @@ ice_txd_enable_offload(struct rte_mbuf *tx_pkt,
uint32_t td_offset = 0;
 
/* Tx Checksum Offload */
-   /* SET MACLEN */
-   td_offset |= (tx_pkt->l2_len >> 1) <<
+   /*Tunnel package usage outer len enable L2/L3 checksum offload*/
+   if (ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
+   /* SET MACLEN */
+   td_offset |= (tx_pkt->outer_l2_len >> 1) <<
ICE_TX_DESC_LEN_MACLEN_S;
 
-   /* Enable L3 checksum offload */
-   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
-   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
-   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
-   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
-   td_offset |= (tx_pkt->l3_len >> 2) <<
-   ICE_TX_DESC_LEN_IPLEN_S;
+   /* Enable L3 checksum offload */
+   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+   td_offset |= (tx_pkt->outer_l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   }
+   } else {
+   /* SET MACLEN */
+   td_offset |= (tx_pkt->l2_len >> 1) <<
+   ICE_TX_DESC_LEN_MACLEN_S;
+
+   /* Enable L3 checksum offload */
+   if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4_CSUM;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV4) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV4;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   } else if (ol_flags & RTE_MBUF_F_TX_IPV6) {
+   td_cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
+   td_offset |= (tx_pkt->l3_len >> 2) <<
+   ICE_TX_DESC_LEN_IPLEN_S;
+   }
}
 
/* Enable L4 checksum offloads */
-- 
2.25.1



Re: [PATCH 3/3] net/mlx5: fix missing adjustment MPRQ stride devargs

2021-12-09 Thread Kevin Traynor

On 08/12/2021 15:40, Matan Azrad wrote:

Hi Ferruh

Thanks for the review.

Please see inside some clarifications.

From: Ferruh Yigit

On 12/8/2021 12:52 PM, Michael Baum wrote:


On 12/07/2021 3:41 PM, ferruh.yi...@intel.com wrote:


On 11/23/2021 6:38 PM, michae...@nvidia.com wrote:

From: Michael Baum

In Multy-Packet RQ creation, the user can choose the number of
strides


Multi-Packet ?


Yes, you're right. It should have been Multi-Packet, thank you for that.




and their size in bytes. The user updates it using specific devargs
for both of these parameters.
The above two parameters determine the size of the WQE which is
actually their product of multiplication.

If the user selects values that are not in the supported range, the
PMD changes them to default values. However, apart from the range
limitations for each parameter individually there is also a minimum
value on their multiplication. When the user selects values that
their multiplication are lower than minimum value, no adjustment is
made and the creation of the WQE fails.

This patch adds an adjustment in these cases as well. When the user

selects values whose multiplication is lower than the minimum, they
are replaced with the default values.

Fixes: ecb160456aed ("net/mlx5: add device parameter for MPRQ stride
size") Cc:sta...@dpdk.org



Again, not sure if we can backport this patch, this looks a behavior
change more than a fix.

Previously if the user provided values ends up being invalid, PMD
seems returning error.
With this patch, instead of returning error PMD prefers to use
default values and doesn't return error.


It isn't behavior change.
It existed before, except that it is concentrated into one function.



I am not sure if it is correct thing to ignore (adjust) user provided
values, but that can be up to the PMD as long as the behavior is

documented.


Adjustment is the likely thing to do because the range depends on the

device and the user does not necessarily know it.

This behavior is documented here
https://doc.dpdk.org/guides/nics/mlx5.html#run-time-configuration
(Run-time configuration -> Driver options -> mprq_log_stride_num/size)



It is documented that adjustments will be done if any specific argument is
not in the range of the device capability.

It is not clear what will happen if the calculated value from both variables are
not valid.


The driver should adjust it to a legal value.


If it is not documented before, and previously it was returning error, now
adjusting values to make it work looks like behavior change to me.


The driver should not return an error - the driver should adjust to a legal 
value in case of illegal values by the user.
It is documented in the devargs description.

Not behavior change but a bug fix; previously, the adjustment may return an 
error(which is a bug) or cause unexpected behavior in the HW(which is an old FW 
bug).
Now, no error, no unexpected behavior - bug should be fixed for any FW version.



I can understand both arguments. It is a behaviour change as the user 
will see a different behaviour for a given set of values.


However, each parameter is already validated and defaults are provided 
as backup. The combination not being checked could be seen a piece of 
missed validation for those values and a bug. In this case, given it is 
unlikely any user would be happy with the WQE creation failure, i think 
it is ok to backport the missing validation/adjustment.



This is more of a process question, than technical detail in the driver, so
@Luca, @Kevin, @Christian, can you please comment? I will follow your
suggestion.



Thanks for raising it Ferruh.

Kevin.





But I think it is wrong to backport the behavior change.


Signed-off-by: Michael Baum
Acked-by: Matan Azrad
---









[Bug 898] Memory leak during interprocess communication.

2021-12-09 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=898

Bug ID: 898
   Summary: Memory leak during interprocess communication.
   Product: DPDK
   Version: 18.11
  Hardware: x86
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: Normal
 Component: core
  Assignee: dev@dpdk.org
  Reporter: aleksey.rogoz...@infotecs.ru
  Target Milestone: ---

Start any primary DPDK process. pktgen for example.
Run any secondary process a large number of times, for example, in a loop.
dpdk-procinfo for example.
After some time, the number of memory segments used by the main process begins
to increase and is not released until the main process ends.

At begin:
dpdk-procinfo -- -m

EAL: Detected 12 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_12553_cdd87636c2be4
EAL: Probing VFIO support...
EAL: PCI device :03:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
eth_ixgbe_dev_init(): No TX queues configured yet. Using default TX function.
EAL: PCI device :03:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
eth_ixgbe_dev_init(): No TX queues configured yet. Using default TX function.
EAL: PCI device :07:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: PCI device :08:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
--- MEMORY_SEGMENTS ---
Segment 0-0: IOVA:0x70600, len:2097152, virt:0x10020, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:10
Segment 0-1: IOVA:0x720e0, len:2097152, virt:0x10040, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:11
Segment 0-2: IOVA:0x720c0, len:2097152, virt:0x10060, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:12
Segment 0-3: IOVA:0x724a0, len:2097152, virt:0x10080, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:13
Segment 0-4: IOVA:0x72480, len:2097152, virt:0x100a0, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:14
Segment 0-5: IOVA:0x82c20, len:2097152, virt:0x100c0, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:15
Segment 0-6: IOVA:0x82c00, len:2097152, virt:0x100e0, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:16
Segment 0-7: IOVA:0x72120, len:2097152, virt:0x10100, socket_id:0,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:17
Segment 4-0: IOVA:0xf6740, len:2097152, virt:0x1100a0, socket_id:1,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:18
Segment 4-1: IOVA:0xfa380, len:2097152, virt:0x1100c0, socket_id:1,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:19
Segment 4-2: IOVA:0xf90e0, len:2097152, virt:0x1100e0, socket_id:1,
hugepage_sz:2097152, nchannel:0, nrank:0 fd:20
- END_MEMORY_SEGMENTS -
 MEMORY_ZONES -
Zone 0: name:, len:0x35840, virt:0x1003b1540, socket_id:0,
flags:0
physical segments used:
  addr: 0x10020 iova: 0x70600 len: 0x20 pagesz: 0x20
Zone 1: name:, len:0x80180, virt:0x100323780,
socket_id:0, flags:0
physical segments used:
  addr: 0x10020 iova: 0x70600 len: 0x20 pagesz: 0x20
Zone 2: name:, len:0x980, virt:0x1002a2ac0,
socket_id:0, flags:0
physical segments used:
  addr: 0x10020 iova: 0x70600 len: 0x20 pagesz: 0x20
Zone 3: name:, len:0x80180, virt:0x100210800,
socket_id:0, flags:0
physical segments used:
  addr: 0x10020 iova: 0x70600 len: 0x20 pagesz: 0x20
Zone 4: name:, len:0x980, virt:0x10020fbc0,
socket_id:0, flags:0
physical segments used:
  addr: 0x10020 iova: 0x70600 len: 0x20 pagesz: 0x20
Zone 5: name:, len:0x40, virt:0x100e0, socket_id:0,
flags:0
physical segments used:
  addr: 0x100e0 iova: 0x82c00 len: 0x20 pagesz: 0x20
  addr: 0x10100 iova: 0x72120 len: 0x20 pagesz: 0x20
Zone 6: name:, len:0x40, virt:0x1100c0, socket_id:1,
flags:0
physical segments used:
  addr: 0x1100c0 iova: 0xfa380 len: 0x20 pagesz: 0x20
  addr: 0x1100e0 iova: 0xf90e0 len: 0x20 pagesz: 0x20
-- END_MEMORY_ZONES ---
- TAIL_QUEUES -
Tailq 0: qname:, tqh_first:(nil), tqh_last:0x77fcd27c
Tailq 1: qname:, tqh_first:(nil), tqh_last:0x77fcd2ac
Tailq 2: qname:, tqh_first:(nil), tqh_last:0x77fcd2dc
Tailq 3: qname:, tqh_first:0x100323700, tqh_last:0x10020fb40
Tailq 4: qname:, tqh_first:(nil), tqh_last:0x77fcd33c
Tailq 5: qname:, tqh_first:(nil), tqh_last:0x77fcd36c
Tailq 6: qname:, tqh_first:(nil), tqh_last:0x77fcd39c
Tailq 7: qname:, tqh_first:(nil), tqh_last:0x77fcd3cc
Tailq 8: qname:, tqh_first:0x1003a3940, tqh_last:0x100210580
Tailq 9: qname:, tqh_first:(nil), tqh_last:0x77fcd42c
Tailq 10: qname:, tqh_first:(nil), tqh_last:0x77fcd45c
Tailq 11: qname:, tqh_first:(nil), tqh_last:0x77fcd48c
Tailq 12: qname:, tqh_first:0x1003e8e40,
tqh

Re: [PATCH v14 04/11] app/test: skip interrupt tests on Windows

2021-12-09 Thread Aaron Conole
Jerin Jacob  writes:

> On Thu, Dec 9, 2021 at 12:30 AM Jie Zhou  wrote:
>>
>> Even though test_interrupts.c can compile on Windows, skip interrupt
>> tests for now since majority of eal_interrupt on Windows are stubs.
>> Will remove the skip after interrupt being fully enabled on Windows.
>>
>> Signed-off-by: Jie Zhou 
>> Acked-by: Dmitry Kozlyuk 
>>
>> ---
>>  app/test/test_interrupts.c | 10 ++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
>> index 2a05399f96..eec9b2805b 100644
>> --- a/app/test/test_interrupts.c
>> +++ b/app/test/test_interrupts.c
>> @@ -12,6 +12,15 @@
>>
>>  #include "test.h"
>>
>> +#ifdef RTE_EXEC_ENV_WINDOWS
>
> Across the series,
> Instead of adding conditional compilation everywhere, Why not disable
> specific file
> for compilation for windows?
> Purpose of EAL to abstract the differences in execution environment
> and application
> should not know that.

I think this was done because there would be two test lists in the meson
unit test file.  But this is the second comment about these ifdef's, and
maybe we should revisit that discussion.  Is there a different way to
accomplish not running the tests which are not appropriate for windows
builds, while not having two overlapping lists of unit tests in the
meson build file?

>> +static int
>> +test_interrupt(void)
>> +{
>> +   printf("Interrupt on Windows is not fully supported yet, skipping 
>> test\n");
>> +   return TEST_SKIPPED;
>> +}
>> +#else
>> +
>>  #define TEST_INTERRUPT_CHECK_INTERVAL 100 /* ms */
>>
>>  /* predefined interrupt handle types */
>> @@ -590,5 +599,6 @@ test_interrupt(void)
>>
>> return ret;
>>  }
>> +#endif /*ifdef RTE_EXEC_ENV_WINDOWS*/
>>
>>  REGISTER_TEST_COMMAND(interrupt_autotest, test_interrupt);
>> --
>> 2.31.0.vfs.0.1
>>



testpmd behavior with stopped queues

2021-12-09 Thread Dmitry Kozlyuk
Hello,

There are testpmd commands to start/stop RxQ/TxQ:
"port 1 rxq 0 stop", "port 1 txq 0 start", etc.
IIUC, when a queue is stopped, testpmd should ignore it.
Currently, it doesn't and tries to use the stopped queue.
If a RxQ is stopped, nothing will be send to the paired TxQ.
If a TxQ is stopped, there is nowhere to send the packets
from the paired RxQ, so it is logical to drop them.
I'm going to implement this behavior, any objections?


19.11.11 patches review and test

2021-12-09 Thread christian . ehrhardt
Hi all,

Here is a list of patches targeted for stable release 19.11.11.

The planned date for the final release is 7th January 2021.

Please help with testing and validation of your use cases and report
any issues/results with reply-all to this mail. For the final release
the fixes and reported validations will be added to the release notes.

A release candidate tarball can be found at:

https://dpdk.org/browse/dpdk-stable/tag/?id=v19.11.11-rc1

These patches are located at branch 19.11 of dpdk-stable repo:
https://dpdk.org/browse/dpdk-stable/

Thanks.

Christian Ehrhardt 

---
Ajit Khaparde (3):
  net/bnxt: fix Tx queue startup state
  net/bnxt: fix memzone free for Tx and Rx rings
  net/bnxt: fix tunnel port accounting

Alexander Bechikov (1):
  mbuf: fix dump of dynamic fields and flags

Alexander Kozyrev (2):
  net/mlx5: fix GENEVE and VXLAN-GPE flow item matching
  net/mlx5: fix GRE flow item matching

Alvin Zhang (1):
  net/i40e: fix Rx packet statistics

Aman Singh (1):
  kni: fix build for SLES15-SP3

Anatoly Burakov (2):
  vfio: fix FreeBSD clear group stub
  vfio: fix FreeBSD documentation

Anoob Joseph (2):
  test/crypto: skip plain text compare for null cipher
  common/cpt: fix KASUMI input length

Arek Kusztal (2):
  crypto/qat: fix status in RSA decryption
  crypto/qat: fix uncleared cookies after operation

Ben Pfaff (1):
  doc: fix numbers power of 2 in LPM6 guide

Bing Zhao (2):
  net/mlx5: fix flow tables double release
  net/mlx5: fix RETA update without stopping device

Bruce Richardson (3):
  eal/freebsd: lock memory device to prevent conflicts
  test/mem: fix memory autotests on FreeBSD
  eal/freebsd: ignore in-memory option

Chengchang Tang (2):
  net/bonding: fix dedicated queue mode in vector burst
  net/bonding: fix RSS key length

Chengfeng Ye (1):
  net/axgbe: fix unreleased lock in I2C transfer

Chengwen Feng (1):
  kni: check error code of allmulticast mode switch

Cian Ferriter (1):
  ring: fix Doxygen comment of internal function

Ciara Loftus (1):
  net/af_xdp: disable secondary process support

Ciara Power (3):
  crypto/openssl: fix CCM processing 0 length source
  examples/fips_validation: remove unused allocation
  test/crypto: fix unnecessary stats retrieval

Conor Walsh (8):
  net/hinic/base: remove some unused variables
  bus/fslmc: remove unused device count
  event/sw: remove unused inflight events count
  net/liquidio: remove unused counter
  net/qede/base: remove unused message size
  net/vmxnet3: fix build with clang 13
  test/distributor: remove unused counter
  examples/performance-thread: remove unused hits count

Dapeng Yu (1):
  net/ice: save rule on switch filter creation

Dariusz Sosnowski (2):
  net/mlx5: fix MPLS tunnel outer layer overwrite
  doc: fix typo in coding style

David Christensen (3):
  eal/ppc: ignore GCC 10 stringop-overflow warnings
  config/ppc: ignore GCC 11 psabi warnings
  test/atomic: fix 128-bit atomic test with many cores

David Hunt (1):
  test/power: fix CPU frequency when turbo enabled

David Marchand (10):
  net/virtio: avoid unneeded link interrupt configuration
  net/virtio-user: fix Rx interrupts with multi-queue
  bus/vmbus: fix leak on device scan
  test/latency: fix loop boundary
  eal/x86: fix some CPU extended features definitions
  mbuf: enforce no option for dynamic fields and flags
  doc: fix default mempool option in guides
  eal/linux: fix uevent message parsing
  test/red: fix typo in test description
  examples/ntb: fix build dependency

Eli Britstein (4):
  net: avoid cast-align warning in VLAN insert function
  mbuf: avoid cast-align warning in data offset macro
  eal/x86: avoid cast-align warning in memcpy functions
  app/testpmd: fix packet burst spreading stats

Eugenio Pérez (1):
  vhost: clean IOTLB cache on vring stop

Fan Zhang (1):
  examples/fips_validation: fix device start

Feifei Wang (2):
  drivers/net: fix typo in vector Rx comment
  drivers/net: fix vector Rx comments

Ferruh Yigit (3):
  net/softnic: fix useless address check
  net/i40e: fix 32-bit build
  ethdev: fix crash on owner delete

Gagandeep Singh (3):
  common/dpaax/caamflib: fix IV for short MAC-I in SNOW3G
  common/dpaax: fix physical address conversion
  drivers/crypto: fix IPsec TTL decrement option

Gaoxiang Liu (1):
  vhost: log socket path on adding connection

Georg Sauthoff (1):
  net: fix aliasing in checksum computation

Gregory Etelson (6):
  examples/multi_process: fix Rx packets distribution
  net/mlx5: fix RSS expansion scheme for GRE header
  app/testpmd: fix hexadecimal parser with odd length
  net/mlx5: fix VXLAN-GPE next protocol translation
  net/mlx5: fix GENEVE protocol type translation
  net/mlx5: fix GRE p

Re: [PATCH v14 04/11] app/test: skip interrupt tests on Windows

2021-12-09 Thread Bruce Richardson
On Thu, Dec 09, 2021 at 08:15:01AM -0500, Aaron Conole wrote:
> Jerin Jacob  writes:
> 
> > On Thu, Dec 9, 2021 at 12:30 AM Jie Zhou  wrote:
> >>
> >> Even though test_interrupts.c can compile on Windows, skip interrupt
> >> tests for now since majority of eal_interrupt on Windows are stubs.
> >> Will remove the skip after interrupt being fully enabled on Windows.
> >>
> >> Signed-off-by: Jie Zhou 
> >> Acked-by: Dmitry Kozlyuk 
> >>
> >> ---
> >>  app/test/test_interrupts.c | 10 ++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
> >> index 2a05399f96..eec9b2805b 100644
> >> --- a/app/test/test_interrupts.c
> >> +++ b/app/test/test_interrupts.c
> >> @@ -12,6 +12,15 @@
> >>
> >>  #include "test.h"
> >>
> >> +#ifdef RTE_EXEC_ENV_WINDOWS
> >
> > Across the series,
> > Instead of adding conditional compilation everywhere, Why not disable
> > specific file
> > for compilation for windows?
> > Purpose of EAL to abstract the differences in execution environment
> > and application
> > should not know that.
> 
> I think this was done because there would be two test lists in the meson
> unit test file.  But this is the second comment about these ifdef's, and
> maybe we should revisit that discussion.  Is there a different way to
> accomplish not running the tests which are not appropriate for windows
> builds, while not having two overlapping lists of unit tests in the
> meson build file?
> 
I'm wondering if a reasonable compromise solution might be to have the
build system expose a usable RTE_EXEC_ENV symbol that can be used in C-code
if statements rather than just in ifdefs. That would allow us to easily add
e.g.

if (RTE_EXEC_ENV == rte_env_linux)
return TEST_SKIPPED;

into each test function needing it. Two lines of C-code is a lot easier to
add and manage than #ifdefs covering the whole file, or alternative lists
in meson.

/Bruce


RE: [PATCH v14 04/11] app/test: skip interrupt tests on Windows

2021-12-09 Thread Richardson, Bruce


> -Original Message-
> From: Bruce Richardson 
> Sent: Thursday, December 9, 2021 4:17 PM
> To: Aaron Conole 
> Cc: Jerin Jacob ; Jie Zhou
> ; dpdk-dev ; Dmitry Kozlyuk
> ; roret...@microsoft.com; Narcisa Ana Maria
> Vasile ; Dmitry Malloy (MESHCHANINOV)
> ; Kadam, Pallavi ;
> tal...@nvidia.com; Thomas Monjalon 
> Subject: Re: [PATCH v14 04/11] app/test: skip interrupt tests on Windows
> 
> On Thu, Dec 09, 2021 at 08:15:01AM -0500, Aaron Conole wrote:
> > Jerin Jacob  writes:
> >
> > > On Thu, Dec 9, 2021 at 12:30 AM Jie Zhou 
> wrote:
> > >>
> > >> Even though test_interrupts.c can compile on Windows, skip interrupt
> > >> tests for now since majority of eal_interrupt on Windows are stubs.
> > >> Will remove the skip after interrupt being fully enabled on Windows.
> > >>
> > >> Signed-off-by: Jie Zhou 
> > >> Acked-by: Dmitry Kozlyuk 
> > >>
> > >> ---
> > >>  app/test/test_interrupts.c | 10 ++
> > >>  1 file changed, 10 insertions(+)
> > >>
> > >> diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
> > >> index 2a05399f96..eec9b2805b 100644
> > >> --- a/app/test/test_interrupts.c
> > >> +++ b/app/test/test_interrupts.c
> > >> @@ -12,6 +12,15 @@
> > >>
> > >>  #include "test.h"
> > >>
> > >> +#ifdef RTE_EXEC_ENV_WINDOWS
> > >
> > > Across the series,
> > > Instead of adding conditional compilation everywhere, Why not disable
> > > specific file
> > > for compilation for windows?
> > > Purpose of EAL to abstract the differences in execution environment
> > > and application
> > > should not know that.
> >
> > I think this was done because there would be two test lists in the meson
> > unit test file.  But this is the second comment about these ifdef's, and
> > maybe we should revisit that discussion.  Is there a different way to
> > accomplish not running the tests which are not appropriate for windows
> > builds, while not having two overlapping lists of unit tests in the
> > meson build file?
> >
> I'm wondering if a reasonable compromise solution might be to have the
> build system expose a usable RTE_EXEC_ENV symbol that can be used in C-
> code
> if statements rather than just in ifdefs. That would allow us to easily
> add
> e.g.
> 
> if (RTE_EXEC_ENV == rte_env_linux)
> return TEST_SKIPPED;

or even " == rte_env_windows" for this case! 😊


[PATCH v1] app/testpmd: fix dereference before null check

2021-12-09 Thread Sean Morrissey
Assign 'left' variable only after null check on 'size'
as function returns if 'size' is null.

Coverity issue: 374381
Fixes: 169a9fed1f4 ("app/testpmd: fix hex string parser support for flow API")
Cc: sta...@dpdk.org
Cc: wei.zh...@intel.com

Signed-off-by: Sean Morrissey 
---
 app/test-pmd/cmdline_flow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index bbe3dc0115..5bb7abcced 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -7702,7 +7702,6 @@ parse_string(struct context *ctx, const struct token 
*token,
 static int
 parse_hex_string(const char *src, uint8_t *dst, uint32_t *size)
 {
-   uint32_t left = *size;
const uint8_t *head = dst;
 
/* Check input parameters */
@@ -7712,6 +7711,8 @@ parse_hex_string(const char *src, uint8_t *dst, uint32_t 
*size)
(*size == 0))
return -1;
 
+   uint32_t left = *size;
+
/* Convert chars to bytes */
while (left) {
char tmp[3], *end = tmp;
-- 
2.25.1



Re: [PATCH v14 04/11] app/test: skip interrupt tests on Windows

2021-12-09 Thread Bruce Richardson
On Thu, Dec 09, 2021 at 04:17:08PM +, Bruce Richardson wrote:
> On Thu, Dec 09, 2021 at 08:15:01AM -0500, Aaron Conole wrote:
> > Jerin Jacob  writes:
> > 
> > > On Thu, Dec 9, 2021 at 12:30 AM Jie Zhou  wrote:
> > >>
> > >> Even though test_interrupts.c can compile on Windows, skip interrupt
> > >> tests for now since majority of eal_interrupt on Windows are stubs.
> > >> Will remove the skip after interrupt being fully enabled on Windows.
> > >>
> > >> Signed-off-by: Jie Zhou 
> > >> Acked-by: Dmitry Kozlyuk 
> > >>
> > >> ---
> > >>  app/test/test_interrupts.c | 10 ++
> > >>  1 file changed, 10 insertions(+)
> > >>
> > >> diff --git a/app/test/test_interrupts.c b/app/test/test_interrupts.c
> > >> index 2a05399f96..eec9b2805b 100644
> > >> --- a/app/test/test_interrupts.c
> > >> +++ b/app/test/test_interrupts.c
> > >> @@ -12,6 +12,15 @@
> > >>
> > >>  #include "test.h"
> > >>
> > >> +#ifdef RTE_EXEC_ENV_WINDOWS
> > >
> > > Across the series,
> > > Instead of adding conditional compilation everywhere, Why not disable
> > > specific file
> > > for compilation for windows?
> > > Purpose of EAL to abstract the differences in execution environment
> > > and application
> > > should not know that.
> > 
> > I think this was done because there would be two test lists in the meson
> > unit test file.  But this is the second comment about these ifdef's, and
> > maybe we should revisit that discussion.  Is there a different way to
> > accomplish not running the tests which are not appropriate for windows
> > builds, while not having two overlapping lists of unit tests in the
> > meson build file?
> > 
> I'm wondering if a reasonable compromise solution might be to have the
> build system expose a usable RTE_EXEC_ENV symbol that can be used in C-code
> if statements rather than just in ifdefs. That would allow us to easily add
> e.g.
> 
> if (RTE_EXEC_ENV == rte_env_linux)
> return TEST_SKIPPED;
> 
> into each test function needing it. Two lines of C-code is a lot easier to
> add and manage than #ifdefs covering the whole file, or alternative lists
> in meson.
> 
Quick patch to allow C-code comparisons:

diff --git a/lib/eal/meson.build b/lib/eal/meson.build
index 1722924f67..b5b9fa14b4 100644
--- a/lib/eal/meson.build
+++ b/lib/eal/meson.build
@@ -10,6 +10,12 @@ if not is_windows
 subdir('unix')
 endif
 
+exec_envs = {'freebsd': 0, 'linux': 1, 'windows': 2}
+foreach env, id:exec_envs
+dpdk_conf.set('RTE_ENV_' + env.to_upper(), id)
+endforeach
+dpdk_conf.set('RTE_EXEC_ENV', exec_envs[exec_env])
+
 dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1)
 subdir(exec_env)

A slightly simpler patch would just expose the environment as a string as
e.g. "linux", but I think numeric ids just make the code better rather than
having string comparisons. Alternatively, this could also be done via
C-code with ifdefs in EAL, but as it stands this meson change allows:

  if (RTE_EXEC_ENV == RTE_ENV_WINDOWS)
 ...

or:

  switch (RTE_EXEC_ENV) {
case RTE_ENV_LINUX: ... ; break;
case RTE_ENV_FREEBSD: ... ; break;
case RTE_ENV_WINDOWS: ... ; break;
  }

Thoughts?

/Bruce


[PATCH] net/af_xdp: fix build with -Wunused-function

2021-12-09 Thread Ciara Loftus
The get_shared_umem function is only called when the kernel
flag XDP_UMEM_UNALIGNED_CHUNK_FLAG is defined. Move the
function implementation and associated helper so that it only
gets compiled when that flag is set.

Fixes: 74b46340e2d4 ("net/af_xdp: support shared UMEM")
Cc: sta...@dpdk.org

Signed-off-by: Ciara Loftus 
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 121 ++--
 1 file changed, 60 insertions(+), 61 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c 
b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 96c2c9d939..b3ed704b36 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -697,67 +697,6 @@ find_internal_resource(struct pmd_internals *port_int)
return list;
 }
 
-/* Check if the netdev,qid context already exists */
-static inline bool
-ctx_exists(struct pkt_rx_queue *rxq, const char *ifname,
-   struct pkt_rx_queue *list_rxq, const char *list_ifname)
-{
-   bool exists = false;
-
-   if (rxq->xsk_queue_idx == list_rxq->xsk_queue_idx &&
-   !strncmp(ifname, list_ifname, IFNAMSIZ)) {
-   AF_XDP_LOG(ERR, "ctx %s,%i already exists, cannot share umem\n",
-   ifname, rxq->xsk_queue_idx);
-   exists = true;
-   }
-
-   return exists;
-}
-
-/* Get a pointer to an existing UMEM which overlays the rxq's mb_pool */
-static inline int
-get_shared_umem(struct pkt_rx_queue *rxq, const char *ifname,
-   struct xsk_umem_info **umem)
-{
-   struct internal_list *list;
-   struct pmd_internals *internals;
-   int i = 0, ret = 0;
-   struct rte_mempool *mb_pool = rxq->mb_pool;
-
-   if (mb_pool == NULL)
-   return ret;
-
-   pthread_mutex_lock(&internal_list_lock);
-
-   TAILQ_FOREACH(list, &internal_list, next) {
-   internals = list->eth_dev->data->dev_private;
-   for (i = 0; i < internals->queue_cnt; i++) {
-   struct pkt_rx_queue *list_rxq =
-   &internals->rx_queues[i];
-   if (rxq == list_rxq)
-   continue;
-   if (mb_pool == internals->rx_queues[i].mb_pool) {
-   if (ctx_exists(rxq, ifname, list_rxq,
-   internals->if_name)) {
-   ret = -1;
-   goto out;
-   }
-   if (__atomic_load_n(
-   &internals->rx_queues[i].umem->refcnt,
-   __ATOMIC_ACQUIRE)) {
-   *umem = internals->rx_queues[i].umem;
-   goto out;
-   }
-   }
-   }
-   }
-
-out:
-   pthread_mutex_unlock(&internal_list_lock);
-
-   return ret;
-}
-
 static int
 eth_dev_configure(struct rte_eth_dev *dev)
 {
@@ -1013,6 +952,66 @@ static inline uintptr_t get_base_addr(struct rte_mempool 
*mp, uint64_t *align)
return aligned_addr;
 }
 
+/* Check if the netdev,qid context already exists */
+static inline bool
+ctx_exists(struct pkt_rx_queue *rxq, const char *ifname,
+   struct pkt_rx_queue *list_rxq, const char *list_ifname)
+{
+   bool exists = false;
+
+   if (rxq->xsk_queue_idx == list_rxq->xsk_queue_idx &&
+   !strncmp(ifname, list_ifname, IFNAMSIZ)) {
+   AF_XDP_LOG(ERR, "ctx %s,%i already exists, cannot share umem\n",
+   ifname, rxq->xsk_queue_idx);
+   exists = true;
+   }
+
+   return exists;
+}
+
+/* Get a pointer to an existing UMEM which overlays the rxq's mb_pool */
+static inline int
+get_shared_umem(struct pkt_rx_queue *rxq, const char *ifname,
+   struct xsk_umem_info **umem)
+{
+   struct internal_list *list;
+   struct pmd_internals *internals;
+   int i = 0, ret = 0;
+   struct rte_mempool *mb_pool = rxq->mb_pool;
+
+   if (mb_pool == NULL)
+   return ret;
+
+   pthread_mutex_lock(&internal_list_lock);
+
+   TAILQ_FOREACH(list, &internal_list, next) {
+   internals = list->eth_dev->data->dev_private;
+   for (i = 0; i < internals->queue_cnt; i++) {
+   struct pkt_rx_queue *list_rxq =
+   &internals->rx_queues[i];
+   if (rxq == list_rxq)
+   continue;
+   if (mb_pool == internals->rx_queues[i].mb_pool) {
+   if (ctx_exists(rxq, ifname, list_rxq,
+   internals->if_name)) {
+   ret = -1;

Re: [PATCH v1] gpudev: return EINVAL if invalid input pointer for free and unregister

2021-12-09 Thread Tyler Retzlaff
On Wed, Dec 08, 2021 at 07:40:10PM +0100, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roret...@linux.microsoft.com]
> > Sent: Wednesday, 8 December 2021 18.35
> > 
> > On Fri, Dec 03, 2021 at 11:37:10AM +0100, Morten Brørup wrote:
> > > > From: Morten Brørup [mailto:m...@smartsharesystems.com]
> > > > Sent: Thursday, 2 December 2021 14.56
> > > >
> > > >
> > > > I disagree: Negative value does not mean failure. Only -1 means
> > > > failure.
> > > >
> > > > There is no -2 return value. There is no -EINVAL return value.
> > > >
> > > > Testing for (ret < 0) might confuse someone to think that other
> > values
> > > > than -1 could be returned as indication of failure, which is not
> > the
> > > > case when following the convention where the functions set errno
> > and
> > > > return -1 in case of failure.
> > > >
> > > > It would be different if following a convention where the functions
> > > > return -errno in case of failure. In this case, testing (ret < 0)
> > would
> > > > be appropriate.
> > > >
> > > > So explicitly testing (ret == -1) clarifies which of the two
> > > > conventions are relevant.
> > > >
> > >
> > > I tested it on Godbolt, and (ret < 0) produces slightly smaller code
> > than (ret == -1) on x86-64:
> > >
> > > https://godbolt.org/z/3xME3jxq8
> > >
> > > A binary test (Error or Data) uses 1 byte less, and a tristate test
> > (Error, Zero or Data) uses 3 byte less.
> > >
> > > Although there is no measurable performance difference for a single
> > instance of this kind of test, we should consider that this kind of
> > test appears many times in the code, so the saved bytes might add up to
> > something slightly significant in the instruction cache.
> > >
> > > My opinion is not so strong anymore... perhaps we should prefer
> > performance over code readability, also in this case?
> > >
> > 
> > i would not expect many calls that return rte_errno to be made on the
> > hot path. most of the use of errno / rte_errno is control but it's good
> > to have considered it. if i start seeing a lot of error handling in hot
> > paths i ordinarily find a way to get rid of it through various
> > techniques.
> 
> Tyler, I think you and I agree perfectly on this topic.
> 
> -1 should be returned as error, and rte_errno should provide details.
> 
> I'm only saying that comparing the return value with < 0 provides marginally 
> less instruction bytes than comparing it with == -1, so even though -1 is the 
> canonical indication of error, the comparison could be < 0 instead of == -1 
> (if weighing performance higher than code clarity).

sounds about right to me, i appreciate the extra analysis. certainly with
explicit -1 it doesn't stop an application gaining the slightly better
code generation with < 0.

thanks


Re: [PATCH v14 02/11] app/test: remove POSIX-specific code

2021-12-09 Thread Tyler Retzlaff
On Wed, Dec 08, 2021 at 10:59:51AM -0800, Jie Zhou wrote:
> - Replace POSIX-specific code with DPDK equivalents or
>   conditionally disable it on Windows
> - Use NUL on Windows as /dev/null for Unix
> - Exclude tests not supported on Windows yet
>   * multi-process
>   * PMD performance statistics display on signal
> 
> Signed-off-by: Jie Zhou 
> Signed-off-by: Dmitry Kozlyuk 
> 
> ---
>  app/test/commands.c   |  2 --
>  app/test/packet_burst_generator.c |  1 +
>  app/test/process.h|  4 +++-
>  app/test/test.c   |  5 -
>  app/test/test_byteorder.c |  2 +-
>  app/test/test_cmdline_ipaddr.c| 13 ++---
>  app/test/test_cmdline_lib.c   | 13 +
>  app/test/test_crc.c   |  1 -
>  app/test/test_memcpy_perf.c   | 29 +++--
>  app/test/test_pmd_perf.c  |  6 +-
>  app/test/test_ring_stress_impl.h  |  2 +-
>  app/test/test_telemetry_data.c|  2 ++
>  12 files changed, 47 insertions(+), 33 deletions(-)
> 
> diff --git a/app/test/commands.c b/app/test/commands.c
> index 2dced3bc44..887cabad64 100644
> --- a/app/test/commands.c
> +++ b/app/test/commands.c
> @@ -8,8 +8,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/app/test/packet_burst_generator.c 
> b/app/test/packet_burst_generator.c
> index 8ac24577ba..6b42b9b83b 100644
> --- a/app/test/packet_burst_generator.c
> +++ b/app/test/packet_burst_generator.c
> @@ -5,6 +5,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "packet_burst_generator.h"
>  
> diff --git a/app/test/process.h b/app/test/process.h
> index 5b10cf64df..1f073b9c5c 100644
> --- a/app/test/process.h
> +++ b/app/test/process.h
> @@ -7,12 +7,14 @@
>  
>  #include   /* errno */
>  #include  /* PATH_MAX */
> +#ifndef RTE_EXEC_ENV_WINDOWS
>  #include  /* basename et al */
> +#include 
> +#endif
>  #include  /* NULL */
>  #include  /* strerror */
>  #include  /* readlink */
>  #include 
> -#include 
>  
>  #include  /* strlcpy */
>  
> diff --git a/app/test/test.c b/app/test/test.c
> index 5194131026..e69cae3eea 100644
> --- a/app/test/test.c
> +++ b/app/test/test.c
> @@ -8,7 +8,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  
> @@ -63,7 +62,9 @@ do_recursive_call(void)
>   const char *env_var;
>   int (*action_fn)(void);
>   } actions[] =  {
> +#ifndef RTE_EXEC_ENV_WINDOWS
>   { "run_secondary_instances", test_mp_secondary },
> +#endif
>  #ifdef RTE_LIB_PDUMP
>  #ifdef RTE_NET_RING
>   { "run_pdump_server_tests", test_pdump },
> @@ -82,7 +83,9 @@ do_recursive_call(void)
>   { "test_file_prefix", no_action },
>   { "test_no_huge_flag", no_action },
>  #ifdef RTE_LIB_TIMER
> +#ifndef RTE_EXEC_ENV_WINDOWS
>   { "timer_secondary_spawn_wait", test_timer_secondary },
> +#endif
>  #endif
>   };
>  
> diff --git a/app/test/test_byteorder.c b/app/test/test_byteorder.c
> index 03c08d9abf..de14ed539e 100644
> --- a/app/test/test_byteorder.c
> +++ b/app/test/test_byteorder.c
> @@ -46,7 +46,7 @@ test_byteorder(void)
>   return -1;
>  
>   res_u16 = rte_bswap16(0x1337);
> - printf("const %"PRIx16" -> %"PRIx16"\n", 0x1337, res_u16);
> + printf("const %"PRIx16" -> %"PRIx16"\n", (uint16_t)0x1337, res_u16);
>   if (res_u16 != 0x3713)
>   return -1;
>  
> diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c
> index 2a1ee120fc..f540063508 100644
> --- a/app/test/test_cmdline_ipaddr.c
> +++ b/app/test/test_cmdline_ipaddr.c
> @@ -1,12 +1,9 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
>   * Copyright(c) 2010-2014 Intel Corporation
>   */
> -
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
>  
>  #include 
>  
> @@ -15,7 +12,7 @@
>  
>  #include "test_cmdline.h"
>  
> -#define IP4(a,b,c,d) {((uint32_t)(((a) & 0xff)) | \
> +#define IP4(a,b,c,d) {.s_addr = (uint32_t)(((a) & 0xff) | \
>  (((b) & 0xff) << 8) | \
>  (((c) & 0xff) << 16)  | \
>  ((d) & 0xff)  << 24)}
> @@ -25,7 +22,11 @@
>  
>  /* create IPv6 address, swapping bytes where needed */
>  #ifndef s6_addr16
> -# define s6_addr16  __u6_addr.__u6_addr16
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +#define s6_addr16 u.Word
> +#else
> +#define s6_addr16 __u6_addr.__u6_addr16
> +#endif
>  #endif
>  #define IP6(a,b,c,d,e,f,g,h) .ipv6 = \
>   {.s6_addr16 = \
> @@ -166,8 +167,6 @@ const char * ipaddr_garbage_network6_strs[] = {
>  };
>  #define IPv6_GARBAGE_PREFIX 64
>  
> -
> -
>  const char * ipaddr_invalid_strs[] = {
>   /** IPv4 **/
>  
> diff --git a/app/test/test_cmdline_lib.c b/app/test/test_cmdline_lib.c
> index f50ccdb599..fcd58cb76a 100644
> --- a/app/test/tes

Re: [PATCH v14 09/11] app/test: add test stubs for not supported ones

2021-12-09 Thread Tyler Retzlaff
On Wed, Dec 08, 2021 at 10:59:58AM -0800, Jie Zhou wrote:
> Add test stubs for tests which are not yet supported for Windows:
> - The libraries that tests depend on are not enabled on Windows yet
> - The tests can compile but with issue still under investigation
> * test_func_reentrancy:
>   Windows EAL has no protection against repeated calls.
> * test_lcores:
>   Execution enters an infinite loops, requires investigation.
> * test_rcu_qsbr_perf:
>   Execution hangs on Windows, requires investigation.
> 
> Signed-off-by: Jie Zhou 
> Signed-off-by: Dmitry Kozlyuk 
> 
> ---
>  app/test/test_acl.c  | 12 
>  app/test/test_bpf.c  | 15 +++-
>  app/test/test_cryptodev.c|  4 ++
>  app/test/test_cryptodev_asym.c   |  4 ++
>  app/test/test_cryptodev_blockcipher.c|  4 ++
>  app/test/test_cryptodev_security_ipsec.c |  4 ++
>  app/test/test_cryptodev_security_pdcp.c  |  4 ++
>  app/test/test_debug.c| 17 -
>  app/test/test_distributor.c  | 13 
>  app/test/test_distributor_perf.c | 13 
>  app/test/test_eal_flags.c| 90 
>  app/test/test_eal_fs.c   | 12 
>  app/test/test_efd.c  | 15 +++-
>  app/test/test_efd_perf.c | 16 -
>  app/test/test_event_crypto_adapter.c | 15 +++-
>  app/test/test_event_eth_rx_adapter.c | 25 ++-
>  app/test/test_event_eth_tx_adapter.c | 12 
>  app/test/test_event_ring.c   | 16 -
>  app/test/test_event_timer_adapter.c  | 16 -
>  app/test/test_eventdev.c | 20 +-
>  app/test/test_external_mem.c | 18 -
>  app/test/test_fib.c  | 22 +-
>  app/test/test_fib6.c | 24 ++-
>  app/test/test_fib6_perf.c| 16 -
>  app/test/test_fib_perf.c | 15 +++-
>  app/test/test_flow_classify.c| 13 
>  app/test/test_func_reentrancy.c  | 12 
>  app/test/test_graph.c| 18 -
>  app/test/test_graph_perf.c   | 16 -
>  app/test/test_hash_perf.c| 12 
>  app/test/test_ipfrag.c   | 16 -
>  app/test/test_ipsec.c| 15 +++-
>  app/test/test_ipsec_perf.c   | 15 +++-
>  app/test/test_ipsec_sad.c| 14 +++-
>  app/test/test_kni.c  | 10 +--
>  app/test/test_lcores.c   | 12 
>  app/test/test_lpm.c  | 14 +++-
>  app/test/test_lpm6.c | 14 +++-
>  app/test/test_lpm6_perf.c| 14 +++-
>  app/test/test_lpm_perf.c | 13 +++-
>  app/test/test_malloc.c   | 20 --
>  app/test/test_mbuf.c | 15 +++-
>  app/test/test_member.c   | 16 -
>  app/test/test_member_perf.c  | 16 -
>  app/test/test_memcpy_perf.c  |  1 -
>  app/test/test_mp_secondary.c | 12 
>  app/test/test_pie.c  | 30 +++-
>  app/test/test_rawdev.c   | 17 -
>  app/test/test_rcu_qsbr_perf.c| 12 
>  app/test/test_red.c  | 29 +++-
>  app/test/test_reorder.c  | 15 +++-
>  app/test/test_rib.c  | 22 +-
>  app/test/test_rib6.c | 22 +-
>  app/test/test_sched.c| 14 +++-
>  app/test/test_security.c |  4 +-
>  app/test/test_table.c| 13 
>  app/test/test_table_acl.c|  3 +
>  app/test/test_table_combined.c   |  4 ++
>  app/test/test_table_pipeline.c   |  4 ++
>  app/test/test_table_ports.c  |  4 ++
>  app/test/test_table_tables.c |  4 ++
>  app/test/test_timer_secondary.c  | 13 
>  app/test/test_trace.c| 32 +++--
>  63 files changed, 880 insertions(+), 72 deletions(-)
> 
> diff --git a/app/test/test_acl.c b/app/test/test_acl.c
> index 5b32347954..7814e25a53 100644
> --- a/app/test/test_acl.c
> +++ b/app/test/test_acl.c
> @@ -11,6 +11,16 @@
>  #include 
>  #include 
>  #include 
> +
> +#ifdef RTE_EXEC_ENV_WINDOWS
> +static int
> +test_acl(void)
> +{
> + printf("acl not supported on Windows, skipping test\n");
> + return TEST_SKIPPED;
> +}
> +
> +#else
>  #include 
>  #include 
>  
> @@ -1741,4 +1751,6 @@ test_acl(void)
>   return 0;
>  }
>  
> +#endif /*ifdef RTE_EXEC_ENV_WINDOWS*/
> +
>  REGISTER_TEST_COMMAND(acl_autotest, test_acl);
> diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
> index 46bcb51f86..055df252ba 100644
> --- a/app/test/test_bpf.c
> +++ b/app/test/test_bpf.c
> @@ -14,11 +14,22 @@
>  #include 
>  #include 
>  #include 
> +#include "test.h"
> +
> +#if !defined(RTE_LIB_BPF)
> +
> +static int
> +test_bpf(void)
> +{
> +

Re: [PATCH v14 00/11] app/test: enable subset of tests on Windows

2021-12-09 Thread Tyler Retzlaff
On Wed, Dec 08, 2021 at 10:59:49AM -0800, Jie Zhou wrote:
> The goal of this patchset is to enable unit tests in CI for Windows.
> It mainly contains:
> - Replace POSIX specific codes
> - Fix some lib and tests per failures investigation
> - Add test stubs for not yet supported ones on Windows
> - Replace .sh script with .py script for meson.build
> - Enable build and run subset of unit tests on Windows
> 
> Future work:
> - Work with CI lab to onboard unit tests for Windows to catch regression
> - Investigate issues hit at CI onboarding
> - Enable more tests
> 
> ---
> V2 changes:
> - Fix compilation error on FreeBSD
> - Fix email mismatch issue
> - Add a missing space around "*"
> 
> ---
> V3 changes:
> - Fix a misc c coding style issue
> - Revise some commit title and message body
> - Fix violations of PEP8 in new added Python scripts
> - Add error handling in get_coremask.py
> - Fix has_hugepage.py to check system support of hugepages
>   instead of checking privileges
> - Fix test meson.build to run Python scripts using py3
> - Consolidate lists of source files, test dep, etc. across all 
>   platforms, with conditional extending on some platform(s)
> 
> ---
> V4 changes:
> - Remove building of ip_frag, rib, and reorder libraries on Windows.
>   These three libs usually can be built on Windows without change.
>   However, in between the time of V3 and V4, there is regression in
>   upstream caused build failures of these three libs. Will separately
>   investigate and enable these libraries.
> 
> - Remove previous patch#2 (Enable mempool/stack on Windows) from this
>   patchset as it was separated out and merged as patch-19314.
> 
> - Consolidate the source files, deps, tests lists across platforms as
>   much as possible.
> 
> ---
> V5 changes:
> - Remove a space between function name and open parenthesis '('
> - Add back a header mistakenly deleted
> 
> ---
> V6 changes:
>- Fix inconsistent static vs. non-static declarations
> 
> ---
> V7 changes:
>- Remove get_coremask.py as it is not needed any more in meson.build
>- Remove enablement of efd and lpm and their corresponding unit tests.
>  The enablement of these two libs and their UTs will be in separate
>  patches after this patch set.
> 
> V8 changes:
>- Fix coding style issue of using C99 // comments
> 
> ---
> V9 changes:
>- Fix has_hugepage.py with adding failure handling on Linux, using
>  proper variable name to follow Python convention, and removing
>  unnecessary comment.
>- Enable previously skipped test_cmdline_socket_fns test cases
>- Revise title and message, and add Fixes info for current Patch#3 
>- Combine 2 patches (previous #2 and #3 in V8) into one and with 
>  more detailed message
> 
> ---
> V10 changes:
>- Fix indentation
> 
> ---
> V11 changes:
>- Remove mandatory dependency on bitratestats, latencystats,
>  and metrics libs in test meson.build, which was reintroduced
>  at rebase in V9.
> 
> ---
> V12 changes:
>- Remove unnecessary print of a null string
>- Enable several previous disabled tests
>- Split Patch#9 in V11 into two patches for better structure
>- Reorder some of the patches for better structure
>- Document more details in commit message for issue tracking
> 
> ---
> V13 changes:
>- Fix misc coding style issue
>- Fix build issue on Ubuntu 18.04
> 
> ---
> V14 changes:
>- Explain the reason of skipping telemetry tests in commit log
> 
> Tested-by: Pallavi Kadam 
> 

the set looks good to me, let's get it in and if we need to make further
changes we can. integration of the set is blocking porting of other
tests.

Acked-by: Tyler Retzlaff 


DTS WG update

2021-12-09 Thread Honnappa Nagarahalli
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Central Standard Time
BEGIN:STANDARD
DTSTART:16010101T02
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T02
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
ORGANIZER;CN=Honnappa Nagarahalli:mailto:honnappa.nagaraha...@arm.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=dts@dpdk.
 org:mailto:d...@dpdk.org
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=dev@dpdk.
 org:mailto:dev@dpdk.org
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=announce@
 dpdk.org:mailto:annou...@dpdk.org
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Lincoln L
 avoie:mailto:lylav...@iol.unh.edu
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Owen Hily
 ard:mailto:ohily...@iol.unh.edu
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Lijuan Tu
 :mailto:lijuan...@intel.com
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Juraj Lin
 keš:mailto:juraj.lin...@pantheon.tech
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=nd:mailto
 :n...@arm.com
ATTENDEE;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=nd:mailto
 :n...@arm.com
DESCRIPTION;LANGUAGE=en-US:Hello\,\n\nThe DTS working group
  has made steady progress in the past few months. We would like to provide
  an update to the community on changes being planned. These changes have b
 een approved by the DPDK tech board.\n\n\n\nThe meeting is scheduled for 1
 .5hrs as we expect good amount of questions from the community. The WG loo
 ks forward to presenting the proposal to everyone.\n\n\n\nThank you\,\n\nH
 onnappa\n\n\n\n\n Honnappa Nagarahalli is inviting you to a scheduled Zoom
  meeting.\n\nJoin Zoom Meeting\nhttps://armltd.zoom.us/j/92755954870?pwd=c
 XVFVjdMTVozdWtCemR0TlFNeGg2QT09&from=addon\n\nMeeting ID: 927 5595 4870\nP
 asscode: 003835\nOne tap mobile\n+13462487799\,\,92755954870#\,\,\,\,*0038
 35# US (Houston)\n+14086380968\,\,92755954870#\,\,\,\,*003835# US (San Jos
 e)\n\nDial by your location\n+1 346 248 7799 US (Houston)\n+1 408 638 0968
  US (San Jose)\n+1 646 518 9805 US (New York)\nMeeting ID: 927 5595 4870\n
 Passcode: 003835\nFind your local number: https://armltd.zoom.us/u/avUpHL6
 X1\n\nJoin by SIP\n92755954...@zoomcrc.com
 \n\nJoin by H.323\n162.255.37.11 (US West)\n162.255.36.11 (US East)\n115.1
 14.131.7 (India Mumbai)\n115.114.115.7 (India Hyderabad)\n213.19.144.110 (
 Amsterdam Netherlands)\n213.244.140.110 (Germany)\n103.122.166.55 (Austral
 ia Sydney)\n103.122.167.55 (Australia Melbourne)\n209.9.211.110 (Hong Kong
  SAR)\n149.137.40.110 (Singapore)\n64.211.144.160 (Brazil)\n69.174.57.160 
 (Canada Toronto)\n65.39.152.160 (Canada Vancouver)\n207.226.132.110 (Japan
  Tokyo)\n149.137.24.110 (Japan Osaka)\nMeeting ID: 927 5595 4870\nPasscode
 : 003835\n
UID:04008200E00074C5B7101A82E008A00092EB5BEDD701000
 010001DF50DB3787B2A4F85D8CA265D9C5845
SUMMARY;LANGUAGE=en-US:DTS WG update
DTSTART;TZID=Central Standard Time:20211214T08
DTEND;TZID=Central Standard Time:20211214T093000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20211210T062443Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION;LANGUAGE=en-US:https://armltd.zoom.us/j/92755954870?pwd=cXVFVjdMTV
 ozdWtCemR0TlFNeGg2QT09&from=addon
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-OWNERAPPTID:-150288411
X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-DISALLOW-COUNTER:TRUE
X-MICROSOFT-LOCATIONS:[ { "DisplayName" : "https://armltd.zoom.us/j/9275595
 4870?pwd=cXVFVjdMTVozdWtCemR0TlFNeGg2QT09&from=addon"\, "LocationAnnotatio
 n" : ""\, "LocationSource" : 0\, "Unresolved" : false\, "LocationUri" : ""
  } ]
BEGIN:VALARM
DESCRIPTION:REMINDER
TRIGGER;RELATED=START:-PT15M
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR


[PATCH v3] net/ixgbe: add vector Rx parameter check

2021-12-09 Thread Bin Zheng
Under the circumstance that `rx_tail` wrap back to zero
and the advance speed of `rx_tail` is greater than `rxrearm_start`,
`rx_tail` will catch up with `rxrearm_start` and surpass it.
This may cause some mbufs be reused by application.

So we need to make some restrictions to ensure that
 `rx_tail` will not exceed `rxrearm_start`.

e.g.

RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail: 991
RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail: 1023
RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0
RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88
RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail: 95
...
RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail: 895
RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail: 927
RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail: 994

when `rx_tail` catches up with `rxrearm_start`,
2(994 - 992) mbufs be reused by application !

Bugzilla ID: 882
Fixes: 5a3cca342417 ("net/ixgbe: fix vector Rx")
Cc: jia@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Bin Zheng 
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c 
b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 1eed949495..4654d0adec 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -364,6 +364,17 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct 
rte_mbuf **rx_pkts,
uint8_t vlan_flags;
uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */
 
+   /*
+* Under the circumstance that `rx_tail` wrap back to zero
+* and the advance speed of `rx_tail` is greater than `rxrearm_start`,
+* `rx_tail` will catch up with `rxrearm_start` and surpass it.
+* This may cause some mbufs be reused by application.
+*
+* So we need to make some restrictions to ensure that
+* `rx_tail` will not exceed `rxrearm_start`.
+*/
+   nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH);
+
/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */
nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_IXGBE_DESCS_PER_LOOP);
 
-- 
2.25.1