Skip to content

Commit 8cc1ddc

Browse files
a-r-ncopybara-github
authored andcommitted
networkconfig: support ring_config expectations in proto
Add rx_ring_size and tx_ring_size fields to NicExpectation to support asserting ethtool ring buffer size settings. PiperOrigin-RevId: 951707778
1 parent b54cbab commit 8cc1ddc

3 files changed

Lines changed: 89 additions & 4 deletions

File tree

test_suites/networkconfig/config_expectations/config_expectations.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ message NicExpectation {
5050

5151
// Receive queues for this NIC.
5252
repeated RxQueue rx_queues = 3;
53+
54+
// Receive and transmit ring buffer sizes for this NIC.
55+
int32 rx_ring_size = 4;
56+
int32 tx_ring_size = 5;
5357
}
5458

5559
message RxQueue {

test_suites/networkconfig/config_expectations/config_expectations_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,19 @@ func TestCPUSets(t *testing.T) {
130130
})
131131
}
132132
}
133+
134+
func TestRingSizes(t *testing.T) {
135+
c := proto()
136+
for _, config := range c.GetConfigExpectations() {
137+
t.Run(config.GetDescription(), func(t *testing.T) {
138+
for nicIdx, nic := range config.GetNics() {
139+
if nic.HasRxRingSize() && nic.GetRxRingSize() <= 0 {
140+
t.Errorf("NIC %d: non-positive rx_ring_size %d", nicIdx, nic.GetRxRingSize())
141+
}
142+
if nic.HasTxRingSize() && nic.GetTxRingSize() <= 0 {
143+
t.Errorf("NIC %d: non-positive tx_ring_size %d", nicIdx, nic.GetTxRingSize())
144+
}
145+
}
146+
})
147+
}
148+
}

test_suites/networkconfig/config_expectations_proto/config_expectations.pb.go

Lines changed: 69 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)