rk3288:pwm_regulator:slove pwm io set low when power on
[firefly-linux-kernel-4.4.55.git] / net / sched / sch_mqprio.c
index ea17cbed29eff7215c062efe04c32de6bf513596..accec33c454c720eb864bf21a7afc33de5100658 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/skbuff.h>
+#include <linux/module.h>
 #include <net/netlink.h>
 #include <net/pkt_sched.h>
 #include <net/sch_generic.h>
@@ -106,7 +107,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
        if (!netif_is_multiqueue(dev))
                return -EOPNOTSUPP;
 
-       if (nla_len(opt) < sizeof(*qopt))
+       if (!opt || nla_len(opt) < sizeof(*qopt))
                return -EINVAL;
 
        qopt = nla_data(opt);
@@ -131,6 +132,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
                        goto err;
                }
                priv->qdiscs[i] = qdisc;
+               qdisc->flags |= TCQ_F_ONETXQUEUE;
        }
 
        /* If the mqprio options indicate that hardware should own
@@ -204,6 +206,9 @@ static int mqprio_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
 
        *old = dev_graft_qdisc(dev_queue, new);
 
+       if (new)
+               new->flags |= TCQ_F_ONETXQUEUE;
+
        if (dev->flags & IFF_UP)
                dev_activate(dev);
 
@@ -246,7 +251,8 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
                opt.offset[i] = dev->tc_to_txq[i].offset;
        }
 
-       NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+       if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
+               goto nla_put_failure;
 
        return skb->len;
 nla_put_failure: