Documentation / netlink / specs / tcp_metrics.yaml


Based on kernel version 6.11. Page generated on 2024-09-24 08:21 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)

name: tcp_metrics

protocol: genetlink-legacy

doc: |
  Management interface for TCP metrics.

c-family-name: tcp-metrics-genl-name
c-version-name: tcp-metrics-genl-version
max-by-define: true
kernel-policy: global

definitions:
  -
    name: tcp-fastopen-cookie-max
    type: const
    value: 16

attribute-sets:
  -
    name: tcp-metrics
    name-prefix: tcp-metrics-attr-
    attributes:
      -
        name: addr-ipv4
        type: u32
        byte-order: big-endian
        display-hint: ipv4
      -
        name: addr-ipv6
        type: binary
        checks:
          min-len: 16
        byte-order: big-endian
        display-hint: ipv6
      -
        name: age
        type: u64
      -
        name: tw-tsval
        type: u32
        doc: unused
      -
        name: tw-ts-stamp
        type: s32
        doc: unused
      -
        name: vals
        type: nest
        nested-attributes: metrics
      -
        name: fopen-mss
        type: u16
      -
        name: fopen-syn-drops
        type: u16
      -
        name: fopen-syn-drop-ts
        type: u64
      -
        name: fopen-cookie
        type: binary
        checks:
          min-len: tcp-fastopen-cookie-max
      -
        name: saddr-ipv4
        type: u32
        byte-order: big-endian
        display-hint: ipv4
      -
        name: saddr-ipv6
        type: binary
        checks:
          min-len: 16
        byte-order: big-endian
        display-hint: ipv6
      -
        name: pad
        type: pad
 
  -
    name: metrics
    # Intentionally don't define the name-prefix, see below.
    doc: |
      Attributes with metrics. Note that the values here do not match
      the TCP_METRIC_* defines in the kernel, because kernel defines
      are off-by one (e.g. rtt is defined as enum 0, while netlink carries
      attribute type 1).
    attributes:
      -
        name: rtt
        type: u32
        doc: |
          Round Trip Time (RTT), in msecs with 3 bits fractional
          (left-shift by 3 to get the msec value).
      -
        name: rttvar
        type: u32
        doc: |
          Round Trip Time VARiance (RTT), in msecs with 2 bits fractional
          (left-shift by 2 to get the msec value).
      -
        name: ssthresh
        type: u32
        doc: Slow Start THRESHold.
      -
        name: cwnd
        type: u32
        doc: Congestion Window.
      -
        name: reodering
        type: u32
        doc: Reodering metric.
      -
        name: rtt-us
        type: u32
        doc: |
          Round Trip Time (RTT), in usecs, with 3 bits fractional
          (left-shift by 3 to get the msec value).
      -
        name: rttvar-us
        type: u32
        doc: |
          Round Trip Time (RTT), in usecs, with 2 bits fractional
          (left-shift by 3 to get the msec value).

operations:
  list:
    -
      name: get
      doc: Retrieve metrics.
      attribute-set: tcp-metrics

      dont-validate: [ strict, dump ]

      do:
        request: &sel_attrs
          attributes:
            - addr-ipv4
            - addr-ipv6
            - saddr-ipv4
            - saddr-ipv6
        reply: &all_attrs
          attributes:
            - addr-ipv4
            - addr-ipv6
            - saddr-ipv4
            - saddr-ipv6
            - age
            - vals
            - fopen-mss
            - fopen-syn-drops
            - fopen-syn-drop-ts
            - fopen-cookie
      dump:
        reply: *all_attrs
 
    -
      name: del
      doc: Delete metrics.
      attribute-set: tcp-metrics

      dont-validate: [ strict, dump ]
      flags: [ admin-perm ]

      do:
        request: *sel_attrs