[qca-nss-qdisc] Change qdiscs to use common message types
Certain qdiscs (like tbl, prio) use per sub-type messages which
makes it harder to abstract and also they serve no real purpose.
These have been modified to use the common shaper messages which
was introduced later.
Change-Id: I83c48f239ec6429693781736d8a89505d8ade55d
Signed-off-by: Sakthi Vignesh Radhakrishnan <sradhakr@codeaurora.org>
diff --git a/nss_qdisc/nss_bf.c b/nss_qdisc/nss_bf.c
index 100ed9c..4e8bb7e 100644
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -141,7 +141,7 @@
* Send node_attach command down to the NSS
*/
if (nss_qdisc_node_attach(&q->nq, &cl->nq, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_BF_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
nss_qdisc_error("Nss attach for class %u failed\n", classid);
nss_qdisc_destroy(&cl->nq);
kfree(cl);
@@ -211,7 +211,7 @@
* Send configure command to the NSS
*/
if (nss_qdisc_configure(&cl->nq, &nim_config,
- NSS_SHAPER_CONFIG_TYPE_BF_GROUP_CHANGE_PARAM) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
nss_qdisc_error("Failed to configure class %u\n", classid);
return -EINVAL;
}
@@ -250,7 +250,7 @@
struct nss_qdisc *nq_child = qdisc_priv(cl->qdisc);
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim,
- NSS_SHAPER_CONFIG_TYPE_BF_GROUP_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Failed to detach child %x from class %x\n",
cl->qdisc->handle, q->nq.qos_tag);
return;
@@ -304,7 +304,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_detach.child_qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, nq_child, &nim,
- NSS_SHAPER_CONFIG_TYPE_BF_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
@@ -357,7 +357,7 @@
nss_qdisc_info("Detaching old: %p\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_old, &nim_detach,
- NSS_SHAPER_CONFIG_TYPE_BF_GROUP_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
}
@@ -371,7 +371,7 @@
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_group_attach.child_qos_tag = nq_new->qos_tag;
if (nss_qdisc_node_attach(&cl->nq, nq_new, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_BF_GROUP_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
return -EINVAL;
}
}
@@ -652,7 +652,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.bf_detach.child_qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim,
- NSS_SHAPER_CONFIG_TYPE_BF_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Node detach failed for qdisc %x class %x\n",
cl->nq.qos_tag, q->nq.qos_tag);
return;
diff --git a/nss_qdisc/nss_blackhole.c b/nss_qdisc/nss_blackhole.c
index 058c54a..a64aca9 100644
--- a/nss_qdisc/nss_blackhole.c
+++ b/nss_qdisc/nss_blackhole.c
@@ -125,7 +125,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.limit = 0;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.drop_mode = NSS_SHAPER_FIFO_DROP_MODE_TAIL;
- if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_FIFO_CHANGE_PARAM) < 0) {
+ if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
nss_qdisc_error("qdisc %x configuration failed\n", sch->handle);
return -EINVAL;
}
diff --git a/nss_qdisc/nss_codel.c b/nss_qdisc/nss_codel.c
index ba3e8c9..f7ce66f 100644
--- a/nss_qdisc/nss_codel.c
+++ b/nss_qdisc/nss_codel.c
@@ -117,7 +117,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.codel_param.cap.mtu);
if (nss_qdisc_configure(&q->nq, &nim,
- NSS_SHAPER_CONFIG_TYPE_CODEL_CHANGE_PARAM) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
return -EINVAL;
}
diff --git a/nss_qdisc/nss_fifo.c b/nss_qdisc/nss_fifo.c
index a18718b..a3f1305 100644
--- a/nss_qdisc/nss_fifo.c
+++ b/nss_qdisc/nss_fifo.c
@@ -179,7 +179,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = nq->qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.limit = q->limit;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.fifo_param.drop_mode = NSS_SHAPER_FIFO_DROP_MODE_TAIL;
- if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_FIFO_CHANGE_PARAM) < 0) {
+ if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
nss_qdisc_error("nss_fifo %p configuration failed\n", sch);
return -EINVAL;
}
diff --git a/nss_qdisc/nss_prio.c b/nss_qdisc/nss_prio.c
index 5be9a35..b89d8ea 100644
--- a/nss_qdisc/nss_prio.c
+++ b/nss_qdisc/nss_prio.c
@@ -107,7 +107,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_detach.priority = i;
if (nss_qdisc_node_detach(&q->nq, nq_child, &nim,
- NSS_SHAPER_CONFIG_TYPE_PRIO_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Failed to detach child in band %d from prio %x\n",
i, q->nq.qos_tag);
return;
@@ -283,7 +283,7 @@
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_detach.priority = band;
if (nss_qdisc_node_detach(&q->nq, nq_old, &nim_detach,
- NSS_SHAPER_CONFIG_TYPE_PRIO_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
}
@@ -295,7 +295,7 @@
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_attach.child_qos_tag = nq_new->qos_tag;
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.prio_attach.priority = band;
if (nss_qdisc_node_attach(&q->nq, nq_new, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_PRIO_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
return -EINVAL;
}
}
diff --git a/nss_qdisc/nss_tbl.c b/nss_qdisc/nss_tbl.c
index 1b46972..cd9e7b3 100644
--- a/nss_qdisc/nss_tbl.c
+++ b/nss_qdisc/nss_tbl.c
@@ -67,7 +67,7 @@
if (q->qdisc != &noop_qdisc) {
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, nq_child, &nim,
- NSS_SHAPER_CONFIG_TYPE_TBL_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Failed to detach child %x from nss_tbl %x\n",
q->qdisc->handle, q->nq.qos_tag);
return;
@@ -153,7 +153,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_param.lap_pir.short_circuit = true;
}
- if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_TBL_CHANGE_PARAM) < 0) {
+ if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
return -EINVAL;
}
@@ -251,7 +251,7 @@
nss_qdisc_info("Detaching old: %p\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, nq_old, &nim_detach,
- NSS_SHAPER_CONFIG_TYPE_TBL_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
}
@@ -261,7 +261,7 @@
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.tbl_attach.child_qos_tag = nq_new->qos_tag;
if (nss_qdisc_node_attach(&q->nq, nq_new, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_TBL_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
return -EINVAL;
}
}
diff --git a/nss_qdisc/nss_wred.c b/nss_qdisc/nss_wred.c
index 7632c04..ac42785 100644
--- a/nss_qdisc/nss_wred.c
+++ b/nss_qdisc/nss_wred.c
@@ -172,7 +172,6 @@
static int nss_wred_change(struct Qdisc *sch, struct nlattr *opt)
{
struct nss_wred_sched_data *q = qdisc_priv(sch);
- struct nss_qdisc *nq = &q->nq;
struct tc_nsswred_qopt *qopt;
struct nss_if_msg nim;
@@ -251,7 +250,7 @@
q->set_default = qopt->set_default;
#if defined(NSS_QDISC_PPE_SUPPORT)
- if (nq->mode == NSS_QDISC_MODE_PPE) {
+ if (q->nq.mode == NSS_QDISC_MODE_PPE) {
if (nss_wred_ppe_change(sch, opt) < 0) {
nss_qdisc_warning("nss_wred %p params validate and save failed\n", sch);
return -EINVAL;
diff --git a/nss_qdisc/nss_wrr.c b/nss_qdisc/nss_wrr.c
index 469c1db..8cbc35f 100644
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -73,7 +73,7 @@
struct nss_qdisc *nq_child = qdisc_priv(cl->qdisc);
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim,
- NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Failed to detach child %x from class %x\n",
cl->qdisc->handle, q->nq.qos_tag);
return;
@@ -184,7 +184,7 @@
* Send node_attach command down to the NSS
*/
if (nss_qdisc_node_attach(&q->nq, &cl->nq, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_WRR_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
nss_qdisc_error("Nss attach for class %u failed\n", classid);
nss_qdisc_destroy(&cl->nq);
return -EINVAL;
@@ -249,7 +249,7 @@
* Send configure command to the NSS
*/
if (nss_qdisc_configure(&cl->nq, &nim_config,
- NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_CHANGE_PARAM) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
nss_qdisc_error("Failed to configure class %x\n", classid);
/*
@@ -293,7 +293,7 @@
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_detach.child_qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim,
- NSS_SHAPER_CONFIG_TYPE_WRR_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
@@ -342,7 +342,7 @@
nss_qdisc_info("Detaching old: %p\n", *old);
nim_detach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
if (nss_qdisc_node_detach(&cl->nq, nq_child, &nim_detach,
- NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_DETACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
return -EINVAL;
}
}
@@ -356,7 +356,7 @@
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = cl->nq.qos_tag;
nim_attach.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_group_attach.child_qos_tag = nq_new->qos_tag;
if (nss_qdisc_node_attach(&cl->nq, nq_new, &nim_attach,
- NSS_SHAPER_CONFIG_TYPE_WRR_GROUP_ATTACH) < 0) {
+ NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_ATTACH) < 0) {
return -EINVAL;
}
}
@@ -539,7 +539,7 @@
/*
* Send configure command to the NSS
*/
- if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_WRR_CHANGE_PARAM) < 0) {
+ if (nss_qdisc_configure(&q->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_CHANGE_PARAM) < 0) {
nss_qdisc_warning("Failed to configure nss_wrr qdisc %x\n", q->nq.qos_tag);
nss_qdisc_destroy(&q->nq);
return -EINVAL;
@@ -637,7 +637,7 @@
*/
nim.msg.shaper_configure.config.msg.shaper_node_config.qos_tag = q->nq.qos_tag;
nim.msg.shaper_configure.config.msg.shaper_node_config.snc.wrr_detach.child_qos_tag = cl->nq.qos_tag;
- if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim, NSS_SHAPER_CONFIG_TYPE_WRR_DETACH) < 0) {
+ if (nss_qdisc_node_detach(&q->nq, &cl->nq, &nim, NSS_SHAPER_CONFIG_TYPE_SHAPER_NODE_DETACH) < 0) {
nss_qdisc_error("Node detach failed for qdisc %x class %x\n",
cl->nq.qos_tag, q->nq.qos_tag);
return;