DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [RFC 2/8] test/table: replace conflicting variable name
Date: Wed, 27 Aug 2025 16:14:05 -0700	[thread overview]
Message-ID: <20250827231528.236172-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20250827231528.236172-1-stephen@networkplumber.org>

The variable name table_id is used in several places causing
warnings if -Wshadow is enabled. Rename it to table_ids.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_table.c          |  2 +-
 app/test/test_table.h          |  2 +-
 app/test/test_table_acl.c      | 28 ++++++++++++++--------------
 app/test/test_table_pipeline.c | 22 +++++++++++-----------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/app/test/test_table.c b/app/test/test_table.c
index 27d2407517..6da0012944 100644
--- a/app/test/test_table.c
+++ b/app/test/test_table.c
@@ -33,7 +33,7 @@ struct rte_mempool *pool = NULL;
 uint32_t port_in_id[N_PORTS];
 uint32_t port_out_id[N_PORTS];
 uint32_t port_out_id_type[3];
-uint32_t table_id[N_PORTS*2];
+uint32_t table_ids[N_PORTS*2];
 uint64_t override_hit_mask = 0xFFFFFFFF;
 uint64_t override_miss_mask = 0xFFFFFFFF;
 uint64_t non_reserved_actions_hit = 0;
diff --git a/app/test/test_table.h b/app/test/test_table.h
index 209bdbff2c..b8fdd98281 100644
--- a/app/test/test_table.h
+++ b/app/test/test_table.h
@@ -120,7 +120,7 @@ extern struct rte_mempool *pool;
 extern uint32_t port_in_id[N_PORTS];
 extern uint32_t port_out_id[N_PORTS];
 extern uint32_t port_out_id_type[3];
-extern uint32_t table_id[N_PORTS*2];
+extern uint32_t table_ids[N_PORTS*2];
 extern uint64_t override_hit_mask;
 extern uint64_t override_miss_mask;
 extern uint64_t non_reserved_actions_hit;
diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index dff9bddfb9..4076c513fb 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -427,14 +427,14 @@ setup_acl_pipeline(void)
 		table_params.ops = &rte_table_acl_ops;
 		table_params.arg_create = &acl_params;
 
-		if (rte_pipeline_table_create(p, &table_params, &table_id[i])) {
+		if (rte_pipeline_table_create(p, &table_params, &table_ids[i])) {
 			rte_panic("Unable to configure table %u\n", i);
 			goto fail;
 		}
 
 		if (connect_miss_action_to_table) {
 			if (rte_pipeline_table_create(p, &table_params,
-				&table_id[i+2])) {
+				&table_ids[i+2])) {
 				rte_panic("Unable to configure table %u\n", i);
 				goto fail;
 			}
@@ -443,10 +443,10 @@ setup_acl_pipeline(void)
 
 	for (i = 0; i < N_PORTS; i++) {
 		if (rte_pipeline_port_in_connect_to_table(p, port_in_id[i],
-			table_id[i])) {
+			table_ids[i])) {
 			rte_panic("Unable to connect input port %u to "
 				"table %u\n",
-				port_in_id[i],  table_id[i]);
+				port_in_id[i],  table_ids[i]);
 			goto fail;
 		}
 	}
@@ -485,11 +485,11 @@ setup_acl_pipeline(void)
 			table_entries_ptr[n] = &entries_ptr[n];
 		}
 
-		ret = rte_pipeline_table_entry_add_bulk(p, table_id[i],
+		ret = rte_pipeline_table_entry_add_bulk(p, table_ids[i],
 				(void **)key_array, table_entries, 5, key_found, table_entries_ptr);
 		if (ret < 0) {
 			rte_panic("Add entry bulk to table %u failed (%d)\n",
-				table_id[i], ret);
+				table_ids[i], ret);
 			goto fail;
 		}
 	}
@@ -519,11 +519,11 @@ setup_acl_pipeline(void)
 			}
 		}
 
-		ret = rte_pipeline_table_entry_delete_bulk(p, table_id[i],
+		ret = rte_pipeline_table_entry_delete_bulk(p, table_ids[i],
 			(void **)key_array, 5, key_found, table_entries);
 		if (ret < 0) {
 			rte_panic("Delete bulk entries from table %u failed (%d)\n",
-				table_id[i], ret);
+				table_ids[i], ret);
 			goto fail;
 		} else
 			printf("Bulk deleted rules.\n");
@@ -555,12 +555,12 @@ setup_acl_pipeline(void)
 
 			rule_params.priority = RTE_ACL_MAX_PRIORITY - n;
 
-			ret = rte_pipeline_table_entry_add(p, table_id[i],
+			ret = rte_pipeline_table_entry_add(p, table_ids[i],
 				&rule_params,
 				&table_entry, &key_found, &entry_ptr);
 			if (ret < 0) {
 				rte_panic("Add entry to table %u failed (%d)\n",
-					table_id[i], ret);
+					table_ids[i], ret);
 				goto fail;
 			}
 		}
@@ -581,11 +581,11 @@ setup_acl_pipeline(void)
 			delete_params = (struct
 				rte_pipeline_table_acl_rule_delete_params *)
 				&(rule_params.field_value[0]);
-			ret = rte_pipeline_table_entry_delete(p, table_id[i],
+			ret = rte_pipeline_table_entry_delete(p, table_ids[i],
 				delete_params, &key_found, NULL);
 			if (ret < 0) {
 				rte_panic("Add entry to table %u failed (%d)\n",
-					table_id[i], ret);
+					table_ids[i], ret);
 				goto fail;
 			} else
 				printf("Deleted Rule.\n");
@@ -607,12 +607,12 @@ setup_acl_pipeline(void)
 
 			rule_params.priority = RTE_ACL_MAX_PRIORITY - n;
 
-			ret = rte_pipeline_table_entry_add(p, table_id[i],
+			ret = rte_pipeline_table_entry_add(p, table_ids[i],
 				&rule_params,
 				&table_entry, &key_found, &entry_ptr);
 			if (ret < 0) {
 				rte_panic("Add entry to table %u failed (%d)\n",
-					table_id[i], ret);
+					table_ids[i], ret);
 				goto fail;
 			}
 		}
diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 960f730cf2..318ef1ac6c 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -311,14 +311,14 @@ setup_pipeline(int test_type)
 				.action_data_size = 0,
 		};
 
-		if (rte_pipeline_table_create(p, &table_params, &table_id[i])) {
+		if (rte_pipeline_table_create(p, &table_params, &table_ids[i])) {
 			rte_panic("Unable to configure table %u\n", i);
 			goto fail;
 		}
 
 		if (connect_miss_action_to_table)
 			if (rte_pipeline_table_create(p, &table_params,
-				&table_id[i+2])) {
+				&table_ids[i+2])) {
 				rte_panic("Unable to configure table %u\n", i);
 				goto fail;
 			}
@@ -326,9 +326,9 @@ setup_pipeline(int test_type)
 
 	for (i = 0; i < N_PORTS; i++)
 		if (rte_pipeline_port_in_connect_to_table(p, port_in_id[i],
-			table_id[i])) {
+			table_ids[i])) {
 			rte_panic("Unable to connect input port %u to "
-				"table %u\n", port_in_id[i],  table_id[i]);
+				"table %u\n", port_in_id[i],  table_ids[i]);
 			goto fail;
 		}
 
@@ -344,20 +344,20 @@ setup_pipeline(int test_type)
 		if (connect_miss_action_to_table) {
 			printf("Setting first table to output to next table\n");
 			default_entry.action = RTE_PIPELINE_ACTION_TABLE;
-			default_entry.table_id = table_id[i+2];
+			default_entry.table_id = table_ids[i+2];
 		}
 
 		/* Add the default action for the table. */
-		ret = rte_pipeline_table_default_entry_add(p, table_id[i],
+		ret = rte_pipeline_table_default_entry_add(p, table_ids[i],
 			&default_entry, &default_entry_ptr);
 		if (ret < 0) {
 			rte_panic("Unable to add default entry to table %u "
-				"code %d\n", table_id[i], ret);
+				"code %d\n", table_ids[i], ret);
 			goto fail;
 		} else
 			printf("Added default entry to table id %d with "
 				"action %x\n",
-				table_id[i], default_entry.action);
+				table_ids[i], default_entry.action);
 
 		if (connect_miss_action_to_table) {
 			/* We create a second table so the first can pass
@@ -370,17 +370,17 @@ setup_pipeline(int test_type)
 
 			/* Add the default action for the table. */
 			ret = rte_pipeline_table_default_entry_add(p,
-				table_id[i+2],
+				table_ids[i+2],
 				&default_entry, &default_entry_ptr);
 			if (ret < 0) {
 				rte_panic("Unable to add default entry to "
 					"table %u code %d\n",
-					table_id[i], ret);
+					table_ids[i], ret);
 				goto fail;
 			} else
 				printf("Added default entry to table id %d "
 					"with action %x\n",
-					table_id[i], default_entry.action);
+					table_ids[i], default_entry.action);
 		}
 	}
 
-- 
2.47.2


  parent reply	other threads:[~2025-08-27 23:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 23:14 [RFC 0/8] Avoid overlapping declarations Stephen Hemminger
2025-08-27 23:14 ` [RFC 1/8] test/ring: avoid shadow variable usage Stephen Hemminger
2025-08-28  7:42   ` Bruce Richardson
2025-08-27 23:14 ` Stephen Hemminger [this message]
2025-08-27 23:14 ` [RFC 3/8] eal: add macro to disable shadow warnings Stephen Hemminger
2025-08-28  7:43   ` Bruce Richardson
2025-08-27 23:14 ` [RFC 4/8] eal: avoid shadowed variable aligned_end Stephen Hemminger
2025-08-27 23:14 ` [RFC 5/8] eal: avoid shadowed variables in trace code Stephen Hemminger
2025-08-27 23:14 ` [RFC 6/8] ethdev: avoid shadowed variable warnings Stephen Hemminger
2025-08-27 23:14 ` [RFC 7/8] telemetry: avoid potential name conflict for handler Stephen Hemminger
2025-08-28  7:45   ` Bruce Richardson
2025-08-27 23:14 ` [RFC 8/8] pcapng: avoid shadow declaration warning Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250827231528.236172-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).