Commit 0a267878 authored by Adam Wujek's avatar Adam Wujek 💬

[BUG: 1824] userspace/tools/rtu_stat: print "CPU" if mask containins all ports+CPU

If CPU is included or not in the mask with all ports the rtu_stat shall display
"ALL CPU"

rtu_stat add mask 01:80:c2:00:00:53 0x3ffff 0
rtu_stat add mask 01:80:c2:00:00:57 0x7ffff 0

rtu_stat displayed:
[...]
01:80:c2:00:00:53         ALL           0          STATIC  (hash 014:0)   -
01:80:c2:00:00:57         ALL           0          STATIC  (hash 090:0)   -
[...]

now:
[...]
01:80:c2:00:00:53         ALL           0          STATIC  (hash 014:0)   -
01:80:c2:00:00:57         ALL CPU       0          STATIC  (hash 090:0)   -
[...]
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent f438872f
......@@ -110,19 +110,19 @@ char *decode_ports(int dpm, int nports)
static char str[80],str2[20];
int i;
if ((dpm & ((1<<nports)-1)) == ((1<<nports)-1))
{
strcpy(str,"ALL");
return str;
}
strcpy(str,"");
/* Print "ALL" or list ports from the mask */
if ((dpm & ((1<<nports)-1)) == ((1<<nports)-1)) {
strcpy(str, "ALL ");
} else {
strcpy(str, "");
for (i = 0; i < nports; i++)
{
sprintf(str2, "%d ", i + 1);
if(dpm&(1<<i)) strcat(str,str2);
for (i = 0; i < nports; i++) {
sprintf(str2, "%d ", i + 1);
if (dpm & (1<<i)) strcat(str,str2);
}
}
/* print CPU if it is in the mask */
if (dpm & (1<<nports))
strcat(str, "CPU");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment