From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0082.outbound.protection.outlook.com [104.47.34.82]) by dpdk.org (Postfix) with ESMTP id 88CEB1AFFD for ; Fri, 9 Mar 2018 09:43:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NrCwEGHXBeTej81OKyGh6JcqzVB8/o7g/fFQ+4AJwfg=; b=NCA3ouS5gAqk4iV4cuXVuMpfozPySb2OX7vqHV+1BL5+f32OvR9R9afD2N+1vProBbhAnpFKn54ncNeCwyJxOBeI93vycgChAqmvA3Iehw5HstCzFhzjYfRD52vTxUCZzTA5zH3xBKdgU+v3Cxuzo4YxBxtSsVRomATPPiEzabQ= Received: from wallaby-smavila.amd.com (202.56.249.162) by MWHPR12MB1517.namprd12.prod.outlook.com (2603:10b6:301:b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.12; Fri, 9 Mar 2018 08:43:23 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 9 Mar 2018 03:42:31 -0500 Message-Id: <1520584954-130575-15-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520584954-130575-1-git-send-email-Ravi1.kumar@amd.com> References: <1515145938-97474-1-git-send-email-Ravi1.kumar@amd.com> <1520584954-130575-1-git-send-email-Ravi1.kumar@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: BM1PR0101CA0057.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::19) To MWHPR12MB1517.namprd12.prod.outlook.com (2603:10b6:301:b::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9a49d19c-20f1-4344-0279-08d58599d210 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR12MB1517; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1517; 3:6TsghP04eYCTIvZmWLOGgV+jj1PC7iMp0xcUaT5JXRuZapLL9Q2tlxjhqu/mpsYc4PZ3TM1328FpBO2vq4cgh7md9KgsGkzBaoztPNwPFP1WIUjGSiXQfWWMGpaa4hkksH2lMZbX5tNkgQkhKIUeqdnY6pT2ID/SoeTWTbwVdQ+E89Rt8dZNlhfyu3meYZvo10tZDdA42WjfFda9NZeOQeKYXJgVvWbaZFAn29rqJps9JU3Gj4AVMYV53dYy1DJF; 25:zGLjzFmHKSnR9XYxcW01A1ZAAxuJ4sly5IIrUtikX6l8hXPz9iF1sjITpgUWz4SydTwRGRnDmkke4PNKcGx/1OPtCe/hK9TPWch6K8U5IfdReACyY09Nf4aWfJzWzqIPxH4lMNoLrqCCSBq/VoGkGckDqe3mtYCAf7A21/E47y/Zxn15BZWd4Q8HrtFtCrKJOBlRCi9iwJ6w7qzY3B23qJGVdUQaN0vyNVRB+qyh3BxzA3RypLyRPAkCpJWYY9kpFlj+x3NniiV48BiPly/9GBbCPnEJvb7ihEf+3P5/KFNwR96cihjDCropiqSbUdg5/6IiOFJ6ADR249wVvOWS4w==; 31:shX6ckFYYJA8001J+uwEFi1W3RWZ9ntRMqEQwEykh5r03pxGlAy7IoNzyk/D1PG3as6T/wyk2oGVPnQw0Zu5uCEt1rKgCrNnDWRDQ3Hwakr4+t1UJXR9TWMovjxqc+0EyyFQzRl2z006Om0JcN6o+/pzOWUzqQ/7zDnFZmEq4Xs+iysobXpIQsiM+IsYTxL9+0pmcMXvA/ZLyK0mfYDn34Z5rh7Lfw2lvUEALKO58vo= X-MS-TrafficTypeDiagnostic: MWHPR12MB1517: X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1517; 20:uGeiLB/8B6anSw5MgqEHb8LL4zqscOOvbR6mP0JG1OkjHWf74IEqzHl2kVJFeFNLVVNvjgu66AWybTeJ1uG7xD+4D7RSfCFks37XoZdn47PECgrzt+Suk+tbV4L2WbInIOwmzYYRAfkH+d8VQwZZ84LkgoQizLgsiE1BKfm/6tCJmnhe2fIJp+iYKGUw6cDCG/g9yzv/jPg7pp473v8eI26kuxWtQKo9hZIQQpRP2Mk1Rs+1jq1k3c1K8ZpPLhoiFAyTEdJzftnzpYM6iE/Nm6SxmGUhRGQubuy5pAl6IYMI4W+D9ho99W9VFXJtC8Jc4v/kjbvlfz06Xt5LYTRij4Y4zL7TaDOCEkgjG1ainRsInO//Eq0VPbQ1pzR4qlUWLlvE48FQaBIT7E2rB2H3C01XO5/AW1EM7Bu4c2EtMFYkRuM7aWE1bjYjwWLQH39UYjMbwh94sRKovyvedbJ9JRt2gUhzkcYbC8AHqzFeELF7yL0vyM9hBQi7AmMfNLiB; 4:BLCwxldqoY3illKBNaA4L1H2B62gCbp94sGB9pP9onCAb3VxfxLz6Fy426dBOcOgvbtAL3O3+UvILTIgGBO7LxSXXL3LYoidHSuU3YC2HsibzNJJnbBCZzQ5543uoZJxMNThUgD/Dxbc0ZKsUIerFTTHfC69hrc5p8bDu/TGeGATVPmz7qmtDpNRMvpj/W2CjPI9+D31Nf6avxjXxieAzf3u0L1S7jDYOkUJjRWuav0A/cs01B7ykmQ0x4/gVVJ4tPsuW9BjiVqMfoReZpUWmFav8vqLPZN3BVu0A7TfAulnn474Ink5wtYldmQCYQNl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:MWHPR12MB1517; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1517; X-Forefront-PRVS: 0606BBEB39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(346002)(39380400002)(396003)(39860400002)(366004)(376002)(199004)(189003)(305945005)(50226002)(386003)(6346003)(26005)(36756003)(97736004)(25786009)(7736002)(50466002)(8936002)(4326008)(16586007)(86362001)(81156014)(81166006)(6666003)(2950100002)(6916009)(16526019)(186003)(5660300001)(59450400001)(316002)(8676002)(76176011)(52116002)(51416003)(7696005)(53416004)(48376002)(478600001)(106356001)(6116002)(3846002)(68736007)(2351001)(2906002)(6486002)(66066001)(47776003)(105586002)(72206003)(53936002)(2361001)(41533002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1517; H:wallaby-smavila.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1517; 23:CnKELiv024hCl6FeQe8l5yLn5I+/BIQqT/hczrHG9?= =?us-ascii?Q?2bY18XDi+mJ7omMhF0IV4i7v0WnAk6Q+CYRMC6F7tMumJdfxPUJsOVUCyBHu?= =?us-ascii?Q?oZWwSW85k2ZXf6758/Ec4C9pKcP2G9kn2YzCriStJupOePlutgKJQTrUI3rx?= =?us-ascii?Q?owmz+YlgkECwIUtJji3sw+65UBikcSQ3cEFDw1jb2GBO9JKs2W7ALMm5aPvf?= =?us-ascii?Q?aSzN+fggYkTqCfh2Iq5FkPYQKMr2uom97jTPLGmp0K3ol/b5xFgF4jVaGozt?= =?us-ascii?Q?NaYhbqJmSF5Mrm7onOMDtb1YOrup6TRABX7w/S/JiujDE6TfVYHwkN2UsX8V?= =?us-ascii?Q?LBK30yp8439JQddNoU1DIzAO3YW3l0E5k/Jyvv+NMik38GYpNmxn1qb9X0Bn?= =?us-ascii?Q?fZmqvos6eWiRZvAPo3P5K5ZxeYizv1zlR46y3y2a65l4koVxv0bAp9dY9zBC?= =?us-ascii?Q?WGsSM4sHxIUaVFSFSjX2ky48UEpdz/003zQdkg2nSik0XzNFmfsDbqNhGBFk?= =?us-ascii?Q?C3sU7aorF0FXSMFOJ0SV/Y7L8o1X8n//tS5QGasEm+E0F/sKRU/M900rAJ/q?= =?us-ascii?Q?ils2GU4/in22i93fn7d4wUeiy9wASRAdm+sPhiXq0dAYB7TXQ1uhFjjQ4O2q?= =?us-ascii?Q?mpzge9lE88Kci5O4v2U1W2zhgV7ycIdr2Mlrog85euiGdI2F76zaONmYDcRo?= =?us-ascii?Q?4+ym2bOPntomJ7OsbA9B963apVYskExNFN5QWckjLx2X1E3UBM4w8/Ogh1WV?= =?us-ascii?Q?zNZOSL26dRmGmiuMa/USH2kyFQheBLdubuZ6s/wR/6HyFRRS/Yx0ba/hYzTf?= =?us-ascii?Q?AEwFedBgmmEsZOuvlVsuwcvcQS446V4XYRVnWVprDS5KqIH0PmK7y+KdPb4F?= =?us-ascii?Q?0CeAd230vazegyePSiTCXvOY2fsW26oXm3melfcWDW99NVjeaS4jZtYKQ416?= =?us-ascii?Q?WgRq8aVDz19q82iyNnTbpeflXHrLiNIGTrYnNOuuiLFvFicx9v/FLaWmT99E?= =?us-ascii?Q?GVh5whksl/vU9RiK1HE5nM1hXG+AkbC5tJlk5XZBiB7W3SVdydzfdY+RvpBG?= =?us-ascii?Q?iCxqi9PKbn+z6vLEl3hI7wEU1GoacbO8MFRfxUaSwAtgLur19xvTr9KRF19b?= =?us-ascii?Q?BK3msESXzFwx5H84x93C0qPO7wEFz/bBCerwXjlM4UsIVibMFLPeLSpm7yip?= =?us-ascii?Q?hADVPTxr1bBtJcNWIe5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:nvyzIDQz+PSFA1oEEtcHDGRq+BW6XpL1XSbUGnS/OAYKMT2XlFhxVvUMJ1sw9O8ggn0y3TbeBvCJFy2ZTEkITiJsaW81KCTBsHcjvwv4RPDoWaZT/pMJL4DGekn2xRkiuAikvYDDsS5+v2n4T6hDb3KSuIunKofzrkV3HwdYV85Gi2e5jEV5/nI29FT1HJlfi7F5HtpYHdG1t1koaOPiWZIKe0coFMbMmoVeH7ahYNy8/FRsbEXUSNa01t2EWz7L SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1517; 20:pFyMcGf9c4FBxId5FlUyxmQL8rR7Q4+3BuBgg6u/oufdZjlVU3qhyDI1sGWdnj2YdfRddmINyHGSaO/Wp+w0xb7XsesRVZ/OqOShe+I/mckx4Nqr7LWkmVeWGYx1xaQrbeLurVW5bQm6JNfreLxDJUv6Wt1TsbzIrwwEe9mBzz6WC/2VdoGGh15SyjoAN/E0rseDCNJ120DUdcsJ4vQ33KGuJ+ii4IlW6RKFPKQYtRqFbDQc3zROePUK0RMZZtAP X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2018 08:43:23.3704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a49d19c-20f1-4344-0279-08d58599d210 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1517 Subject: [dpdk-dev] [PATCH v3 15/18] net/axgbe: add generic transmit and receive stats support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2018 08:43:26 -0000 Signed-off-by: Ravi Kumar --- doc/guides/nics/axgbe.rst | 1 + doc/guides/nics/features/axgbe.ini | 1 + drivers/net/axgbe/axgbe_ethdev.c | 51 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/doc/guides/nics/axgbe.rst b/doc/guides/nics/axgbe.rst index 8fe75bf..9038463 100644 --- a/doc/guides/nics/axgbe.rst +++ b/doc/guides/nics/axgbe.rst @@ -136,6 +136,7 @@ AXGBE PMD has support for: - Base L2 features - TSS (Transmit Side Scaling) - Promiscuous mode +- Port statistics - Multicast mode - RSS (Receive Side Scaling) - Checksum offload diff --git a/doc/guides/nics/features/axgbe.ini b/doc/guides/nics/features/axgbe.ini index 9f4d38f..042ff1e 100644 --- a/doc/guides/nics/features/axgbe.ini +++ b/doc/guides/nics/features/axgbe.ini @@ -13,5 +13,6 @@ RSS hash = Y CRC offload = Y L3 checksum offload = Y L4 checksum offload = Y +Basic stats = Y Linux UIO = Y x86-64 = Y diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 0b67cf6..9e5114b 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -143,6 +143,9 @@ static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev); static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev); static int axgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); +static int axgbe_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats); +static void axgbe_dev_stats_reset(struct rte_eth_dev *dev); static void axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); @@ -204,6 +207,8 @@ static const struct eth_dev_ops axgbe_eth_dev_ops = { .allmulticast_enable = axgbe_dev_allmulticast_enable, .allmulticast_disable = axgbe_dev_allmulticast_disable, .link_update = axgbe_dev_link_update, + .stats_get = axgbe_dev_stats_get, + .stats_reset = axgbe_dev_stats_reset, .dev_infos_get = axgbe_dev_info_get, .rx_queue_setup = axgbe_dev_rx_queue_setup, .rx_queue_release = axgbe_dev_rx_queue_release, @@ -418,6 +423,52 @@ axgbe_dev_link_update(struct rte_eth_dev *dev, return old_link_status == dev->data->dev_link.link_status ? -1 : 0; } +static int +axgbe_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats) +{ + struct axgbe_rx_queue *rxq; + struct axgbe_tx_queue *txq; + unsigned int i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + stats->q_ipackets[i] = rxq->pkts; + stats->ipackets += rxq->pkts; + stats->q_ibytes[i] = rxq->bytes; + stats->ibytes += rxq->bytes; + } + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + stats->q_opackets[i] = txq->pkts; + stats->opackets += txq->pkts; + stats->q_obytes[i] = txq->bytes; + stats->obytes += txq->bytes; + } + + return 0; +} + +static void +axgbe_dev_stats_reset(struct rte_eth_dev *dev) +{ + struct axgbe_rx_queue *rxq; + struct axgbe_tx_queue *txq; + unsigned int i; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + rxq = dev->data->rx_queues[i]; + rxq->pkts = 0; + rxq->bytes = 0; + rxq->errors = 0; + } + for (i = 0; i < dev->data->nb_tx_queues; i++) { + txq = dev->data->tx_queues[i]; + txq->pkts = 0; + txq->bytes = 0; + txq->errors = 0; + } +} static void axgbe_dev_info_get(struct rte_eth_dev *dev, -- 2.7.4