[2/2] examples/l3fwd: print port bdf when initializing routes
Checks
Commit Message
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(-)
@@ -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);
}
}