Skip to content

Commit b637efb

Browse files
harp-intelCopilot
andauthored
reorder network/nic tables in report (#561)
* reorder network/nic tables in report Signed-off-by: Harper, Jason M <[email protected]> * address magic number Co-authored-by: Copilot <[email protected]> * fix: return empty string instead of "N/A" for empty queue mappings Signed-off-by: Harper, Jason M <[email protected]> --------- Signed-off-by: Harper, Jason M <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 1f5215c commit b637efb

File tree

5 files changed

+36
-39
lines changed

5 files changed

+36
-39
lines changed

cmd/report/report.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ var (
6767
flagMemory bool
6868
flagDimm bool
6969
flagNic bool
70-
flagNetIrq bool
7170
flagNetConfig bool
7271
flagDisk bool
7372
flagFilesystem bool
@@ -108,9 +107,8 @@ const (
108107
flagSSTName = "sst"
109108
flagMemoryName = "memory"
110109
flagDimmName = "dimm"
111-
flagNicName = "nic"
112110
flagNetConfigName = "netconfig"
113-
flagNetIrqName = "netirq"
111+
flagNicName = "nic"
114112
flagDiskName = "disk"
115113
flagFilesystemName = "filesystem"
116114
flagGpuName = "gpu"
@@ -171,9 +169,8 @@ var categories = []common.Category{
171169
{FlagName: flagElcName, FlagVar: &flagElc, Help: "Efficiency Latency Control Settings", TableNames: []string{report.ElcTableName}},
172170
{FlagName: flagMemoryName, FlagVar: &flagMemory, Help: "Memory Configuration", TableNames: []string{report.MemoryTableName}},
173171
{FlagName: flagDimmName, FlagVar: &flagDimm, Help: "DIMM Population", TableNames: []string{report.DIMMTableName}},
174-
{FlagName: flagNicName, FlagVar: &flagNic, Help: "Network Cards", TableNames: []string{report.NICTableName, report.NICPacketSteeringTableName}},
175172
{FlagName: flagNetConfigName, FlagVar: &flagNetConfig, Help: "Network Configuration", TableNames: []string{report.NetworkConfigTableName}},
176-
{FlagName: flagNetIrqName, FlagVar: &flagNetIrq, Help: "Network IRQ to CPU Mapping", TableNames: []string{report.NetworkIRQMappingTableName}},
173+
{FlagName: flagNicName, FlagVar: &flagNic, Help: "Network Cards", TableNames: []string{report.NICTableName, report.NICCpuAffinityTableName, report.NICPacketSteeringTableName}},
177174
{FlagName: flagDiskName, FlagVar: &flagDisk, Help: "Storage Devices", TableNames: []string{report.DiskTableName}},
178175
{FlagName: flagFilesystemName, FlagVar: &flagFilesystem, Help: "File Systems", TableNames: []string{report.FilesystemTableName}},
179176
{FlagName: flagGpuName, FlagVar: &flagGpu, Help: "GPUs", TableNames: []string{report.GPUTableName}},

internal/report/table_defs.go

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ const (
9292
ElcTableName = "Efficiency Latency Control"
9393
MemoryTableName = "Memory"
9494
DIMMTableName = "DIMM"
95-
NICTableName = "NIC"
96-
NetworkIRQMappingTableName = "Network IRQ Mapping"
9795
NetworkConfigTableName = "Network Configuration"
96+
NICTableName = "NIC"
97+
NICCpuAffinityTableName = "NIC CPU Affinity"
9898
NICPacketSteeringTableName = "NIC Packet Steering"
9999
DiskTableName = "Disk"
100100
FilesystemTableName = "Filesystem"
@@ -367,35 +367,36 @@ var tableDefinitions = map[string]TableDefinition{
367367
FieldsFunc: dimmTableValues,
368368
InsightsFunc: dimmTableInsights,
369369
HTMLTableRendererFunc: dimmTableHTMLRenderer},
370-
NICTableName: {
371-
Name: NICTableName,
372-
HasRows: true,
370+
NetworkConfigTableName: {
371+
Name: NetworkConfigTableName,
372+
HasRows: false,
373373
MenuLabel: NetworkMenuLabel,
374+
ScriptNames: []string{
375+
script.SysctlScriptName,
376+
script.IRQBalanceScriptName,
377+
},
378+
FieldsFunc: networkConfigTableValues},
379+
NICTableName: {
380+
Name: NICTableName,
381+
HasRows: true,
374382
ScriptNames: []string{
375383
script.NicInfoScriptName,
376384
},
377385
FieldsFunc: nicTableValues},
378-
NetworkConfigTableName: {
379-
Name: NetworkConfigTableName,
380-
HasRows: false,
386+
NICCpuAffinityTableName: {
387+
Name: NICCpuAffinityTableName,
388+
HasRows: true,
381389
ScriptNames: []string{
382-
script.SysctlScriptName,
390+
script.NicInfoScriptName,
383391
},
384-
FieldsFunc: networkConfigTableValues},
392+
FieldsFunc: nicCpuAffinityTableValues},
385393
NICPacketSteeringTableName: {
386394
Name: NICPacketSteeringTableName,
387395
HasRows: true,
388396
ScriptNames: []string{
389397
script.NicInfoScriptName,
390398
},
391399
FieldsFunc: nicPacketSteeringTableValues},
392-
NetworkIRQMappingTableName: {
393-
Name: NetworkIRQMappingTableName,
394-
HasRows: true,
395-
ScriptNames: []string{
396-
script.NicInfoScriptName,
397-
},
398-
FieldsFunc: networkIRQMappingTableValues},
399400
DiskTableName: {
400401
Name: DiskTableName,
401402
HasRows: true,
@@ -1637,7 +1638,6 @@ func nicTableValues(outputs map[string]script.ScriptOutput) []Field {
16371638
{Name: "MTU", Description: "Maximum Transmission Unit. The largest size packet or frame, specified in octets (eight-bit bytes), that can be sent in a packet- or frame-based network such as the Internet."},
16381639
{Name: "TX Queues"},
16391640
{Name: "RX Queues"},
1640-
{Name: "IRQBalance", Description: "System level setting. Dynamically monitors system activity and spreads IRQs across available cores, aiming to balance CPU load, improve throughput, and reduce latency for interrupt-heavy workloads."},
16411641
{Name: "Adaptive RX", Description: "Enables dynamic adjustment of receive interrupt coalescing based on traffic patterns."},
16421642
{Name: "Adaptive TX", Description: "Enables dynamic adjustment of transmit interrupt coalescing based on traffic patterns."},
16431643
{Name: "rx-usecs", Description: "Sets the delay, in microseconds, before an interrupt is generated after receiving a packet. Higher values reduce CPU usage (by batching packets), but increase latency. Lower values reduce latency, but increase interrupt rate and CPU load."},
@@ -1675,11 +1675,10 @@ func nicTableValues(outputs map[string]script.ScriptOutput) []Field {
16751675
fields[12].Values = append(fields[12].Values, nicInfo.MTU)
16761676
fields[13].Values = append(fields[13].Values, nicInfo.TXQueues)
16771677
fields[14].Values = append(fields[14].Values, nicInfo.RXQueues)
1678-
fields[15].Values = append(fields[15].Values, nicInfo.IRQBalance)
1679-
fields[16].Values = append(fields[16].Values, nicInfo.AdaptiveRX)
1680-
fields[17].Values = append(fields[17].Values, nicInfo.AdaptiveTX)
1681-
fields[18].Values = append(fields[18].Values, nicInfo.RxUsecs)
1682-
fields[19].Values = append(fields[19].Values, nicInfo.TxUsecs)
1678+
fields[15].Values = append(fields[15].Values, nicInfo.AdaptiveRX)
1679+
fields[16].Values = append(fields[16].Values, nicInfo.AdaptiveTX)
1680+
fields[17].Values = append(fields[17].Values, nicInfo.RxUsecs)
1681+
fields[18].Values = append(fields[18].Values, nicInfo.TxUsecs)
16831682
}
16841683
return fields
16851684
}
@@ -1700,14 +1699,14 @@ func nicPacketSteeringTableValues(outputs map[string]script.ScriptOutput) []Fiel
17001699
// XPS row
17011700
if nicInfo.TXQueues != "0" {
17021701
fields[0].Values = append(fields[0].Values, nicInfo.Name)
1703-
fields[1].Values = append(fields[1].Values, "xps_cpus")
1702+
fields[1].Values = append(fields[1].Values, "XPS")
17041703
fields[2].Values = append(fields[2].Values, formatQueueCPUMappings(nicInfo.XPSCPUs, "tx-"))
17051704
}
17061705

17071706
// RPS row
17081707
if nicInfo.RXQueues != "0" {
17091708
fields[0].Values = append(fields[0].Values, nicInfo.Name)
1710-
fields[1].Values = append(fields[1].Values, "rps_cpus")
1709+
fields[1].Values = append(fields[1].Values, "RPS")
17111710
fields[2].Values = append(fields[2].Values, formatQueueCPUMappings(nicInfo.RPSCPUs, "rx-"))
17121711
}
17131712
}
@@ -1741,12 +1740,12 @@ func formatQueueCPUMappings(mappings map[string]string, prefix string) string {
17411740
}
17421741

17431742
if len(queueMappings) == 0 {
1744-
return "N/A"
1743+
return ""
17451744
}
17461745
return strings.Join(queueMappings, " | ")
17471746
}
17481747

1749-
func networkIRQMappingTableValues(outputs map[string]script.ScriptOutput) []Field {
1748+
func nicCpuAffinityTableValues(outputs map[string]script.ScriptOutput) []Field {
17501749
nicIRQMappings := nicIRQMappingsFromOutput(outputs)
17511750
if len(nicIRQMappings) == 0 {
17521751
return []Field{}
@@ -1772,6 +1771,7 @@ func networkConfigTableValues(outputs map[string]script.ScriptOutput) []Field {
17721771
{Name: "net.core.netdev_max_backlog"},
17731772
{Name: "net.ipv4.tcp_max_syn_backlog"},
17741773
{Name: "net.core.somaxconn"},
1774+
{Name: "IRQ Balance"},
17751775
}
17761776
// load the params into a map so we can easily look them up
17771777
sysctlParams := make(map[string]string)
@@ -1788,13 +1788,14 @@ func networkConfigTableValues(outputs map[string]script.ScriptOutput) []Field {
17881788
}
17891789
}
17901790
// add the values to the fields
1791-
for i := range fields {
1791+
for i := range fields[:len(fields)-1] {
17921792
if val, ok := sysctlParams[fields[i].Name]; ok {
17931793
fields[i].Values = append(fields[i].Values, val)
17941794
} else {
17951795
fields[i].Values = append(fields[i].Values, "")
17961796
}
17971797
}
1798+
fields[len(fields)-1].Values = append(fields[len(fields)-1].Values, strings.TrimSpace(outputs[script.IRQBalanceScriptName].Stdout))
17981799
return fields
17991800
}
18001801

internal/report/table_helpers.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,6 @@ type nicInfo struct {
12541254
MACAddress string
12551255
NUMANode string
12561256
CPUAffinity string
1257-
IRQBalance string
12581257
AdaptiveRX string
12591258
AdaptiveTX string
12601259
RxUsecs string
@@ -1294,7 +1293,6 @@ func parseNicInfo(scriptOutput string) []nicInfo {
12941293
"MAC Address: ": &nic.MACAddress,
12951294
"NUMA Node: ": &nic.NUMANode,
12961295
"CPU Affinity: ": &nic.CPUAffinity,
1297-
"IRQ Balance: ": &nic.IRQBalance,
12981296
"rx-usecs: ": &nic.RxUsecs,
12991297
"tx-usecs: ": &nic.TxUsecs,
13001298
"MTU: ": &nic.MTU,

internal/report/table_helpers_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,6 @@ func TestParseNicInfo(t *testing.T) {
654654
if first.CPUAffinity == "" {
655655
t.Errorf("expected non-empty CPUAffinity")
656656
}
657-
if first.IRQBalance != "Disabled" {
658-
t.Errorf("expected IRQBalance 'Disabled', got '%s'", first.IRQBalance)
659-
}
660657
if first.AdaptiveRX != "off" {
661658
t.Errorf("expected AdaptiveRX 'off', got '%s'", first.AdaptiveRX)
662659
}

internal/script/script_defs.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const (
8383
TransparentHugePagesScriptName = "transparent huge pages"
8484
NumaBalancingScriptName = "numa balancing"
8585
NicInfoScriptName = "nic info"
86+
IRQBalanceScriptName = "irq balance"
8687
DiskInfoScriptName = "disk info"
8788
HdparmScriptName = "hdparm"
8889
DfScriptName = "df"
@@ -779,7 +780,6 @@ rdmsr 0x2FFE
779780
printf "%s:%s;" "$int" "$cpu"
780781
done
781782
printf "\n"
782-
echo "IRQ Balance: $(pgrep irqbalance >/dev/null 2>&1 && echo "Enabled" || echo "Disabled")"
783783
echo "TX Queues: $(ls -d /sys/class/net/"$ifc"/queues/tx-* | wc -l)"
784784
echo "RX Queues: $(ls -d /sys/class/net/"$ifc"/queues/rx-* | wc -l)"
785785
for q in /sys/class/net/"$ifc"/queues/tx-*; do
@@ -798,6 +798,10 @@ done
798798
Depends: []string{"ethtool"},
799799
Superuser: true,
800800
},
801+
IRQBalanceScriptName: {
802+
Name: IRQBalanceScriptName,
803+
ScriptTemplate: "pgrep irqbalance >/dev/null 2>&1 && echo 'Enabled' || echo 'Disabled'",
804+
},
801805
DiskInfoScriptName: {
802806
Name: DiskInfoScriptName,
803807
ScriptTemplate: `echo "NAME|MODEL|SIZE|MOUNTPOINT|FSTYPE|RQ-SIZE|MIN-IO|FIRMWARE|ADDR|NUMA|LINKSPEED|LINKWIDTH|MAXLINKSPEED|MAXLINKWIDTH"

0 commit comments

Comments
 (0)