net/netvsc: return the correct chimney index

Message ID 1596348268-65844-1-git-send-email-longli@linuxonhyperv.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/netvsc: return the correct chimney index |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Long Li Aug. 2, 2020, 6:04 a.m. UTC
  From: Long Li <longli@microsoft.com>

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 <longli@microsoft.com>
---
 drivers/net/netvsc/hn_rxtx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Aug. 2, 2020, 5:28 p.m. UTC | #1
On Sat,  1 Aug 2020 23:04:28 -0700
longli@linuxonhyperv.com wrote:

> From: Long Li <longli@microsoft.com>
> 
> 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 <longli@microsoft.com>

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Thomas Monjalon Aug. 5, 2020, 4:10 p.m. UTC | #2
02/08/2020 19:28, Stephen Hemminger:
> On Sat,  1 Aug 2020 23:04:28 -0700
> longli@linuxonhyperv.com wrote:
> 
> > From: Long Li <longli@microsoft.com>
> > 
> > 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 <longli@microsoft.com>
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks
  

Patch

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;