From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B474A0526; Tue, 21 Jul 2020 19:34:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23BA21BFFF; Tue, 21 Jul 2020 19:34:12 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id BFBDB1BFFE for ; Tue, 21 Jul 2020 19:34:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595352850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=D7euI3mHj5CKDajVbPGM5+T9TwucsMD28Z8XH+Qnn5I=; b=bKGkR+ZGvMr1W5x2bvqXmcICIXs3sDSvwTTTwOCRX6Qx6EGWFrHRenq8IY3ENZ8gWuJKhI CJAy8rpD+8cMWVXSovTujKd0oN05dFzJ/DdFxiBFgK2G5LHnd313X2cMAbTtGWZ1tacJCj 1e8CjfikGMFhH6f/xpSOjNqsje2Unu0= Received: from mail-vk1-f197.google.com (mail-vk1-f197.google.com [209.85.221.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-IVY50hQbN5i4xXDJijI5CQ-1; Tue, 21 Jul 2020 13:34:06 -0400 X-MC-Unique: IVY50hQbN5i4xXDJijI5CQ-1 Received: by mail-vk1-f197.google.com with SMTP id c2so8552967vkh.18 for ; Tue, 21 Jul 2020 10:34:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D7euI3mHj5CKDajVbPGM5+T9TwucsMD28Z8XH+Qnn5I=; b=lGez5CvbJEtvV9s5F3XxAx0w9DjSZtnoP2l9inuxvo1v/GmmEKtKXH+UpauKw/C8hu 3qyxX+kkuTgGkZHtd9tNLgzfV52374RfVRBAoDxhAn2exNJKgDzbcr7fLAzZXHxDOdJX zJxtZ+FWB44jf6suldNdVnJoQG6Fh0SfZm+jphTi4eOoyHqToekdpD4652K3+7f5bRJF 8K0q4UmuPcOJeKnL1oRTqkL/y0ZPBxHSnPLwhZZy4nq7bRbWXU88N9Uju3okoowFaWC8 Fy9MzjaDrHwXtO4Isbv8jJNXIu6Tr47AEPy1sWPJ7usfIwZp1Za8qWqduWs2WaLkvQ45 cNZQ== X-Gm-Message-State: AOAM530K61lzcjsIn6cksRmX51YX1j0gCHJz5xvbGiFxrFwZNBinDzi9 IWezP6MV2U6RSsNpoJPPpj+zYiayQZcAFNkJ01HIo5Pbgdr59HR7Rh0kYfWd5nKWu8iRnS2fDVL vEU/cCV/rWLOLCPxalIY= X-Received: by 2002:a9f:31f3:: with SMTP id w48mr14926498uad.87.1595352846485; Tue, 21 Jul 2020 10:34:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg9Np9Q1Sfnb+AC1lcssuKsiB9DUApA8HOJ9zb+1yCwh28Ul46sE3nqkhOuPnCB5/Jr8gHM5BuETckhh05IRQ= X-Received: by 2002:a9f:31f3:: with SMTP id w48mr14926447uad.87.1595352845883; Tue, 21 Jul 2020 10:34:05 -0700 (PDT) MIME-Version: 1.0 References: <20200716051903.94195-1-ruifeng.wang@arm.com> <20200716154920.167185-1-ruifeng.wang@arm.com> <608e9beb-812e-2375-b532-79b6366d31f8@intel.com> <20200721171005.GJ735@bricha3-MOBL.ger.corp.intel.com> In-Reply-To: <20200721171005.GJ735@bricha3-MOBL.ger.corp.intel.com> From: David Marchand Date: Tue, 21 Jul 2020 19:33:54 +0200 Message-ID: To: Bruce Richardson , "Medvedkin, Vladimir" Cc: Ruifeng Wang , "dev@dpdk.org" , nd , Honnappa Nagarahalli , Phil Yang X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] lpm: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jul 21, 2020 at 7:16 PM Bruce Richardson wrote: > > On Tue, Jul 21, 2020 at 05:23:02PM +0100, Medvedkin, Vladimir wrote: > > Hi Ruifeng, > > > > On 18/07/2020 10:22, Ruifeng Wang wrote: > > > > > > > -----Original Message----- > > > > From: Medvedkin, Vladimir > > > > Sent: Saturday, July 18, 2020 1:12 AM > > > > To: Ruifeng Wang ; Bruce Richardson > > > > > > > > Cc: dev@dpdk.org; nd ; Honnappa Nagarahalli > > > > ; Phil Yang > > > > Subject: Re: [PATCH v2] lpm: fix unchecked return value > > > > > > > > Hi Ruifeng, > > > > > > > Hi Vladimir, > > > > > > > On 16/07/2020 16:49, Ruifeng Wang wrote: > > > > > Coverity complains about unchecked return value of > > > > rte_rcu_qsbr_dq_enqueue. > > > > > By default, defer queue size is big enough to hold all tbl8 groups. > > > > > When enqueue fails, return error to the user to indicate system issue. > > > > > > > > > > Coverity issue: 360832 > > > > > Fixes: 8a9f8564e9f9 ("lpm: implement RCU rule reclamation") > > > > > > > > > > Signed-off-by: Ruifeng Wang > > > > > --- > > > > > v2: > > > > > Converted return value to conform to LPM API convention. (Vladimir) > > > > > > > > > > lib/librte_lpm/rte_lpm.c | 19 +++++++++++++------ > > > > > 1 file changed, 13 insertions(+), 6 deletions(-) > > > > > > > > > > diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index > > > > > 2db9e16a2..757436f49 100644 > > > > > --- a/lib/librte_lpm/rte_lpm.c > > > > > +++ b/lib/librte_lpm/rte_lpm.c > > > > > @@ -532,11 +532,12 @@ tbl8_alloc(struct rte_lpm *lpm) > > > > > return group_idx; > > > > > } > > > > > > > > > > -static void > > > > > +static int32_t > > > > > tbl8_free(struct rte_lpm *lpm, uint32_t tbl8_group_start) > > > > > { > > > > > struct rte_lpm_tbl_entry zero_tbl8_entry = {0}; > > > > > struct __rte_lpm *internal_lpm; > > > > > + int status; > > > > > > > > > > internal_lpm = container_of(lpm, struct __rte_lpm, lpm); > > > > > if (internal_lpm->v == NULL) { > > > > > @@ -552,9 +553,15 @@ tbl8_free(struct rte_lpm *lpm, uint32_t > > > > tbl8_group_start) > > > > > __ATOMIC_RELAXED); > > > > > } else if (internal_lpm->rcu_mode == RTE_LPM_QSBR_MODE_DQ) { > > > > > /* Push into QSBR defer queue. */ > > > > > - rte_rcu_qsbr_dq_enqueue(internal_lpm->dq, > > > > > + status = rte_rcu_qsbr_dq_enqueue(internal_lpm->dq, > > > > > (void *)&tbl8_group_start); > > > > > + if (status == 1) { > > > > > + RTE_LOG(ERR, LPM, "Failed to push QSBR FIFO\n"); > > > > > + return -rte_errno; > > > > > + } > > > > > } > > > > > + > > > > > + return 0; > > > > > } > > > > > > > > > > static __rte_noinline int32_t > > > > > @@ -1040,7 +1047,7 @@ delete_depth_big(struct rte_lpm *lpm, uint32_t > > > > ip_masked, > > > > > #define group_idx next_hop > > > > > uint32_t tbl24_index, tbl8_group_index, tbl8_group_start, > > > > tbl8_index, > > > > > tbl8_range, i; > > > > > - int32_t tbl8_recycle_index; > > > > > + int32_t tbl8_recycle_index, status = 0; > > > > > > > > > > /* > > > > > * Calculate the index into tbl24 and range. Note: All depths > > > > > larger @@ -1097,7 +1104,7 @@ delete_depth_big(struct rte_lpm *lpm, > > > > uint32_t ip_masked, > > > > > */ > > > > > lpm->tbl24[tbl24_index].valid = 0; > > > > > __atomic_thread_fence(__ATOMIC_RELEASE); > > > > > - tbl8_free(lpm, tbl8_group_start); > > > > > + status = tbl8_free(lpm, tbl8_group_start); > > > > > } else if (tbl8_recycle_index > -1) { > > > > > /* Update tbl24 entry. */ > > > > > struct rte_lpm_tbl_entry new_tbl24_entry = { @@ -1113,10 > > > > +1120,10 > > > > > @@ delete_depth_big(struct rte_lpm *lpm, uint32_t ip_masked, > > > > > __atomic_store(&lpm->tbl24[tbl24_index], > > > > &new_tbl24_entry, > > > > > __ATOMIC_RELAXED); > > > > > __atomic_thread_fence(__ATOMIC_RELEASE); > > > > > - tbl8_free(lpm, tbl8_group_start); > > > > > + status = tbl8_free(lpm, tbl8_group_start); > > > > > } > > > > > #undef group_idx > > > > > - return 0; > > > > > + return status; > > > > > > > > This will change rte_lpm_delete API. As a suggestion, you can leave it as it > > > > was before ("return 0"), and send separate patch (with "return status)" > > > > which will be targeted to 20.11. > > > > > > > > > > Is the change of API because a variable is returned instead of constant? > > > The patch passed ABI check on Travis: http://mails.dpdk.org/archives/test-report/2020-July/144864.html > > > So I didn't know there is API/ABI issue. > > > > > > Because new error status codes are returned. At the moment rte_lpm_delete() > > returns only -EINVAL. After patches it will also returns -ENOSPC. The user's > > code may not handle this returned error status. > > > > On the other hand, from documentation about returned value: > > "0 on success, negative value otherwise", > > and given the fact that this behavior is only after calling > > rte_lpm_rcu_qsbr_add(), I think we can accept this patch. > > Bruce, please correct me. > > > That sounds reasonable to me. No change in the committed ABI, since the > specific values are not called out. > I will take this as a second ack and merge this fix for rc2. Thanks. -- David Marchand