From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by dpdk.org (Postfix) with ESMTP id B620C5A15 for ; Wed, 21 Jan 2015 05:17:14 +0100 (CET) Received: by mail-pd0-f170.google.com with SMTP id p10so35696858pdj.1 for ; Tue, 20 Jan 2015 20:17:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yNEa0cSRVYPvyo3FCZ3GOsJoXGYyu3fIuwPIPFc5bwM=; b=j/fZf8NwcIz/V+VNGK3CjI+NA1btQz+hnvPOA681ijnW+ywn9MWr9IPDWdNmJQtFNw 5grxSzqo2oSxLR9tN8KNzmWhEYualx8J0gR4d/KcaqPi/93KNi2nNEiXyV+hOoRGGJ+U BRsEe0O5F43030BLYzUzISc4E0NfZnILnjK1/Oo56A/RG/yiYe9CnGZSeW0CESZ3yhfR DqUpWNA0KyOJlz6Tz9nQFLpodTMGF0nPQa3mGpqVv8gBdwsQKgcYo89UPQ/1pDGBDSsh Yj1NwCqiNjyQcb6yinWqdb9oBN4+4NHyDicguhir8D5AJSVDhf9r5RsB8vGRZwYqwlN7 nCUA== X-Gm-Message-State: ALoCoQluSwQmIMFYtBPk3dgPdj5ttV5t9YmE6aqhtS46shAY5VJciW59dZWxdgBu+Y/B9xGYIkgF X-Received: by 10.68.212.229 with SMTP id nn5mr58144290pbc.52.1421813833955; Tue, 20 Jan 2015 20:17:13 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id a2sm1297438pdi.82.2015.01.20.20.17.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jan 2015 20:17:13 -0800 (PST) From: stephen@networkplumber.org To: dev@dpdk.org Date: Tue, 20 Jan 2015 20:16:58 -0800 Message-Id: <1421813818-2354-1-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH] stats: remove useless memset's 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: Wed, 21 Jan 2015 04:17:15 -0000 From: Stephen Hemminger The rte_eth_stats_get is the only API that should call the device statistics function directly, and it already does a memset of the resulting structure. Therefore doing memset() in the driver is redundant and should be removed. Signed-off-by: Stephen Hemminger --- lib/librte_pmd_af_packet/rte_eth_af_packet.c | 2 -- lib/librte_pmd_bond/rte_eth_bond_pmd.c | 4 ---- lib/librte_pmd_enic/enic_main.c | 1 - lib/librte_pmd_i40e/i40e_ethdev_vf.c | 1 - lib/librte_pmd_ixgbe/ixgbe_ethdev.c | 1 - lib/librte_pmd_ring/rte_eth_ring.c | 1 - 6 files changed, 10 deletions(-) diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c b/lib/librte_pmd_af_packet/rte_eth_af_packet.c index 755780a..1ffe1cd 100644 --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c @@ -285,8 +285,6 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0; const struct pmd_internals *internal = dev->data->dev_private; - memset(igb_stats, 0, sizeof(*igb_stats)); - imax = (internal->nb_queues < RTE_ETHDEV_QUEUE_STAT_CNTRS ? internal->nb_queues : RTE_ETHDEV_QUEUE_STAT_CNTRS); for (i = 0; i < imax; i++) { diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c b/lib/librte_pmd_bond/rte_eth_bond_pmd.c index e9cec2a..8b80297 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c @@ -1362,12 +1362,8 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { struct bond_dev_private *internals = dev->data->dev_private; struct rte_eth_stats slave_stats; - int i; - /* clear bonded stats before populating from slaves */ - memset(stats, 0, sizeof(*stats)); - for (i = 0; i < internals->slave_count; i++) { rte_eth_stats_get(internals->slaves[i].port_id, &slave_stats); diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.c index 8ab8e44..48fdca2 100644 --- a/lib/librte_pmd_enic/enic_main.c +++ b/lib/librte_pmd_enic/enic_main.c @@ -211,7 +211,6 @@ void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) { struct vnic_stats *stats; - memset(r_stats, 0, sizeof(*r_stats)); if (vnic_dev_stats_dump(enic->vdev, &stats)) { dev_err(enic, "Error in getting stats\n"); return; diff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c index fe46cf1..7d8d8ef 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c +++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c @@ -1673,7 +1673,6 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) static void i40evf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) { - memset(stats, 0, sizeof(*stats)); if (i40evf_get_statics(dev, stats)) PMD_DRV_LOG(ERR, "Get statics failed"); } diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c index b58ec45..e36cdf5 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c @@ -1940,7 +1940,6 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (stats == NULL) return; - memset(stats, 0, sizeof(*stats)); stats->ipackets = hw_stats->vfgprc; stats->ibytes = hw_stats->vfgorc; stats->opackets = hw_stats->vfgptc; diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c index 4f1b6ed..f685f08 100644 --- a/lib/librte_pmd_ring/rte_eth_ring.c +++ b/lib/librte_pmd_ring/rte_eth_ring.c @@ -165,7 +165,6 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats) unsigned long rx_total = 0, tx_total = 0, tx_err_total = 0; const struct pmd_internals *internal = dev->data->dev_private; - memset(igb_stats, 0, sizeof(*igb_stats)); for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < internal->nb_rx_queues; i++) { igb_stats->q_ipackets[i] = internal->rx_ring_queues[i].rx_pkts.cnt; -- 2.1.4