Skip to content

Commit

Permalink
ipfix probe_ptree: device queue stats for rss groups
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Sep 5, 2022
1 parent de3a225 commit 02dcd33
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/lib/ptree/support/snabb-snabbflow-v1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ local function collect_pci_states (pid)
local states = {}
for _, device in ipairs(shm.children("/"..pid.."/pci")) do
local stats = shm.open_frame("/"..pid.."/pci/"..device)
local queue_stats = {}
for name, c in pairs(stats) do
local queue = name:match("^rxdrop_(%d+)$") -- Connect-X
or name:match("^q(%d+)_rxdrops$") -- Intel_mp
if queue then
queue_stats[tonumber(queue)] = {
packets_dropped = counter.read(c)
}
end
end
table.insert(states, {
device = device,
packets_received = counter.read(stats.rxpackets),
packets_dropped = counter.read(stats.rxdrop)
packets_dropped = counter.read(stats.rxdrop),
queue = queue_stats
})
end
return states
Expand Down Expand Up @@ -109,6 +120,13 @@ function collect_rss_states (pid, rss_links)
return states
end

function collect_queue_state (interfaces, rxq)
local queue_state = {}
for device, interface in pairs(interfaces) do
queue_state[device] = interface.queue[rxq]
end
return queue_state
end

local function compute_pid_reader ()
return function (pid) return pid end
Expand Down Expand Up @@ -184,6 +202,7 @@ local function process_states (pids)
state.rss_group[rss_state.id] = {
id = rss_state.id,
pid = rss_state.pid,
queue = collect_queue_state(state.interface, rss_state.id-1),
exporter = {}
}
end
Expand Down
20 changes: 19 additions & 1 deletion src/lib/yang/snabb-snabbflow-v1.yang
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module snabb-snabbflow-v1 {
"Interaces serving as IPFIX Observation Points.";

leaf device {
type string;
type pci-address;
description
"PCI address of the network device.";
}
Expand Down Expand Up @@ -537,6 +537,24 @@ module snabb-snabbflow-v1 {

uses worker-state;

list queue {
key device;
description
"Statistics for the receive queues used by this RSS group.";

leaf device {
type pci-address;
description
"PCI address of the network device.";
}

leaf packets-dropped {
type yang:zero-based-counter64;
description
"Count of incoming packets that were dropped.";
}
}

list exporter {
key name;
description
Expand Down

0 comments on commit 02dcd33

Please sign in to comment.