Skip to content
Snippets Groups Projects

qosmngr: do not read stats for disabled queues

Merged Markus Gothe requested to merge genexis-iowrt/qosmngr:fix-ubus-wrr into devel
All threads resolved!
1 file
+ 18
9
Compare changes
  • Side-by-side
  • Inline
+ 18
9
@@ -79,11 +79,15 @@ static int get_no_queues(const char *ifname)
@@ -79,11 +79,15 @@ static int get_no_queues(const char *ifname)
uci_foreach_element(&uci_pkg->sections, uci_elmnt) {
uci_foreach_element(&uci_pkg->sections, uci_elmnt) {
struct uci_section *uci_sec = uci_to_section(uci_elmnt);
struct uci_section *uci_sec = uci_to_section(uci_elmnt);
if (uci_sec && !strcmp(uci_sec->type, "queue")) {
if (uci_sec && !strcmp(uci_sec->type, "queue")) {
struct uci_element *e = NULL;
const char *opt_enab;
uci_foreach_element(&uci_sec->options, e) {
opt_enab = uci_lookup_option_string(uci_ctx, uci_sec, "enable");
struct uci_option *uci_opn = uci_to_option(e);
if (opt_enab && !strcmp(opt_enab, "1")) {
if (uci_opn && !strcmp(uci_opn->v.string, ifname))
struct uci_element *e = NULL;
queues++;
uci_foreach_element(&uci_sec->options, e) {
 
struct uci_option *uci_opn = uci_to_option(e);
 
if (uci_opn && !strcmp(uci_opn->v.string, ifname))
 
queues++;
 
}
}
}
}
}
}
}
@@ -383,7 +387,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
@@ -383,7 +387,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void
static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void *dd,
static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void *dd,
char *ifname, int qid)
char *ifname, int qid)
{
{
int ret = 0;
int ret = -1;
if (qid >= 0) {
if (qid >= 0) {
ret = prepare_stats_blob(b, stats, dd, ifname, qid);
ret = prepare_stats_blob(b, stats, dd, ifname, qid);
@@ -391,10 +395,15 @@ static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void
@@ -391,10 +395,15 @@ static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void
int i;
int i;
int queues = get_no_queues(ifname);
int queues = get_no_queues(ifname);
 
if (queues <= 0) {
 
ret = 0;
 
return ret;
 
}
 
for (i = 0; i < queues; i++) {
for (i = 0; i < queues; i++) {
ret = prepare_stats_blob(b, stats, dd, ifname, i);
int pst = prepare_stats_blob(b, stats, dd, ifname, i);
if (ret != 0)
if (pst == 0)
return ret;
ret = 0;
}
}
}
}
Loading