[dpdk-dev] [PATCH v2 3/3] examples/l3fwd: print port bdf when initializing routes

pbhagavatula at marvell.com pbhagavatula at marvell.com
Sun Aug 2 20:16:30 CEST 2020


From: Pavan Nikhilesh <pbhagavatula at 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 at marvell.com>
---
 examples/l3fwd/l3fwd_lpm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 00047c706..65639d65a 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -496,6 +496,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < RTE_DIM(ipv4_l3fwd_lpm_route_array); i++) {
+		struct rte_eth_dev_info dev_info;
 		struct in_addr in;
 
 		/* skip unused ports */
@@ -503,6 +504,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,
@@ -515,10 +518,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 */
@@ -536,12 +540,15 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < RTE_DIM(ipv6_l3fwd_lpm_route_array); 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,
@@ -553,11 +560,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);
 	}
 }
 
-- 
2.17.1



More information about the dev mailing list