mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
nvethernet: ethtool: counter for pkt_err stats got cleared
Add counter for how many times pkt_err stats got cleared using osi_clear_tx_pkt_err_stats and osi_clear_rx_pkt_err_stats call. Bug 200548007 Change-Id: I3f98256306f9104ad952ff1829c48ccce41c4d4e Signed-off-by: rakesh goyal <rgoyal@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2304565 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com> Reviewed-by: Ashutosh Jha <ajha@nvidia.com> Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Revanth Kumar Uppala
parent
9980e3e524
commit
ecf995a8f7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -38,6 +38,27 @@ struct ether_stats {
|
||||
size_t stat_offset;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Name of pkt_err statistics, with length of name not more than
|
||||
* ETH_GSTRING_LEN
|
||||
*/
|
||||
#define ETHER_PKT_ERR_STAT(y) \
|
||||
{ (#y), FIELD_SIZEOF(struct osi_pkt_err_stats, y), \
|
||||
offsetof(struct osi_dma_priv_data, pkt_err_stats.y)}
|
||||
/**
|
||||
* @brief ETHER clear pkt_err statistics
|
||||
*/
|
||||
static const struct ether_stats ether_cstrings_stats[] = {
|
||||
/* Counter for pkt_err stats got cleared */
|
||||
ETHER_PKT_ERR_STAT(clear_tx_err),
|
||||
ETHER_PKT_ERR_STAT(clear_rx_err),
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief clear pkt_err statistics array length
|
||||
*/
|
||||
#define ETHER_PKT_ERR_STAT_LEN OSI_ARRAY_SIZE(ether_cstrings_stats)
|
||||
|
||||
/**
|
||||
* @brief Name of extra DMA stat, with length of name not more than ETH_GSTRING_LEN
|
||||
*/
|
||||
@@ -305,6 +326,14 @@ static void ether_get_ethtool_stats(struct net_device *dev,
|
||||
data[j++] = (ether_dstrings_stats[i].sizeof_stat ==
|
||||
sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
|
||||
}
|
||||
|
||||
for (i = 0; i < ETHER_PKT_ERR_STAT_LEN; i++) {
|
||||
char *p = (char *)osi_dma +
|
||||
ether_cstrings_stats[i].stat_offset;
|
||||
|
||||
data[j++] = (ether_cstrings_stats[i].sizeof_stat ==
|
||||
sizeof(u64)) ? (*(u64 *)p) : (*(u32 *)p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +372,11 @@ static int ether_get_sset_count(struct net_device *dev, int sset)
|
||||
} else {
|
||||
len += ETHER_EXTRA_DMA_STAT_LEN;
|
||||
}
|
||||
if (INT_MAX - ETHER_PKT_ERR_STAT_LEN < len) {
|
||||
/* do nothing */
|
||||
} else {
|
||||
len += ETHER_PKT_ERR_STAT_LEN;
|
||||
}
|
||||
} else {
|
||||
len = -EOPNOTSUPP;
|
||||
}
|
||||
@@ -396,6 +430,14 @@ static void ether_get_strings(struct net_device *dev, u32 stringset, u8 *data)
|
||||
}
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
for (i = 0; i < ETHER_PKT_ERR_STAT_LEN; i++) {
|
||||
str = (u8 *)ether_cstrings_stats[i].stat_string;
|
||||
if (memcpy(p, str, ETH_GSTRING_LEN) ==
|
||||
OSI_NULL) {
|
||||
return;
|
||||
}
|
||||
p += ETH_GSTRING_LEN;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dev_err(pdata->dev, "%s() Unsupported stringset\n", __func__);
|
||||
|
||||
Reference in New Issue
Block a user