[v2] net/nfp: store counter reset before zeroing flow query

Message ID 20221209081747.39507-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2] net/nfp: store counter reset before zeroing flow query |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Chaoyong He Dec. 9, 2022, 8:17 a.m. UTC
  The reset flag in the query structure are cleared by mistake, cause
the flow count never be reset, so the query API will always has count
value even the flow has stopped, and this will cause the flow never
been aged.

Fixes: 30ecce522732 ("net/nfp: support flow API")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---

V2:
* cc to stable
* revise the logic

---
 drivers/net/nfp/nfp_flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Jan. 17, 2023, 5 p.m. UTC | #1
On 12/9/2022 8:17 AM, Chaoyong He wrote:
> The reset flag in the query structure are cleared by mistake, cause
> the flow count never be reset, so the query API will always has count
> value even the flow has stopped, and this will cause the flow never
> been aged.
> 
> Fixes: 30ecce522732 ("net/nfp: support flow API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 6f79d950db..d1d209ce13 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -3809,6 +3809,7 @@  nfp_flow_stats_get(struct rte_eth_dev *dev,
 		struct rte_flow *nfp_flow,
 		void *data)
 {
+	bool reset;
 	uint32_t ctx_id;
 	struct rte_flow *flow;
 	struct nfp_flow_priv *priv;
@@ -3823,6 +3824,7 @@  nfp_flow_stats_get(struct rte_eth_dev *dev,
 	}
 
 	query = (struct rte_flow_query_count *)data;
+	reset = query->reset;
 	memset(query, 0, sizeof(*query));
 
 	ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
@@ -3834,7 +3836,7 @@  nfp_flow_stats_get(struct rte_eth_dev *dev,
 		query->bytes = stats->bytes;
 		query->hits_set = 1;
 		query->bytes_set = 1;
-		if (query->reset != 0) {
+		if (reset) {
 			stats->pkts = 0;
 			stats->bytes = 0;
 		}