You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kmod-redhat-atlantic/SOURCES/0124-netdrv-net-atlantic-us...

130 lines
4.7 KiB

From 160379b0e060e5eca5d817ec9485f7464cf64cb0 Mon Sep 17 00:00:00 2001
From: Igor Russkikh <irusskik@redhat.com>
Date: Fri, 6 Nov 2020 18:38:21 -0500
Subject: [PATCH 124/139] [netdrv] net: atlantic: use simple assignment in
_get_stats and _get_sw_stats
Message-id: <1604687916-15087-125-git-send-email-irusskik@redhat.com>
Patchwork-id: 338566
Patchwork-instance: patchwork
O-Subject: [RHEL8.4 BZ 1857861 124/139] net: atlantic: use simple assignment in _get_stats and _get_sw_stats
Bugzilla: 1857861
RH-Acked-by: David Arcari <darcari@redhat.com>
RH-Acked-by: John Linville <linville@redhat.com>
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
Bugzilla: http://bugzilla.redhat.com/1857861
commit 3624aa3c2582e4b9097e7648f6f03c82e474ceb8
Author: Mark Starovoytov <mstarovoitov@marvell.com>
Date: Mon Jul 20 21:32:33 2020 +0300
net: atlantic: use simple assignment in _get_stats and _get_sw_stats
This patch replaces addition assignment operator with a simple assignment
in aq_vec_get_stats() and aq_vec_get_sw_stats(), because it is
sufficient in both cases and this change simplifies the introduction of
u64_stats_update_* in these functions.
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Igor Russkikh <irusskik@redhat.com>
Cc: David Arcari <darcari@redhat.com>
Cc: Igor Russkikh <irusskik@redhat.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 47 +++++++++++++------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
index d1d43c8ce400..2acdaee18ba0 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only
-/*
- * aQuantia Corporation Network Driver
- * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
+/* Atlantic Network Driver
+ *
+ * Copyright (C) 2014-2019 aQuantia Corporation
+ * Copyright (C) 2019-2020 Marvell International Ltd.
*/
/* File aq_vec.c: Definition of common structure for vector of Rx and Tx rings.
@@ -349,7 +350,7 @@ cpumask_t *aq_vec_get_affinity_mask(struct aq_vec_s *self)
return &self->aq_ring_param.affinity_mask;
}
-static void aq_vec_add_stats(struct aq_vec_s *self,
+static void aq_vec_get_stats(struct aq_vec_s *self,
const unsigned int tc,
struct aq_ring_stats_rx_s *stats_rx,
struct aq_ring_stats_tx_s *stats_tx)
@@ -359,23 +360,23 @@ static void aq_vec_add_stats(struct aq_vec_s *self,
if (tc < self->rx_rings) {
struct aq_ring_stats_rx_s *rx = &ring[AQ_VEC_RX_ID].stats.rx;
- stats_rx->packets += rx->packets;
- stats_rx->bytes += rx->bytes;
- stats_rx->errors += rx->errors;
- stats_rx->jumbo_packets += rx->jumbo_packets;
- stats_rx->lro_packets += rx->lro_packets;
- stats_rx->pg_losts += rx->pg_losts;
- stats_rx->pg_flips += rx->pg_flips;
- stats_rx->pg_reuses += rx->pg_reuses;
+ stats_rx->packets = rx->packets;
+ stats_rx->bytes = rx->bytes;
+ stats_rx->errors = rx->errors;
+ stats_rx->jumbo_packets = rx->jumbo_packets;
+ stats_rx->lro_packets = rx->lro_packets;
+ stats_rx->pg_losts = rx->pg_losts;
+ stats_rx->pg_flips = rx->pg_flips;
+ stats_rx->pg_reuses = rx->pg_reuses;
}
if (tc < self->tx_rings) {
struct aq_ring_stats_tx_s *tx = &ring[AQ_VEC_TX_ID].stats.tx;
- stats_tx->packets += tx->packets;
- stats_tx->bytes += tx->bytes;
- stats_tx->errors += tx->errors;
- stats_tx->queue_restarts += tx->queue_restarts;
+ stats_tx->packets = tx->packets;
+ stats_tx->bytes = tx->bytes;
+ stats_tx->errors = tx->errors;
+ stats_tx->queue_restarts = tx->queue_restarts;
}
}
@@ -389,16 +390,16 @@ int aq_vec_get_sw_stats(struct aq_vec_s *self, const unsigned int tc, u64 *data,
memset(&stats_rx, 0U, sizeof(struct aq_ring_stats_rx_s));
memset(&stats_tx, 0U, sizeof(struct aq_ring_stats_tx_s));
- aq_vec_add_stats(self, tc, &stats_rx, &stats_tx);
+ aq_vec_get_stats(self, tc, &stats_rx, &stats_tx);
/* This data should mimic aq_ethtool_queue_stat_names structure
*/
- data[count] += stats_rx.packets;
- data[++count] += stats_tx.packets;
- data[++count] += stats_tx.queue_restarts;
- data[++count] += stats_rx.jumbo_packets;
- data[++count] += stats_rx.lro_packets;
- data[++count] += stats_rx.errors;
+ data[count] = stats_rx.packets;
+ data[++count] = stats_tx.packets;
+ data[++count] = stats_tx.queue_restarts;
+ data[++count] = stats_rx.jumbo_packets;
+ data[++count] = stats_rx.lro_packets;
+ data[++count] = stats_rx.errors;
if (p_count)
*p_count = ++count;
--
2.13.6