From patchwork Fri Sep 25 09:58:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Ivanov X-Patchwork-Id: 1371131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4ByS6S1Zyjz9sPB for ; Fri, 25 Sep 2020 19:58:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4716A875E7; Fri, 25 Sep 2020 09:58:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VIghoF-4Qdwq; Fri, 25 Sep 2020 09:58:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 01E56875E3; Fri, 25 Sep 2020 09:58:30 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B0781C1AD9; Fri, 25 Sep 2020 09:58:29 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5A869C0890 for ; Fri, 25 Sep 2020 09:58:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 41C7686C43 for ; Fri, 25 Sep 2020 09:58:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x8TpG6FfSjy3 for ; Fri, 25 Sep 2020 09:58:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.kot-begemot.co.uk (ivanoab7.miniserver.com [37.128.132.42]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B47A386C59 for ; Fri, 25 Sep 2020 09:58:25 +0000 (UTC) Received: from tun252.jain.kot-begemot.co.uk ([192.168.18.6] helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLkUi-0000ro-9z; Fri, 25 Sep 2020 09:58:24 +0000 Received: from jain.kot-begemot.co.uk ([192.168.3.3]) by jain.kot-begemot.co.uk with esmtp (Exim 4.92) (envelope-from ) id 1kLkUf-00059v-Jj; Fri, 25 Sep 2020 10:58:23 +0100 From: anton.ivanov@cambridgegreys.com To: dev@openvswitch.org Date: Fri, 25 Sep 2020 10:58:02 +0100 Message-Id: <20200925095807.19358-5-anton.ivanov@cambridgegreys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200925095807.19358-1-anton.ivanov@cambridgegreys.com> References: <20200925095807.19358-1-anton.ivanov@cambridgegreys.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett Cc: i.maximets@ovn.org, Anton Ivanov Subject: [ovs-dev] [PATCH ovn v4 4/9] ovn-northd: Add commands to set/get parallelisation thresholds X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Anton Ivanov Add commands to control and display single-threaded to multi- threaded cutoff. Signed-off-by: Anton Ivanov --- northd/ovn-northd.c | 47 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 225f4ca8e..c768431d0 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -59,6 +59,8 @@ static unixctl_cb_func ovn_northd_resume; static unixctl_cb_func ovn_northd_is_paused; static unixctl_cb_func ovn_northd_status; static unixctl_cb_func cluster_state_reset_cmd; +static unixctl_cb_func get_param_cutoff; +static unixctl_cb_func set_param_cutoff; struct northd_context { struct ovsdb_idl *ovnnb_idl; @@ -11460,8 +11462,8 @@ static void init_lflows_thread_pool(void) * Setting to 1 forces "all parallel" lflow build. */ -#define OD_CUTOFF 1 -#define OP_CUTOFF 1 +static ssize_t lflow_od_cuttoff = 1; +static ssize_t lflow_op_cutoff = 1; static void build_lswitch_and_lrouter_flows(struct hmap *datapaths, struct hmap *ports, @@ -11472,7 +11474,8 @@ build_lswitch_and_lrouter_flows(struct hmap *datapaths, struct hmap *ports, { char *svc_check_match = xasprintf("eth.dst == %s", svc_monitor_mac); - if (hmap_count(datapaths) > OD_CUTOFF || hmap_count(ports) > OP_CUTOFF) { + if (hmap_count(datapaths) > lflow_od_cuttoff || + hmap_count(ports) > lflow_op_cutoff) { struct hmap *lflow_segs; struct lswitch_flow_build_info *lsiv; @@ -13157,6 +13160,14 @@ main(int argc, char *argv[]) unixctl_command_register("is-paused", "", 0, 0, ovn_northd_is_paused, &state); unixctl_command_register("status", "", 0, 0, ovn_northd_status, &state); + unixctl_command_register("set-datapath-cutoff", "", 0, 0, + set_param_cutoff, &lflow_od_cuttoff); + unixctl_command_register("set-port-cutoff", "", 0, 0, + set_param_cutoff, &lflow_op_cutoff); + unixctl_command_register("get-datapath-cutoff", "", 0, 0, + get_param_cutoff, &lflow_od_cuttoff); + unixctl_command_register("get-port-cutoff", "", 0, 0, + get_param_cutoff, &lflow_op_cutoff); bool reset_ovnsb_idl_min_index = false; unixctl_command_register("sb-cluster-state-reset", "", 0, 0, @@ -13582,3 +13593,33 @@ cluster_state_reset_cmd(struct unixctl_conn *conn, int argc OVS_UNUSED, poll_immediate_wake(); unixctl_command_reply(conn, NULL); } + +static void set_param_cutoff +(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], + void *param_) +{ + long new_cutoff; + ssize_t *param = param_; + + if (str_to_long(argv[1], 10, &new_cutoff)) { + if (new_cutoff > 0) { + *param = new_cutoff; + return; + } + } + unixctl_command_reply_error(conn, "unsigned integer required"); +} + +static void get_param_cutoff +(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[] OVS_UNUSED, + void *param_) +{ + struct ds ds = DS_EMPTY_INITIALIZER; + ssize_t *param = param_; + + ds_put_format(&ds, "%ld\n", *param); + unixctl_command_reply(conn, ds_cstr(&ds)); + ds_destroy(&ds); +}