Skip to content

Commit

Permalink
feat: provide initial support for ethtool configuration
Browse files Browse the repository at this point in the history
See https://github.com/siderolabs/ethtool - our fork.

This PR covers only configuring rings, follow-up PRs will address other
pieces: channels and features.

Example:

```
node: 172.20.0.5
metadata:
    namespace: network
    type: EthernetStatuses.net.talos.dev
    id: enp0s2
    version: 4
    owner: network.EthernetStatusController
    phase: running
    created: 2025-02-04T16:03:14Z
    updated: 2025-02-04T16:04:12Z
spec:
    linkState: true
    port: Other
    duplex: Unknown
    rings:
        rx-max: 256
        tx-max: 256
        rx: 128
        tx: 128
        tx-push: false
        rx-push: false
```

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Feb 5, 2025
1 parent b726e2f commit 716f700
Show file tree
Hide file tree
Showing 49 changed files with 4,969 additions and 1,374 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ linters-settings:
- golang.zx2c4.com/wireguard
- golang.zx2c4.com/wireguard/wgctrl
- cloud.google.com/go
- github.com/mdlayher/ethtool
# fd-leak related replacements: https://github.com/siderolabs/talos/issues/9412
- github.com/insomniacslk/dhcp
- github.com/safchain/ethtool
retract-allow-no-explanation: false
exclude-forbidden: false

Expand Down
49 changes: 49 additions & 0 deletions api/resource/definitions/network/network.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,55 @@ message DNSResolveCacheSpec {
string status = 1;
}

// EthernetRingsSpec describes config of Ethernet rings.
message EthernetRingsSpec {
uint32 rx = 1;
uint32 rx_mini = 2;
uint32 rx_jumbo = 3;
uint32 tx = 4;
uint32 rx_buf_len = 5;
uint32 cqe_size = 6;
bool tx_push = 7;
bool rx_push = 8;
uint32 tx_push_buf_len = 9;
bool tcp_data_split = 10;
}

// EthernetRingsStatus describes status of Ethernet rings.
message EthernetRingsStatus {
uint32 rx_max = 1;
uint32 rx_mini_max = 2;
uint32 rx_jumbo_max = 3;
uint32 tx_max = 4;
uint32 tx_push_buf_len_max = 5;
uint32 rx = 6;
uint32 rx_mini = 7;
uint32 rx_jumbo = 8;
uint32 tx = 9;
uint32 rx_buf_len = 10;
uint32 cqe_size = 11;
bool tx_push = 12;
bool rx_push = 13;
uint32 tx_push_buf_len = 14;
bool tcp_data_split = 15;
}

// EthernetSpecSpec describes config of Ethernet link.
message EthernetSpecSpec {
EthernetRingsSpec rings = 1;
}

// EthernetStatusSpec describes status of rendered secrets.
message EthernetStatusSpec {
bool link_state = 1;
int64 speed_megabits = 2;
talos.resource.definitions.enums.NethelpersPort port = 3;
talos.resource.definitions.enums.NethelpersDuplex duplex = 4;
repeated string our_modes = 5;
repeated string peer_modes = 6;
EthernetRingsStatus rings = 7;
}

