aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/wme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/wme.c')
-rw-r--r--net/mac80211/wme.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 5b8a157975a3..4e236599dd31 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -28,6 +28,7 @@ struct ieee80211_sched_data
28 struct sk_buff_head requeued[TC_80211_MAX_QUEUES]; 28 struct sk_buff_head requeued[TC_80211_MAX_QUEUES];
29}; 29};
30 30
31static const char llc_ip_hdr[8] = {0xAA, 0xAA, 0x3, 0, 0, 0, 0x08, 0};
31 32
32/* given a data frame determine the 802.1p/1d tag to use */ 33/* given a data frame determine the 802.1p/1d tag to use */
33static inline unsigned classify_1d(struct sk_buff *skb, struct Qdisc *qd) 34static inline unsigned classify_1d(struct sk_buff *skb, struct Qdisc *qd)
@@ -54,12 +55,12 @@ static inline unsigned classify_1d(struct sk_buff *skb, struct Qdisc *qd)
54 return skb->priority - 256; 55 return skb->priority - 256;
55 56
56 /* check there is a valid IP header present */ 57 /* check there is a valid IP header present */
57 offset = ieee80211_get_hdrlen_from_skb(skb) + 8 /* LLC + proto */; 58 offset = ieee80211_get_hdrlen_from_skb(skb);
58 if (skb->protocol != __constant_htons(ETH_P_IP) || 59 if (skb->len < offset + sizeof(llc_ip_hdr) + sizeof(*ip) ||
59 skb->len < offset + sizeof(*ip)) 60 memcmp(skb->data + offset, llc_ip_hdr, sizeof(llc_ip_hdr)))
60 return 0; 61 return 0;
61 62
62 ip = (struct iphdr *) (skb->data + offset); 63 ip = (struct iphdr *) (skb->data + offset + sizeof(llc_ip_hdr));
63 64
64 dscp = ip->tos & 0xfc; 65 dscp = ip->tos & 0xfc;
65 if (dscp & 0x1c) 66 if (dscp & 0x1c)
@@ -296,16 +297,16 @@ static void wme_qdiscop_destroy(struct Qdisc* qd)
296 297
297 298
298/* called whenever parameters are updated on existing qdisc */ 299/* called whenever parameters are updated on existing qdisc */
299static int wme_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt) 300static int wme_qdiscop_tune(struct Qdisc *qd, struct nlattr *opt)
300{ 301{
301/* struct ieee80211_sched_data *q = qdisc_priv(qd); 302/* struct ieee80211_sched_data *q = qdisc_priv(qd);
302*/ 303*/
303 /* check our options block is the right size */ 304 /* check our options block is the right size */
304 /* copy any options to our local structure */ 305 /* copy any options to our local structure */
305/* Ignore options block for now - always use static mapping 306/* Ignore options block for now - always use static mapping
306 struct tc_ieee80211_qopt *qopt = RTA_DATA(opt); 307 struct tc_ieee80211_qopt *qopt = nla_data(opt);
307 308
308 if (opt->rta_len < RTA_LENGTH(sizeof(*qopt))) 309 if (opt->nla_len < nla_attr_size(sizeof(*qopt)))
309 return -EINVAL; 310 return -EINVAL;
310 memcpy(q->tag2queue, qopt->tag2queue, sizeof(qopt->tag2queue)); 311 memcpy(q->tag2queue, qopt->tag2queue, sizeof(qopt->tag2queue));
311*/ 312*/
@@ -314,7 +315,7 @@ static int wme_qdiscop_tune(struct Qdisc *qd, struct rtattr *opt)
314 315
315 316
316/* called during initial creation of qdisc on device */ 317/* called during initial creation of qdisc on device */
317static int wme_qdiscop_init(struct Qdisc *qd, struct rtattr *opt) 318static int wme_qdiscop_init(struct Qdisc *qd, struct nlattr *opt)
318{ 319{
319 struct ieee80211_sched_data *q = qdisc_priv(qd); 320 struct ieee80211_sched_data *q = qdisc_priv(qd);
320 struct net_device *dev = qd->dev; 321 struct net_device *dev = qd->dev;
@@ -369,10 +370,10 @@ static int wme_qdiscop_dump(struct Qdisc *qd, struct sk_buff *skb)
369 struct tc_ieee80211_qopt opt; 370 struct tc_ieee80211_qopt opt;
370 371
371 memcpy(&opt.tag2queue, q->tag2queue, TC_80211_MAX_TAG + 1); 372 memcpy(&opt.tag2queue, q->tag2queue, TC_80211_MAX_TAG + 1);
372 RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt); 373 NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
373*/ return skb->len; 374*/ return skb->len;
374/* 375/*
375rtattr_failure: 376nla_put_failure:
376 skb_trim(skb, p - skb->data);*/ 377 skb_trim(skb, p - skb->data);*/
377 return -1; 378 return -1;
378} 379}
@@ -443,7 +444,7 @@ static void wme_classop_put(struct Qdisc *q, unsigned long cl)
443 444
444 445
445static int wme_classop_change(struct Qdisc *qd, u32 handle, u32 parent, 446static int wme_classop_change(struct Qdisc *qd, u32 handle, u32 parent,
446 struct rtattr **tca, unsigned long *arg) 447 struct nlattr **tca, unsigned long *arg)
447{ 448{
448 unsigned long cl = *arg; 449 unsigned long cl = *arg;
449 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr); 450 struct ieee80211_local *local = wdev_priv(qd->dev->ieee80211_ptr);
@@ -527,7 +528,7 @@ static struct tcf_proto ** wme_classop_find_tcf(struct Qdisc *qd,
527 528
528/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached) 529/* this qdisc is classful (i.e. has classes, some of which may have leaf qdiscs attached)
529 * - these are the operations on the classes */ 530 * - these are the operations on the classes */
530static struct Qdisc_class_ops class_ops = 531static const struct Qdisc_class_ops class_ops =
531{ 532{
532 .graft = wme_classop_graft, 533 .graft = wme_classop_graft,
533 .leaf = wme_classop_leaf, 534 .leaf = wme_classop_leaf,
@@ -547,7 +548,7 @@ static struct Qdisc_class_ops class_ops =
547 548
548 549
549/* queueing discipline operations */ 550/* queueing discipline operations */
550static struct Qdisc_ops wme_qdisc_ops = 551static struct Qdisc_ops wme_qdisc_ops __read_mostly =
551{ 552{
552 .next = NULL, 553 .next = NULL,
553 .cl_ops = &class_ops, 554 .cl_ops = &class_ops,