diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-11-07 20:33:38 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-08 19:19:48 -0500 |
commit | 9da93ece59f4a3e1544dfa2aa53e91f9e724abc6 (patch) | |
tree | e14e23e727ee4b2a9746f8d4480d067713625296 /net/sched/sch_api.c | |
parent | bfaee9113f30abfa1f77ecb5e4a6f53a9d4c690c (diff) |
net: sched: refactor grafting Qdiscs with a parent
The code for grafting Qdiscs when there is a parent has two needless
indentation levels, and breaks the "keep the success path unindented"
guideline. Refactor.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r-- | net/sched/sch_api.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 4b3af41cc1d7..f55bc50cd0a9 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -1007,7 +1007,6 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
1007 | { | 1007 | { |
1008 | struct Qdisc *q = old; | 1008 | struct Qdisc *q = old; |
1009 | struct net *net = dev_net(dev); | 1009 | struct net *net = dev_net(dev); |
1010 | int err = 0; | ||
1011 | 1010 | ||
1012 | if (parent == NULL) { | 1011 | if (parent == NULL) { |
1013 | unsigned int i, num_q, ingress; | 1012 | unsigned int i, num_q, ingress; |
@@ -1062,28 +1061,29 @@ skip: | |||
1062 | dev_activate(dev); | 1061 | dev_activate(dev); |
1063 | } else { | 1062 | } else { |
1064 | const struct Qdisc_class_ops *cops = parent->ops->cl_ops; | 1063 | const struct Qdisc_class_ops *cops = parent->ops->cl_ops; |
1064 | unsigned long cl; | ||
1065 | int err; | ||
1065 | 1066 | ||
1066 | /* Only support running class lockless if parent is lockless */ | 1067 | /* Only support running class lockless if parent is lockless */ |
1067 | if (new && (new->flags & TCQ_F_NOLOCK) && | 1068 | if (new && (new->flags & TCQ_F_NOLOCK) && |
1068 | parent && !(parent->flags & TCQ_F_NOLOCK)) | 1069 | parent && !(parent->flags & TCQ_F_NOLOCK)) |
1069 | new->flags &= ~TCQ_F_NOLOCK; | 1070 | new->flags &= ~TCQ_F_NOLOCK; |
1070 | 1071 | ||
1071 | err = -EOPNOTSUPP; | 1072 | if (!cops || !cops->graft) |
1072 | if (cops && cops->graft) { | 1073 | return -EOPNOTSUPP; |
1073 | unsigned long cl = cops->find(parent, classid); | ||
1074 | 1074 | ||
1075 | if (cl) { | 1075 | cl = cops->find(parent, classid); |
1076 | err = cops->graft(parent, cl, new, &old, | 1076 | if (!cl) { |
1077 | extack); | 1077 | NL_SET_ERR_MSG(extack, "Specified class not found"); |
1078 | } else { | 1078 | return -ENOENT; |
1079 | NL_SET_ERR_MSG(extack, "Specified class not found"); | ||
1080 | err = -ENOENT; | ||
1081 | } | ||
1082 | } | 1079 | } |
1083 | if (!err) | 1080 | |
1084 | notify_and_destroy(net, skb, n, classid, old, new); | 1081 | err = cops->graft(parent, cl, new, &old, extack); |
1082 | if (err) | ||
1083 | return err; | ||
1084 | notify_and_destroy(net, skb, n, classid, old, new); | ||
1085 | } | 1085 | } |
1086 | return err; | 1086 | return 0; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | static int qdisc_block_indexes_set(struct Qdisc *sch, struct nlattr **tca, | 1089 | static int qdisc_block_indexes_set(struct Qdisc *sch, struct nlattr **tca, |