Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3018948ybi; Tue, 2 Jul 2019 00:30:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLWQberNvEh1pYysOv02cA9DFM2EYozx7Yhyjg8cIDBe+nAdSg4HT33g0WassgfekfxNIr X-Received: by 2002:a63:b243:: with SMTP id t3mr29287063pgo.223.1562052655023; Tue, 02 Jul 2019 00:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562052655; cv=none; d=google.com; s=arc-20160816; b=SvK008zSOLb1MEPBmTmxS3SWg6n2BesZfe28rcIr4qbR6ctAkUvlJCeSy5mAKb5mZj etOvVnPR8SkYQpG6os1F1ClKf2dU4H5mFJ/257Qa/3kgdJgY1eIVVoovnv2nZ0gRc4zI q8D285llN1SfQmMtbEgDMlKTzfQ9L85z0wOlMgE6o+RMtcf4sCKo7yA6gFgVRAroBMtP F7utcFTDVfG3ZDDEqV4m5wtmHjds6kklKM5UwZgMTJ2KkCTsoThWAm4W2Muk3XUt92FQ KzPgHNDsfy0AvyUGDh7tNPDwGA94WvZH2zYYKDHknn0NjIlpw4NYK6Ouce18dnheWbNh 1lTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=zJ76xT7w6gFyozt5ojYjuTl/zTjuvmuMJ+kSqAkhfSs=; b=Reppefz/vfM2bmmD5gpNSNTO3HVQBUPY3t2vcKq/T5yfGoE45S3/bAAMEzuNtbggkp l1sbPX5mBJNwHX1Dlc03V3aNaAnJZDdkjOlp/yh6+EjX/OSxtQQQ/GfOYmnGx2+Ujv4N 7fgIkItrcU2PCP9i+HU8+MwZRK42l4k2efklLAIJb68LlhfW4TydbFEKMC1YgLSxKubC 6StSFFrnoB9Jq+cJAMJMpzAPu1MLmp5SvYcYI16Vu8jGDMq5JFBgGn1VwULtJqSYr8If Is4BYJROPz4Iz7f0HouBog3DN0zXfbQD5NlDdnSBmNF/FE2hX/PcG/cxQBIgUObeeg3I i4Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si12773969pgu.469.2019.07.02.00.30.39; Tue, 02 Jul 2019 00:30:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfGBHaM (ORCPT + 99 others); Tue, 2 Jul 2019 03:30:12 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35052 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725845AbfGBHaM (ORCPT ); Tue, 2 Jul 2019 03:30:12 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D5C8F26AC966FD5D207D; Tue, 2 Jul 2019 15:30:08 +0800 (CST) Received: from localhost.localdomain (10.175.34.53) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Tue, 2 Jul 2019 15:29:57 +0800 From: Xue Chaojing To: CC: , , , , , , Subject: [PATCH net-next] hinic: remove standard netdev stats Date: Mon, 1 Jul 2019 23:40:00 +0000 Message-ID: <20190701234000.31738-1-xuechaojing@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.34.53] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch removes standard netdev stats in ethtool -S. Suggested-by: Jakub Kicinski Signed-off-by: Xue Chaojing --- .../net/ethernet/huawei/hinic/hinic_ethtool.c | 47 +------------------ 1 file changed, 1 insertion(+), 46 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c index 8d98f37c88a8..73a20f01ad4c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c @@ -440,35 +440,6 @@ static u32 hinic_get_rxfh_indir_size(struct net_device *netdev) #define ARRAY_LEN(arr) ((int)((int)sizeof(arr) / (int)sizeof(arr[0]))) -#define HINIC_NETDEV_STAT(_stat_item) { \ - .name = #_stat_item, \ - .size = FIELD_SIZEOF(struct rtnl_link_stats64, _stat_item), \ - .offset = offsetof(struct rtnl_link_stats64, _stat_item) \ -} - -static struct hinic_stats hinic_netdev_stats[] = { - HINIC_NETDEV_STAT(rx_packets), - HINIC_NETDEV_STAT(tx_packets), - HINIC_NETDEV_STAT(rx_bytes), - HINIC_NETDEV_STAT(tx_bytes), - HINIC_NETDEV_STAT(rx_errors), - HINIC_NETDEV_STAT(tx_errors), - HINIC_NETDEV_STAT(rx_dropped), - HINIC_NETDEV_STAT(tx_dropped), - HINIC_NETDEV_STAT(multicast), - HINIC_NETDEV_STAT(collisions), - HINIC_NETDEV_STAT(rx_length_errors), - HINIC_NETDEV_STAT(rx_over_errors), - HINIC_NETDEV_STAT(rx_crc_errors), - HINIC_NETDEV_STAT(rx_frame_errors), - HINIC_NETDEV_STAT(rx_fifo_errors), - HINIC_NETDEV_STAT(rx_missed_errors), - HINIC_NETDEV_STAT(tx_aborted_errors), - HINIC_NETDEV_STAT(tx_carrier_errors), - HINIC_NETDEV_STAT(tx_fifo_errors), - HINIC_NETDEV_STAT(tx_heartbeat_errors), -}; - #define HINIC_FUNC_STAT(_stat_item) { \ .name = #_stat_item, \ .size = FIELD_SIZEOF(struct hinic_vport_stats, _stat_item), \ @@ -658,20 +629,11 @@ static void hinic_get_ethtool_stats(struct net_device *netdev, { struct hinic_dev *nic_dev = netdev_priv(netdev); struct hinic_vport_stats vport_stats = {0}; - const struct rtnl_link_stats64 *net_stats; struct hinic_phy_port_stats *port_stats; - struct rtnl_link_stats64 temp; u16 i = 0, j = 0; char *p; int err; - net_stats = dev_get_stats(netdev, &temp); - for (j = 0; j < ARRAY_LEN(hinic_netdev_stats); j++, i++) { - p = (char *)net_stats + hinic_netdev_stats[j].offset; - data[i] = (hinic_netdev_stats[j].size == - sizeof(u64)) ? *(u64 *)p : *(u32 *)p; - } - err = hinic_get_vport_stats(nic_dev, &vport_stats); if (err) netif_err(nic_dev, drv, netdev, @@ -716,8 +678,7 @@ static int hinic_get_sset_count(struct net_device *netdev, int sset) switch (sset) { case ETH_SS_STATS: q_num = nic_dev->num_qps; - count = ARRAY_LEN(hinic_netdev_stats) + - ARRAY_LEN(hinic_function_stats) + + count = ARRAY_LEN(hinic_function_stats) + (ARRAY_LEN(hinic_tx_queue_stats) + ARRAY_LEN(hinic_rx_queue_stats)) * q_num; @@ -738,12 +699,6 @@ static void hinic_get_strings(struct net_device *netdev, switch (stringset) { case ETH_SS_STATS: - for (i = 0; i < ARRAY_LEN(hinic_netdev_stats); i++) { - memcpy(p, hinic_netdev_stats[i].name, - ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } - for (i = 0; i < ARRAY_LEN(hinic_function_stats); i++) { memcpy(p, hinic_function_stats[i].name, ETH_GSTRING_LEN); -- 2.17.1