Commit 23813168 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ynl-ethtool'



Jakub Kicinski says:

====================
tools: ynl: generate code for the ethtool family

And finally ethtool support. Thanks to Stan's work the ethtool family
spec is quite complete, so there is a lot of operations to support.

I chickened out of stats-get support, they require at the very least
type-value support on a u64 scalar. Type-value is an arrangement where
a u16 attribute is encoded directly in attribute type. Code gen can
support this if the inside is a nest, we just throw in an extra
field into that nest to carry the attr type. But a little more coding
is needed to for a scalar, because first we need to turn the scalar
into a struct with one member, then we can add the attr type.

Other than that ethtool required event support (notification which
does not share contents with any GET), but the previous series
already added that to the codegen.

I haven't tested all the ops here, and a few I tried seem to work.
====================

Acked-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents b30a1f30 f561ff23
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -195,6 +195,10 @@ properties:
                    description: Max length for a string or a binary attribute.
                    $ref: '#/$defs/len-or-define'
              sub-type: *attr-type
              # Start genetlink-c
              name-prefix:
                type: string
              # End genetlink-c

      # Make sure name-prefix does not appear in subsets (subsets inherit naming)
      dependencies:
+4 −0
Original line number Diff line number Diff line
@@ -226,6 +226,10 @@ properties:
                    description: Max length for a string or a binary attribute.
                    $ref: '#/$defs/len-or-define'
              sub-type: *attr-type
              # Start genetlink-c
              name-prefix:
                type: string
              # End genetlink-c
              # Start genetlink-legacy
              struct:
                description: Name of the struct type used for the attribute.
+92 −28
Original line number Diff line number Diff line
@@ -9,8 +9,13 @@ doc: Partial family for Ethtool Netlink.
definitions:
  -
    name: udp-tunnel-type
    enum-name:
    type: enum
    entries: [ vxlan, geneve, vxlan-gpe ]
  -
    name: stringset
    type: enum
    entries: []

attribute-sets:
  -
@@ -497,7 +502,7 @@ attribute-sets:
    attributes:
      -
        name: pad
        type: u32
        type: pad
      -
        name: tx-frames
        type: u64
@@ -577,7 +582,7 @@ attribute-sets:
        name: phc-index
        type: u32
  -
    name: cable-test-ntf-nest-result
    name: cable-result
    attributes:
      -
        name: pair
@@ -586,7 +591,7 @@ attribute-sets:
        name: code
        type: u8
  -
    name: cable-test-ntf-nest-fault-length
    name: cable-fault-length
    attributes:
      -
        name: pair
@@ -595,18 +600,25 @@ attribute-sets:
        name: cm
        type: u32
  -
    name: cable-test-ntf-nest
    name: cable-nest
    attributes:
      -
        name: result
        type: nest
        nested-attributes: cable-test-ntf-nest-result
        nested-attributes: cable-result
      -
        name: fault-length
        type: nest
        nested-attributes: cable-test-ntf-nest-fault-length
        nested-attributes: cable-fault-length
  -
    name: cable-test
    attributes:
      -
        name: header
        type: nest
        nested-attributes: header
  -
    name: cable-test-ntf
    attributes:
      -
        name: header
@@ -618,7 +630,7 @@ attribute-sets:
      -
        name: nest
        type: nest
        nested-attributes: cable-test-ntf-nest
        nested-attributes: cable-nest
  -
    name: cable-test-tdr-cfg
    attributes:
@@ -632,8 +644,22 @@ attribute-sets:
        name: step
        type: u32
      -
        name: pari
        name: pair
        type: u8
  -
    name: cable-test-tdr-ntf
    attributes:
      -
        name: header
        type: nest
        nested-attributes: header
      -
        name: status
        type: u8
      -
        name: nest
        type: nest
        nested-attributes: cable-nest
  -
    name: cable-test-tdr
    attributes:
@@ -646,7 +672,7 @@ attribute-sets:
        type: nest
        nested-attributes: cable-test-tdr-cfg
  -
    name: tunnel-info-udp-entry
    name: tunnel-udp-entry
    attributes:
      -
        name: port
@@ -657,7 +683,7 @@ attribute-sets:
        type: u32
        enum: udp-tunnel-type
  -
    name: tunnel-info-udp-table
    name: tunnel-udp-table
    attributes:
      -
        name: size
@@ -667,9 +693,17 @@ attribute-sets:
        type: nest
        nested-attributes: bitset
      -
        name: udp-ports
        name: entry
        type: nest
        multi-attr: true
        nested-attributes: tunnel-udp-entry
  -
    name: tunnel-udp
    attributes:
      -
        name: table
        type: nest
        nested-attributes: tunnel-info-udp-entry
        nested-attributes: tunnel-udp-table
  -
    name: tunnel-info
    attributes:
@@ -680,13 +714,13 @@ attribute-sets:
      -
        name: udp-ports
        type: nest
        nested-attributes: tunnel-info-udp-table
        nested-attributes: tunnel-udp
  -
    name: fec-stat
    attributes:
      -
        name: pad
        type: u8
        type: pad
      -
        name: corrected
        type: binary
@@ -750,7 +784,7 @@ attribute-sets:
    attributes:
      -
        name: pad
        type: u32
        type: pad
      -
        name: id
        type: u32
@@ -759,16 +793,29 @@ attribute-sets:
        type: u32
      -
        name: stat
        type: nest
        nested-attributes: u64
        type: u64
        type-value: [ id ]
      -
        name: hist-rx
        type: nest
        nested-attributes: u64
        nested-attributes: stats-grp-hist
      -
        name: hist-tx
        type: nest
        nested-attributes: u64
        nested-attributes: stats-grp-hist
      -
        name: hist-bkt-low
        type: u32
      -
        name: hist-bkt-hi
        type: u32
      -
        name: hist-val
        type: u64
  -
    name: stats-grp-hist
    subset-of: stats-grp
    attributes:
      -
        name: hist-bkt-low
        type: u32
@@ -783,7 +830,7 @@ attribute-sets:
    attributes:
      -
        name: pad
        type: u32
        type: pad
      -
        name: header
        type: nest
@@ -836,12 +883,15 @@ attribute-sets:
      -
        name: admin-state
        type: u32
        name-prefix: ethtool-a-podl-pse-
      -
        name: admin-control
        type: u32
        name-prefix: ethtool-a-podl-pse-
      -
        name: pw-d-status
        type: u32
        name-prefix: ethtool-a-podl-pse-
  -
    name: rss
    attributes:
@@ -895,6 +945,7 @@ attribute-sets:

operations:
  enum-model: directional
  name-prefix: ethtool-msg-
  list:
    -
      name: strset-get
@@ -1348,10 +1399,16 @@ operations:
        request:
          attributes:
            - header
        reply:
    -
      name: cable-test-ntf
      doc: Cable test notification.

      attribute-set: cable-test-ntf

      event:
        attributes:
          - header
            - cable-test-ntf-nest
          - status
    -
      name: cable-test-tdr-act
      doc: Cable test TDR.
@@ -1362,10 +1419,17 @@ operations:
        request:
          attributes:
            - header
        reply:
    -
      name: cable-test-tdr-ntf
      doc: Cable test TDR notification.

      attribute-set: cable-test-tdr-ntf

      event:
        attributes:
          - header
            - cable-test-tdr-cfg
          - status
          - nest
    -
      name: tunnel-info-get
      doc: Get tsinfo params.
+6 −3
Original line number Diff line number Diff line
@@ -7,9 +7,12 @@ ifeq ("$(DEBUG)","1")
  CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
endif

YNL_GEN_ARG_ethtool:=--user-header linux/ethtool_netlink.h \
	--exclude-op stats-get

TOOL:=../ynl-gen-c.py

GENS:=devlink handshake fou netdev
GENS:=ethtool devlink handshake fou netdev
SRCS=$(patsubst %,%-user.c,${GENS})
HDRS=$(patsubst %,%-user.h,${GENS})
OBJS=$(patsubst %,%-user.o,${GENS})
@@ -22,11 +25,11 @@ protos.a: $(OBJS)

%-user.h: ../../../../Documentation/netlink/specs/%.yaml $(TOOL)
	@echo -e "\tGEN $@"
	@$(TOOL) --mode user --header --spec $< > $@
	@$(TOOL) --mode user --header --spec $< $(YNL_GEN_ARG_$*) > $@

%-user.c: ../../../../Documentation/netlink/specs/%.yaml $(TOOL)
	@echo -e "\tGEN $@"
	@$(TOOL) --mode user --source --spec $< > $@
	@$(TOOL) --mode user --source --spec $< $(YNL_GEN_ARG_$*) > $@

%-user.o: %-user.c %-user.h
	@echo -e "\tCC $@"
+6353 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading