From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-9.cisco.com (rcdn-iport-9.cisco.com [173.37.86.80]) by dpdk.org (Postfix) with ESMTP id 345B12BC8 for ; Tue, 24 May 2016 08:33:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3957; q=dns/txt; s=iport; t=1464071583; x=1465281183; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=mJYwzYE8rQHF8pfK7LGlcxbu82Fhj6e75kEqPYKfkKw=; b=TAQlOobTQKJm3cuMObMlBEa8sMffWQznuykzo1DemCUFO+41ab1oowZP eODqxaCuXgbBg1Wo0TOKCDL8ClovPjs2+OjBAlAfrYOZYQQOtGi3aydDZ FrpMy+j2HxGA146Eq64NnIti6HCJvrlrRUWRmSNbtv7CiZM+qLmnuucLe g=; X-IronPort-AV: E=Sophos;i="5.26,359,1459814400"; d="scan'208";a="105386190" Received: from rcdn-core-1.cisco.com ([173.37.93.152]) by rcdn-iport-9.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2016 06:33:02 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-1.cisco.com (8.14.5/8.14.5) with ESMTP id u4O6X2GF024243; Tue, 24 May 2016 06:33:02 GMT Received: by cisco.com (Postfix, from userid 392789) id 5621D3FAADDB; Mon, 23 May 2016 23:33:02 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: John Daley Date: Mon, 23 May 2016 23:32:49 -0700 Message-Id: <1464071579-30072-2-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1464071579-30072-1-git-send-email-johndale@cisco.com> References: <1464071579-30072-1-git-send-email-johndale@cisco.com> Subject: [dpdk-dev] [PATCH v2 01/11] enic: fix Rx drop counters 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: Tue, 24 May 2016 06:33:03 -0000 rx_no_bufs is a hardware counter of packets dropped on the interface due to no host buffers and should be used to update r_stats->imissed counter instead of rx_nombuf. Include rx_drop in ierrors. rx_drop is incremented if packets arrive when the receive queue is disabled. Add a structure and functions for initializing and clearing software counters. Add count of Rx mbuf allocation failures (rx_nombuf) as the first counter. Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: John Daley --- drivers/net/enic/enic.h | 7 +++++++ drivers/net/enic/enic_main.c | 24 +++++++++++++++++++++--- drivers/net/enic/enic_rx.c | 5 +---- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 09f3853..584d49b 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -91,6 +91,10 @@ struct enic_fdir { struct enic_fdir_node *nodes[ENICPMD_FDIR_MAX]; }; +struct enic_soft_stats { + rte_atomic64_t rx_nombuf; +}; + /* Per-instance private data structure */ struct enic { struct enic *next; @@ -133,6 +137,9 @@ struct enic { /* interrupt resource */ struct vnic_intr intr; unsigned int intr_count; + + /* software counters */ + struct enic_soft_stats soft_stats; }; static inline unsigned int enic_cq_rq(__rte_unused struct enic *enic, unsigned int rq) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index bbbe660..c002ef3 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -211,15 +211,30 @@ void enic_send_pkt(struct enic *enic, struct vnic_wq *wq, 0 /*wrid*/); } +static void enic_clear_soft_stats(struct enic *enic) +{ + struct enic_soft_stats *soft_stats = &enic->soft_stats; + rte_atomic64_clear(&soft_stats->rx_nombuf); +} + +static void enic_init_soft_stats(struct enic *enic) +{ + struct enic_soft_stats *soft_stats = &enic->soft_stats; + rte_atomic64_init(&soft_stats->rx_nombuf); + enic_clear_soft_stats(enic); +} + void enic_dev_stats_clear(struct enic *enic) { if (vnic_dev_stats_clear(enic->vdev)) dev_err(enic, "Error in clearing stats\n"); + enic_clear_soft_stats(enic); } void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) { struct vnic_stats *stats; + struct enic_soft_stats *soft_stats; if (vnic_dev_stats_dump(enic->vdev, &stats)) { dev_err(enic, "Error in getting stats\n"); @@ -232,12 +247,13 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) r_stats->ibytes = stats->rx.rx_bytes_ok; r_stats->obytes = stats->tx.tx_bytes_ok; - r_stats->ierrors = stats->rx.rx_errors; + r_stats->ierrors = stats->rx.rx_errors + stats->rx.rx_drop; r_stats->oerrors = stats->tx.tx_errors; - r_stats->imissed = stats->rx.rx_drop; + r_stats->imissed = stats->rx.rx_no_bufs; - r_stats->rx_nombuf = stats->rx.rx_no_bufs; + soft_stats = &enic->soft_stats; + r_stats->rx_nombuf = rte_atomic64_read(&soft_stats->rx_nombuf); } void enic_del_mac_address(struct enic *enic) @@ -795,6 +811,8 @@ int enic_setup_finish(struct enic *enic) { int ret; + enic_init_soft_stats(enic); + ret = enic_set_rss_nic_cfg(enic); if (ret) { dev_err(enic, "Failed to config nic, aborting.\n"); diff --git a/drivers/net/enic/enic_rx.c b/drivers/net/enic/enic_rx.c index f92f6bc..89c62ce 100644 --- a/drivers/net/enic/enic_rx.c +++ b/drivers/net/enic/enic_rx.c @@ -275,10 +275,7 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, /* allocate a new mbuf */ nmb = rte_mbuf_raw_alloc(rq->mp); if (nmb == NULL) { - dev_err(enic, "RX mbuf alloc failed port=%u qid=%u", - enic->port_id, (unsigned)rq->index); - rte_eth_devices[enic->port_id]. - data->rx_mbuf_alloc_failed++; + rte_atomic64_inc(&enic->soft_stats.rx_nombuf); break; } -- 2.7.0