On 30/07/2025 02:45, Jakub Kicinski wrote:
On Tue, 29 Jul 2025 03:23:54 -0700 Vadim Fedorenko wrote:
diff --git a/Documentation/netlink/specs/ethtool.yaml
b/Documentation/netlink/specs/ethtool.yaml
index 1063d5d32fea2..3781ced722fee 100644
--- a/Documentation/netlink/specs/ethtool.yaml
+++ b/Documentation/netlink/specs/ethtool.yaml
@@ -1239,6 +1239,30 @@ attribute-sets:
name: corr-bits
type: binary
sub-type: u64
+ -
+ name: hist
+ type: nest
+ multi-attr: True
+ nested-attributes: fec-hist
+ -
+ name: fec-hist-bin-low
+ type: s32
+ -
+ name: fec-hist-bin-high
+ type: s32
+ -
+ name: fec-hist-bin-val
+ type: u64
+ -
+ name: fec-hist
+ subset-of: fec-stat
no need to make this a subset, better to make it its own attr set
like a set for general histogram? or still fec-specific?
+ attributes:
+ -
+ name: fec-hist-bin-low
+ -
+ name: fec-hist-bin-high
+ -
+ name: fec-hist-bin-val
-
name: fec
attr-cnt-name: __ethtool-a-fec-cnt
+static const struct ethtool_fec_hist_range netdevsim_fec_ranges[] = {
+ { 0, 0},
+ { 1, 3},
+ { 4, 7},
+ { -1, -1}
+};
Let's add a define for the terminating element?
I believe it's about (-1, -1) case. If we end up using (0, 0) then there
is no need to define anything, right?
+/**
+ * struct ethtool_fec_hist_range - byte range for FEC bins histogram statistics
byte range? thought these are bit errors..
+ * sentinel value of { -1, -1 } is used as marker for end of bins array
+ * @low: low bound of the bin (inclusive)
+ * @high: high bound of the bin (inclusive)
+ */
+ len += nla_total_size_64bit(sizeof(u64) * ETHTOOL_FEC_HIST_MAX);
I don't think it's right, each attr is its own nla_total_size().
Add a nla_total_size(8) to the calculation below
got it
+ /* add FEC bins information */
+ len += (nla_total_size(0) + /* _A_FEC_HIST */
+ nla_total_size(4) + /* _A_FEC_HIST_BIN_LOW */
+ nla_total_size(4)) * /* _A_FEC_HIST_BIN_HI */
+ ETHTOOL_FEC_HIST_MAX;