Commit 9382a506 authored by David S. Miller's avatar David S. Miller

Merge branch 'sch_api-style'

Alexander Aring says:

====================
net: sched: sch_api: fix coding style issues for extack

this patch prepares to handle extack for qdiscs and fixes checkpatch
issues.

There are a bunch of warnings issued by checkpatch which bothered me.
This first patchset is to get rid of those warnings to make way for
the next patchsets.

I plan to followup with qdiscs, classifiers and actions after this.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 045203e9 54160ef6
...@@ -161,7 +161,8 @@ struct Qdisc_class_ops { ...@@ -161,7 +161,8 @@ struct Qdisc_class_ops {
void (*walk)(struct Qdisc *, struct qdisc_walker * arg); void (*walk)(struct Qdisc *, struct qdisc_walker * arg);
/* Filter manipulation */ /* Filter manipulation */
struct tcf_block * (*tcf_block)(struct Qdisc *, unsigned long); struct tcf_block * (*tcf_block)(struct Qdisc *sch,
unsigned long arg);
unsigned long (*bind_tcf)(struct Qdisc *, unsigned long, unsigned long (*bind_tcf)(struct Qdisc *, unsigned long,
u32 classid); u32 classid);
void (*unbind_tcf)(struct Qdisc *, unsigned long); void (*unbind_tcf)(struct Qdisc *, unsigned long);
...@@ -185,11 +186,12 @@ struct Qdisc_ops { ...@@ -185,11 +186,12 @@ struct Qdisc_ops {
struct sk_buff * (*dequeue)(struct Qdisc *); struct sk_buff * (*dequeue)(struct Qdisc *);
struct sk_buff * (*peek)(struct Qdisc *); struct sk_buff * (*peek)(struct Qdisc *);
int (*init)(struct Qdisc *, struct nlattr *arg); int (*init)(struct Qdisc *sch, struct nlattr *arg);
void (*reset)(struct Qdisc *); void (*reset)(struct Qdisc *);
void (*destroy)(struct Qdisc *); void (*destroy)(struct Qdisc *);
int (*change)(struct Qdisc *, struct nlattr *arg); int (*change)(struct Qdisc *sch,
void (*attach)(struct Qdisc *); struct nlattr *arg);
void (*attach)(struct Qdisc *sch);
int (*dump)(struct Qdisc *, struct sk_buff *); int (*dump)(struct Qdisc *, struct sk_buff *);
int (*dump_stats)(struct Qdisc *, struct gnet_dump *); int (*dump_stats)(struct Qdisc *, struct gnet_dump *);
......
...@@ -1020,7 +1020,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev, ...@@ -1020,7 +1020,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
#endif #endif
err = -ENOENT; err = -ENOENT;
if (ops == NULL) if (!ops)
goto err_out; goto err_out;
sch = qdisc_alloc(dev_queue, ops); sch = qdisc_alloc(dev_queue, ops);
...@@ -1060,7 +1060,12 @@ static struct Qdisc *qdisc_create(struct net_device *dev, ...@@ -1060,7 +1060,12 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
netdev_info(dev, "Caught tx_queue_len zero misconfig\n"); netdev_info(dev, "Caught tx_queue_len zero misconfig\n");
} }
if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) { if (ops->init) {
err = ops->init(sch, tca[TCA_OPTIONS]);
if (err != 0)
goto err_out5;
}
if (qdisc_is_percpu_stats(sch)) { if (qdisc_is_percpu_stats(sch)) {
sch->cpu_bstats = sch->cpu_bstats =
netdev_alloc_pcpu_stats(struct gnet_stats_basic_cpu); netdev_alloc_pcpu_stats(struct gnet_stats_basic_cpu);
...@@ -1087,7 +1092,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev, ...@@ -1087,7 +1092,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
if (sch->flags & TCQ_F_MQROOT) if (sch->flags & TCQ_F_MQROOT)
goto err_out4; goto err_out4;
if ((sch->parent != TC_H_ROOT) && if (sch->parent != TC_H_ROOT &&
!(sch->flags & TCQ_F_INGRESS) && !(sch->flags & TCQ_F_INGRESS) &&
(!p || !(p->flags & TCQ_F_MQROOT))) (!p || !(p->flags & TCQ_F_MQROOT)))
running = qdisc_root_sleeping_running(sch); running = qdisc_root_sleeping_running(sch);
...@@ -1107,7 +1112,8 @@ static struct Qdisc *qdisc_create(struct net_device *dev, ...@@ -1107,7 +1112,8 @@ static struct Qdisc *qdisc_create(struct net_device *dev,
qdisc_hash_add(sch, false); qdisc_hash_add(sch, false);
return sch; return sch;
}
err_out5:
/* ops->init() failed, we call ->destroy() like qdisc_create_dflt() */ /* ops->init() failed, we call ->destroy() like qdisc_create_dflt() */
if (ops->destroy) if (ops->destroy)
ops->destroy(sch); ops->destroy(sch);
...@@ -1139,7 +1145,7 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca) ...@@ -1139,7 +1145,7 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca)
int err = 0; int err = 0;
if (tca[TCA_OPTIONS]) { if (tca[TCA_OPTIONS]) {
if (sch->ops->change == NULL) if (!sch->ops->change)
return -EINVAL; return -EINVAL;
err = sch->ops->change(sch, tca[TCA_OPTIONS]); err = sch->ops->change(sch, tca[TCA_OPTIONS]);
if (err) if (err)
...@@ -1344,7 +1350,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, ...@@ -1344,7 +1350,8 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
goto create_n_graft; goto create_n_graft;
if (n->nlmsg_flags & NLM_F_EXCL) if (n->nlmsg_flags & NLM_F_EXCL)
return -EEXIST; return -EEXIST;
if (tca[TCA_KIND] && nla_strcmp(tca[TCA_KIND], q->ops->id)) if (tca[TCA_KIND] &&
nla_strcmp(tca[TCA_KIND], q->ops->id))
return -EINVAL; return -EINVAL;
if (q == p || if (q == p ||
(p && check_loop(q, p, 0))) (p && check_loop(q, p, 0)))
...@@ -1389,7 +1396,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, ...@@ -1389,7 +1396,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n,
} }
/* Change qdisc parameters */ /* Change qdisc parameters */
if (q == NULL) if (!q)
return -ENOENT; return -ENOENT;
if (n->nlmsg_flags & NLM_F_EXCL) if (n->nlmsg_flags & NLM_F_EXCL)
return -EEXIST; return -EEXIST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment