From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH net-next 3/7] net: sched: cls_flower: implement offload tcf_proto_op Date: Mon, 25 Jun 2018 22:48:37 +0200 Message-ID: <20180625204837.GG2161@nanopsycho> References: <20180625043431.13413-1-jakub.kicinski@netronome.com> <20180625043431.13413-4-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, xiyou.wangcong@gmail.com, jhs@mojatatu.com, gerlitz.or@gmail.com, netdev@vger.kernel.org, oss-drivers@netronome.com, John Hurley To: Jakub Kicinski Return-path: Received: from mail-wm0-f67.google.com ([74.125.82.67]:35251 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755695AbeFYUt7 (ORCPT ); Mon, 25 Jun 2018 16:49:59 -0400 Received: by mail-wm0-f67.google.com with SMTP id z137-v6so5715225wmc.0 for ; Mon, 25 Jun 2018 13:49:58 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180625043431.13413-4-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Mon, Jun 25, 2018 at 06:34:27AM CEST, jakub.kicinski@netronome.com wrote: >From: John Hurley > >Add the reoffload tcf_proto_op in flower to generate an offload message >for each filter in the given tcf_proto. Call the specified callback with >this new offload message. The function only returns an error if the >callback rejects adding a 'hardware only' rule. > >A filter contains a flag to indicate if it is in hardware or not. To >ensure the reoffload function properly maintains this flag, keep a >reference counter for the number of instances of the filter that are in >hardware. Only update the flag when this counter changes from or to 0. Add >a generic helper function to implement this behaviour. > >Signed-off-by: John Hurley >Signed-off-by: Jakub Kicinski >--- > include/net/sch_generic.h | 15 +++++++++++++ > net/sched/cls_flower.c | 44 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 59 insertions(+) > >diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h >index 88ed64f60056..c0bd11a928ed 100644 >--- a/include/net/sch_generic.h >+++ b/include/net/sch_generic.h >@@ -336,6 +336,21 @@ static inline void tcf_block_offload_dec(struct tcf_block *block, u32 *flags) > block->offloadcnt--; > } > >+static inline void >+tc_cls_offload_cnt_update(struct tcf_block *block, u32 *cnt, u32 *flags, Why u32? This is not uapi or hw facing. Just use "unsigned int". [...]