From 02dcd3365097d448c28205051618b62f8e1b0b3f Mon Sep 17 00:00:00 2001 From: Max Rottenkolber Date: Mon, 5 Sep 2022 14:51:58 +0200 Subject: [PATCH] ipfix probe_ptree: device queue stats for rss groups --- src/lib/ptree/support/snabb-snabbflow-v1.lua | 21 +++++++++++++++++++- src/lib/yang/snabb-snabbflow-v1.yang | 20 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/lib/ptree/support/snabb-snabbflow-v1.lua b/src/lib/ptree/support/snabb-snabbflow-v1.lua index bd3fc3cc62..6558a5849e 100644 --- a/src/lib/ptree/support/snabb-snabbflow-v1.lua +++ b/src/lib/ptree/support/snabb-snabbflow-v1.lua @@ -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 @@ -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 @@ -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 diff --git a/src/lib/yang/snabb-snabbflow-v1.yang b/src/lib/yang/snabb-snabbflow-v1.yang index 349d1a318a..6262b22ff8 100644 --- a/src/lib/yang/snabb-snabbflow-v1.yang +++ b/src/lib/yang/snabb-snabbflow-v1.yang @@ -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."; } @@ -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