From patchwork Sun Oct 3 20:24:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 100397 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 668FBA034F; Sun, 3 Oct 2021 22:25:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4819A4126B; Sun, 3 Oct 2021 22:24:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1C8B241267 for ; Sun, 3 Oct 2021 22:24:56 +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 193D09PC024895; Sun, 3 Oct 2021 13:24:56 -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=2dQb2424HI5rwonkLFhM1tCxOdeZncb9W6bDNy8pBKU=; b=j378qCuQX779Lis5DxVkAH7kk6QzV2V2OmttvF4LtPnUYf3Lo0U/nFVv1QOnDQBg9STd LgvYIIEdbijV8sksTByeUJeV9E0GtZGRQJUMWX267KWtki6Tl7hTaFPGQbWT6EvazDA7 TArlY2RB5z6CEsBsMzVqtDlSqLG458d/pWSbLWELl8H6AN7jx1uMAEeU0cacGBLD4ztP gLfsEVT1bp/hmEfAM4ifxW7LSHBB+0VN96i81NMjEwAHblV1qwyiPcnS1JYguOG9iLfW wLBqWgMPGzkitZzA4/IbZ2pKbj4qYyUzLzu5gO+gKETcQ1eHya0rxM3qxrZljh0dXC7X VA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3bf6g3hmu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 03 Oct 2021 13:24:56 -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:24:54 -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:24:54 -0700 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.177.176]) by maili.marvell.com (Postfix) with ESMTP id 425613F7069; Sun, 3 Oct 2021 13:24:53 -0700 (PDT) From: To: , CC: , Pavan Nikhilesh Date: Mon, 4 Oct 2021 01:54:46 +0530 Message-ID: <20211003202448.10908-2-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211003202448.10908-1-pbhagavatula@marvell.com> References: <20211003201110.10448-1-pbhagavatula@marvell.com> <20211003202448.10908-1-pbhagavatula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: nvlnBFMFE1QPam2JLd9TQa75LoyLvoL1 X-Proofpoint-ORIG-GUID: nvlnBFMFE1QPam2JLd9TQa75LoyLvoL1 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 v4 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pavan Nikhilesh 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 --- 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 */