From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0059.outbound.protection.outlook.com [104.47.36.59]) by dpdk.org (Postfix) with ESMTP id EEBBC1C94C for ; Thu, 5 Apr 2018 08:40:33 +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=58ADRyqMvO2rYjbjVGgfX/C1Uj3NOHktCRIxJeHMeko=; b=hUzPB+svaI5fv/QZAioauepWDnFPlqSls2deWFxUYG8i4ZaXQUGXWAH+rjYXyi9z0HlYh7MeQUo6wVyDGkga+5I+FDDgHwadA4EckECNi/YygMfnPU4BjXPuQ/7bj7uDbRcc3ujaiyqsb3gyrhpn3O5P4BrjfPNZwTWjsXGcNRY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ravi1.Kumar@amd.com; Received: from wallaby-smavila.amd.com (202.56.249.162) by BN6PR12MB1505.namprd12.prod.outlook.com (2603:10b6:405:11::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Thu, 5 Apr 2018 06:40:31 +0000 From: Ravi Kumar To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 5 Apr 2018 02:39:47 -0400 Message-Id: <1522910389-35530-15-git-send-email-Ravi1.kumar@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522910389-35530-1-git-send-email-Ravi1.kumar@amd.com> References: <1520584954-130575-1-git-send-email-Ravi1.kumar@amd.com> <1522910389-35530-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: BMXPR01CA0040.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::26) To BN6PR12MB1505.namprd12.prod.outlook.com (2603:10b6:405:11::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc6bc155-5661-4c07-996d-08d59ac02179 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR12MB1505; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 3:41lOEiTWTcJ0qd2MwGspxxyflzCUkUf++K9/VOqfbQw/cZLbq3USkOa1mexvhGpHYWZ1ZjU5nRhU064IAW47dIg/N+HdoiARvouHjjKbXtyy/aQ0pG59lw4A/12G8OwMFYjZVdp6RoMse3zttlTKTh4grNrrou/gh5yynzgS8x9IRL1CCMvNUs+g0mdvhpQIdgUK4YggCDp0x+HDZQ+7vS7dNaEnM+eH7BH/L9Xm8K5TRg+Vmih7z89Nf7GYF1QL; 25:KKxWQH1aIYwWbHmFK051+T7xtT1yMYSL9cGpFgRrFKmRmwnWLFabFA7xmibKhFhm2Q/zepOb9CMf42aC8tPtmQKtFrHPcyCLH+0MJDkOBqOAyEZ/LZdI1UOgfqcdbwnZlTzKygbot7vIqJ92CfOgzkZQRNf0Cs4lm8ZwvAJq6oEcV9B8N2tqie4ZwryAblZPtRX1eWSEemk5wHsEONI6p9MNnRgYomL0LV1PKtVRfITuAJ4Qz0m1ZTnY3m59BydRsLdoLCQGWvwVcLDJWA56Tp56LTGb4ISfxl7rWf7jsmpWpy0kjYP1+gmU07/AYn21lcs+5ibQBOKAVXfw9VNHiA==; 31:PB57Q1t0hR5ecFdy8U81BOxtASb95E6MTWfiYD4R2AwMitA3tW9cv/mv1QJLLKlKNZRmABbEzZor7V/NZ468cn65RHP4ChNvc/+Cxrq+qbHsHbiHeIOIZ+sc8FXpj620d6R7WLINqVl08iQoBENmdCW326oJW0g3ywN7/O6wEtetGhFUV8gSibcXbsXN4He8ltbOllTyu67l6fb3Yi8D9zVbVjhYp3uQruDhdZBRwco= X-MS-TrafficTypeDiagnostic: BN6PR12MB1505: X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 20:elSkiPEN0UN02osJXWPzsq/PQn0p+IX1ETHaHYpdmC+J5uHnsj4fdTua0cP6nMnEU9n31ok9/GIbqrcGsWEBFmAfephkBcskcdzo/h/G5oW96kFyLsrMA1UiGwkZS+Vqj3GIkX8z9ztiMSAby8WFuLCCNBqm59/rEeMnjMqhObAVKZd9ig4EfvdzlO7HHvfuHEcXu5hfiGEfEwBxZFsBE9Sm6e//4MwzMnb94WBygJo2Wv0QzN/U05Le1BX4WA3/B7PWQWYNBYIRoLr94f1m4T25pBnIPA1JWTShrpd69r27iqQGaAbaC+JOrjxHX6CqpCJ9amFh8V8hfp/I1husSyJUC5GHjLy0OmAL+ZJgR9WiOFQyWjHhiNXXguNH/36/Mo/HAGMnXK+zrE0xW+zYqOFBdECQIq4VbqcsT3jORrl3OAxefciaA5LulAVkdXJWen7quj+GKH1O8pvJmfTaMN1+40QZAg0qIKDejsfAHhXjky1GGsNTrJE8L5Egi1/9; 4:dS5/E1iYOFOEcRb9hmSzQJdNaInQ0BxIXm5Oz5w7IkD6RP82N1jcEAyaTIKuJIK8rc6uDU+xlHa+u8ljRz4PT2OjmuSbWW4bZDFh2YHsFbUW0wCg6Gy7gVqtaamBdCytiz6vRDrFuAeB/7bBMpJNp+qgovphKR2Phcs1EIXIicF98OF74oYRSDWm9L0ggi8bue68LWa/ryeoRms5eB3LVaJ2QU2m+vtQdaxgb/aJSSTAJbzP8mMHB4oyM1p+/IcFXYQ7hqKdGyqvjUv3F20N1KVlOq2ZB9jta8v2D35i/wnBpz+xoIxGWwCOekr7saLL 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)(3231221)(944501327)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:BN6PR12MB1505; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1505; X-Forefront-PRVS: 06339BAE63 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(396003)(39860400002)(39380400002)(199004)(189003)(3846002)(476003)(2616005)(316002)(446003)(956004)(305945005)(7736002)(478600001)(16586007)(16526019)(6486002)(186003)(76176011)(5660300001)(59450400001)(97736004)(2906002)(6116002)(486006)(386003)(26005)(50466002)(11346002)(25786009)(575784001)(8936002)(86362001)(50226002)(66066001)(47776003)(48376002)(2351001)(6666003)(2361001)(6916009)(4326008)(81166006)(36756003)(53416004)(51416003)(68736007)(7696005)(8676002)(106356001)(105586002)(52116002)(81156014)(53936002)(72206003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1505; 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; BN6PR12MB1505; 23:xHnW099885oDMI7nxE5FUlJZdAfDbM64eZwLLOik0?= =?us-ascii?Q?+eBMbpr6O77iBW81/fONyInQJTjEtK/t6VeGeoDWCifx3dYj7GCO48h3+kzl?= =?us-ascii?Q?gqhjEEG9sGSCVkXdSw0Y1Y3Ypimsep7yaBt8CgHiPX8MopAtHWgZ7STBNHHK?= =?us-ascii?Q?EOrHwqQBQ+kflSKuRHiw0AlIPwY8zUv+c55X+BgSMUv7A38xeWCAkpfDuALK?= =?us-ascii?Q?R92ZZ0rjY0v+yPgOul8iquzHTHt4BJ30qd0vADdpxa42FTEeR8A1ftVPBCFD?= =?us-ascii?Q?FNDZi8D7DPnoAP0nqgjuyhBWH+ok8PWgjeZmPpVejn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; 24:chAh9NP7Q/0B+xWAjHYDlkF2QVqxLZr+YpQFOIntdFyZeMocr7oWZGdDAo0twCX5S5Pr4vvfaM8WaE7Drv9oIZbPp/tNN9t4MY7yNOY5lWQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1505; 7:85xGCHQ24GK24bLb+HiJQaLYkr0RqGGNdhT0nV2VDzcMx8a5zi89y7ucNdPKGehzPXjfbs5YuBEpTYhmbC64WkyG7yVUMRbv40qt4sSXlerio+RE32DI3557PMYErs1r6OEOs6brkXjrNOsZCIcQRlcA/0MaxRSrdcl507kBInFzsIwPScIIIEGJUMELdaSO42NdMCbc3b/zeD3GhVG3w9dcLK/Y9TO06ZliCVCUMIYE7fvhDFTMf4vdYCVVTG1D; 20:srmSpF8Bch/uxRj1Psn7Rp3UjSHBvB0Z0zXEN2k5045tB3VJjVflDzSpBWH6F3UmONfHV1Qcl+EDUnKxHHBm87sD5S/wpd94aut1WQm/Oug0UIrz4UQCNkzAVep3GNanlOeAGS9YGzzPFWtDWrLvIx1yQwujra6Qk20qFtirwx/uI5Jq53E13CQF6Bd/3+MoofqR6bQU68SBqFYsnBD19OXMHpMOz3XjWZKirzSE17eFs8GQVagSv9RWvzzRJ6UI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2018 06:40:31.9661 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc6bc155-5661-4c07-996d-08d59ac02179 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1505 Subject: [dpdk-dev] [PATCH v4 15/17] 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: Thu, 05 Apr 2018 06:40:34 -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 b2581f9..b213890 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