netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: sched: cls_flower: dump offload count value
@ 2018-09-06 15:37 Vlad Buslov
  2018-09-07  9:11 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Buslov @ 2018-09-06 15:37 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, Vlad Buslov

Change flower in_hw_count type to fixed-size u32 and dump it as
TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared
blocks and re-offload functionality.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 include/net/sch_generic.h    | 2 +-
 include/uapi/linux/pkt_cls.h | 2 ++
 net/sched/cls_flower.c       | 5 ++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a6d00093f35e..d68ac55539a5 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -362,7 +362,7 @@ static inline void tcf_block_offload_dec(struct tcf_block *block, u32 *flags)
 }
 
 static inline void
-tc_cls_offload_cnt_update(struct tcf_block *block, unsigned int *cnt,
+tc_cls_offload_cnt_update(struct tcf_block *block, u32 *cnt,
 			  u32 *flags, bool add)
 {
 	if (add) {
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index be382fb0592d..2824fb7ed1c9 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -483,6 +483,8 @@ enum {
 	TCA_FLOWER_KEY_ENC_OPTS,
 	TCA_FLOWER_KEY_ENC_OPTS_MASK,
 
+	TCA_FLOWER_IN_HW_COUNT,		/* be32 */
+
 	__TCA_FLOWER_MAX,
 };
 
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 6fd9bdd93796..4b8dd37dd4f8 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -98,7 +98,7 @@ struct cls_fl_filter {
 	struct list_head list;
 	u32 handle;
 	u32 flags;
-	unsigned int in_hw_count;
+	u32 in_hw_count;
 	struct rcu_work rwork;
 	struct net_device *hw_dev;
 };
@@ -1880,6 +1880,9 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
 	if (f->flags && nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags))
 		goto nla_put_failure;
 
+	if (nla_put_u32(skb, TCA_FLOWER_IN_HW_COUNT, f->in_hw_count))
+		goto nla_put_failure;
+
 	if (tcf_exts_dump(skb, &f->exts))
 		goto nla_put_failure;
 
-- 
2.7.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sched: cls_flower: dump offload count value
  2018-09-06 15:37 [PATCH net-next] net: sched: cls_flower: dump offload count value Vlad Buslov
@ 2018-09-07  9:11 ` Jakub Kicinski
  2018-09-07  9:28   ` Vlad Buslov
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2018-09-07  9:11 UTC (permalink / raw)
  To: Vlad Buslov; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem

On Thu,  6 Sep 2018 18:37:23 +0300, Vlad Buslov wrote:
> Change flower in_hw_count type to fixed-size u32 and dump it as
> TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared
> blocks and re-offload functionality.
> 
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
> Acked-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/net/sch_generic.h    | 2 +-
>  include/uapi/linux/pkt_cls.h | 2 ++
>  net/sched/cls_flower.c       | 5 ++++-
>  3 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index a6d00093f35e..d68ac55539a5 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -362,7 +362,7 @@ static inline void tcf_block_offload_dec(struct tcf_block *block, u32 *flags)
>  }
>  
>  static inline void
> -tc_cls_offload_cnt_update(struct tcf_block *block, unsigned int *cnt,
> +tc_cls_offload_cnt_update(struct tcf_block *block, u32 *cnt,
>  			  u32 *flags, bool add)
>  {
>  	if (add) {
> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
> index be382fb0592d..2824fb7ed1c9 100644
> --- a/include/uapi/linux/pkt_cls.h
> +++ b/include/uapi/linux/pkt_cls.h
> @@ -483,6 +483,8 @@ enum {
>  	TCA_FLOWER_KEY_ENC_OPTS,
>  	TCA_FLOWER_KEY_ENC_OPTS_MASK,
>  
> +	TCA_FLOWER_IN_HW_COUNT,		/* be32 */

Why be32?

I wish there was a good way to share this attribute between
classifiers :( 

>  	__TCA_FLOWER_MAX,
>  };
>  
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index 6fd9bdd93796..4b8dd37dd4f8 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c
> @@ -98,7 +98,7 @@ struct cls_fl_filter {
>  	struct list_head list;
>  	u32 handle;
>  	u32 flags;
> -	unsigned int in_hw_count;
> +	u32 in_hw_count;
>  	struct rcu_work rwork;
>  	struct net_device *hw_dev;
>  };
> @@ -1880,6 +1880,9 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
>  	if (f->flags && nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags))
>  		goto nla_put_failure;
>  
> +	if (nla_put_u32(skb, TCA_FLOWER_IN_HW_COUNT, f->in_hw_count))
> +		goto nla_put_failure;
> +
>  	if (tcf_exts_dump(skb, &f->exts))
>  		goto nla_put_failure;
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: sched: cls_flower: dump offload count value
  2018-09-07  9:11 ` Jakub Kicinski
@ 2018-09-07  9:28   ` Vlad Buslov
  0 siblings, 0 replies; 3+ messages in thread
From: Vlad Buslov @ 2018-09-07  9:28 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, jhs, xiyou.wangcong, jiri, davem


On Fri 07 Sep 2018 at 09:11, Jakub Kicinski <jakub.kicinski@netronome.com> wrote:
> On Thu,  6 Sep 2018 18:37:23 +0300, Vlad Buslov wrote:
>> Change flower in_hw_count type to fixed-size u32 and dump it as
>> TCA_FLOWER_IN_HW_COUNT. This change is necessary to properly test shared
>> blocks and re-offload functionality.
>> 
>> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
>> Acked-by: Jiri Pirko <jiri@mellanox.com>
>> ---
>>  include/net/sch_generic.h    | 2 +-
>>  include/uapi/linux/pkt_cls.h | 2 ++
>>  net/sched/cls_flower.c       | 5 ++++-
>>  3 files changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
>> index a6d00093f35e..d68ac55539a5 100644
>> --- a/include/net/sch_generic.h
>> +++ b/include/net/sch_generic.h
>> @@ -362,7 +362,7 @@ static inline void tcf_block_offload_dec(struct tcf_block *block, u32 *flags)
>>  }
>>  
>>  static inline void
>> -tc_cls_offload_cnt_update(struct tcf_block *block, unsigned int *cnt,
>> +tc_cls_offload_cnt_update(struct tcf_block *block, u32 *cnt,
>>  			  u32 *flags, bool add)
>>  {
>>  	if (add) {
>> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
>> index be382fb0592d..2824fb7ed1c9 100644
>> --- a/include/uapi/linux/pkt_cls.h
>> +++ b/include/uapi/linux/pkt_cls.h
>> @@ -483,6 +483,8 @@ enum {
>>  	TCA_FLOWER_KEY_ENC_OPTS,
>>  	TCA_FLOWER_KEY_ENC_OPTS_MASK,
>>  
>> +	TCA_FLOWER_IN_HW_COUNT,		/* be32 */
>
> Why be32?

This comment is wrong.
Thanks for catching this.

>
> I wish there was a good way to share this attribute between
> classifiers :( 
>
>>  	__TCA_FLOWER_MAX,
>>  };
>>  
>> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
>> index 6fd9bdd93796..4b8dd37dd4f8 100644
>> --- a/net/sched/cls_flower.c
>> +++ b/net/sched/cls_flower.c
>> @@ -98,7 +98,7 @@ struct cls_fl_filter {
>>  	struct list_head list;
>>  	u32 handle;
>>  	u32 flags;
>> -	unsigned int in_hw_count;
>> +	u32 in_hw_count;
>>  	struct rcu_work rwork;
>>  	struct net_device *hw_dev;
>>  };
>> @@ -1880,6 +1880,9 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
>>  	if (f->flags && nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags))
>>  		goto nla_put_failure;
>>  
>> +	if (nla_put_u32(skb, TCA_FLOWER_IN_HW_COUNT, f->in_hw_count))
>> +		goto nla_put_failure;
>> +
>>  	if (tcf_exts_dump(skb, &f->exts))
>>  		goto nla_put_failure;
>>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-07 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06 15:37 [PATCH net-next] net: sched: cls_flower: dump offload count value Vlad Buslov
2018-09-07  9:11 ` Jakub Kicinski
2018-09-07  9:28   ` Vlad Buslov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).