Code Review
/
deb_dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
New upstream version 18.05
[deb_dpdk.git]
/
app
/
proc-info
/
main.c
diff --git
a/app/proc_info/main.c
b/app/proc-info/main.c
similarity index 98%
rename from
app/proc_info/main.c
rename to
app/proc-info/main.c
index
2f53e3c
..
c20effa
100644
(file)
--- a/
app/proc_info/main.c
+++ b/
app/proc-info/main.c
@@
-159,7
+159,7
@@
proc_info_preparse_args(int argc, char **argv)
proc_info_usage(prgname);
return -1;
}
proc_info_usage(prgname);
return -1;
}
- s
trncpy(host_id, argv[i+1], sizeof(host_id)
);
+ s
nprintf(host_id, sizeof(host_id), "%s", argv[i+1]
);
}
}
}
}
@@
-488,14
+488,18
@@
nic_xstats_display(uint16_t port_id)
if (enable_collectd_format) {
char counter_type[MAX_STRING_LEN];
char buf[MAX_STRING_LEN];
if (enable_collectd_format) {
char counter_type[MAX_STRING_LEN];
char buf[MAX_STRING_LEN];
+ size_t n;
collectd_resolve_cnt_type(counter_type,
sizeof(counter_type),
xstats_names[i].name);
collectd_resolve_cnt_type(counter_type,
sizeof(counter_type),
xstats_names[i].name);
- sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
+ n = snprintf(buf, MAX_STRING_LEN,
+ "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
PRIu64"\n", host_id, port_id, counter_type,
xstats_names[i].name, values[i]);
PRIu64"\n", host_id, port_id, counter_type,
xstats_names[i].name, values[i]);
- ret = write(stdout_fd, buf, strlen(buf));
+ if (n > sizeof(buf) - 1)
+ n = sizeof(buf) - 1;
+ ret = write(stdout_fd, buf, n);
if (ret < 0)
goto err;
} else {
if (ret < 0)
goto err;
} else {
@@
-628,7
+632,7
@@
main(int argc, char **argv)
return 0;
}
return 0;
}
- nb_ports = rte_eth_dev_count();
+ nb_ports = rte_eth_dev_count
_avail
();
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
if (nb_ports == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
@@
-636,7
+640,7
@@
main(int argc, char **argv)
if (enabled_port_mask == 0)
enabled_port_mask = 0xffff;
if (enabled_port_mask == 0)
enabled_port_mask = 0xffff;
-
for (i = 0; i < nb_ports; i++
) {
+
RTE_ETH_FOREACH_DEV(i
) {
if (enabled_port_mask & (1 << i)) {
if (enable_stats)
nic_stats_display(i);
if (enabled_port_mask & (1 << i)) {
if (enable_stats)
nic_stats_display(i);