From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 76D68A0518;
	Sun,  2 Aug 2020 20:17:02 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 111201C029;
	Sun,  2 Aug 2020 20:16:53 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id B62791C029
 for <dev@dpdk.org>; Sun,  2 Aug 2020 20:16:50 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 072IFGZe003253; Sun, 2 Aug 2020 11:16:49 -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=pfpt0818;
 bh=JEGr4VKymZLraXrC1u8KHGdS4uz8zPA1VA/Z7Pia4JI=;
 b=J2zXoL3GVDS4nDWV+3yDJGEBcRysUfq7/AITcAKPhgaq+U2hU5S4BwH6oT2qdh9TNcUt
 vg5k8XLDcOZUw4Ycn9PG9VoiYd3jWIX+F75pD8QgEqph4vaWl+Ni3caPPGDGGUv5iCXz
 EmddZJ/COeTerPc+Pw0ZMJXbADcRhC6gFOz17T37TjXhk1v/RYwROlUHktRn6Bzx6zxK
 0K9Mg56e8aP9f/X4639oQraEELxeebjbbmA+cMF+QrYnq06QslJ/WNNbi3lm6zywqnlU
 NkytXyR5g02j5dup8wb+R2XLTmyEyJ+4sOPzvmKqI2P+qRJpNrsKmG4Tu81dksVqb4vV Ew== 
Received: from sc-exch02.marvell.com ([199.233.58.182])
 by mx0a-0016f401.pphosted.com with ESMTP id 32n6cgc0qg-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Sun, 02 Aug 2020 11:16:49 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com
 (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Sun, 2 Aug 2020 11:16:49 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Sun, 2 Aug 2020 11:16:49 -0700
Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.161.240])
 by maili.marvell.com (Postfix) with ESMTP id C354D3F703F;
 Sun,  2 Aug 2020 11:16:44 -0700 (PDT)
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <thomas@monjalon.net>, <david.marchand@redhat.com>, 
 Marko Kovacevic <marko.kovacevic@intel.com>, Ori Kam <orika@mellanox.com>,
 Bruce Richardson <bruce.richardson@intel.com>, Radu Nicolau
 <radu.nicolau@intel.com>, Akhil Goyal <akhil.goyal@nxp.com>,
 Tomasz Kantecki <tomasz.kantecki@intel.com>,
 Sunil Kumar Kori <skori@marvell.com>, "Pavan
 Nikhilesh" <pbhagavatula@marvell.com>
CC: <dev@dpdk.org>
Date: Sun, 2 Aug 2020 23:46:30 +0530
Message-ID: <20200802181631.691-3-pbhagavatula@marvell.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20200802181631.691-1-pbhagavatula@marvell.com>
References: <20191030052318.1167-1-pbhagavatula@marvell.com>
 <20200802181631.691-1-pbhagavatula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687
 definitions=2020-08-02_15:2020-07-31,
 2020-08-02 signatures=0
Subject: [dpdk-dev] [PATCH v2 3/3] examples/l3fwd: print port bdf when
	initializing routes
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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 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(-)

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