diff options
author | Joel Stanley <joel@jms.id.au> | 2019-12-12 01:32:01 +0300 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2019-12-12 01:32:06 +0300 |
commit | fdc60468f3e452364d432f1a7c3f83d58bba1b84 (patch) | |
tree | de7197f150958ae72cb87b6cf4885610f3edd704 /net/sched/sch_taprio.c | |
parent | 20572eecd7248b66d855a8e4812debd9f828ccba (diff) | |
parent | 8539dfa4fcbcf58c3c2f92ac57b964add884d12b (diff) | |
download | linux-dev-5.3.tar.xz |
Merge tag 'v5.3.15' into dev-5.3dev-5.3
This is the 5.3.15 stable release
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'net/sched/sch_taprio.c')
-rw-r--r-- | net/sched/sch_taprio.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 76bebe516194..92c0766d7f4f 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -842,7 +842,7 @@ static int taprio_parse_mqprio_opt(struct net_device *dev, } /* Verify priority mapping uses valid tcs */ - for (i = 0; i < TC_BITMASK + 1; i++) { + for (i = 0; i <= TC_BITMASK; i++) { if (qopt->prio_tc_map[i] >= qopt->num_tc) { NL_SET_ERR_MSG(extack, "Invalid traffic class in priority to traffic class mapping"); return -EINVAL; @@ -1014,6 +1014,26 @@ static void setup_txtime(struct taprio_sched *q, } } +static int taprio_mqprio_cmp(const struct net_device *dev, + const struct tc_mqprio_qopt *mqprio) +{ + int i; + + if (!mqprio || mqprio->num_tc != dev->num_tc) + return -1; + + for (i = 0; i < mqprio->num_tc; i++) + if (dev->tc_to_txq[i].count != mqprio->count[i] || + dev->tc_to_txq[i].offset != mqprio->offset[i]) + return -1; + + for (i = 0; i <= TC_BITMASK; i++) + if (dev->prio_tc_map[i] != mqprio->prio_tc_map[i]) + return -1; + + return 0; +} + static int taprio_change(struct Qdisc *sch, struct nlattr *opt, struct netlink_ext_ack *extack) { @@ -1065,6 +1085,10 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, admin = rcu_dereference(q->admin_sched); rcu_read_unlock(); + /* no changes - no new mqprio settings */ + if (!taprio_mqprio_cmp(dev, mqprio)) + mqprio = NULL; + if (mqprio && (oper || admin)) { NL_SET_ERR_MSG(extack, "Changing the traffic mapping of a running schedule is not supported"); err = -ENOTSUPP; @@ -1132,7 +1156,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, mqprio->offset[i]); /* Always use supplied priority mappings */ - for (i = 0; i < TC_BITMASK + 1; i++) + for (i = 0; i <= TC_BITMASK; i++) netdev_set_prio_tc_map(dev, i, mqprio->prio_tc_map[i]); } |