提交 972ce7e3 编写于 作者: I Ioana Ciornei 提交者: Jakub Kicinski

dpaa2-eth: fix ethtool statistics

Unfortunately, with the blamed commit I also added a side effect in the
ethtool stats shown. Because I added two more fields in the per channel
structure without verifying if its size is used in any way, part of the
ethtool statistics were off by 2.
Fix this by not looking up the size of the structure but instead on a
fixed value kept in a macro.

Fixes: fc398bec ("net: dpaa2: add adaptive interrupt coalescing")
Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20211215105831.290070-1-ioana.ciornei@nxp.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
上级 1d1c950f
...@@ -388,6 +388,8 @@ struct dpaa2_eth_ch_stats { ...@@ -388,6 +388,8 @@ struct dpaa2_eth_ch_stats {
__u64 bytes_per_cdan; __u64 bytes_per_cdan;
}; };
#define DPAA2_ETH_CH_STATS 7
/* Maximum number of queues associated with a DPNI */ /* Maximum number of queues associated with a DPNI */
#define DPAA2_ETH_MAX_TCS 8 #define DPAA2_ETH_MAX_TCS 8
#define DPAA2_ETH_MAX_RX_QUEUES_PER_TC 16 #define DPAA2_ETH_MAX_RX_QUEUES_PER_TC 16
......
...@@ -278,7 +278,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, ...@@ -278,7 +278,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev,
/* Per-channel stats */ /* Per-channel stats */
for (k = 0; k < priv->num_channels; k++) { for (k = 0; k < priv->num_channels; k++) {
ch_stats = &priv->channel[k]->stats; ch_stats = &priv->channel[k]->stats;
for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64) - 1; j++) for (j = 0; j < DPAA2_ETH_CH_STATS; j++)
*((__u64 *)data + i + j) += *((__u64 *)ch_stats + j); *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j);
} }
i += j; i += j;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册