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 4D78EA052A; Sun, 2 Aug 2020 08:04:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EF5601C01F; Sun, 2 Aug 2020 08:04:41 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by dpdk.org (Postfix) with ESMTP id 2A7B011A2; Sun, 2 Aug 2020 08:04:40 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1004) id 45E6C20B4908; Sat, 1 Aug 2020 23:04:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 45E6C20B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1596348279; bh=vAiOyqJs0/JOGSkAZu1BOpvYSULqcfcSbBC18LRpZyg=; h=From:To:Cc:Subject:Date:From; b=n8PnuNMovKr5RZ04am0AGUKv6VTIGAm5vXePSz2+4QfvonANvnZWWZjr78uJE2KPO x9OwMKs3xngzn6CESNjjbqhinLdVpdkl2+51pz2uGHv7Vghp2uGoq+OjkDGxOjHYoq 5OX9TeaNA6L9c71LUgCOshmQTHhYAa3MRzMXsmEc= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger Cc: dev@dpdk.org, Long Li , stable@dpdk.org Date: Sat, 1 Aug 2020 23:04:28 -0700 Message-Id: <1596348268-65844-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/netvsc: return the correct chimney index 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" From: Long Li 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") Cc: stable@dpdk.org Signed-off-by: Long Li --- 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 86a4c0d74..6b32c2ca7 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 += rte_bsf64(slab); rte_bitmap_clear(hv->chim_bmap, index); + } rte_spinlock_unlock(&hv->chim_lock); return index; -- 2.25.1