From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730041.outbound.protection.outlook.com [40.107.73.41]) by dpdk.org (Postfix) with ESMTP id 4E0881B3C0 for ; Sat, 29 Sep 2018 12:32:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5kVY6OTULqZTdVizQ/zftkjo/+GKw5Rt/ISAMXXDKB4=; b=C+x8HYkLPVFY+502RJD5tHaHXPftaOFosV0EWFS9Y4d7ea7WRA/Dk3KluD+tZNeDB5pcMKxqQc3jBBkmY3DV8bmS1sgrnLpf0eSXzMEOlSnf7TRML4n2fP8kyP6Fc2F8iGn/wxxUgyoVJKFc9HrL323YN5I+Jyhh5PRDGe1h6YY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; Received: from ubuntubox.rdc.aquantia.com (95.79.108.179) by BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Sat, 29 Sep 2018 10:31:59 +0000 From: Igor Russkikh To: dev@dpdk.org Cc: pavel.belous@aquantia.com, igor.russkikh@aquantia.com, Pavel Belous Date: Sat, 29 Sep 2018 13:30:26 +0300 Message-Id: <30f6460dc35d9d8e87e714f53c8a93d4353e2468.1538215990.git.igor.russkikh@aquantia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.79.108.179] X-ClientProxiedBy: VI1P193CA0009.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::19) To BLUPR0701MB1650.namprd07.prod.outlook.com (2a01:111:e400:58c6::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db8f7c32-24e1-4bcb-b289-08d625f6cd78 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:BLUPR0701MB1650; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 3:cYBwmhQOmS4nUpI/biB5PfH2+my3mycahSCV1TF5oviU+aWBGW1zAn5vp/C0Ck5HjIC3QgNvQRRQsbZ3wPRNxzOUwhx5ZipZCPXa5DCxSjb/7N43GmeXzSDeitFaHN3VzmJD+ampUixRx2GLrWR1tM11PMvCZtVoGMwO/z2TCnTE9b2IDWglz83UL5IQ7JOJFxyb+e51Q1uJn+o/XDPyEhegaMwMO3zUmp0qtxsqXTYFHo1NfYjmrIzksNLxMykc; 25:OWY3wtXNYk0tKwwkRJJ4ZrZZxj5ir78vx0nyh6txXwC7SID8ox1H0cSHX13+DpTqrz7ITCDWDcG+bX6Z3T2SF5JQC0/rrksaILN6kGRU9O9SKvtijNEgGNlpsHDsDuKYvqAxz3mYjSsadUUr1DvdO6BgHwmWfSRvE/r7Zn50wq1urfP5biyDqQetEeGB6XgzoqCy1+dzv7aTGbMl74omXPB+dGmhRIn8+DOEp9C0Thu/6eVdIVwgEo4+zxzRuvrP1FcRq6qCCZPRpDWIhyJiB+2QfDoC/IiJkFh4Eyt13ytcE24TX726PQduWvASLjsN70teAaPNW/+Jk9ZCXtPWeE/dGHoo7UYVePL+BKKJtPA=; 31:8oxnKPyG8DM6d2jkVw5+x3xnbbHZ/intgp3ab0hSATRezh+QC3ElIVnYEL7YRnVF+tFfmiTPlCto4fQBsnBD6pJWSFHsWI0K1thEqM/Ig5Q3l1cZvBL+PK7FlLfUcJcsKdl6aDh2aJLqeB6A5R3EGNMU+BNQ7fU3QU2E8HQLkxi1JMA9R53YdVmDUmwTwhKTM6B7ldSWjeuTVAx2CIGuP815SGmdpYp2bQUM2ZRq2W0= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1650: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 20:tbmXg7sathjsI1ySGn2Byo8Cd/4EgX7RH5OnPoI1QsPbJB2IHA1WAOzzlht2Q8U4wkVCux4GDFbxkFYIWl/PJQH9vh8yhL+7580TBeJl/QBCH4dX1skKTq4moawkEk5tkPKkyLQa/RG6UUqiTEDDG7/4bu0xpk8dUWi7tzYlohwb/A/G740aGeHLkFjwnePRBK59s8Vt8BKao9fDFvrKmfBYyEILZHdj/ygb5jpYMpvno76gADQizasZ33Ydm1yoPnKowwIE/yliNDGF8A9z9ii2fBSkp1JYBc2RJvzqU5bWS2XxINzi7HmQwPAEJRCOa4bcWSquhwfDKwZB10LpsnEjBa1xAZJv9SXeyy8IbhG/Nm8RNU0suxT/tq9nWAbvM/IbsQzPAesX4Z8O7UBHqZ7zWGc/nAQwIQhu1zHC1GqJH4XEfFC3QGJwb32wEV4lO9uXKG1LBo83yA55OQUF47SGqnkTR76HtMO4m21Xva01KDZqzLqYN/rYKHmNEYJm; 4:0Xt4YEbyeQwMakvkKEki31iM95w9+JoT1w1A+xfQYCkU976n7NBlWGEM4F6CoRDv1E8MaC3fBpMhtEp+aV09tUvVnM9/QTCoZ4L2/yuDqI61t/I0VtA64XyQTxXWgfmTyTLJhaSS6soMImqTZpBSeNYzJ8m9bgu+SoVWHfI9m3lnRRScGD0eAKrKq61PjB/MvwvBW4/LMpnZSqTgpSDRiThrTmSmHpkTaAKmuC1WlGJBGFXEjpnsD6SxlPXRabyB9ff43H7MShEgct+NkDDuPw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201708071742011)(7699051); SRVR:BLUPR0701MB1650; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1650; X-Forefront-PRVS: 0810818DA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(396003)(376002)(39850400004)(366004)(189003)(199004)(16526019)(14444005)(446003)(76176011)(2906002)(6916009)(6666003)(97736004)(8676002)(81166006)(81156014)(36756003)(4326008)(316002)(8936002)(50226002)(34290500001)(575784001)(86362001)(5660300001)(68736007)(16586007)(118296001)(72206003)(3846002)(6116002)(53936002)(386003)(105586002)(6486002)(47776003)(66066001)(486006)(25786009)(305945005)(50466002)(44832011)(956004)(2616005)(26005)(107886003)(52116002)(51416003)(7696005)(186003)(476003)(478600001)(2361001)(7736002)(2351001)(48376002)(106356001)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1650; H:ubuntubox.rdc.aquantia.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1650; 23:R6hbtkxHr9MX2CQwlOi6RvTLKMo9yqlrQa9RB4P?= =?us-ascii?Q?Na8CMCv0l8PZ1W9xMLS5UHf1j+YFtHW0YKm+XW+TKqGsaAqwD4MOUZFSwfN+?= =?us-ascii?Q?XtqWsOPXx+OP3nUVpOC8DYlRH6QbRWceYMJWEEXCV7EP8y4i3yT6sHGBOb27?= =?us-ascii?Q?IIl4JWWRHTj9NU/n4rUhwFLuHSAN38/2yYUKVmTkhoMH8MnDM1UIxcAC3c5N?= =?us-ascii?Q?W2aZzEhac7ZS0BKqsksf6voHcdCM3evIpOhXZynSL00jcTL9cEgyHv+5stCA?= =?us-ascii?Q?qU4SIcC0ZcJb8ZvLCywvC7fzc5SqAdExS+wS7PLCsXEZBKz8VZB3c6j5gjVO?= =?us-ascii?Q?qvtRpKbF/Snm6NM1ny2EYrabAy7bQnRUepx3prgZIM+PQN8RwaGph046HQ/f?= =?us-ascii?Q?BI3GUtuvYYbsTsOl0+mMv/9gS0HGRT1zWiMZXdJGuNElaEpR5JdanzEm2b2I?= =?us-ascii?Q?1WTdac+3muro3nPm93M2IKwguS10Tjq7CBg4/Kzqp7AS0l5ABMtaeMo6BDKg?= =?us-ascii?Q?vF226Rd1j3NKqm1NlHcuxaYbCa9gQIMy44v0obVwgaaF0AiGPtyLeQwCcmHL?= =?us-ascii?Q?4dBtAi+xV6Cp7Mjw3+rd8yImMFMISKWQKbpYPGR9XH3w47Th2A4zJZIFLHMv?= =?us-ascii?Q?l4p572NnE15Ghp/S+UHyvFFVsv5qI2/sAjLAOBBepfZDzh882M9/NWt5WJ6g?= =?us-ascii?Q?ao5xx245mZCtgXWwgIGg3uG0u+WMJnVmHcCvmqrI7Ln5KFocfKHfvNtafIxY?= =?us-ascii?Q?W5diJ3GzqXabnVH4KDhzD97TIXyr5fSmkQ5amdgZEfO4ZooZbqPFLERdMaCJ?= =?us-ascii?Q?9E89POqXYQPEhpiKZkpOFb5s8c97Xb6B2rwD7tsWvGueCvN77MShbn60Cbn/?= =?us-ascii?Q?Rhrr9xj7f7+R25sHQPfqIBIcOodlVnmoVoKkr9y9eWugYPcASC8ACMWXYIH+?= =?us-ascii?Q?BG9r0kJDn1+iJCuY+8FBxEfMTv/q8R4J9li4P2m5g3yN/n+IXgZuFkq39C6k?= =?us-ascii?Q?raCXSAuf9Q1lXM+jEwJVxGmcTri/9VxA3SSe+NcpbPz7r3RCX46DK0Rnnq9p?= =?us-ascii?Q?b9oaCx+mh+t372O846PMXM6i/rHQNbXh7GaijCUC4LiHbdkQSA6QwoIg4hYB?= =?us-ascii?Q?qcBLmRzgnP7olc2CuGPyLZQgu/Uy9YhUNjRDO/KfGJb5anWcnfBhcvsCEw5l?= =?us-ascii?Q?yLJ4KcImzTnmbmONUmQrj6i5du62FYgWwnUGv3yObfG1mthjbKWUKSYnqN16?= =?us-ascii?Q?beahjwts9dbYKdZIuFetQoKPf4nRtoeVa7nVl9P2b1IsOYx5NyLYHqczLuOw?= =?us-ascii?Q?yFsF9PyXPlaK3Hv1FujCQBPNQzc4NH95JsEntX79UXkDM?= X-Microsoft-Antispam-Message-Info: XEilpNhh76x8xAYkeJfdM6r1YIBYcBy4y1erPHX4z7C75UFcOn4Rvor8Lep+6cbPble5V2XCVGmSbk/QWSPl08lhSWvnkSOQGPo0bRreG/bYJXVeSSMshyBcy2TtZK1Lwiga1aqQNo0yeLE4A6z1041DblHEeWni9BRxbNYFjJd1CRevJGzVMT0tSZLPoHaBRoOw1ZKaI1Mc2z8AwJ11f/QC2gMSbWux6j0niX7kZfLNisoPgEUgiQ8vxXXU7sWxQ9gGMJORYV69v5h4+ISkr2n7tW768MbrDoztCrHFxlkeYVu+HcmIPdBWRb+Z50LwYzVSN5622pXlogLYi3wFVhFaJcxUeXVUv0RELhBN9W0= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1650; 6:otfNUyr7T0HEACJeKd730AjDY7H32AglSI4ahnN/q3dg1caCnvfdhEp0KbRr+wBmJ2IZ5q5/5h2EtqUlJxJXlCs/MTb01oT5vkajtzAjIQj+XS7F2giWUTPm9QOCeLpGJBuYvWG2X0dP/iLy0ckikUjd7sCvJRlfnJlcZU4/9CJL7EDyjwNMlevRL7KvxkFHT1P4Nv+MQjMVPtEmbet2/5+JijFUGlCXUt4uwbLOcZEmJQmJG9LGvON5E0wykkBhx4cttC+8TvmUWUV5kVWcaB1ATvZEGyplSd/+xkCVnyAwsSi6a0mfgwaZmNCakGtnLetc6eV0a0iETgaVwwraPSbRoR6wBSYobQAiKEl/gZeX0wd0vTTI51jXrmU7RC98iD/h3b2K2bGQ1jx9tC12oyP5Kow8U1vMSbA6RDpZkxpj23EPz3veG72nykODbgCAeSCTJgVPOEWyAZOambE06A==; 5:Hj7h2lvmdThrAUWZKFnI5Gsthh92ude+OgNvo2nh8MypnAFq3Od6EdGkG/l/mPC7TzwSPSTi72S22fWagVQm12f74BXo8LerAl48pzS5Pr2jeHnoxyoEKDx5O3wRdt2fXUjWv2+SdQTyyGoyUPqK/4NA7oYqypQcPG/z/j8EozE=; 7:oN995kqWiBY6OH+zLYBpeqZ+wZBmHoXlazDK/KorPx4Nnx7caUxHhi3fw850xMW26KzvwxPZTNYxURaTRai87BNs+oAC+pqtZUZYXAF4TX8Shk+5DYYUAFb5TEcuARTfvH9ec3c8ZpFJJwLXCHjL40Hs7116uiKto7oC10LKGHPQ234sg/HZRXRxgVKLElscSg8LRnrEr8iYvPXtDL36iwQAYyv43IRE1hFVtWTLCghy41Ruqw/4jm6e3yHeAB3f SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2018 10:31:59.8297 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db8f7c32-24e1-4bcb-b289-08d625f6cd78 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1650 Subject: [dpdk-dev] [PATCH v3 12/22] net/atlantic: device statistics, xstats 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: Sat, 29 Sep 2018 10:32:08 -0000 From: Pavel Belous Signed-off-by: Igor Russkikh Signed-off-by: Pavel Belous --- drivers/net/atlantic/atl_ethdev.c | 154 ++++++++++++++++++++++++++++++++++++++ drivers/net/atlantic/atl_ethdev.h | 1 + drivers/net/atlantic/atl_rxtx.c | 11 ++- drivers/net/atlantic/atl_types.h | 41 ++++++++++ 4 files changed, 206 insertions(+), 1 deletion(-) diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 75c9fa169925..fc1d862042d2 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -24,6 +24,24 @@ static void atl_dev_close(struct rte_eth_dev *dev); static int atl_dev_reset(struct rte_eth_dev *dev); static int atl_dev_link_update(struct rte_eth_dev *dev, int wait); +static int atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused, + struct rte_eth_xstat_name *xstats_names, + unsigned int size); + +static int atl_dev_stats_get(struct rte_eth_dev *dev, + struct rte_eth_stats *stats); + +static int atl_dev_xstats_get(struct rte_eth_dev *dev, + struct rte_eth_xstat *stats, unsigned int n); + +static void atl_dev_stats_reset(struct rte_eth_dev *dev); +static void atl_dev_xstats_reset(struct rte_eth_dev *dev); + +static int atl_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev, + uint16_t queue_id, + uint8_t stat_idx, + uint8_t is_rx); + static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); @@ -113,6 +131,33 @@ static const struct rte_eth_desc_lim tx_desc_lim = { .nb_mtu_seg_max = ATL_TX_MAX_SEG, }; +#define ATL_XSTATS_FIELD(name) { \ + #name, \ + offsetof(struct aq_stats_s, name) \ +} + +struct atl_xstats_tbl_s { + const char *name; + unsigned int offset; +}; + +static struct atl_xstats_tbl_s atl_xstats_tbl[] = { + ATL_XSTATS_FIELD(uprc), + ATL_XSTATS_FIELD(mprc), + ATL_XSTATS_FIELD(bprc), + ATL_XSTATS_FIELD(erpt), + ATL_XSTATS_FIELD(uptc), + ATL_XSTATS_FIELD(mptc), + ATL_XSTATS_FIELD(bptc), + ATL_XSTATS_FIELD(erpr), + ATL_XSTATS_FIELD(ubrc), + ATL_XSTATS_FIELD(ubtc), + ATL_XSTATS_FIELD(mbrc), + ATL_XSTATS_FIELD(mbtc), + ATL_XSTATS_FIELD(bbrc), + ATL_XSTATS_FIELD(bbtc), +}; + static const struct eth_dev_ops atl_eth_dev_ops = { .dev_configure = atl_dev_configure, .dev_start = atl_dev_start, @@ -125,6 +170,14 @@ static const struct eth_dev_ops atl_eth_dev_ops = { /* Link */ .link_update = atl_dev_link_update, + /* Stats */ + .stats_get = atl_dev_stats_get, + .xstats_get = atl_dev_xstats_get, + .xstats_get_names = atl_dev_xstats_get_names, + .stats_reset = atl_dev_stats_reset, + .xstats_reset = atl_dev_xstats_reset, + .queue_stats_mapping_set = atl_dev_queue_stats_mapping_set, + .fw_version_get = atl_fw_version_get, .dev_infos_get = atl_dev_info_get, .dev_supported_ptypes_get = atl_dev_supported_ptypes_get, @@ -286,6 +339,9 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) (u8 *)ð_dev->data->mac_addrs[0]) != 0) return -EINVAL; + /* Reset the hw statistics */ + atl_dev_stats_reset(eth_dev); + rte_intr_callback_register(intr_handle, atl_dev_interrupt_handler, eth_dev); @@ -613,6 +669,104 @@ atl_dev_reset(struct rte_eth_dev *dev) return ret; } + +static int +atl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) +{ + struct atl_adapter *adapter = + (struct atl_adapter *)dev->data->dev_private; + struct aq_hw_s *hw = &adapter->hw; + struct atl_sw_stats *swstats = &adapter->sw_stats; + unsigned int i; + + hw->aq_fw_ops->update_stats(hw); + + /* Fill out the rte_eth_stats statistics structure */ + stats->ipackets = hw->curr_stats.dma_pkt_rc; + stats->ibytes = hw->curr_stats.dma_oct_rc; + stats->imissed = hw->curr_stats.dpc; + stats->ierrors = hw->curr_stats.erpt; + + stats->opackets = hw->curr_stats.dma_pkt_tc; + stats->obytes = hw->curr_stats.dma_oct_tc; + stats->oerrors = 0; + + stats->rx_nombuf = swstats->rx_nombuf; + + for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { + stats->q_ipackets[i] = swstats->q_ipackets[i]; + stats->q_opackets[i] = swstats->q_opackets[i]; + stats->q_ibytes[i] = swstats->q_ibytes[i]; + stats->q_obytes[i] = swstats->q_obytes[i]; + stats->q_errors[i] = swstats->q_errors[i]; + } + return 0; +} + +static void +atl_dev_stats_reset(struct rte_eth_dev *dev) +{ + struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + hw->aq_fw_ops->update_stats(hw); + + /* Reset software totals */ + memset(&hw->curr_stats, 0, sizeof(hw->curr_stats)); +} + +static int +atl_dev_xstats_get_names(struct rte_eth_dev *dev __rte_unused, + struct rte_eth_xstat_name *xstats_names, + unsigned int size) +{ + unsigned int i; + + if (!xstats_names) + return RTE_DIM(atl_xstats_tbl); + + for (i = 0; i < size && i < RTE_DIM(atl_xstats_tbl); i++) + snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, "%s", + atl_xstats_tbl[i].name); + + return size; +} + +static int +atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, + unsigned int n) +{ + struct atl_adapter *adapter = + (struct atl_adapter *)dev->data->dev_private; + struct aq_hw_s *hw = &adapter->hw; + unsigned int i; + + if (!stats) + return 0; + + for (i = 0; i < n && i < RTE_DIM(atl_xstats_tbl); i++) { + stats[i].id = i; + stats[i].value = *(u64 *)((uint8_t *)&hw->curr_stats + + atl_xstats_tbl[i].offset); + } + + return n; +} + +static void +atl_dev_xstats_reset(struct rte_eth_dev *dev __rte_unused) +{ +} + +static int +atl_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev __rte_unused, + uint16_t queue_id __rte_unused, + uint8_t stat_idx __rte_unused, + uint8_t is_rx __rte_unused) +{ + /* The mapping is hardcoded: queue 0 -> stat 0, etc */ + return 0; +} + static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) { diff --git a/drivers/net/atlantic/atl_ethdev.h b/drivers/net/atlantic/atl_ethdev.h index f75ed0fd1127..90d63797b2c6 100644 --- a/drivers/net/atlantic/atl_ethdev.h +++ b/drivers/net/atlantic/atl_ethdev.h @@ -32,6 +32,7 @@ struct atl_interrupt { struct atl_adapter { struct aq_hw_s hw; struct aq_hw_cfg_s hw_cfg; + struct atl_sw_stats sw_stats; struct atl_interrupt intr; }; diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c index 9d82a0d74f22..94054ca5c9fa 100644 --- a/drivers/net/atlantic/atl_rxtx.c +++ b/drivers/net/atlantic/atl_rxtx.c @@ -843,7 +843,8 @@ atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) "queue_id=%u", (unsigned int)rxq->port_id, (unsigned int)rxq->queue_id); dev->data->rx_mbuf_alloc_failed++; - goto err_stop; + adapter->sw_stats.rx_nombuf++; + goto err_stop; } nb_hold++; @@ -926,6 +927,9 @@ atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) * of returned packets. */ rx_pkts[nb_rx++] = rx_mbuf_first; + adapter->sw_stats.q_ipackets[rxq->queue_id]++; + adapter->sw_stats.q_ibytes[rxq->queue_id] += + rx_mbuf_first->pkt_len; PMD_RX_LOG(ERR, "add mbuf segs=%d pkt_len=%d", rx_mbuf_first->nb_segs, @@ -1071,6 +1075,8 @@ static inline void atl_xmit_pkt(struct aq_hw_s *hw, struct atl_tx_queue *txq, struct rte_mbuf *tx_pkt) { + struct atl_adapter *adapter = + ATL_DEV_TO_ADAPTER(&rte_eth_devices[txq->port_id]); uint32_t pay_len = 0; int tail = 0; struct atl_tx_entry *tx_entry; @@ -1151,6 +1157,9 @@ atl_xmit_pkt(struct aq_hw_s *hw, struct atl_tx_queue *txq, txq->tx_tail = tail; txq->tx_free -= desc_count; + + adapter->sw_stats.q_opackets[txq->queue_id]++; + adapter->sw_stats.q_obytes[txq->queue_id] += pay_len; } uint16_t diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h index 5f840cc8d63d..99e920315014 100644 --- a/drivers/net/atlantic/atl_types.h +++ b/drivers/net/atlantic/atl_types.h @@ -147,4 +147,45 @@ struct aq_fw_ops { int (*set_eeprom)(struct aq_hw_s *self, u32 *data, u32 len); }; +struct atl_sw_stats { + u64 crcerrs; + u64 errbc; + u64 mspdc; + u64 mpctotal; + u64 mpc[8]; + u64 mlfc; + u64 mrfc; + u64 rlec; + u64 lxontxc; + u64 lxonrxc; + u64 lxofftxc; + u64 lxoffrxc; + u64 pxontxc[8]; + u64 pxonrxc[8]; + u64 pxofftxc[8]; + u64 pxoffrxc[8]; + u64 gprc; + u64 bprc; + u64 mprc; + u64 gptc; + u64 gorc; + u64 gotc; + u64 tor; + u64 tpr; + u64 tpt; + u64 mptc; + u64 bptc; + u64 xec; + u64 fccrc; + u64 ldpcec; + u64 pcrc8ec; + + u64 rx_nombuf; + u64 q_ipackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]; + u64 q_opackets[RTE_ETHDEV_QUEUE_STAT_CNTRS]; + u64 q_ibytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]; + u64 q_obytes[RTE_ETHDEV_QUEUE_STAT_CNTRS]; + u64 q_errors[RTE_ETHDEV_QUEUE_STAT_CNTRS]; +}; + #endif -- 2.7.4