Message ID | 20170516172802.1317-6-jiri@resnulli.us |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@resnulli.us> wrote: > From: Jiri Pirko <jiri@mellanox.com> > > Call the helper from the function rather than to always adjust the > return value of the function. And rename the function name to reflect this change?
Tue, May 16, 2017 at 11:01:52PM CEST, xiyou.wangcong@gmail.com wrote: >On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@resnulli.us> wrote: >> From: Jiri Pirko <jiri@mellanox.com> >> >> Call the helper from the function rather than to always adjust the >> return value of the function. > >And rename the function name to reflect this change? ? What do you suggest?
On Tue, May 16, 2017 at 2:03 PM, Jiri Pirko <jiri@resnulli.us> wrote: > Tue, May 16, 2017 at 11:01:52PM CEST, xiyou.wangcong@gmail.com wrote: >>On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@resnulli.us> wrote: >>> From: Jiri Pirko <jiri@mellanox.com> >>> >>> Call the helper from the function rather than to always adjust the >>> return value of the function. >> >>And rename the function name to reflect this change? > > ? What do you suggest? tcf_auto_major_prio()?
Wed, May 17, 2017 at 12:38:08AM CEST, xiyou.wangcong@gmail.com wrote: >On Tue, May 16, 2017 at 2:03 PM, Jiri Pirko <jiri@resnulli.us> wrote: >> Tue, May 16, 2017 at 11:01:52PM CEST, xiyou.wangcong@gmail.com wrote: >>>On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@resnulli.us> wrote: >>>> From: Jiri Pirko <jiri@mellanox.com> >>>> >>>> Call the helper from the function rather than to always adjust the >>>> return value of the function. >>> >>>And rename the function name to reflect this change? >> >> ? What do you suggest? > >tcf_auto_major_prio()? That makes no sense. prio is passed from user in upper 2 bytes (god knows why but that is how it is). The helper returns prio, that's it. Nothing major about it...
On 17-05-17 01:47 AM, Jiri Pirko wrote: > Wed, May 17, 2017 at 12:38:08AM CEST, xiyou.wangcong@gmail.com wrote: [..] >> >> tcf_auto_major_prio()? > > That makes no sense. prio is passed from user in upper 2 bytes (god > knows why but that is how it is). I am not sure it is any god's decision ;-> Unless you think the creator of this semantic is a god which in some circles is blasphemy ;-> 16 bits for prio: 16 bits for proto - what is the problem? cheers, jamal
Wed, May 17, 2017 at 02:47:47PM CEST, jhs@mojatatu.com wrote: >On 17-05-17 01:47 AM, Jiri Pirko wrote: >> Wed, May 17, 2017 at 12:38:08AM CEST, xiyou.wangcong@gmail.com wrote: > >[..] >> > >> > tcf_auto_major_prio()? >> >> That makes no sense. prio is passed from user in upper 2 bytes (god >> knows why but that is how it is). > >I am not sure it is any god's decision ;-> Unless you think the creator >of this semantic is a god which in some circles is blasphemy ;-> > >16 bits for prio: 16 bits for proto - what is the problem? Should have been a struct, at least. But as you know, I always prefer a Netlink attr :)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0e49e6e..72624fa 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -125,7 +125,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) if (tp) first = tp->prio - 1; - return first; + return TC_H_MAJ(first); } static struct tcf_proto *tcf_proto_create(const char *kind, u32 protocol, @@ -405,7 +405,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, } if (prio_allocate) - prio = TC_H_MAJ(tcf_auto_prio(rtnl_dereference(*back))); + prio = tcf_auto_prio(rtnl_dereference(*back)); tp = tcf_proto_create(nla_data(tca[TCA_KIND]), protocol, prio, parent, q, block);