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 0B4DCA0553; Fri, 10 Jun 2022 11:29:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6A7A4069C; Fri, 10 Jun 2022 11:29:18 +0200 (CEST) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by mails.dpdk.org (Postfix) with ESMTP id 1A4EB40689 for ; Fri, 10 Jun 2022 11:29:18 +0200 (CEST) Received: by mail-qt1-f177.google.com with SMTP id x7so18949427qta.6 for ; Fri, 10 Jun 2022 02:29:18 -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=cNSJVZkKir2CjxFavVWn3voOt43Dv+IPGW2+sqIPUNI=; b=eo6T3fccjKvqd5aEv5XS0HQVlcRsz0fCJwTiLdOivwJ7SbK+/3oY0ou7MKnil3knVr k4oTvDgDYTVJMJUa4jnfDCdKefGIDuHblwiPxjwyCImyeCjLMMXVbhOyucJXK47OjHbX Q+UbMCTZlzw6/aX52K4oEGIJUn+MD/DdoEsGsW2KM2kZ3V6osZITxK23QA7hGLlGGmMx R8Y2QOltvX40IFiTqSiP8EpBjONYPyk2/0uppWZBWvlQq3GWEfGBYamOd1sn6tTwYc4L 7FIUehzzCJKoM6d4GLtoYnvNke7hz2rUQeulih2sVAAmSV/CkSmpK7KHOZgA+eEJKLfV 9hug== 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=cNSJVZkKir2CjxFavVWn3voOt43Dv+IPGW2+sqIPUNI=; b=g+vxHOOZIwkfRAdGuMerN2ZCUcm/Pg6w+dvF39ZPG8mgFSGrbUHcS+cG/Ls7oQu4KD d5up99eqBAfJu1fJvsePIbcstoeThqc6rpb6NamFxc6QId8NVJlLrcD18bex8GAqQuvC akHslqXOpJgcmwBxVDabNsI1fPpAw1ms95SxNOs9t5v5S4MH7q85iw+uR8MQLkudBLrp J89Q0Mcf4VRfq7ud0+mbzOxS5KO637l9aHUr6dAY5boAPG8z2g8hl8qSr4nJ8mLkuG0h aQcvJloL7bgsKdPrxHQApFslBMamD3c1z3ksX0Uwfuo4RYFou05jaloEajjUbbkvPJM/ UpoQ== X-Gm-Message-State: AOAM5320e3dAIYACNcrnfX/MrZyuN7ZeR70Vs1fRTcA3e1FbkgLuZqjK e3zpMg2yWxaI/Vl+HTbLA2fNOQiXL0o2YXhANxo= X-Google-Smtp-Source: ABdhPJy/t5efc5nWAbM8GXGy8CbqPUHZVb/aF3Ego1h2oNrAlw+u7LT8F9pK4WKEZQP3ijvUBhPLA9MyUWSuTJB3UWY= X-Received: by 2002:a05:622a:8d:b0:305:1c58:a837 with SMTP id o13-20020a05622a008d00b003051c58a837mr1341052qtw.410.1654853357402; Fri, 10 Jun 2022 02:29:17 -0700 (PDT) MIME-Version: 1.0 References: <20220531121950.3511727-1-hpothula@marvell.com> In-Reply-To: <20220531121950.3511727-1-hpothula@marvell.com> From: Jerin Jacob Date: Fri, 10 Jun 2022 14:58:51 +0530 Message-ID: Subject: Re: [PATCH] common/cnxk: add lower bound check for SSO resources To: Hanumanth Pothula Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev , Jerin Jacob 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 Tue, May 31, 2022 at 5:50 PM Hanumanth Pothula wrote: > > Observing a crash when the user runs the second test case, with the > first test case using all HWGRP and HWS, SSO resources. This happens > as there are no HWGRP and HWS resources left for the second test case. > > Make sure to process a test case only when valid HWGRPS and HWS > are present by adding lower bound check for HWGRPS and HWS. > > Signed-off-by: Hanumanth Pothula Applied to dpdk-next-net-eventdev/for-main. Thanks > --- > drivers/common/cnxk/roc_sso.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c > index f8a0a96533..8997e6f999 100644 > --- a/drivers/common/cnxk/roc_sso.c > +++ b/drivers/common/cnxk/roc_sso.c > @@ -598,9 +598,9 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) > struct sso_lf_alloc_rsp *rsp_hwgrp; > int rc; > > - if (roc_sso->max_hwgrp < nb_hwgrp) > + if (!nb_hwgrp || roc_sso->max_hwgrp < nb_hwgrp) > return -ENOENT; > - if (roc_sso->max_hws < nb_hws) > + if (!nb_hws || roc_sso->max_hws < nb_hws) > return -ENOENT; > > rc = sso_rsrc_attach(roc_sso, SSO_LF_TYPE_HWS, nb_hws); > -- > 2.25.1 >