From f6c99a52f7714cae8cd048d758086e213e163571 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 29 May 2013 11:46:29 +0200 Subject: [PATCH] ifpps: support mq devices in /proc/interrupts /proc/interrupts can have such a structure ... 98: 35 0 2902361 PCI-MSI-X eth1-0 106: 61 11 3841 PCI-MSI-X eth1-1 114: 28 0 61452 PCI-MSI-X eth1-2 122: 24 1586 22 PCI-MSI-X eth1-3 130: 2912 0 337 PCI-MSI-X eth1-4 138: 21 0 28 PCI-MSI-X eth1-5 146: 21 0 56 PCI-MSI-X eth1-6 154: 34 1 1 PCI-MSI-X eth1-7 ... and will not count all IRQs for eth1-*. Thus change it to sum up multiple entries. Signed-off-by: Daniel Borkmann --- ifpps.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ifpps.c b/ifpps.c index 448fe01f..5e4b5b0a 100644 --- a/ifpps.c +++ b/ifpps.c @@ -227,6 +227,7 @@ static int stats_proc_interrupts(char *ifname, struct ifstat *stats) { int ret = -EINVAL, i, cpus, try = 0; char *ptr, *buff; + bool seen = false; size_t buff_len; struct ethtool_drvinfo drvinf; FILE *fp; @@ -249,16 +250,20 @@ retry: if (strstr(buff, ifname) == NULL) continue; + /* XXX: remove this one here */ stats->irq_nr = strtol(ptr, &ptr, 10); bug_on(stats->irq_nr == 0); if (ptr) ptr++; for (i = 0; i < cpus && ptr; ++i) { - stats->irqs[i] = strtol(ptr, &ptr, 10); + if (seen) + stats->irqs[i] += strtol(ptr, &ptr, 10); + else + stats->irqs[i] = strtol(ptr, &ptr, 10); if (i == cpus - 1) { ret = 0; - goto done; + seen = true; } } -- 2.11.4.GIT