From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0061.outbound.protection.outlook.com [104.47.32.61]) by dpdk.org (Postfix) with ESMTP id 482B61CFD8 for ; Fri, 6 Apr 2018 14:37:37 +0200 (CEST) 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=BuN3IWj5L2OqRdHqjzLAF5Ze//8Vtu+V1XxkMie7T+A=; b=lKx6pzg4p28GIOuKGfh9WJiJPMNigqGsYFmMrLZZs57bGMy3+Hf4OcSo6Y3JGiz6NYoSn9M0MiqroQIcLAIqaesK2fU+q5tLVX1NlzCtFrfsgAQ27dkV/9uacs3GYOs4dODh+hz0tYQHbQ4iVaMmBhhE4dP9vO8EdrsO+G36KRA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by CY4PR12MB1509.namprd12.prod.outlook.com (2603:10b6:910:8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Fri, 6 Apr 2018 12:37:34 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 6 Apr 2018 08:36:48 -0400 Message-Id: <1523018211-65765-15-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523018211-65765-1-git-send-email-Ravi1.kumar@amd.com> References: <1522910389-35530-1-git-send-email-Ravi1.kumar@amd.com> <1523018211-65765-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: MA1PR0101CA0013.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::23) To CY4PR12MB1509.namprd12.prod.outlook.com (2603:10b6:910:8::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 14fd3a1f-a724-490d-e795-08d59bbb2cf1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR12MB1509; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 3:w/21pVleyoCLQ0uHsVJcMoV8+3iS1O18RQ4RsUM7sGewa70DxLrpb2IPuYas8GCsr9m3yL7qjLi+o2IaLS54fhxSVkWSucPSjdkmDhVD7g7HQSeX0F5RTrC3NoR6h/ls1RMRi5UuwbnCFBT1SxavP0G3I5DZ1z4wIcne4qDxoZcw2sm854qA1PNv+shK+WKoreDHCag+XDhwennR8QDKZdrlOSYp0zUhH6ESdn/HMbrAa4DY7/KMBZsNlU/y2cFk; 25:84z6574bMMYUP/2NOed8Pd6uxm1HkhGYqXeNsr7vWC++f7EnNQ+r9HhUvO/XZUOYgIdSBo1FxAo68pOB9gF3PX/XirmIhpLRvXoAcpLR6U0/1kWkNSABJRF6FJGpolMJbaMFvAAp2xcCRKVaLD+KGhDpmvJxkBmxbGsRgG6p12aOaK3asA8JRLSl/whcohr417PPIKhxcY9zEJUkbQpqkqa2YmSsPjWYzwOFQh2Dtzl4xo4i7ghTiNQXGsLn5u2GD1lzH6ZaU+0KSS54PIPRt0PTBHhIczEq0GHuZCJq27apOG5A0puz3Dd/IxVej1PSKZH1H/C1vn5d4HVMj6R7GQ==; 31:Oj/pbQXiQeR0iKd9qLOUw1R/BpDfmL6RL3ug7qw0ng8oDIAsijbuMViv3EhPeURZGCmLBoijLk1CccxO5m0G7z+bgOcAG3dEpZK+bbiAWIdN2ZG4z88LwPwqDhb4s+GhmgnQwJUha3hOt2CAqUiKdz/6wqkp0ML9eyg6vmfWtj4M5Zh0843Lhso0JnNEHpOADAlAcE+Im9B6YIydQyknOu52UDmzhmh8eFkB5oBtfY8= X-MS-TrafficTypeDiagnostic: CY4PR12MB1509: X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 20:Cv/rYWxMwP17xwIB36AcjLE0dqIgZHKZgTEqpR+7lJqG0c2H6mKubSj773NF8d9ntq6zOHY5pYkQmsFVF39Lge/8HKUD97VGYtO8hbRppaVHFaVsLBHns2/RfS4QfsZmjtLbiUPd18F59OVvvL97e0zPTSqfKB1LVMFvRMzHwjyYpaMWGFca1jAu0jkFevFk0SPfhb5fjOoLvh/41P1pqy5Oo+TaJw9WdnIOtY9r/sH4huuI+rHm+sUzQW6BLGWZl1a1tf8ReBMmtQxEhE6Rgbcl08jpIwwv9K7LSPPogWEHnLAfEOIYk7sFl10LnlEmlM+KoWNRC/19YIHCBzoXVIKeysqENYqT9nxEkH2nXpslxBi5Az5wdH5V0ehi6g0LpHmRg4pMoX9zb5HTXwf43K0uvSJHx/Vi6mlQvoyXyHYeXfth7zQfh5q6I97FL6w9EYSeld5bx2K5XKimB2/MXT335SAWWW/89PUYjWBbWeB6wLGHIq/y9Gu8B0TvYhAE; 4:jimteeadFTkqoFSUmyP+8KxX3GXlZ8CNZyUut/3Pfjn4WD+bpqtQcpXg3t9b3K+K/H/ITVn06M0DcTQz1cu9RHT86ap+aI15f3b9ZZ0tZOdcEamz2r4EQubAWGYJAQZhhrp+602ZYFiDTEldvu8qWtgzivbBjEJBfUyT4uEqUxXEpk929ap50qCwOOrxNLwm0OppdURkwBC9KJi8h+lVrxD0UkZNRJm/SIB6gwxDV3lxvr3KVAPBshm5vlE78S2FSRphlVDP4uD+67mksIKTUPbCts2nrVHW8IJAu8/CJhyazEKUzmG5egI/PB3kGTUo 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)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231221)(944501327)(52105095)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:CY4PR12MB1509; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1509; X-Forefront-PRVS: 0634F37BFF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(346002)(366004)(376002)(199004)(189003)(48376002)(72206003)(7696005)(105586002)(478600001)(6116002)(50466002)(3846002)(575784001)(446003)(486006)(53936002)(11346002)(68736007)(2906002)(2616005)(51416003)(386003)(16526019)(186003)(26005)(76176011)(956004)(50226002)(16586007)(476003)(316002)(97736004)(305945005)(2351001)(2361001)(25786009)(7736002)(36756003)(59450400001)(5660300001)(52116002)(8676002)(6916009)(6666003)(47776003)(4326008)(6486002)(86362001)(53416004)(8936002)(66066001)(81166006)(81156014)(106356001)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1509; H:wallaby-smavila.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1509; 23:VPfv3mNPz8GrTtPTQXO8TQhibFmgovDCRyHfeOIXr?= =?us-ascii?Q?x5J18MB9OFKRBQJ9xFS5Vc7706Ng6KJDPGrJ5/AQM1k5CvS0CdJUZ60cWjWD?= =?us-ascii?Q?CKTUipzEjkc8xJuDm3ktp1cV35emdWfPvUXoaxJXdMebVin3mXi7fEirpyKS?= =?us-ascii?Q?+O7ncC82stfIPKsAsqC9BTcAxWG0z3qQli1sOtxEb+LNc8esMv+RuLk8mLxW?= =?us-ascii?Q?Yc/cBymytPII6WEHfWAAjuvDlzjkGBkHCkRhisOzOo6kQ8J8+ICQkKLyYOfr?= =?us-ascii?Q?ucwVe/21sUNT0bfCMeq+UV45e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CLht?= =?us-ascii?Q?EBbi55f/ELPfhXJhdR/GakrXCzHg5rcmM0Cg8nYBa0yLA3Ayw/UD0sohUsCB?= =?us-ascii?Q?QDn2R8BHgdorWoL5vAeeJkWNFdjnSQ8/tjhsckKYANUhzdHUcEOkZIGGzeoe?= =?us-ascii?Q?i3Un8prdhfG2UWWlvuaIUg=3D?= X-Microsoft-Antispam-Message-Info: jPy3W4sHehEM9Eoz65iKsjd3akRTMA71QHYrlOHW6b6Yt+7plDHPC/npZRzmbNcDsN6FweEFiNEJirF6owZ9f4tyqE92mJ2D0oDytBQxtSLzzphrEGoCZeyxvdGC5V/SUjNKiAGzLi1ZdnfjMv2g08P0lTLIZOZnkCHNgrWLdhwbLIklYGr0xYPPxTkegWpO X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 6:cZHbtzddKJeBvrJT5FF2/e034W3fQyK9wiz0W9SCR3qkkOSgy2NsU0STZ2XjZyHEgX3M6DhgGlYMM+UyJXTnS6wBZrw+lcbQ5Kbn0P2KKGAVwBrvM0//1uYPrQJqBjsL+xM7xSEXw30CfPT9of94KVtffn/aadXCyKL22ztkIXp3p3db7dYpGLvJiHx+i77qwehYfGWDcXAiFr/gkYgnwzI1rSwPHgPJSzk/erM9J+zzsN6IWZ/0vzH7ENtVPs7dRdv6k8uurMd3lX6co/HOpBtqxXg8C2o15DihyA1WPDq39+GG2eweYW1S0feisDmAmihib8UujdARD3jubFltT0tzXLSboAbI8xl6DIwC7QxpfdoQNW/1cc+6rp0x3WGc+DoT+ZNW694G9WD9V1pNuR0WRXxLPTndqBgY192yo2jaovgqq5/LaoZ4mGCkqnmOUe8u6Q5/P2A55kOAEAVSWg==; 5:xj/Q5S5QhTxfmIuV02msLjNedQeM3VC33NMeOR0lm118M6ViEP+b+TSlc/t6546MXOErTViLti6IEFs2azjjstl37vUUVVccHDmHewTqforiWb+ZiZ4XiiZi9rmAH9bMLhXjT3osEYNEU9duWQGev4CnjcUA+avGJGHZHrZNAhw=; 24:25aT7bcWZr6ld4qykYMHzhGQTeTM9LPiLFptE1V3d6zNo4GcCbNdLWhQCRmYqlU0neWiEpqaP1f2v+IfKl0+PmzH69MUFAxx+d1SNisZSmI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1509; 7:R5NXJfGTr6Lt4ZNBzAAjeVhx3X8/9OjPzdOFH29dRGoJj5ykG+PpALnZ9I7vBMJsCxFstwgH7maYsQFyU5EjZ4SaaxZHecrgEvBWaBXRuUAy3Y5Q/ws9hVpDwcyflz5KAsBoZol/Jppx8c3yU2owxnmcFKdUCi2qDVBrf21NRu3ROQbDWKEpoDGjd0qhE+ewJ7Slx9oCEyoUP5rBL4FLmfBc69E/S3dfpigoNhhjQP0YcNHnWWLViILiU/EeJCPR; 20:EimGm4cnp6Hk92d8NJe/ubvAWCwQcUpRwC/v9r+6nDQZV2d8QbVC/Va4/YkgXZ3C7ZCgCE3y4SZzvTibte7uEPNLCAErSdu99+8Vbemgwb0IByiN25fZQfv9yhIKvkVxDtZTfNEFFzVr0Y0XssIHfl/YaP4ctECZRMi8dI6BQRVLQb/EQxIXNjtTCnZ3QmED9rGs5A9tK9x00KH5R5vmHxk19TQlPJNFb0jCsrqN3P3jSMiwLEyTFDGW6J7mHd3T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2018 12:37:34.8346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14fd3a1f-a724-490d-e795-08d59bbb2cf1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1509 Subject: [dpdk-dev] [PATCH v5 15/18] net/axgbe: support generic transmit and receive stats api 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, 06 Apr 2018 12:37:38 -0000 This patch adds support for port statistics api defined for ethernet PMDs. Signed-off-by: Ravi Kumar --- doc/guides/nics/axgbe.rst | 1 + doc/guides/nics/features/axgbe.ini | 1 + drivers/net/axgbe/axgbe_ethdev.c | 52 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/doc/guides/nics/axgbe.rst b/doc/guides/nics/axgbe.rst index 009be03..e30f494 100644 --- a/doc/guides/nics/axgbe.rst +++ b/doc/guides/nics/axgbe.rst @@ -20,6 +20,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 e5495bd..8c7b0ee 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -21,6 +21,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); @@ -82,6 +85,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, @@ -294,6 +299,53 @@ axgbe_dev_link_update(struct rte_eth_dev *dev, return ret; } +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, struct rte_eth_dev_info *dev_info) -- 2.7.4