Re: [RFC Patch net-next 1/5] net: dsa: microchip: add rmon grouping for ethtool statistics
From: Vladimir Oltean
Date: Wed Dec 07 2022 - 08:23:46 EST
On Wed, Nov 30, 2022 at 06:58:58PM +0530, Rakesh Sankaranarayanan wrote:
> diff --git a/drivers/net/dsa/microchip/ksz_ethtool.c b/drivers/net/dsa/microchip/ksz_ethtool.c
> new file mode 100644
> index 000000000000..7e1f1b4d1e98
> --- /dev/null
> +++ b/drivers/net/dsa/microchip/ksz_ethtool.c
> @@ -0,0 +1,178 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Microchip KSZ series ethtool statistics
> + *
> + * Copyright (C) 2022 Microchip Technology Inc.
> + */
> +
> +#include "ksz_common.h"
> +#include "ksz_ethtool.h"
> +
> +enum ksz8_mib_entry {
> + ksz8_rx,
> + ksz8_rx_hi,
> + ksz8_rx_undersize,
> + ksz8_rx_fragments,
> + ksz8_rx_oversize,
> + ksz8_rx_jabbers,
> + ksz8_rx_symbol_err,
> + ksz8_rx_crc_err,
> + ksz8_rx_align_err,
> + ksz8_rx_mac_ctrl,
> + ksz8_rx_pause,
> + ksz8_rx_bcast,
> + ksz8_rx_mcast,
> + ksz8_rx_ucast,
> + ksz8_rx_64_or_less,
> + ksz8_rx_65_127,
> + ksz8_rx_128_255,
> + ksz8_rx_256_511,
> + ksz8_rx_512_1023,
> + ksz8_rx_1024_1522,
> + ksz8_tx,
> + ksz8_tx_hi,
> + ksz8_tx_late_col,
> + ksz8_tx_pause,
> + ksz8_tx_bcast,
> + ksz8_tx_mcast,
> + ksz8_tx_ucast,
> + ksz8_tx_deferred,
> + ksz8_tx_total_col,
> + ksz8_tx_exc_col,
> + ksz8_tx_single_col,
> + ksz8_tx_mult_col,
> + ksz8_rx_discards = 0x100,
> + ksz8_tx_discards,
> +};
> +
> +enum ksz9477_mib_entry {
> + ksz9477_rx_hi,
> + ksz9477_rx_undersize,
> + ksz9477_rx_fragments,
> + ksz9477_rx_oversize,
> + ksz9477_rx_jabbers,
> + ksz9477_rx_symbol_err,
> + ksz9477_rx_crc_err,
> + ksz9477_rx_align_err,
> + ksz9477_rx_mac_ctrl,
> + ksz9477_rx_pause,
> + ksz9477_rx_bcast,
> + ksz9477_rx_mcast,
> + ksz9477_rx_ucast,
> + ksz9477_rx_64_or_less,
> + ksz9477_rx_65_127,
> + ksz9477_rx_128_255,
> + ksz9477_rx_256_511,
> + ksz9477_rx_512_1023,
> + ksz9477_rx_1024_1522,
> + ksz9477_rx_1523_2000,
> + ksz9477_rx_2001,
> + ksz9477_tx_hi,
> + ksz9477_tx_late_col,
> + ksz9477_tx_pause,
> + ksz9477_tx_bcast,
> + ksz9477_tx_mcast,
> + ksz9477_tx_ucast,
> + ksz9477_tx_deferred,
> + ksz9477_tx_total_col,
> + ksz9477_tx_exc_col,
> + ksz9477_tx_single_col,
> + ksz9477_tx_mult_col,
> + ksz9477_rx_total = 0x80,
> + ksz9477_tx_total,
> + ksz9477_rx_discards,
> + ksz9477_tx_discards,
> +};
We usually name constants using all capitals.
Can you do something to reuse the ksz_mib_names structures?