From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 55A8BA052A; Mon, 25 Jan 2021 18:58:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E75E1410BE; Mon, 25 Jan 2021 18:58:49 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80138.outbound.protection.outlook.com [40.107.8.138]) by mails.dpdk.org (Postfix) with ESMTP id D228D1410AB for ; Mon, 25 Jan 2021 18:58:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HhBJZjm3UoNgcn4ziYvVHytjBkxfqfzbM/2gM1WMs9lfP5meBpT586r8nVYNZFZFbtT+ZuB5oDrUKLvN2tY26wPzM/DqQoK/nNuDbAATW0LRZ5sRCYrBBWvYDwHIKohvodzR9/rC3uTWJQFBuiIIXIslsmva6EIHvqUVc3bdzMIQgB575pEcnD5nsDiUuBFYwjPGalU+q7Uwpu9HfuN9SERNF3kHoGn4HiHfTC0g9tGJ9XHgQBdMHv/BNLIiYqnFClI5g0cmJ39gEckP+FpJRqDviKrcx7aiE1Ke+66n8p/XvLVuKVsj0A1XqUW95LKIC59QTE28oB8pqABh20/SIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pPN1M+cvIU5RleB/Sg7dMtL4lK11rMs4VfLiEs9oEDc=; b=mLtSAUXXbW2Xh28fmA2It7egTCXznSbbG40emT+v4M09zWLo9q48hKSw/NrLShLizsaXotlp2QqYfSYLOvofJ9XzCjLTYI1NC6ESHc64qZ7A8/TBFVMQVB5ycZPsmA6J0e4I7XwfY0MlziTOGjt931Wm2dJVYcJ4rgrbxtd0iOk33keCujh7RM6DwuvstDrVwJ6In3vOqgJPuHJ+6uWRl8ppeFP51vNF+L3fiefz38hH8N9aA0f1vRFH2Ai+byLUkoqrOm9k1Hkhhd5NS2551229/FuYLFdBCr4KTpbjU5zvatdpplRJtDX9ThOWw4P/GvcnFm+jC4KLPlfl76kRwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cgstowernetworks.com; dmarc=pass action=none header.from=cgstowernetworks.com; dkim=pass header.d=cgstowernetworks.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cgstowernetworks.onmicrosoft.com; s=selector2-cgstowernetworks-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pPN1M+cvIU5RleB/Sg7dMtL4lK11rMs4VfLiEs9oEDc=; b=G4WBjzwQ0ESQR62GsabgAhNsEsCtRITP8tnF0ovkUognwPxxHVG9XMI96EJzI464mvcMehRn29JhqEPEts5rlHiFYUAs419C2ZhDyS8mDtltzwrYiwh3Tk8kL+gzHH6RV/iBsPItcA+0IpShxGyJLzGjmJFOlh4IPXy05fad2dY= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=cgstowernetworks.com; Received: from DB7PR09MB2345.eurprd09.prod.outlook.com (2603:10a6:10:44::10) by DB7PR09MB2284.eurprd09.prod.outlook.com (2603:10a6:10:4d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.15; Mon, 25 Jan 2021 17:58:47 +0000 Received: from DB7PR09MB2345.eurprd09.prod.outlook.com ([fe80::5c30:16f8:e550:ed9b]) by DB7PR09MB2345.eurprd09.prod.outlook.com ([fe80::5c30:16f8:e550:ed9b%4]) with mapi id 15.20.3784.016; Mon, 25 Jan 2021 17:58:47 +0000 From: Ido Goshen To: Ferruh Yigit Cc: dev@dpdk.org, Ido Goshen Date: Mon, 25 Jan 2021 19:58:36 +0200 Message-Id: <20210125175836.87200-1-ido@cgstowernetworks.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-Originating-IP: [81.218.57.230] X-ClientProxiedBy: VI1P195CA0070.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::23) To DB7PR09MB2345.eurprd09.prod.outlook.com (2603:10a6:10:44::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from idog-ubuntu.home (81.218.57.230) by VI1P195CA0070.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Mon, 25 Jan 2021 17:58:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03d507be-d996-43b3-3f19-08d8c15adcce X-MS-TrafficTypeDiagnostic: DB7PR09MB2284: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1013; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ekX57jKRZ2tx7chgwUwE/7ajktx8Q6b88kR8Xj6XlNUBiToU4quQCtLP8gBrwZMOI6PorAqrNrqpYlYueF9hzxyUcy8X5I4aodkkuDgVx27E2FhaZL4fWhdcDBJdXWXGb8CjZUIQZHeNlemXVupRksTGBq36fbqnZ7tS8lJxeqDCXW41m6SKpUr23z4Vj4KHSbySA5rUTNUlb9cyfdoy65PGJK7xQmAQzP5fGFq88uzsCwjB6A8iSoEwmOI2qhrHVx/DPnGXq6QoLSXRuxknKcWigHyfLz3HK2WkW8cREZWglAOeA8mwj5LNf3cnvh9PUfa7rsqys635xE9P9bhYnaAym7Q6ziMus3dSH6Hh1UxxAPt7nzFKaQ6xchIRo0TUzAnSlVFDOIrOSLFUcq5dTp77Hj3oJfmPf9OUiugSRj5fPtgTYivcFO13ykBvXklaR9Vg9WB/fqFH/hmLB9eJ1eNUn9T3OHVpPZU+NxJgbbkBfnnfTxmSwL5Y42FEKe1+gd9nsJXiJeqa97c2ieNO3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR09MB2345.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(396003)(366004)(39830400003)(346002)(136003)(1076003)(316002)(86362001)(6512007)(6916009)(52116002)(107886003)(8886007)(478600001)(2616005)(6506007)(956004)(36756003)(6666004)(8676002)(16526019)(66476007)(66946007)(66556008)(6486002)(186003)(2906002)(4326008)(5660300002)(8936002)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: t73mDz2BnGh0Z2Ifp1VGJGAZUHkGFb2SgUKrFStsrgwqpMF0OYBrZ26Vv/ZRycQzWZLuEsbIf52qBW0IPOYp55Iyv8J5tGTeK+BAj8jaTvyUWOFkLsxv79Mqdf0Pfjk1AJVdjxCL1PFyadUyOWsgDV92w9VF1oVgGs42anCl4jIVHGXjitFvAYbMAFgbs5hMKFPmKAF4ZmAZl7xHvesr/VZ1MlsW+ETg5hCeJABc75QNNLXQQdLm3A+hqlYNFEUinEM5I3XJ1EBobnkN32/6okfZ+A/C25u2L6l5yxYiSTrui/VNoB2GCp1vfZQs0TTXj+JlOm3oCsQi5W6rsfhvm+xVzG4uTyQq33rs72VbzCibqwdCC3GQOnyTlRBudGqUyrrR+rsBk/jmzEz6D88wOuKHxD8HgIc9l7qYoWK1+7995PmW6IMvd/OUT1grjg8GZQ9Igbc/1mlOl9C4QhNde8XPKhKVxgCn/TGV6gsxO1tIUBDkL3rdRgGmYktpnJRF0StP4MgtmVxYMuAMCXqIyNY7vde2liV9eLNUayAVg+712uEl9uECTDRdJhrXS2+MxdRbTqM8YVjPjGToeWzo6unselZ1kPYVtxYLhBtV/QGKolxJVlFS92CJGGyavWeWBCY21ifYcBQbwOcNHylMeBv+tR0euC+Uuf72eSpNjLsPSHw35nOQnxkULUnOeJhSkUpnjqs8llIo2/P+gHMBG/pW9J+n0FJrbZiAJfPwinbE5APgraSGBTWIcVq6vjzU X-OriginatorOrg: cgstowernetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03d507be-d996-43b3-3f19-08d8c15adcce X-MS-Exchange-CrossTenant-AuthSource: DB7PR09MB2345.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 17:58:47.1075 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fc9e9498-07e8-4b82-b4cf-365bba23cbbf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j3oX6gfLn8o0jvyZyTfnNvn5e/ceYSXqzvymJRY1bd9K8vQ6MZaOCdy7yjw671ZFwYADkd5R4j8wW5sKFaCiW3YTEwp2c3oxLEWqtNtN3SE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR09MB2284 Subject: [dpdk-dev] [PATCH 1/1] net/pcap: imissed stats support 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" Signed-off-by: Ido Goshen --- drivers/net/pcap/rte_eth_pcap.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index a32b1f3f3..83e208514 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -58,6 +58,7 @@ struct queue_stat { volatile unsigned long pkts; volatile unsigned long bytes; volatile unsigned long err_pkts; + volatile unsigned long missed_reset; }; struct pcap_rx_queue { @@ -680,11 +681,23 @@ eth_dev_info(struct rte_eth_dev *dev, return 0; } +static unsigned long +eth_stats_get_pcap_missed(struct rte_eth_dev *dev, unsigned int qid) +{ + const struct pmd_process_private *pp = dev->process_private; + pcap_t *pcap = pp->rx_pcap[qid]; + struct pcap_stat stat; + if (pcap_stats(pcap, &stat) != 0) + return 0; + return stat.ps_drop; +} + static int eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { unsigned int i; unsigned long rx_packets_total = 0, rx_bytes_total = 0; + unsigned long rx_missed_total = 0; unsigned long tx_packets_total = 0, tx_bytes_total = 0; unsigned long tx_packets_err_total = 0; const struct pmd_internals *internal = dev->data->dev_private; @@ -695,6 +708,10 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->q_ibytes[i] = internal->rx_queue[i].rx_stat.bytes; rx_packets_total += stats->q_ipackets[i]; rx_bytes_total += stats->q_ibytes[i]; + unsigned long rx_missed = eth_stats_get_pcap_missed(dev, i); + if (rx_missed) + rx_missed_total = rx_missed - + internal->rx_queue[i].rx_stat.missed_reset; } for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && @@ -708,6 +725,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->ipackets = rx_packets_total; stats->ibytes = rx_bytes_total; + stats->imissed = rx_missed_total; stats->opackets = tx_packets_total; stats->obytes = tx_bytes_total; stats->oerrors = tx_packets_err_total; @@ -724,6 +742,8 @@ eth_stats_reset(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { internal->rx_queue[i].rx_stat.pkts = 0; internal->rx_queue[i].rx_stat.bytes = 0; + internal->rx_queue[i].rx_stat.missed_reset = + eth_stats_get_pcap_missed(dev, i); } for (i = 0; i < dev->data->nb_tx_queues; i++) { -- 2.17.1