From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016ce01.pphosted.com (mx0b-0016ce01.pphosted.com [67.231.156.153]) by dpdk.org (Postfix) with ESMTP id 5547E68DD for ; Thu, 12 May 2016 02:06:45 +0200 (CEST) Received: from pps.filterd (m0085408.ppops.net [127.0.0.1]) by mx0b-0016ce01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u4C022lE013180; Wed, 11 May 2016 17:06:44 -0700 Received: from avcashub1.qlogic.com ([198.186.0.115]) by mx0b-0016ce01.pphosted.com with ESMTP id 22tyrex87y-1 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Wed, 11 May 2016 17:06:44 -0700 Received: from avluser05.qlc.com (10.1.113.115) by qlc.com (10.1.4.190) with Microsoft SMTP Server id 14.3.235.1; Wed, 11 May 2016 17:06:43 -0700 Received: (from rmody@localhost) by avluser05.qlc.com (8.14.4/8.14.4/Submit) id u4C06hkt015488; Wed, 11 May 2016 17:06:43 -0700 X-Authentication-Warning: avluser05.qlc.com: rmody set sender to rasesh.mody@qlogic.com using -f From: Rasesh Mody To: CC: , , Rasesh Mody , Harish Patil Date: Wed, 11 May 2016 17:06:22 -0700 Message-ID: <1463011585-15429-2-git-send-email-rasesh.mody@qlogic.com> X-Mailer: git-send-email 1.7.10.3 In-Reply-To: <1463011585-15429-1-git-send-email-rasesh.mody@qlogic.com> References: <1463011585-15429-1-git-send-email-rasesh.mody@qlogic.com> MIME-Version: 1.0 Content-Type: text/plain disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8162 signatures=670716 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 adultscore=69 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1605110314 Subject: [dpdk-dev] [PATCH v5 2/5] bnx2x: add xstats support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2016 00:06:45 -0000 Add extended stats support to provide additional statistical info. Signed-off-by: Rasesh Mody Signed-off-by: Harish Patil --- doc/guides/nics/overview.rst | 2 +- drivers/net/bnx2x/bnx2x_ethdev.c | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/overview.rst b/doc/guides/nics/overview.rst index 0bd8fae..7ab84c6 100644 --- a/doc/guides/nics/overview.rst +++ b/doc/guides/nics/overview.rst @@ -128,7 +128,7 @@ Most of these differences are summarized below. Packet type parsing Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Timesync Y Y Y Y Y Basic stats Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y - Extended stats Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y + Extended stats Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Stats per queue Y Y Y Y Y Y Y Y Y Y Y Y Y Y EEPROM dump Y Y Y Registers dump Y Y Y Y Y Y diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 3ff57c4..78e5ac1 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -334,6 +334,64 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) brb_truncate_discard + stats->rx_nombuf; } +#define BNX2X_EXTENDED_STATS 9 + +static int +bnx2x_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats, + unsigned int n) +{ + struct bnx2x_softc *sc = dev->data->dev_private; + unsigned int num = BNX2X_EXTENDED_STATS; + + if (n < num) + return num; + + num = 0; + + bnx2x_stats_handle(sc, STATS_EVENT_UPDATE); + + snprintf(xstats[num].name, sizeof(xstats[num].name), "rx_buffer_drops"); + xstats[num++].value = HILO_U64(sc->eth_stats.brb_drop_hi, + sc->eth_stats.brb_drop_lo); + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "rx_buffer_truncates"); + xstats[num++].value = HILO_U64(sc->eth_stats.brb_truncate_hi, + sc->eth_stats.brb_truncate_lo); + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "rx_buffer_truncate_discard"); + xstats[num++].value = sc->eth_stats.brb_truncate_discard; + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "mac_filter_discard"); + xstats[num++].value = sc->eth_stats.mac_filter_discard; + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "no_match_vlan_tag_discard"); + xstats[num++].value = sc->eth_stats.mf_tag_discard; + + snprintf(xstats[num].name, sizeof(xstats[num].name), "tx_pause"); + xstats[num++].value = HILO_U64(sc->eth_stats.pause_frames_sent_hi, + sc->eth_stats.pause_frames_sent_lo); + + snprintf(xstats[num].name, sizeof(xstats[num].name), "rx_pause"); + xstats[num++].value = HILO_U64(sc->eth_stats.pause_frames_received_hi, + sc->eth_stats.pause_frames_received_lo); + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "tx_priority_flow_control"); + xstats[num++].value = HILO_U64(sc->eth_stats.pfc_frames_sent_hi, + sc->eth_stats.pfc_frames_sent_lo); + + snprintf(xstats[num].name, sizeof(xstats[num].name), + "rx_priority_flow_control"); + xstats[num++].value = HILO_U64(sc->eth_stats.pfc_frames_received_hi, + sc->eth_stats.pfc_frames_received_lo); + + return num; +} + static void bnx2x_dev_infos_get(struct rte_eth_dev *dev, __rte_unused struct rte_eth_dev_info *dev_info) { @@ -376,6 +434,7 @@ static const struct eth_dev_ops bnx2x_eth_dev_ops = { .allmulticast_disable = bnx2x_dev_allmulticast_disable, .link_update = bnx2x_dev_link_update, .stats_get = bnx2x_dev_stats_get, + .xstats_get = bnx2x_dev_xstats_get, .dev_infos_get = bnx2x_dev_infos_get, .rx_queue_setup = bnx2x_dev_rx_queue_setup, .rx_queue_release = bnx2x_dev_rx_queue_release, @@ -399,6 +458,7 @@ static const struct eth_dev_ops bnx2xvf_eth_dev_ops = { .allmulticast_disable = bnx2x_dev_allmulticast_disable, .link_update = bnx2xvf_dev_link_update, .stats_get = bnx2x_dev_stats_get, + .xstats_get = bnx2x_dev_xstats_get, .dev_infos_get = bnx2x_dev_infos_get, .rx_queue_setup = bnx2x_dev_rx_queue_setup, .rx_queue_release = bnx2x_dev_rx_queue_release, -- 1.7.10.3