Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: sched: choke: remove dead filter classify code

sch_choke is classless qdisc so it does not define cl_ops. Therefore
filter_list cannot be ever changed, being NULL all the time.
Reason is this check in tc_ctl_tfilter:

/* Is it classful? */
cops = q->ops->cl_ops;
if (!cops)
return -EINVAL;

So remove this dead code.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
5952fde1 270c7759

-51
-51
net/sched/sch_choke.c
··· 58 58 59 59 /* Variables */ 60 60 struct red_vars vars; 61 - struct tcf_proto __rcu *filter_list; 62 61 struct { 63 62 u32 prob_drop; /* Early probability drops */ 64 63 u32 prob_mark; /* Early probability marks */ ··· 151 152 choke_skb_cb(skb)->classid = classid; 152 153 } 153 154 154 - static u16 choke_get_classid(const struct sk_buff *skb) 155 - { 156 - return choke_skb_cb(skb)->classid; 157 - } 158 - 159 155 /* 160 156 * Compare flow of two packets 161 157 * Returns true only if source and destination address and port match. ··· 179 185 return !memcmp(&choke_skb_cb(skb1)->keys, 180 186 &choke_skb_cb(skb2)->keys, 181 187 sizeof(choke_skb_cb(skb1)->keys)); 182 - } 183 - 184 - /* 185 - * Classify flow using either: 186 - * 1. pre-existing classification result in skb 187 - * 2. fast internal classification 188 - * 3. use TC filter based classification 189 - */ 190 - static bool choke_classify(struct sk_buff *skb, 191 - struct Qdisc *sch, int *qerr) 192 - 193 - { 194 - struct choke_sched_data *q = qdisc_priv(sch); 195 - struct tcf_result res; 196 - struct tcf_proto *fl; 197 - int result; 198 - 199 - fl = rcu_dereference_bh(q->filter_list); 200 - result = tc_classify(skb, fl, &res, false); 201 - if (result >= 0) { 202 - #ifdef CONFIG_NET_CLS_ACT 203 - switch (result) { 204 - case TC_ACT_STOLEN: 205 - case TC_ACT_QUEUED: 206 - *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN; 207 - case TC_ACT_SHOT: 208 - return false; 209 - } 210 - #endif 211 - choke_set_classid(skb, TC_H_MIN(res.classid)); 212 - return true; 213 - } 214 - 215 - return false; 216 188 } 217 189 218 190 /* ··· 217 257 return false; 218 258 219 259 oskb = choke_peek_random(q, pidx); 220 - if (rcu_access_pointer(q->filter_list)) 221 - return choke_get_classid(nskb) == choke_get_classid(oskb); 222 - 223 260 return choke_match_flow(oskb, nskb); 224 261 } 225 262 ··· 226 269 int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 227 270 struct choke_sched_data *q = qdisc_priv(sch); 228 271 const struct red_parms *p = &q->parms; 229 - 230 - if (rcu_access_pointer(q->filter_list)) { 231 - /* If using external classifiers, get result and record it. */ 232 - if (!choke_classify(skb, sch, &ret)) 233 - goto other_drop; /* Packet was eaten by filter */ 234 - } 235 272 236 273 choke_skb_cb(skb)->keys_valid = 0; 237 274 /* Compute average queue usage (see RED) */ ··· 291 340 qdisc_drop(skb, sch, to_free); 292 341 return NET_XMIT_CN; 293 342 294 - other_drop: 295 343 if (ret & __NET_XMIT_BYPASS) 296 344 qdisc_qstats_drop(sch); 297 345 __qdisc_drop(skb, to_free); ··· 488 538 { 489 539 struct choke_sched_data *q = qdisc_priv(sch); 490 540 491 - tcf_destroy_chain(&q->filter_list); 492 541 choke_free(q->tab); 493 542 } 494 543