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 736ACA00BE for ; Thu, 28 May 2020 18:25:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 616951DC1D; Thu, 28 May 2020 18:25:47 +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 031F61DC1E for ; Thu, 28 May 2020 18:25:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590683145; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mk1eDVozr/lKweCK2wuq9pgxc3KQBuZZvMSrGJqLr2g=; b=KuslV1vbeq52Zs9mW/pGPx+w2NoLnQDhmGatbS8VCH2es5rZSt4ky2g+G59HG/Bear7OF/ yLuRyGh7X31hEHl3d/4rb/T9OLuNQC4tgldAYGpxq6AvY38XIwDFfcZXwp2+1Zm5Txh4eD i5oHrRH8ACIkgBrGAca/FeuJNyutdd0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-HWuZ2eeHMXOJykzv93yRHA-1; Thu, 28 May 2020 12:25:41 -0400 X-MC-Unique: HWuZ2eeHMXOJykzv93yRHA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A68B1872FE0; Thu, 28 May 2020 16:25:40 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.235]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE16C60C87; Thu, 28 May 2020 16:25:39 +0000 (UTC) From: Kevin Traynor To: Michal Krawczyk Cc: dpdk stable Date: Thu, 28 May 2020 17:22:52 +0100 Message-Id: <20200528162322.7863-65-ktraynor@redhat.com> In-Reply-To: <20200528162322.7863-1-ktraynor@redhat.com> References: <20200528162322.7863-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/ena/base: fix testing for supported hash function' has been queued to LTS release 18.11.9 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" Hi, FYI, your patch has been queued to LTS release 18.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/03/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/99f5693c1f9d7fbeaed6519ff79c5c59c8a4ead2 Thanks. Kevin. --- >From 99f5693c1f9d7fbeaed6519ff79c5c59c8a4ead2 Mon Sep 17 00:00:00 2001 From: Michal Krawczyk Date: Wed, 8 Apr 2020 10:28:56 +0200 Subject: [PATCH] net/ena/base: fix testing for supported hash function [ upstream commit 6e585db68903b9ef8e0a547efc8f3e71af424397 ] There was a bug in ena_com_fill_hash_function(), which was causing bit to be shifted left one bit too much. To fix that, the ENA_FFS macro is being used (returning the location of the first bit set), hash_function value is being subtracted by 1 if any hash function is supported by the device and BIT macro is used for shifting for better verbosity. Fixes: 99ecfbf845b3 ("ena: import communication layer") Signed-off-by: Michal Krawczyk --- drivers/net/ena/base/ena_com.c | 19 +++++++++++++------ drivers/net/ena/base/ena_plat_dpdk.h | 2 ++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/net/ena/base/ena_com.c b/drivers/net/ena/base/ena_com.c index f22d67cd4d..4a6bc5e179 100644 --- a/drivers/net/ena/base/ena_com.c +++ b/drivers/net/ena/base/ena_com.c @@ -2099,10 +2099,12 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, const u8 *key, u16 key_len, u32 init_val) { - struct ena_rss *rss = &ena_dev->rss; + struct ena_admin_feature_rss_flow_hash_control *hash_key; struct ena_admin_get_feat_resp get_resp; - struct ena_admin_feature_rss_flow_hash_control *hash_key = - rss->hash_key; + enum ena_admin_hash_functions old_func; + struct ena_rss *rss = &ena_dev->rss; int rc; + hash_key = rss->hash_key; + /* Make sure size is a mult of DWs */ if (unlikely(key_len & 0x3)) @@ -2116,5 +2118,5 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, return rc; - if (!((1 << func) & get_resp.u.flow_hash_func.supported_func)) { + if (!(BIT(func) & get_resp.u.flow_hash_func.supported_func)) { ena_trc_err("Flow hash function %d isn't supported\n", func); return ENA_COM_UNSUPPORTED; @@ -2141,9 +2143,10 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, } + old_func = rss->hash_func; rc = ena_com_set_hash_function(ena_dev); /* Restore the old function */ if (unlikely(rc)) - ena_com_get_hash_function(ena_dev, NULL, NULL); + rss->hash_func = old_func; return rc; @@ -2167,5 +2170,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, return rc; - rss->hash_func = get_resp.u.flow_hash_func.selected_func; + /* ENA_FFS returns 1 in case the lsb is set */ + rss->hash_func = ENA_FFS(get_resp.u.flow_hash_func.selected_func); + if (rss->hash_func) + rss->hash_func--; + if (func) *func = rss->hash_func; diff --git a/drivers/net/ena/base/ena_plat_dpdk.h b/drivers/net/ena/base/ena_plat_dpdk.h index 5cc559b4f4..03ea2cd0dd 100644 --- a/drivers/net/ena/base/ena_plat_dpdk.h +++ b/drivers/net/ena/base/ena_plat_dpdk.h @@ -263,3 +263,5 @@ extern rte_atomic32_t ena_alloc_cnt; #endif +#define ENA_FFS(x) ffs(x) + #endif /* DPDK_ENA_COM_ENA_PLAT_DPDK_H_ */ -- 2.21.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-28 17:13:02.465397349 +0100 +++ 0065-net-ena-base-fix-testing-for-supported-hash-function.patch 2020-05-28 17:12:59.143555450 +0100 @@ -1 +1 @@ -From 6e585db68903b9ef8e0a547efc8f3e71af424397 Mon Sep 17 00:00:00 2001 +From 99f5693c1f9d7fbeaed6519ff79c5c59c8a4ead2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6e585db68903b9ef8e0a547efc8f3e71af424397 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 38a474b1bd..04f5d21d6f 100644 +index f22d67cd4d..4a6bc5e179 100644 @@ -27 +28 @@ -@@ -2395,10 +2395,12 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, +@@ -2099,10 +2099,12 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, @@ -43 +44 @@ -@@ -2412,5 +2414,5 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, +@@ -2116,5 +2118,5 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, @@ -50 +51 @@ -@@ -2438,4 +2440,5 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, +@@ -2141,9 +2143,10 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, @@ -54 +54,0 @@ - rss->hash_func = func; @@ -56 +56 @@ -@@ -2443,5 +2446,5 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, + @@ -63 +63 @@ -@@ -2465,5 +2468,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, +@@ -2167,5 +2170,9 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, @@ -75 +75 @@ -index e9b33bc36c..e9b3c02270 100644 +index 5cc559b4f4..03ea2cd0dd 100644 @@ -78,2 +78,2 @@ -@@ -302,4 +302,6 @@ extern rte_atomic32_t ena_alloc_cnt; - #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +@@ -263,3 +263,5 @@ extern rte_atomic32_t ena_alloc_cnt; + #endif @@ -83,2 +83 @@ - void ena_rss_key_fill(void *key, size_t size); - + #endif /* DPDK_ENA_COM_ENA_PLAT_DPDK_H_ */