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

net: sched: constify tcf_proto and tc_action

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric Dumazet and committed by
David S. Miller
dc7f9f6e 95ec3eb4

+39 -35
+3 -3
include/net/act_api.h
··· 72 72 73 73 struct tc_action { 74 74 void *priv; 75 - struct tc_action_ops *ops; 75 + const struct tc_action_ops *ops; 76 76 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ 77 77 __u32 order; 78 78 struct tc_action *next; ··· 86 86 __u32 type; /* TBD to match kind */ 87 87 __u32 capab; /* capabilities includes 4 bit version */ 88 88 struct module *owner; 89 - int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); 89 + int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); 90 90 int (*get_stats)(struct sk_buff *, struct tc_action *); 91 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 92 92 int (*cleanup)(struct tc_action *, int bind); ··· 115 115 extern int tcf_register_action(struct tc_action_ops *a); 116 116 extern int tcf_unregister_action(struct tc_action_ops *a); 117 117 extern void tcf_action_destroy(struct tc_action *a, int bind); 118 - extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); 118 + extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res); 119 119 extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 120 120 extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 121 121 extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
+2 -2
include/net/pkt_sched.h
··· 99 99 __qdisc_run(q); 100 100 } 101 101 102 - extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, 102 + extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, 103 103 struct tcf_result *res); 104 - extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 104 + extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp, 105 105 struct tcf_result *res); 106 106 107 107 /* Calculate maximal size of packet seen by hard_start_xmit
+7 -5
include/net/sch_generic.h
··· 181 181 struct tcf_proto_ops *next; 182 182 char kind[IFNAMSIZ]; 183 183 184 - int (*classify)(struct sk_buff*, struct tcf_proto*, 185 - struct tcf_result *); 184 + int (*classify)(struct sk_buff *, 185 + const struct tcf_proto *, 186 + struct tcf_result *); 186 187 int (*init)(struct tcf_proto*); 187 188 void (*destroy)(struct tcf_proto*); 188 189 ··· 206 205 /* Fast access part */ 207 206 struct tcf_proto *next; 208 207 void *root; 209 - int (*classify)(struct sk_buff*, struct tcf_proto*, 210 - struct tcf_result *); 208 + int (*classify)(struct sk_buff *, 209 + const struct tcf_proto *, 210 + struct tcf_result *); 211 211 __be16 protocol; 212 212 213 213 /* All the rest */ ··· 216 214 u32 classid; 217 215 struct Qdisc *q; 218 216 void *data; 219 - struct tcf_proto_ops *ops; 217 + const struct tcf_proto_ops *ops; 220 218 }; 221 219 222 220 struct qdisc_skb_cb {
+2 -2
net/sched/act_api.c
··· 365 365 } 366 366 #endif 367 367 368 - int tcf_action_exec(struct sk_buff *skb, struct tc_action *act, 368 + int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act, 369 369 struct tcf_result *res) 370 370 { 371 - struct tc_action *a; 371 + const struct tc_action *a; 372 372 int ret = -1; 373 373 374 374 if (skb->tc_verd & TC_NCLS) {
+1 -1
net/sched/act_csum.c
··· 500 500 } 501 501 502 502 static int tcf_csum(struct sk_buff *skb, 503 - struct tc_action *a, struct tcf_result *res) 503 + const struct tc_action *a, struct tcf_result *res) 504 504 { 505 505 struct tcf_csum *p = a->priv; 506 506 int action;
+2 -1
net/sched/act_gact.c
··· 125 125 return 0; 126 126 } 127 127 128 - static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) 128 + static int tcf_gact(struct sk_buff *skb, const struct tc_action *a, 129 + struct tcf_result *res) 129 130 { 130 131 struct tcf_gact *gact = a->priv; 131 132 int action = TC_ACT_SHOT;
+1 -1
net/sched/act_ipt.c
··· 195 195 return tcf_ipt_release(ipt, bind); 196 196 } 197 197 198 - static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, 198 + static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a, 199 199 struct tcf_result *res) 200 200 { 201 201 int ret = 0, result = 0;
+1 -1
net/sched/act_mirred.c
··· 154 154 return 0; 155 155 } 156 156 157 - static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, 157 + static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a, 158 158 struct tcf_result *res) 159 159 { 160 160 struct tcf_mirred *m = a->priv;
+1 -1
net/sched/act_nat.c
··· 102 102 return tcf_hash_release(&p->common, bind, &nat_hash_info); 103 103 } 104 104 105 - static int tcf_nat(struct sk_buff *skb, struct tc_action *a, 105 + static int tcf_nat(struct sk_buff *skb, const struct tc_action *a, 106 106 struct tcf_result *res) 107 107 { 108 108 struct tcf_nat *p = a->priv;
+1 -1
net/sched/act_pedit.c
··· 120 120 return 0; 121 121 } 122 122 123 - static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, 123 + static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, 124 124 struct tcf_result *res) 125 125 { 126 126 struct tcf_pedit *p = a->priv;
+1 -1
net/sched/act_police.c
··· 282 282 return ret; 283 283 } 284 284 285 - static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, 285 + static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a, 286 286 struct tcf_result *res) 287 287 { 288 288 struct tcf_police *police = a->priv;
+2 -1
net/sched/act_simple.c
··· 36 36 }; 37 37 38 38 #define SIMP_MAX_DATA 32 39 - static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) 39 + static int tcf_simp(struct sk_buff *skb, const struct tc_action *a, 40 + struct tcf_result *res) 40 41 { 41 42 struct tcf_defact *d = a->priv; 42 43
+1 -1
net/sched/act_skbedit.c
··· 39 39 .lock = &skbedit_lock, 40 40 }; 41 41 42 - static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a, 42 + static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a, 43 43 struct tcf_result *res) 44 44 { 45 45 struct tcf_skbedit *d = a->priv;
+3 -3
net/sched/cls_api.c
··· 40 40 41 41 /* Find classifier type by string name */ 42 42 43 - static struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind) 43 + static const struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind) 44 44 { 45 - struct tcf_proto_ops *t = NULL; 45 + const struct tcf_proto_ops *t = NULL; 46 46 47 47 if (kind) { 48 48 read_lock(&cls_mod_lock); ··· 132 132 struct Qdisc *q; 133 133 struct tcf_proto **back, **chain; 134 134 struct tcf_proto *tp; 135 - struct tcf_proto_ops *tp_ops; 135 + const struct tcf_proto_ops *tp_ops; 136 136 const struct Qdisc_class_ops *cops; 137 137 unsigned long cl; 138 138 unsigned long fh;
+1 -1
net/sched/cls_basic.c
··· 39 39 .police = TCA_BASIC_POLICE 40 40 }; 41 41 42 - static int basic_classify(struct sk_buff *skb, struct tcf_proto *tp, 42 + static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, 43 43 struct tcf_result *res) 44 44 { 45 45 int r;
+1 -1
net/sched/cls_cgroup.c
··· 101 101 struct tcf_ematch_tree ematches; 102 102 }; 103 103 104 - static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, 104 + static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp, 105 105 struct tcf_result *res) 106 106 { 107 107 struct cls_cgroup_head *head = tp->root;
+1 -1
net/sched/cls_flow.c
··· 356 356 } 357 357 } 358 358 359 - static int flow_classify(struct sk_buff *skb, struct tcf_proto *tp, 359 + static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp, 360 360 struct tcf_result *res) 361 361 { 362 362 struct flow_head *head = tp->root;
+1 -1
net/sched/cls_fw.c
··· 77 77 return handle & (HTSIZE - 1); 78 78 } 79 79 80 - static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp, 80 + static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp, 81 81 struct tcf_result *res) 82 82 { 83 83 struct fw_head *head = (struct fw_head *)tp->root;
+1 -1
net/sched/cls_route.c
··· 125 125 return 0; \ 126 126 } 127 127 128 - static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp, 128 + static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp, 129 129 struct tcf_result *res) 130 130 { 131 131 struct route4_head *head = (struct route4_head *)tp->root;
+1 -1
net/sched/cls_rsvp.h
··· 130 130 return r; \ 131 131 } 132 132 133 - static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp, 133 + static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp, 134 134 struct tcf_result *res) 135 135 { 136 136 struct rsvp_session **sht = ((struct rsvp_head *)tp->root)->ht;
+1 -1
net/sched/cls_tcindex.c
··· 79 79 } 80 80 81 81 82 - static int tcindex_classify(struct sk_buff *skb, struct tcf_proto *tp, 82 + static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp, 83 83 struct tcf_result *res) 84 84 { 85 85 struct tcindex_data *p = PRIV(tp);
+1 -1
net/sched/cls_u32.c
··· 93 93 return h; 94 94 } 95 95 96 - static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) 96 + static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res) 97 97 { 98 98 struct { 99 99 struct tc_u_knode *knode;
+3 -3
net/sched/sch_api.c
··· 1644 1644 * to this qdisc, (optionally) tests for protocol and asks 1645 1645 * specific classifiers. 1646 1646 */ 1647 - int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, 1647 + int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, 1648 1648 struct tcf_result *res) 1649 1649 { 1650 1650 __be16 protocol = skb->protocol; ··· 1668 1668 } 1669 1669 EXPORT_SYMBOL(tc_classify_compat); 1670 1670 1671 - int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 1671 + int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp, 1672 1672 struct tcf_result *res) 1673 1673 { 1674 1674 int err = 0; 1675 1675 #ifdef CONFIG_NET_CLS_ACT 1676 - struct tcf_proto *otp = tp; 1676 + const struct tcf_proto *otp = tp; 1677 1677 reclassify: 1678 1678 #endif 1679 1679