[2/2] examples/l3fwd: print port bdf when initializing routes
diff mbox series

Message ID 20191030052318.1167-2-pbhagavatula@marvell.com
State New
Delegated to: David Marchand
Headers show
Series
  • [1/2] examples/l3fwd: increase number of routes
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail Compilation issues

Commit Message

Pavan Nikhilesh Bhagavatula Oct. 30, 2019, 5:23 a.m. UTC
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Since the number of Ethernet ports have gone up, print the pci bdf along
with the routes.
This is also helpful for cases where whitelisting order is honored.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/l3fwd/l3fwd_lpm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index ace5823b5..707912a87 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -294,6 +294,7 @@  setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV4_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct rte_eth_dev_info dev_info;
 		struct in_addr in;
 
 		/* skip unused ports */
@@ -301,6 +302,8 @@  setup_lpm(const int socketid)
 				enabled_port_mask) == 0)
 			continue;
 
+		rte_eth_dev_info_get(ipv4_l3fwd_lpm_route_array[i].if_out,
+				     &dev_info);
 		ret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid],
 			ipv4_l3fwd_lpm_route_array[i].ip,
 			ipv4_l3fwd_lpm_route_array[i].depth,
@@ -313,10 +316,11 @@  setup_lpm(const int socketid)
 		}
 
 		in.s_addr = htonl(ipv4_l3fwd_lpm_route_array[i].ip);
-		printf("LPM: Adding route %s / %d (%d)\n",
+		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET, &in, abuf, sizeof(abuf)),
 			ipv4_l3fwd_lpm_route_array[i].depth,
-			ipv4_l3fwd_lpm_route_array[i].if_out);
+			ipv4_l3fwd_lpm_route_array[i].if_out,
+			dev_info.device->name);
 	}
 
 	/* create the LPM6 table */
@@ -334,12 +338,15 @@  setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < IPV6_L3FWD_LPM_NUM_ROUTES; i++) {
+		struct rte_eth_dev_info dev_info;
 
 		/* skip unused ports */
 		if ((1 << ipv6_l3fwd_lpm_route_array[i].if_out &
 				enabled_port_mask) == 0)
 			continue;
 
+		rte_eth_dev_info_get(ipv4_l3fwd_lpm_route_array[i].if_out,
+				     &dev_info);
 		ret = rte_lpm6_add(ipv6_l3fwd_lpm_lookup_struct[socketid],
 			ipv6_l3fwd_lpm_route_array[i].ip,
 			ipv6_l3fwd_lpm_route_array[i].depth,
@@ -351,11 +358,12 @@  setup_lpm(const int socketid)
 				i, socketid);
 		}
 
-		printf("LPM: Adding route %s / %d (%d)\n",
+		printf("LPM: Adding route %s / %d (%d) [%s]\n",
 		       inet_ntop(AF_INET6, ipv6_l3fwd_lpm_route_array[i].ip,
 				 abuf, sizeof(abuf)),
 		       ipv6_l3fwd_lpm_route_array[i].depth,
-		       ipv6_l3fwd_lpm_route_array[i].if_out);
+		       ipv6_l3fwd_lpm_route_array[i].if_out,
+		       dev_info.device->name);
 	}
 }