net/nfp: fix parsing non-exist meta data

Message ID 20240415024758.1001527-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted
Delegated to: Ferruh Yigit
Headers
Series net/nfp: fix parsing non-exist meta data |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Chaoyong He April 15, 2024, 2:47 a.m. UTC
  From: Long Wu <long.wu@corigine.com>

If the packet without meta data, the initialization logic of
'meta->flags' will be skipped and lead to the wrong logic
because of 'meta->flags' has random value.

Fix it by make sure 'meta->flags' can be initialized in any situation.

Fixes: 5eed6ad5a7b9 ("net/nfp: use flag bits to control meta data parsing")
Cc: stable@dpdk.org

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Zerun Fu <zerun.fu@corigine.com>
---
 drivers/net/nfp/nfp_net_meta.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit April 19, 2024, 12:54 a.m. UTC | #1
On 4/15/2024 3:47 AM, Chaoyong He wrote:
> From: Long Wu <long.wu@corigine.com>
> 
> If the packet without meta data, the initialization logic of
> 'meta->flags' will be skipped and lead to the wrong logic
> because of 'meta->flags' has random value.
> 
> Fix it by make sure 'meta->flags' can be initialized in any situation.
> 
> Fixes: 5eed6ad5a7b9 ("net/nfp: use flag bits to control meta data parsing")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Zerun Fu <zerun.fu@corigine.com>
>

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

Patch

diff --git a/drivers/net/nfp/nfp_net_meta.c b/drivers/net/nfp/nfp_net_meta.c
index fa7e0d3d00..b31ef56f17 100644
--- a/drivers/net/nfp/nfp_net_meta.c
+++ b/drivers/net/nfp/nfp_net_meta.c
@@ -27,7 +27,6 @@  nfp_net_meta_parse_chained(uint8_t *meta_base,
 
 	meta_info = rte_be_to_cpu_32(meta_header);
 	meta_offset = meta_base + 4;
-	meta->flags = 0;
 
 	for (; meta_info != 0; meta_info >>= NFP_NET_META_FIELD_SIZE, meta_offset += 4) {
 		switch (meta_info & NFP_NET_META_FIELD_MASK) {
@@ -237,6 +236,8 @@  nfp_net_meta_parse(struct nfp_net_rx_desc *rxds,
 	uint8_t *meta_base;
 	rte_be32_t meta_header;
 
+	meta->flags = 0;
+
 	if (unlikely(NFP_DESC_META_LEN(rxds) == 0))
 		return;