aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_dsmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_dsmark.c')
-rw-r--r--net/sched/sch_dsmark.c79
1 files changed, 40 insertions, 39 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index ad30b7b4769f..40e06a6890da 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -147,7 +147,7 @@ static int dsmark_delete(struct Qdisc *sch, unsigned long arg)
147 return 0; 147 return 0;
148} 148}
149 149
150static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker) 150static void dsmark_walk(struct Qdisc *sch, struct qdisc_walker *walker)
151{ 151{
152 struct dsmark_qdisc_data *p = qdisc_priv(sch); 152 struct dsmark_qdisc_data *p = qdisc_priv(sch);
153 int i; 153 int i;
@@ -171,7 +171,8 @@ ignore:
171 } 171 }
172} 172}
173 173
174static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl) 174static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,
175 unsigned long cl)
175{ 176{
176 struct dsmark_qdisc_data *p = qdisc_priv(sch); 177 struct dsmark_qdisc_data *p = qdisc_priv(sch);
177 return &p->filter_list; 178 return &p->filter_list;
@@ -179,7 +180,7 @@ static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long
179 180
180/* --------------------------- Qdisc operations ---------------------------- */ 181/* --------------------------- Qdisc operations ---------------------------- */
181 182
182static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) 183static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
183{ 184{
184 struct dsmark_qdisc_data *p = qdisc_priv(sch); 185 struct dsmark_qdisc_data *p = qdisc_priv(sch);
185 int err; 186 int err;
@@ -188,24 +189,24 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
188 189
189 if (p->set_tc_index) { 190 if (p->set_tc_index) {
190 switch (skb->protocol) { 191 switch (skb->protocol) {
191 case __constant_htons(ETH_P_IP): 192 case __constant_htons(ETH_P_IP):
192 if (skb_cow_head(skb, sizeof(struct iphdr))) 193 if (skb_cow_head(skb, sizeof(struct iphdr)))
193 goto drop; 194 goto drop;
194 195
195 skb->tc_index = ipv4_get_dsfield(ip_hdr(skb)) 196 skb->tc_index = ipv4_get_dsfield(ip_hdr(skb))
196 & ~INET_ECN_MASK; 197 & ~INET_ECN_MASK;
197 break; 198 break;
198 199
199 case __constant_htons(ETH_P_IPV6): 200 case __constant_htons(ETH_P_IPV6):
200 if (skb_cow_head(skb, sizeof(struct ipv6hdr))) 201 if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
201 goto drop; 202 goto drop;
202 203
203 skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb)) 204 skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
204 & ~INET_ECN_MASK; 205 & ~INET_ECN_MASK;
205 break; 206 break;
206 default: 207 default:
207 skb->tc_index = 0; 208 skb->tc_index = 0;
208 break; 209 break;
209 } 210 }
210 } 211 }
211 212
@@ -238,7 +239,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
238 } 239 }
239 } 240 }
240 241
241 err = p->q->enqueue(skb,p->q); 242 err = p->q->enqueue(skb, p->q);
242 if (err != NET_XMIT_SUCCESS) { 243 if (err != NET_XMIT_SUCCESS) {
243 sch->qstats.drops++; 244 sch->qstats.drops++;
244 return err; 245 return err;
@@ -274,31 +275,31 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
274 pr_debug("index %d->%d\n", skb->tc_index, index); 275 pr_debug("index %d->%d\n", skb->tc_index, index);
275 276
276 switch (skb->protocol) { 277 switch (skb->protocol) {
277 case __constant_htons(ETH_P_IP): 278 case __constant_htons(ETH_P_IP):
278 ipv4_change_dsfield(ip_hdr(skb), p->mask[index], 279 ipv4_change_dsfield(ip_hdr(skb), p->mask[index],
279 p->value[index]); 280 p->value[index]);
280 break; 281 break;
281 case __constant_htons(ETH_P_IPV6): 282 case __constant_htons(ETH_P_IPV6):
282 ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index], 283 ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index],
283 p->value[index]); 284 p->value[index]);
284 break;
285 default:
286 /*
287 * Only complain if a change was actually attempted.
288 * This way, we can send non-IP traffic through dsmark
289 * and don't need yet another qdisc as a bypass.
290 */
291 if (p->mask[index] != 0xff || p->value[index])
292 printk(KERN_WARNING "dsmark_dequeue: "
293 "unsupported protocol %d\n",
294 ntohs(skb->protocol));
295 break; 285 break;
286 default:
287 /*
288 * Only complain if a change was actually attempted.
289 * This way, we can send non-IP traffic through dsmark
290 * and don't need yet another qdisc as a bypass.
291 */
292 if (p->mask[index] != 0xff || p->value[index])
293 printk(KERN_WARNING
294 "dsmark_dequeue: unsupported protocol %d\n",
295 ntohs(skb->protocol));
296 break;
296 } 297 }
297 298
298 return skb; 299 return skb;
299} 300}
300 301
301static int dsmark_requeue(struct sk_buff *skb,struct Qdisc *sch) 302static int dsmark_requeue(struct sk_buff *skb, struct Qdisc *sch)
302{ 303{
303 struct dsmark_qdisc_data *p = qdisc_priv(sch); 304 struct dsmark_qdisc_data *p = qdisc_priv(sch);
304 int err; 305 int err;
@@ -419,8 +420,8 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
419 tcm->tcm_info = p->q->handle; 420 tcm->tcm_info = p->q->handle;
420 421
421 opts = RTA_NEST(skb, TCA_OPTIONS); 422 opts = RTA_NEST(skb, TCA_OPTIONS);
422 RTA_PUT_U8(skb,TCA_DSMARK_MASK, p->mask[cl-1]); 423 RTA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl-1]);
423 RTA_PUT_U8(skb,TCA_DSMARK_VALUE, p->value[cl-1]); 424 RTA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl-1]);
424 425
425 return RTA_NEST_END(skb, opts); 426 return RTA_NEST_END(skb, opts);
426 427