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 56575A0A0B; Mon, 1 Feb 2021 09:31:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D080216064D; Mon, 1 Feb 2021 09:31:15 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2119.outbound.protection.outlook.com [40.107.21.119]) by mails.dpdk.org (Postfix) with ESMTP id D92CD40693 for ; Mon, 1 Feb 2021 09:31:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aW0idQ4y4mMcIy3nV4dS1kshs858X+v3JGQuofS0QOH2+bMUqkQKMbi9ku/BHYegR7B6wJRmen+gMeMndltkrmXQbD2gtiwMZLuTrTbdqPrtptYxUNbJKb+2ad2TLQNqNWVLKUK2OPgdpO8YdjPxud8rQ5XOv6a7SI9BFFH64zJy25ABdF5uPs9ibKZtH7HDsxzVFoqAa47ZcdrBe8JNkQ0/6A2nnHYATv7lNX1YAdrnsu4cPO51w6tVYCmuQsgC5H4042x+sEymxW69YasHT7cACayQW3qKHbYM18i48MDaIbZTmf0dwuw7pt890r5yx1Y1SAby02IEG1X596mBqQ== 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=DkUxuJdlO8FhK4rI843gK1kQOcCHUz8WO6cPp1fLCVI=; b=l1kXD633rZwODmSg3IJxRJijQi+AkbjKEQEMHIWoWNTEzjuun8QZN1JgEOYYuE7ZI+lGsX3ClnGyovzrE5z3yrYaZNHdxTEB1sKy4IaTI+fmD7WsvznQ0SbDE00mN0BtebJobch8XVcaz1CxTvJ2s7tP2OZBi4lCJToietVKexdpX1drId5KyonWo7IcGwzBWmGzcSTpHrhC6YMcmYhvmtdnc0rlH2dGkm94cQTf2rUdwkKhptFCNjv8hKngNsQbUAzTnkwdqdq1RHuGmrK1UuLE4TqHtF+j5242u2qrBFDdxka16h/X+UXC09qwM0baOickyDy/djHQrBQZDsNo6w== 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=DkUxuJdlO8FhK4rI843gK1kQOcCHUz8WO6cPp1fLCVI=; b=Wu6YrKQ6LOBdn4vSUKpjuOI4JcxCf3WkmCOSKQCY5qYvAvXE7020b+r5Etz0dZB233xvf2UidyKkpgBOOhpkpFyB1BUxY/+Rkx/RscPA1gNSdkcJeFAmhzAhrl5MFPwh6TzlNOaNJ55bO1aUJxx6V3K/twc4vGLrekOQoDovW34= 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 DB6PR0902MB2037.eurprd09.prod.outlook.com (2603:10a6:6:8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Mon, 1 Feb 2021 08:31:12 +0000 Received: from DB7PR09MB2345.eurprd09.prod.outlook.com ([fe80::fc34:cf58:29e8:932a]) by DB7PR09MB2345.eurprd09.prod.outlook.com ([fe80::fc34:cf58:29e8:932a%6]) with mapi id 15.20.3805.017; Mon, 1 Feb 2021 08:31:12 +0000 From: Ido Goshen To: Ferruh Yigit Cc: dev@dpdk.org, Ido Goshen Date: Mon, 1 Feb 2021 10:30:12 +0200 Message-Id: <20210201083012.28544-1-ido@cgstowernetworks.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Content-Type: text/plain X-Originating-IP: [81.218.57.230] X-ClientProxiedBy: ZR0P278CA0123.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::20) To DB7PR09MB2345.eurprd09.prod.outlook.com (2603:10a6:10:44::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from idog-ubuntu.localdomain (81.218.57.230) by ZR0P278CA0123.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.18 via Frontend Transport; Mon, 1 Feb 2021 08:31:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58ca4223-e20a-4e26-47bb-08d8c68bbb73 X-MS-TrafficTypeDiagnostic: DB6PR0902MB2037: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:175; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xwPgFuTXdfRV8g8ct8Ig2F7waHiLe3ZPEb51/F77dW0v8L7m+o8w5nJK5fOEMVCKyeLiCp09odejrwcfwzeOko/A4t1j82+RtmdT/E+b3BDSz/qh1ObpPylKHxHImUX4KVxoRrVdz5qxYjg/JrRlpBGw33eX0qNwULpPV3/2bWUVSu6NyY47AyVP3vv1d0OCfBtaz6ih2vPz8BQTK2EmSd0uoUVic7DLAflcdI1FoeHRcW/cgXz6UXExFZ3LGhkXsuQJ4/TZ7nzqMrGVwUbprlN9dEUXNmqiR+2TzkPG4rgvFGVq/sOnonozfM0ZWhdGE5/a1uYRO0etVjJBH0/+nZaoDTdEfKvGXUibDlAyyVywY4nXR/aXSWQCSWogBidaEiPuJPJ6ZQS+BAzTqdpB7Dmh+Siw6HODkCgCwtsVS+slBA0V31gNi4EFN9bBdmJWW7PZ4WlLdEYaB0F+zYOQP61/22lE+2hoX9LwqqdK29CgkHi/o49YcNPXQfWvkxza6larzHWPDqblsLu3+kBa+w== 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:(366004)(346002)(6916009)(83380400001)(66556008)(66946007)(66476007)(956004)(26005)(2616005)(2906002)(5660300002)(1076003)(4326008)(86362001)(508600001)(52116002)(6486002)(107886003)(36756003)(186003)(8676002)(6506007)(8936002)(6512007)(16526019); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?Xm0O0Dt4BtbknvqkHvdo/CMCIMkWIxeo6ENgvOvF3IBH5Ykv9gEsiT0rPcIi?= =?us-ascii?Q?M8HLMLQNkON/9ItVdqG7nBjp3UKNFRQ6YR6IE4kHaol72dXpUZHI1cvBQ44t?= =?us-ascii?Q?YfmYX4eTw9yVhDmhkJzInf868mEFyKtUMjdP7Sbc+9nrTFjKjmu4nKKKyMF3?= =?us-ascii?Q?CI6emBFvC1oyRwOFN1ujPdPnQC+mfySoqHPDfrzRoao7Qq3VBwtH9O4ejTZK?= =?us-ascii?Q?cY2ABOSEeZEJiwwTrwVa3WBKB5A6mOIqhCaj8yLFeUX1VM6CwDmTli754+PZ?= =?us-ascii?Q?YKImulec/x829xHDOtbzZXcVkr5jylssDCLSNeijP6n0lMlsXMMCJm+1rM1k?= =?us-ascii?Q?hec1UoX71FTctq95So4U2i+taSFkaMc/kpvZRcDmuwa1JBjj4Bdy+nLq4xVG?= =?us-ascii?Q?ih/wXMI9TB3bzBJy6xyVtxpIIOr4PZXG382pJaBgZkTn93HnKjuIIowu9+kq?= =?us-ascii?Q?gv1In2l8aRKSAJnFhPX5da4flPjMF78ed2aHS/KHObmmuw7eNMPqrSReTS0d?= =?us-ascii?Q?e2Vc48AQ58BsrtRQ8Yt+RrcdGWotzZ4fzIgeA4vSqrFBpSJ2JhWC0YHPdCqI?= =?us-ascii?Q?G4LS5CB62GCHEOv2iFfMJKTD4izmbvtlZD2W/2Ku1+LOYkvhWwEauZFs+hQl?= =?us-ascii?Q?DUi/7LYeDEO7/lW3JQ7agI51w7eeZzKmUKZiGRD1NyJckpITsXIvpbLJinIf?= =?us-ascii?Q?9tS+t9wSaQx8XBykX4t8DHh49X/zwlrWUzVsdCQioju6DscKcRQfrNRYDLoW?= =?us-ascii?Q?fD73Qx/1b4s3lsK1vht78sy7K5KOU7jY/gIYiHMqdVRI2D+mlNHHE31dGBmw?= =?us-ascii?Q?SrW3eD6d9scP9Rj1Fe0GRWkoTuG29T0I11rA0F8TWA47vQYJaoh5DAiuOK9l?= =?us-ascii?Q?9hwLPwmSmAuvT7N3io2RGS8qJivnbJKekRfZOvUUHM7okQRH9gHKI3QwtH/E?= =?us-ascii?Q?fHn+jFY9xF8o1nRcW9Tg7Ma7aDUhvjfh/8+BkglQHU63i06wsaH4k/OulR9L?= =?us-ascii?Q?4wlLe/R8UjpKJeYYlbKeU3XHLC60pX2F001fs/zzRoyH8j8AGLxCl3iJBbXY?= =?us-ascii?Q?lxDVVb+H?= X-OriginatorOrg: cgstowernetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58ca4223-e20a-4e26-47bb-08d8c68bbb73 X-MS-Exchange-CrossTenant-AuthSource: DB7PR09MB2345.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2021 08:31:12.6270 (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: reSNQy1okeJW30bD/m+haw8qGXFamn9hp0LBtgpfibiLoYbq+ZEDM3OSzRjaLdPk41PPE70CxDgo40XioVOYyvEaeTF8OxW2nNNI3ihMNEQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0902MB2037 Subject: [dpdk-dev] [PATCH v2] 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 --- v2: * sum all queues (rx_missed_total += fix) * null pcap protection * inter stop/start persistancy (counter won't reset on stop) drivers/net/pcap/rte_eth_pcap.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index a32b1f3f3..18c59d61c 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -58,6 +58,8 @@ struct queue_stat { volatile unsigned long pkts; volatile unsigned long bytes; volatile unsigned long err_pkts; + volatile unsigned long missed_reset; + volatile unsigned long missed_mnemonic; }; struct pcap_rx_queue { @@ -144,6 +146,19 @@ RTE_LOG_REGISTER(eth_pcap_logtype, pmd.net.pcap, NOTICE); rte_log(RTE_LOG_ ## level, eth_pcap_logtype, \ "%s(): " fmt "\n", __func__, ##args) +static unsigned long +eth_pcap_stats_missed_get(struct rte_eth_dev *dev, unsigned int qid) +{ + const struct pmd_process_private *pp = dev->process_private; + pcap_t *pcap = pp->rx_pcap[qid]; + if (!pcap) + return 0; + struct pcap_stat stat; + if (pcap_stats(pcap, &stat) != 0) + return 0; + return stat.ps_drop; +} + static int eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf, const u_char *data, uint16_t data_len) @@ -621,6 +636,8 @@ eth_dev_stop(struct rte_eth_dev *dev) /* Special iface case. Single pcap is open and shared between tx/rx. */ if (internals->single_iface) { + internals->rx_queue[0].rx_stat.missed_mnemonic = + eth_pcap_stats_missed_get(dev, 0); pcap_close(pp->tx_pcap[0]); pp->tx_pcap[0] = NULL; pp->rx_pcap[0] = NULL; @@ -641,6 +658,8 @@ eth_dev_stop(struct rte_eth_dev *dev) for (i = 0; i < dev->data->nb_rx_queues; i++) { if (pp->rx_pcap[i] != NULL) { + internals->rx_queue[i].rx_stat.missed_mnemonic = + eth_pcap_stats_missed_get(dev, i); pcap_close(pp->rx_pcap[i]); pp->rx_pcap[i] = NULL; } @@ -685,6 +704,7 @@ 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 +715,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_pcap_stats_missed_get(dev, i) + + internal->rx_queue[i].rx_stat.missed_mnemonic - + internal->rx_queue[i].rx_stat.missed_reset; + rx_missed_total += rx_missed; } for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && @@ -708,6 +732,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 +749,9 @@ 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_pcap_stats_missed_get(dev, i); + internal->rx_queue[i].rx_stat.missed_mnemonic = 0; } for (i = 0; i < dev->data->nb_tx_queues; i++) { -- 2.17.1