Commit cc2f0812 authored by Vadim Fedorenko's avatar Vadim Fedorenko Committed by Jakub Kicinski
Browse files

ethtool: add FEC bins histogram report



IEEE 802.3ck-2022 defines counters for FEC bins and 802.3df-2024
clarifies it a bit further. Implement reporting interface through as
addition to FEC stats available in ethtool. Drivers can leave bin
counter uninitialized if per-lane values are provided. In this case the
core will recalculate summ for the bin.

Signed-off-by: default avatarVadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Link: https://patch.msgid.link/20250924124037.1508846-2-vadim.fedorenko@linux.dev


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fbb8bc40
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1219,6 +1219,30 @@ attribute-sets:
        name: udp-ports
        type: nest
        nested-attributes: tunnel-udp
  -
    name: fec-hist
    attr-cnt-name: --ethtool-a-fec-hist-cnt
    attributes:
      -
        name: pad
        type: pad
      -
        name: bin-low
        type: u32
        doc: Low bound of FEC bin (inclusive)
      -
        name: bin-high
        type: u32
        doc: High bound of FEC bin (inclusive)
      -
        name: bin-val
        type: uint
        doc: Error count in the bin (optional if per-lane values exist)
      -
        name: bin-val-per-lane
        type: binary
        sub-type: u64
        doc: An array of per-lane error counters in the bin (optional)
  -
    name: fec-stat
    attr-cnt-name: __ethtool-a-fec-stat-cnt
@@ -1242,6 +1266,11 @@ attribute-sets:
        name: corr-bits
        type: binary
        sub-type: u64
      -
        name: hist
        type: nest
        multi-attr: True
        nested-attributes: fec-hist
  -
    name: fec
    attr-cnt-name: __ethtool-a-fec-cnt
+5 −0
Original line number Diff line number Diff line
@@ -1541,6 +1541,11 @@ Drivers fill in the statistics in the following structure:
.. kernel-doc:: include/linux/ethtool.h
    :identifiers: ethtool_fec_stats

Statistics may have FEC bins histogram attribute ``ETHTOOL_A_FEC_STAT_HIST``
as defined in IEEE 802.3ck-2022 and 802.3df-2024. Nested attributes will have
the range of FEC errors in the bin (inclusive) and the amount of error events
in the bin.

FEC_SET
=======

+2 −1
Original line number Diff line number Diff line
@@ -3208,7 +3208,8 @@ static int bnxt_get_fecparam(struct net_device *dev,
}

static void bnxt_get_fec_stats(struct net_device *dev,
			       struct ethtool_fec_stats *fec_stats)
			       struct ethtool_fec_stats *fec_stats,
			       struct ethtool_fec_hist *hist)
{
	struct bnxt *bp = netdev_priv(dev);
	u64 *rx;
+2 −1
Original line number Diff line number Diff line
@@ -930,7 +930,8 @@ static void fun_get_rmon_stats(struct net_device *netdev,
}

static void fun_get_fec_stats(struct net_device *netdev,
			      struct ethtool_fec_stats *stats)
			      struct ethtool_fec_stats *stats,
			      struct ethtool_fec_hist *hist)
{
	const struct funeth_priv *fp = netdev_priv(netdev);

+2 −1
Original line number Diff line number Diff line
@@ -1659,7 +1659,8 @@ static void hns3_set_msglevel(struct net_device *netdev, u32 msg_level)
}

static void hns3_get_fec_stats(struct net_device *netdev,
			       struct ethtool_fec_stats *fec_stats)
			       struct ethtool_fec_stats *fec_stats,
			       struct ethtool_fec_hist *hist)
{
	struct hnae3_handle *handle = hns3_get_handle(netdev);
	struct hnae3_ae_dev *ae_dev = hns3_get_ae_dev(handle);
Loading