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 18312A04D7 for ; Thu, 3 Sep 2020 02:01:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2CD1DE0; Thu, 3 Sep 2020 02:01:43 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id C0EB2DE0 for ; Thu, 3 Sep 2020 02:01:42 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1004) id 0168D20B7178; Wed, 2 Sep 2020 17:01:42 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0168D20B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1599091302; bh=I44T/DzO1QJX5nr++NTcauUYZlMWM6+j3jHNxTtjrnc=; h=From:To:Cc:Subject:Date:From; b=r1MkYML3otYkD8MbGJ6QFGqFEFupLLfddsoZZbGg+nXE4SNcNa8LacLrwSk1CYwd1 McbBGaRYFqB+UjFkBvoCvCl2kZEnZODKRrKF0X1JuDNIj0G42leqovhXx3Rkui32JA IUPOkU5kJGrsrPYXLAe+z4eOxzxmGkAi44dUTPNg= From: Long Li To: Stephen Hemminger Cc: stable@dpdk.org, Long Li Date: Wed, 2 Sep 2020 17:01:31 -0700 Message-Id: <1599091291-25256-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH 18.11] net/netvsc: fix chimney index X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Long Li [ upstream commit 3eee636809e449b8b4c0cdfaf841f2d0e4a558e8 ] The code should look into "slab" to figure out the index returned from rte_bitmap_scan(). Fixes: cc02518132 ("net/netvsc: split send buffers from Tx descriptors") Signed-off-by: Long Li Acked-by: Stephen Hemminger --- drivers/net/netvsc/hn_rxtx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index cdd44a76c3..535f27d009 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -206,11 +206,13 @@ hn_chim_uninit(struct rte_eth_dev *dev) static uint32_t hn_chim_alloc(struct hn_data *hv) { uint32_t index = NVS_CHIM_IDX_INVALID; - uint64_t slab; + uint64_t slab = 0; rte_spinlock_lock(&hv->chim_lock); - if (rte_bitmap_scan(hv->chim_bmap, &index, &slab)) + if (rte_bitmap_scan(hv->chim_bmap, &index, &slab)) { + index += __builtin_ctzll(slab); rte_bitmap_clear(hv->chim_bmap, index); + } rte_spinlock_unlock(&hv->chim_lock); return index; -- 2.25.1