Commit 80f0f574 authored by Roman Mashak's avatar Roman Mashak Committed by David S. Miller

net sched actions: fix coding style in pedit action

Fix coding style issues in tc pedit action detected by the
checkpatch script.
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarRoman Mashak <mrv@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a9fe5c3
...@@ -136,15 +136,15 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, ...@@ -136,15 +136,15 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
{ {
struct tc_action_net *tn = net_generic(net, pedit_net_id); struct tc_action_net *tn = net_generic(net, pedit_net_id);
struct nlattr *tb[TCA_PEDIT_MAX + 1]; struct nlattr *tb[TCA_PEDIT_MAX + 1];
struct nlattr *pattr;
struct tc_pedit *parm;
int ret = 0, err;
struct tcf_pedit *p;
struct tc_pedit_key *keys = NULL; struct tc_pedit_key *keys = NULL;
struct tcf_pedit_key_ex *keys_ex; struct tcf_pedit_key_ex *keys_ex;
struct tc_pedit *parm;
struct nlattr *pattr;
struct tcf_pedit *p;
int ret = 0, err;
int ksize; int ksize;
if (nla == NULL) if (!nla)
return -EINVAL; return -EINVAL;
err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL); err = nla_parse_nested(tb, TCA_PEDIT_MAX, nla, pedit_policy, NULL);
...@@ -175,7 +175,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, ...@@ -175,7 +175,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
return ret; return ret;
p = to_pedit(*a); p = to_pedit(*a);
keys = kmalloc(ksize, GFP_KERNEL); keys = kmalloc(ksize, GFP_KERNEL);
if (keys == NULL) { if (!keys) {
tcf_idr_release(*a, bind); tcf_idr_release(*a, bind);
kfree(keys_ex); kfree(keys_ex);
return -ENOMEM; return -ENOMEM;
...@@ -220,6 +220,7 @@ static void tcf_pedit_cleanup(struct tc_action *a) ...@@ -220,6 +220,7 @@ static void tcf_pedit_cleanup(struct tc_action *a)
{ {
struct tcf_pedit *p = to_pedit(a); struct tcf_pedit *p = to_pedit(a);
struct tc_pedit_key *keys = p->tcfp_keys; struct tc_pedit_key *keys = p->tcfp_keys;
kfree(keys); kfree(keys);
kfree(p->tcfp_keys_ex); kfree(p->tcfp_keys_ex);
} }
...@@ -284,7 +285,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, ...@@ -284,7 +285,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
if (p->tcfp_nkeys > 0) { if (p->tcfp_nkeys > 0) {
struct tc_pedit_key *tkey = p->tcfp_keys; struct tc_pedit_key *tkey = p->tcfp_keys;
struct tcf_pedit_key_ex *tkey_ex = p->tcfp_keys_ex; struct tcf_pedit_key_ex *tkey_ex = p->tcfp_keys_ex;
enum pedit_header_type htype = TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK; enum pedit_header_type htype =
TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET; enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
for (i = p->tcfp_nkeys; i > 0; i--, tkey++) { for (i = p->tcfp_nkeys; i > 0; i--, tkey++) {
...@@ -316,16 +318,15 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, ...@@ -316,16 +318,15 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
hoffset + tkey->at); hoffset + tkey->at);
goto bad; goto bad;
} }
d = skb_header_pointer(skb, hoffset + tkey->at, 1, d = skb_header_pointer(skb, hoffset + tkey->at,
&_d); 1, &_d);
if (!d) if (!d)
goto bad; goto bad;
offset += (*d & tkey->offmask) >> tkey->shift; offset += (*d & tkey->offmask) >> tkey->shift;
} }
if (offset % 4) { if (offset % 4) {
pr_info("tc filter pedit" pr_info("tc filter pedit offset must be on 32 bit boundaries\n");
" offset must be on 32 bit boundaries\n");
goto bad; goto bad;
} }
...@@ -335,7 +336,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, ...@@ -335,7 +336,8 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
goto bad; goto bad;
} }
ptr = skb_header_pointer(skb, hoffset + offset, 4, &_data); ptr = skb_header_pointer(skb, hoffset + offset,
4, &_data);
if (!ptr) if (!ptr)
goto bad; goto bad;
/* just do it, baby */ /* just do it, baby */
...@@ -358,8 +360,9 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a, ...@@ -358,8 +360,9 @@ static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
} }
goto done; goto done;
} else } else {
WARN(1, "pedit BUG: index %d\n", p->tcf_index); WARN(1, "pedit BUG: index %d\n", p->tcf_index);
}
bad: bad:
p->tcf_qstats.overlimits++; p->tcf_qstats.overlimits++;
......
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