summaryrefslogtreecommitdiff
path: root/ifpps.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-05-29 11:46:29 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-05-29 11:46:29 +0200
commitf6c99a52f7714cae8cd048d758086e213e163571 (patch)
treef2a7aeafab321d9d70e1385a773e943431752b74 /ifpps.c
parent2563b4dae8314fb4c155c7b9705e44fd8a936c1a (diff)
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 <dborkman@redhat.com>
Diffstat (limited to 'ifpps.c')
-rw-r--r--ifpps.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ifpps.c b/ifpps.c
index 448fe01..5e4b5b0 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;
}
}