Skip to contentSkip to conversation

pkt_sched: sch_sfq: Add dummy unbind_tcf and put handles. Was: [PATCH] sfq: add dummy bind/unbind handles

PATCH Applied Jarek Poplawski 2 participants 2 messages Aug 9, 2010 – Aug 10, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pkt_sched: sch_sfq: Add dummy unbind_tcf and put handles. Was: [PATCH] sfq: add dummy bind/unbind handles

Franchoze Eric wrote, On 08/09/2010 05:01 PM:

Quoted 4 lines

08.08.10, 11:04, "Jarek Poplawski" <[email protected]>:

Quoted 1 line

David Miller wrote, On 08.08.2010 07:45:

...

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

Agreed, I can't see a way that unbind can ever be invoked if the bind call always returns zero.

To tell the truth, I think unbind should be implemented anyway, just for consistency, safety, and easier verification. But, looking at a similar case of .get and .put in the same driver, Patrick seemed to do it purposely, so I expected some discussion about the rules yet, and made it minimal to ease merging to older kernels.

...

Quoted 2 lines

As for me it's better to add unbind now that get unexpected null derefance in future with API changing...

Here is my proposal which adds both unbind and put, plus some early verification (the next patch). Of course, there is still Stephen's alternative with later checks.

Jarek P.
----------------->
Add dummy .unbind_tcf and .put qdisc class ops for easier verification. (All other schedulers have it like this.)

---

net/sched/sch_sfq.c +6 -0
index 534f332..d8e0ae5 100644
@@ -519,6 +519,10 @@ static unsigned long sfq_bind(struct Qdisc *sch, unsigned long parent,
 	return 0;
 }
 
+static void sfq_put(struct Qdisc *q, unsigned long cl)
+{
+}
+
 static struct tcf_proto **sfq_find_tcf(struct Qdisc *sch, unsigned long cl)
 {
 	struct sfq_sched_data *q = qdisc_priv(sch);
@@ -572,8 +576,10 @@ static void sfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 
 static const struct Qdisc_class_ops sfq_class_ops = {
 	.get		=	sfq_get,
+	.put		=	sfq_put,
 	.tcf_chain	=	sfq_find_tcf,
 	.bind_tcf	=	sfq_bind,
+	.unbind_tcf	=	sfq_put,
 	.dump		=	sfq_dump_class,
 	.dump_stats	=	sfq_dump_class_stats,
 	.walk		=	sfq_walk,