From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D04CBA034F;
	Sun,  3 Oct 2021 22:11:27 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7E78A41270;
	Sun,  3 Oct 2021 22:11:21 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 694C341262
 for <dev@dpdk.org>; Sun,  3 Oct 2021 22:11:19 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 193IuYul007120
 for <dev@dpdk.org>; Sun, 3 Oct 2021 13:11:18 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=RCUFIfGYui2RR23wIxmxNnX+UeZjbVCMBmxlJej3qJU=;
 b=h03DVhkCD1bHqhxUoRM4N04SZ0cVpqqmz/MBf+0MSFS9hSe7pNdqJlgcsAt8Cw8eebje
 1rxqsLCt5mQpW9nDH6lBon8ELbuAgiFp97oR/oHUbvh2ceT9hulUVeQjRtjipDhYt7Ea
 hPjZGpTLTX3yeVwKnrkppXk+Ff0eHfIwzscR+MNiPaFfluT5F6L6fMhN0mc37IVm4Dfg
 6dzocOgwQzbBV/8mj9Zu6LuvUOLnibL52FZLkca65M34dW2zNLgUNpP6tgZF024gf2Mv
 dx4W01Nq7uq9s1h4/WB42hV7dUbCnXRVUH4A7eLASnv/lg2Ft0zQnaxar76HgzMtxlop +w== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0a-0016f401.pphosted.com with ESMTP id 3bf6g3hm79-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)
 for <dev@dpdk.org>; Sun, 03 Oct 2021 13:11:18 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;
 Sun, 3 Oct 2021 13:11:17 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend
 Transport; Sun, 3 Oct 2021 13:11:17 -0700
Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.177.176])
 by maili.marvell.com (Postfix) with ESMTP id CF1213F7073;
 Sun,  3 Oct 2021 13:11:15 -0700 (PDT)
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>
CC: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Date: Mon, 4 Oct 2021 01:41:09 +0530
Message-ID: <20211003201110.10448-2-pbhagavatula@marvell.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20211003201110.10448-1-pbhagavatula@marvell.com>
References: <20200802181631.691-1-pbhagavatula@marvell.com>
 <20211003201110.10448-1-pbhagavatula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: jI7IUD4YteNj27Sr_aQ9GIcR99FKQDIZ
X-Proofpoint-ORIG-GUID: jI7IUD4YteNj27Sr_aQ9GIcR99FKQDIZ
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475
 definitions=2021-10-03_09,2021-10-01_02,2020-04-07_01
Subject: [dpdk-dev] [PATCH 2/3] examples/l3fwd: print port bdf when adding
 routes
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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 allow listing order is not honored.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 examples/l3fwd/l3fwd_fib.c | 16 ++++++++++------
 examples/l3fwd/l3fwd_lpm.c |  9 ++++++---
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c
index f8d6a3ac39..cc6054ca44 100644
--- a/examples/l3fwd/l3fwd_fib.c
+++ b/examples/l3fwd/l3fwd_fib.c
@@ -439,6 +439,7 @@ setup_fib(const int socketid)
 
 	/* Populate the fib ipv4 table. */
 	for (i = 0; i < RTE_DIM(ipv4_l3fwd_route_array); i++) {
+		struct rte_eth_dev_info dev_info;
 		struct in_addr in;
 
 		/* Skip unused ports. */
@@ -446,6 +447,8 @@ setup_fib(const int socketid)
 				enabled_port_mask) == 0)
 			continue;
 
+		rte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out,
+				     &dev_info);
 		ret = rte_fib_add(ipv4_l3fwd_fib_lookup_struct[socketid],
 			ipv4_l3fwd_route_array[i].ip,
 			ipv4_l3fwd_route_array[i].depth,
@@ -459,13 +462,14 @@ setup_fib(const int socketid)
 
 		in.s_addr = htonl(ipv4_l3fwd_route_array[i].ip);
 		if (inet_ntop(AF_INET, &in, abuf, sizeof(abuf)) != NULL) {
-			printf("FIB: Adding route %s / %d (%d)\n",
-				abuf,
-				ipv4_l3fwd_route_array[i].depth,
-				ipv4_l3fwd_route_array[i].if_out);
+			printf("FIB: Adding route %s / %d (%d) [%s]\n", abuf,
+			       ipv4_l3fwd_route_array[i].depth,
+			       ipv4_l3fwd_route_array[i].if_out,
+			       dev_info.device->name);
 		} else {
-			printf("FIB: IPv4 route added to port %d\n",
-				ipv4_l3fwd_route_array[i].if_out);
+			printf("FIB: IPv4 route added to port %d [%s]\n",
+			       ipv4_l3fwd_route_array[i].if_out,
+			       dev_info.device->name);
 		}
 	}
 	/* >8 End of setup fib. */
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 7200160164..582911c622 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -451,6 +451,7 @@ setup_lpm(const int socketid)
 
 	/* populate the LPM table */
 	for (i = 0; i < RTE_DIM(ipv4_l3fwd_route_array); i++) {
+		struct rte_eth_dev_info dev_info;
 		struct in_addr in;
 
 		/* skip unused ports */
@@ -458,6 +459,8 @@ setup_lpm(const int socketid)
 				enabled_port_mask) == 0)
 			continue;
 
+		rte_eth_dev_info_get(ipv4_l3fwd_route_array[i].if_out,
+				     &dev_info);
 		ret = rte_lpm_add(ipv4_l3fwd_lpm_lookup_struct[socketid],
 			ipv4_l3fwd_route_array[i].ip,
 			ipv4_l3fwd_route_array[i].depth,
@@ -470,10 +473,10 @@ setup_lpm(const int socketid)
 		}
 
 		in.s_addr = htonl(ipv4_l3fwd_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_route_array[i].depth,
-			ipv4_l3fwd_route_array[i].if_out);
+		       ipv4_l3fwd_route_array[i].depth,
+		       ipv4_l3fwd_route_array[i].if_out, dev_info.device->name);
 	}
 
 	/* create the LPM6 table */
-- 
2.33.0