From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4191BA0545; Mon, 20 Jun 2022 21:30:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBFDF4069C; Mon, 20 Jun 2022 21:30:24 +0200 (CEST) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mails.dpdk.org (Postfix) with ESMTP id E770040151 for ; Mon, 20 Jun 2022 21:30:23 +0200 (CEST) Received: by mail-qk1-f173.google.com with SMTP id 68so8518206qkk.9 for ; Mon, 20 Jun 2022 12:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wi8cwUwo4dnNIldk+Er0idS7OLjbDTpmyasfaSqqVZ8=; b=R6Ia2IrheTbrIK1eG7/HFpgJW66gK9DQnXRAsnIRRtcvnb5QHeSkji3fr4XiLYqHgl 2xayelIvSvPgi86eiqnnIPOFEYwSNZS427xjEI9Y4CREmC8xrk9xYmgIS9SFD7dwsJUq LImuXf7l8Ufs/VKLqPVrrB0zwEGrSibnVHDONoz1PNJkm5FKxoAL7OO/XnxFDcKQP5DN 23P7GINfnHuENGoKkn3gjF3dlF5qwyfCNI4V6KLpHiLiXo7iFPA6Ef9+l/+SqrbU1lAL lKgL5FppkNnSIlmSMoA9ieBL7XzqKjlqaQhTcTqxAkbs8pN/iQ7C6EfHNoC8a5mejhcP 8n6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wi8cwUwo4dnNIldk+Er0idS7OLjbDTpmyasfaSqqVZ8=; b=oYxd+7LAQT4a5E5CfO+RrfoLxfhvTIPupRM/p8fUgI+S+8wcKWiBxBi9QTL0JV+LiV a/ZCcyYJYwIs2uevClkItMV3cTTzc5jRc8V8Nx6RwMtKyrSo6JI2NqRjL4svsHUiRw1t kGdsHEdj5Gnys3/WB/b6oMu5/iAuFKuGM8ar1P/Q5aGEjaAdivKIJZ3FTK23tk8GYGps 9TgG1ypMQu4/vYN5AWhf9XPrRJ1Q1KJGzMlxsLzFaMdRRs/8T/MyMnNgJP1np3JfW7xT urfYWfiRsMIqlU3Gg3i+wg963blzD4QN23xK1WOAKEfaDxlnBNN4tbigf2m8FbfdHyjg yC+g== X-Gm-Message-State: AJIora+5eKTOexGR2mxoGlcVFKwHpx6TbTwyp+SjZMTkh23bOC82fv7R Vsi3S6yqQNUPVqH/SAMCR66CB461fWCzDm6n+XE= X-Google-Smtp-Source: AGRyM1v1zrWpNmsGjajCWEM4A0S1UG0a43AFwbf/3A12gx354j7Cstl5L6RLFU4e0fOG97+CsetzSZ4gy7iJDJmFnNc= X-Received: by 2002:a05:620a:424c:b0:6aa:cdf8:f6f3 with SMTP id w12-20020a05620a424c00b006aacdf8f6f3mr15825154qko.26.1655753423175; Mon, 20 Jun 2022 12:30:23 -0700 (PDT) MIME-Version: 1.0 References: <20220617123818.3359117-1-vfialko@marvell.com> <20220617123818.3359117-2-vfialko@marvell.com> In-Reply-To: <20220617123818.3359117-2-vfialko@marvell.com> From: Jerin Jacob Date: Tue, 21 Jun 2022 00:59:57 +0530 Message-ID: Subject: Re: [PATCH v2 1/2] app/eventdev: add null checks for cop allocations To: Volodymyr Fialko Cc: dpdk-dev , Jerin Jacob , Anoob Joseph Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, Jun 17, 2022 at 6:09 PM Volodymyr Fialko wrote: > > Crypto operation allocation may fail in case when total size of queue > pairs are bigger then the pool size. then -> than > > Signed-off-by: Volodymyr Fialko Series-Acked-by: Jerin Jacob Series applied to dpdk-next-net-eventdev/for-main. Thanks > --- > app/test-eventdev/test_perf_common.c | 40 ++++++++++++++++++++++++++-- > 1 file changed, 38 insertions(+), 2 deletions(-) > > diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c > index b41785492e..a5e031873d 100644 > --- a/app/test-eventdev/test_perf_common.c > +++ b/app/test-eventdev/test_perf_common.c > @@ -367,6 +367,7 @@ crypto_adapter_enq_op_new(struct prod_data *p) > struct evt_options *opt = t->opt; > uint16_t qp_id = p->ca.cdev_qp_id; > uint8_t cdev_id = p->ca.cdev_id; > + uint64_t alloc_failures = 0; > uint32_t flow_counter = 0; > struct rte_crypto_op *op; > struct rte_mbuf *m; > @@ -386,9 +387,17 @@ crypto_adapter_enq_op_new(struct prod_data *p) > > op = rte_crypto_op_alloc(t->ca_op_pool, > RTE_CRYPTO_OP_TYPE_SYMMETRIC); > + if (unlikely(op == NULL)) { > + alloc_failures++; > + continue; > + } > + > m = rte_pktmbuf_alloc(pool); > - if (m == NULL) > + if (unlikely(m == NULL)) { > + alloc_failures++; > + rte_crypto_op_free(op); > continue; > + } > > rte_pktmbuf_append(m, len); > sym_op = op->sym; > @@ -404,6 +413,11 @@ crypto_adapter_enq_op_new(struct prod_data *p) > > op = rte_crypto_op_alloc(t->ca_op_pool, > RTE_CRYPTO_OP_TYPE_ASYMMETRIC); > + if (unlikely(op == NULL)) { > + alloc_failures++; > + continue; > + } > + > asym_op = op->asym; > asym_op->modex.base.data = modex_test_case.base.data; > asym_op->modex.base.length = modex_test_case.base.len; > @@ -418,6 +432,10 @@ crypto_adapter_enq_op_new(struct prod_data *p) > > count++; > } > + > + if (opt->verbose_level > 1 && alloc_failures) > + printf("%s(): lcore %d allocation failures: %"PRIu64"\n", > + __func__, rte_lcore_id(), alloc_failures); > } > > static inline void > @@ -430,6 +448,7 @@ crypto_adapter_enq_op_fwd(struct prod_data *p) > const uint64_t nb_pkts = t->nb_pkts; > struct rte_mempool *pool = t->pool; > struct evt_options *opt = t->opt; > + uint64_t alloc_failures = 0; > uint32_t flow_counter = 0; > struct rte_crypto_op *op; > struct rte_event ev; > @@ -455,9 +474,17 @@ crypto_adapter_enq_op_fwd(struct prod_data *p) > > op = rte_crypto_op_alloc(t->ca_op_pool, > RTE_CRYPTO_OP_TYPE_SYMMETRIC); > + if (unlikely(op == NULL)) { > + alloc_failures++; > + continue; > + } > + > m = rte_pktmbuf_alloc(pool); > - if (m == NULL) > + if (unlikely(m == NULL)) { > + alloc_failures++; > + rte_crypto_op_free(op); > continue; > + } > > rte_pktmbuf_append(m, len); > sym_op = op->sym; > @@ -473,6 +500,11 @@ crypto_adapter_enq_op_fwd(struct prod_data *p) > > op = rte_crypto_op_alloc(t->ca_op_pool, > RTE_CRYPTO_OP_TYPE_ASYMMETRIC); > + if (unlikely(op == NULL)) { > + alloc_failures++; > + continue; > + } > + > asym_op = op->asym; > asym_op->modex.base.data = modex_test_case.base.data; > asym_op->modex.base.length = modex_test_case.base.len; > @@ -489,6 +521,10 @@ crypto_adapter_enq_op_fwd(struct prod_data *p) > > count++; > } > + > + if (opt->verbose_level > 1 && alloc_failures) > + printf("%s(): lcore %d allocation failures: %"PRIu64"\n", > + __func__, rte_lcore_id(), alloc_failures); > } > > static inline int > -- > 2.25.1 >