// HardwareAddrSpec describes spec for the link.
message HardwareAddrSpec {
string name = 1;
Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/talos/output/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (table *Table) WriteResource(node string, r resource.Resource, event state.
label = "-"
case state.Updated:
label = " "
case state.Bootstrapped, state.Errored:
case state.Bootstrapped, state.Errored, state.Noop:
return nil
}

Expand Down
55 changes: 30 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/siderolabs/talos

go 1.23.3
go 1.23.5

replace (
// see e.g. https://github.com/grpc/grpc-go/issues/6696
Expand All @@ -9,6 +9,9 @@ replace (
// forked coredns so we don't carry caddy and other stuff into the Talos
github.com/coredns/coredns => github.com/siderolabs/coredns v1.12.50

// forked ethtool introduces missing APIs
github.com/mdlayher/ethtool => github.com/siderolabs/ethtool v0.0.0-20250204161245-ee04fc1b1856

// see https://github.com/mdlayher/kobject/pull/5
github.com/mdlayher/kobject => github.com/smira/kobject v0.0.0-20240304111826-49c8d4613389

Expand Down Expand Up @@ -70,7 +73,7 @@ require (
github.com/containernetworking/plugins v1.6.1
github.com/coredns/coredns v1.11.3
github.com/coreos/go-iptables v0.8.0
github.com/cosi-project/runtime v0.8.1
github.com/cosi-project/runtime v0.9.2
github.com/distribution/reference v0.6.0
github.com/docker/cli v27.4.1+incompatible
github.com/docker/docker v27.4.1+incompatible
Expand All @@ -89,7 +92,7 @@ require (
github.com/godbus/dbus/v5 v5.1.0
github.com/golang/mock v1.6.0
github.com/google/cadvisor v0.51.0
github.com/google/cel-go v0.22.1
github.com/google/cel-go v0.23.2
github.com/google/go-containerregistry v0.20.2
github.com/google/go-tpm v0.9.3
github.com/google/nftables v0.2.0
Expand Down Expand Up @@ -180,15 +183,15 @@ require (
go.uber.org/zap v1.27.0
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
golang.org/x/net v0.34.0
golang.org/x/oauth2 v0.24.0
golang.org/x/sync v0.10.0
golang.org/x/sys v0.29.0
golang.org/x/oauth2 v0.25.0
golang.org/x/sync v0.11.0
golang.org/x/sys v0.30.0
golang.org/x/term v0.28.0
golang.org/x/text v0.21.0
golang.org/x/time v0.8.0
golang.org/x/text v0.22.0
golang.org/x/time v0.10.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
google.golang.org/grpc v1.70.0
google.golang.org/protobuf v1.36.4
gopkg.in/yaml.v3 v3.0.1
k8s.io/klog/v2 v2.130.1
kernel.org/pub/linux/libs/security/libcap/cap v1.2.73
Expand All @@ -197,7 +200,7 @@ require (
)

require (
cel.dev/expr v0.18.0 // indirect
cel.dev/expr v0.19.2 // indirect
github.com/0x5a17ed/itkit v0.6.0 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 // indirect
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20231105174938-2b5cbb29f3e2 // indirect
Expand All @@ -208,9 +211,9 @@ require (
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.9 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/ProtonMail/go-crypto v1.1.5 // indirect
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/ProtonMail/gopenpgp/v2 v2.8.1 // indirect
github.com/ProtonMail/gopenpgp/v2 v2.8.2 // indirect
github.com/adrg/xdg v0.5.3 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
Expand All @@ -234,7 +237,7 @@ require (
github.com/containerd/continuity v0.4.4 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/go-cni v1.1.11 // indirect
github.com/containerd/go-cni v1.1.12 // indirect
github.com/containerd/plugin v1.0.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/containerd/ttrpc v1.2.7 // indirect
Expand All @@ -248,7 +251,7 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/dot v1.6.4 // indirect
github.com/emicklei/go-restful/v3 v3.11.2 // indirect
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
github.com/evanphx/json-patch v5.9.11+incompatible // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
Expand All @@ -274,7 +277,7 @@ require (
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosuri/uilive v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
Expand All @@ -289,7 +292,7 @@ require (
github.com/lmittmann/tint v1.0.4 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 // indirect
Expand Down Expand Up @@ -317,6 +320,7 @@ require (
github.com/opencontainers/selinux v1.11.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand All @@ -327,7 +331,8 @@ require (
github.com/prometheus/common v0.60.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/siderolabs/protoenc v0.2.1 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/siderolabs/protoenc v0.2.2 // indirect
github.com/siderolabs/tcpproxy v0.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
Expand All @@ -347,18 +352,18 @@ require (
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect
go.opentelemetry.io/otel v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/otel/trace v1.31.0 // indirect
go.opentelemetry.io/otel v1.32.0 // indirect
go.opentelemetry.io/otel/metric v1.32.0 // indirect
go.opentelemetry.io/otel/trace v1.32.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/tools v0.27.0 // indirect
golang.org/x/tools v0.29.0 // indirect
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 716f700

Please sign in to comment.