netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eelco Chaudron <echaudro@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, dev@openvswitch.org,
	kuba@kernel.org, pabeni@redhat.com, pshelar@ovn.org
Subject: Re: [PATCH net-next 2/2] net: openvswitch: make masks cache size configurable
Date: Wed, 22 Jul 2020 21:22:52 +0200	[thread overview]
Message-ID: <20200722192252.GC23458@breakpoint.cc> (raw)
In-Reply-To: <159540647223.619787.13052866492035799125.stgit@ebuild>

Eelco Chaudron <echaudro@redhat.com> wrote:
> This patch makes the masks cache size configurable, or with
> a size of 0, disable it.
> 
> Reviewed-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  include/uapi/linux/openvswitch.h |    1 
>  net/openvswitch/datapath.c       |   11 +++++
>  net/openvswitch/flow_table.c     |   86 ++++++++++++++++++++++++++++++++++----
>  net/openvswitch/flow_table.h     |   10 ++++
>  4 files changed, 98 insertions(+), 10 deletions(-)
> 
> diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
> index 7cb76e5ca7cf..8300cc29dec8 100644
> --- a/include/uapi/linux/openvswitch.h
> +++ b/include/uapi/linux/openvswitch.h
> @@ -86,6 +86,7 @@ enum ovs_datapath_attr {
>  	OVS_DP_ATTR_MEGAFLOW_STATS,	/* struct ovs_dp_megaflow_stats */
>  	OVS_DP_ATTR_USER_FEATURES,	/* OVS_DP_F_*  */
>  	OVS_DP_ATTR_PAD,
> +	OVS_DP_ATTR_MASKS_CACHE_SIZE,

This new attr should probably get an entry in
datapath.c datapath_policy[].

> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -1535,6 +1535,10 @@ static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
>  	if (nla_put_u32(skb, OVS_DP_ATTR_USER_FEATURES, dp->user_features))
>  		goto nla_put_failure;
>  
> +	if (nla_put_u32(skb, OVS_DP_ATTR_MASKS_CACHE_SIZE,
> +			ovs_flow_tbl_masks_cache_size(&dp->table)))
> +		goto nla_put_failure;
> +
>  	genlmsg_end(skb, ovs_header);
>  	return 0;


ovs_dp_cmd_msg_size() should add another nla_total_size(sizeof(u32))
to make sure there is enough space.

> +	if (a[OVS_DP_ATTR_MASKS_CACHE_SIZE]) {
> +		u32 cache_size;
> +
> +		cache_size = nla_get_u32(a[OVS_DP_ATTR_MASKS_CACHE_SIZE]);
> +		ovs_flow_tbl_masks_cache_resize(&dp->table, cache_size);
> +	}

I see a 0 cache size is legal (turns it off) and that the allocation
path has a few sanity checks as well.

Would it make sense to add min/max policy to datapath_policy[] for this
as well?

  parent reply	other threads:[~2020-07-22 19:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  8:27 [PATCH net-next 0/2] net: openvswitch: masks cache enhancements Eelco Chaudron
2020-07-22  8:27 ` [PATCH net-next 1/2] net: openvswitch: add masks cache hit counter Eelco Chaudron
2020-07-22  8:27 ` [PATCH net-next 2/2] net: openvswitch: make masks cache size configurable Eelco Chaudron
2020-07-22 15:21   ` Jakub Kicinski
2020-07-22 15:31     ` Eelco Chaudron
2020-07-22 17:40   ` kernel test robot
2020-07-22 19:22   ` Florian Westphal [this message]
2020-07-23  9:59     ` Eelco Chaudron
2020-07-23 10:15       ` Florian Westphal
2020-07-22  8:37 ` [PATCH net-next 0/2] net: openvswitch: masks cache enhancements Eelco Chaudron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200722192252.GC23458@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).