# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)

name: ovs_vport
version: 2
protocol: genetlink-legacy

doc:
  OVS vport configuration over generic netlink.

definitions:
  -
    name: ovs-header
    type: struct
    members:
      -
        name: dp-ifindex
        type: u32
  -
    name: vport-type
    type: enum
    entries: [ unspec, netdev, internal, gre, vxlan, geneve ]
  -
    name: vport-stats
    type: struct
    members:
      -
        name: rx-packets
        type: u64
      -
        name: tx-packets
        type: u64
      -
        name: rx-bytes
        type: u64
      -
        name: tx-bytes
        type: u64
      -
        name: rx-errors
        type: u64
      -
        name: tx-errors
        type: u64
      -
        name: rx-dropped
        type: u64
      -
        name: tx-dropped
        type: u64

attribute-sets:
  -
    name: vport-options
    attributes:
      -
        name: dst-port
        type: u32
      -
        name: extension
        type: u32
  -
    name: upcall-stats
    attributes:
      -
        name: success
        type: u64
        value: 0
      -
        name: fail
        type: u64
  -
    name: vport
    attributes:
      -
        name: port-no
        type: u32
      -
        name: type
        type: u32
        enum: vport-type
      -
        name: name
        type: string
      -
        name: options
        type: nest
        nested-attributes: vport-options
      -
        name: upcall-pid
        type: binary
        sub-type: u32
      -
        name: stats
        type: binary
        struct: vport-stats
      -
        name: pad
        type: unused
      -
        name: ifindex
        type: u32
      -
        name: netnsid
        type: u32
      -
        name: upcall-stats
        type: nest
        nested-attributes: upcall-stats

operations:
  list:
    -
      name: vport-get
      doc: Get / dump OVS vport configuration and state
      value: 3
      attribute-set: vport
      fixed-header: ovs-header
      do: &vport-get-op
        request:
          attributes:
            - dp-ifindex
            - name
        reply: &dev-all
          attributes:
            - dp-ifindex
            - port-no
            - type
            - name
            - upcall-pid
            - stats
            - ifindex
            - netnsid
            - upcall-stats
      dump: *vport-get-op

mcast-groups:
  list:
    -
      name: ovs_vport
