Skip to content
Snippets Groups Projects
Commit e5bdc50b authored by Lwithwma Brahma's avatar Lwithwma Brahma Committed by Markus Gothe
Browse files

qosmngr: do not read stats for disabled queues

-Fix qos ubus call in mixed mode
parent 5985b914
No related branches found
No related tags found
1 merge request!24qosmngr: do not read stats for disabled queues
Pipeline #150434 passed
......@@ -79,11 +79,15 @@ static int get_no_queues(const char *ifname)
uci_foreach_element(&uci_pkg->sections, uci_elmnt) {
struct uci_section *uci_sec = uci_to_section(uci_elmnt);
if (uci_sec && !strcmp(uci_sec->type, "queue")) {
struct uci_element *e = NULL;
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++;
const char *opt_enab;
opt_enab = uci_lookup_option_string(uci_ctx, uci_sec, "enable");
if (opt_enab && !strcmp(opt_enab, "1")) {
struct uci_element *e = NULL;
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
static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void *dd,
char *ifname, int qid)
{
int ret = 0;
int ret = -1;
if (qid >= 0) {
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
int i;
int queues = get_no_queues(ifname);
if (queues <= 0) {
ret = 0;
return ret;
}
for (i = 0; i < queues; i++) {
ret = prepare_stats_blob(b, stats, dd, ifname, i);
if (ret != 0)
return ret;
int pst = prepare_stats_blob(b, stats, dd, ifname, i);
if (pst == 0)
ret = 0;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment