From patchwork Mon Sep 30 11:15:39 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: wenxu
X-Patchwork-Id: 1169268
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org;
spf=pass (mailfrom) smtp.mailfrom=openvswitch.org
(client-ip=140.211.169.12; helo=mail.linuxfoundation.org;
envelope-from=ovs-dev-bounces@openvswitch.org;
receiver=)
Authentication-Results: ozlabs.org;
dmarc=fail (p=none dis=none) header.from=ucloud.cn
Received: from mail.linuxfoundation.org (mail.linuxfoundation.org
[140.211.169.12])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
bits)) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 46hfwX30Zhz9s7T
for ;
Mon, 30 Sep 2019 21:16:11 +1000 (AEST)
Received: from mail.linux-foundation.org (localhost [127.0.0.1])
by mail.linuxfoundation.org (Postfix) with ESMTP id A9F2215B6;
Mon, 30 Sep 2019 11:16:07 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@mail.linuxfoundation.org
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id C06CA1577
for ; Mon, 30 Sep 2019 11:16:05 +0000 (UTC)
X-Greylist: from auto-whitelisted by SQLgrey-1.7.6
Received: from m9784.mail.qiye.163.com (m9784.mail.qiye.163.com
[220.181.97.84])
by smtp1.linuxfoundation.org (Postfix) with ESMTP id AD59D8B1
for ; Mon, 30 Sep 2019 11:16:04 +0000 (UTC)
Received: from localhost.localdomain (unknown [123.59.132.129])
by m9784.mail.qiye.163.com (Hmail) with ESMTPA id 59C4C40EF1;
Mon, 30 Sep 2019 19:15:41 +0800 (CST)
From: wenxu@ucloud.cn
To: dev@openvswitch.org,
vladbu@mellanox.com,
roid@mellanox.com
Date: Mon, 30 Sep 2019 19:15:39 +0800
Message-Id: <1569842139-21593-1-git-send-email-wenxu@ucloud.cn>
X-Mailer: git-send-email 1.8.3.1
X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSVVNSklCQkJCSk1LTE1NTVlXWShZQU
lCN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG
X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6P006PBw5PDg#NS0QMVEBLwE9
FApPCTlVSlVKTk1CQ09JSk9KT0hIVTMWGhIXVQweFQMOOw4YFxQOH1UYFUVZV1kSC1lBWUpJSFVO
QlVKSElVSklCWVdZCAFZQU1NSUg3Bg++
X-HM-Tid: 0a6d81e218c52086kuqy59c4c40ef1
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE
autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
Subject: [ovs-dev] [PATCH] upcall: Configure datapath max-unkeep-op through
ovs-vsctl.
X-BeenThere: ovs-dev@openvswitch.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
MIME-Version: 1.0
Sender: ovs-dev-bounces@openvswitch.org
Errors-To: ovs-dev-bounces@openvswitch.org
From: wenxu
This patch adds a new configuration option, "max-unkeep_op" to the
Open_vSwitch "other-config" column. This sets maximum allowed ravalidator
do the UNKEEP operations with limit in each dump.
In the hw-offload mode. The huge number of UNKEEP operationes will
make revalidator block long time.
---
ofproto/ofproto-dpif-upcall.c | 10 +++++++---
ofproto/ofproto-provider.h | 3 +++
ofproto/ofproto.c | 9 +++++++++
ofproto/ofproto.h | 2 ++
vswitchd/bridge.c | 3 +++
vswitchd/vswitch.xml | 11 +++++++++++
6 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 657aa7f..9423a50 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -2607,6 +2607,7 @@ revalidate(struct revalidator *revalidator)
long long int now;
size_t n_dp_flows;
bool kill_them_all;
+ unsigned int counter = 0;
n_dumped = dpif_flow_dump_next(dump_thread, flows, ARRAY_SIZE(flows));
if (!n_dumped) {
@@ -2695,9 +2696,12 @@ revalidate(struct revalidator *revalidator)
}
if (result != UKEY_KEEP) {
- /* Takes ownership of 'recircs'. */
- reval_op_init(&ops[n_ops++], result, udpif, ukey, &recircs,
- &odp_actions);
+ if (!ofproto_max_unkeep_op ||
+ ++counter <= ofproto_max_unkeep_op) {
+ /* Takes ownership of 'recircs'. */
+ reval_op_init(&ops[n_ops++], result, udpif, ukey, &recircs,
+ &odp_actions);
+ }
}
ovs_mutex_unlock(&ukey->mutex);
}
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index c980e6b..bce194a 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -532,6 +532,9 @@ extern unsigned ofproto_max_revalidator;
* duration exceeds half of max-revalidator config variable. */
extern unsigned ofproto_min_revalidate_pps;
+/* Maximum unkeep op in revalidator.*/
+extern unsigned ofproto_max_unkeep_op;
+
/* Number of upcall handler and revalidator threads. Only affects the
* ofproto-dpif implementation. */
extern size_t n_handlers, n_revalidators;
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index b4249b0..6a4cf2e 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -308,6 +308,7 @@ unsigned ofproto_flow_limit = OFPROTO_FLOW_LIMIT_DEFAULT;
unsigned ofproto_max_idle = OFPROTO_MAX_IDLE_DEFAULT;
unsigned ofproto_max_revalidator = OFPROTO_MAX_REVALIDATOR_DEFAULT;
unsigned ofproto_min_revalidate_pps = OFPROTO_MIN_REVALIDATE_PPS_DEFAULT;
+unsigned ofproto_max_unkeep_op = OFPROTO_MAX_UNKEEP_OP_DEFAULT;
size_t n_handlers, n_revalidators;
@@ -721,6 +722,14 @@ ofproto_set_min_revalidate_pps(unsigned min_revalidate_pps)
ofproto_min_revalidate_pps = min_revalidate_pps ? min_revalidate_pps : 1;
}
+/* Sets the maximum allowed unkeep operation inrevalidator. */
+void
+ofproto_set_max_unkeep_op(unsigned max_unkeep_op)
+{
+ ofproto_max_unkeep_op = max_unkeep_op;
+}
+
+
/* If forward_bpdu is true, the NORMAL action will forward frames with
* reserved (e.g. STP) destination Ethernet addresses. if forward_bpdu is false,
* the NORMAL action will drop these frames. */
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 033c4cf..e1946ff 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -311,6 +311,7 @@ int ofproto_port_dump_done(struct ofproto_port_dump *);
#define OFPROTO_MAX_IDLE_DEFAULT 10000 /* ms */
#define OFPROTO_MAX_REVALIDATOR_DEFAULT 500 /* ms */
#define OFPROTO_MIN_REVALIDATE_PPS_DEFAULT 5
+#define OFPROTO_MAX_UNKEEP_OP_DEFAULT 0
const char *ofproto_port_open_type(const struct ofproto *,
const char *port_type);
@@ -340,6 +341,7 @@ void ofproto_set_flow_limit(unsigned limit);
void ofproto_set_max_idle(unsigned max_idle);
void ofproto_set_max_revalidator(unsigned max_revalidator);
void ofproto_set_min_revalidate_pps(unsigned min_revalidate_pps);
+void ofproto_set_max_unkeep_op(unsigned max_unkeep_op);
void ofproto_set_forward_bpdu(struct ofproto *, bool forward_bpdu);
void ofproto_set_mac_table_config(struct ofproto *, unsigned idle_time,
size_t max_entries);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 9095ebf..5248926 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -804,6 +804,9 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
ofproto_set_min_revalidate_pps(
smap_get_int(&ovs_cfg->other_config, "min-revalidate-pps",
OFPROTO_MIN_REVALIDATE_PPS_DEFAULT));
+ ofproto_set_max_unkeep_op(smap_get_int(&ovs_cfg->other_config,
+ "max-ukeep-op",
+ OFPROTO_MAX_UNKEEP_OP_DEFAULT));
ofproto_set_vlan_limit(smap_get_int(&ovs_cfg->other_config, "vlan-limit",
LEGACY_MAX_VLAN_HEADERS));
ofproto_set_bundle_idle_timeout(smap_get_int(&ovs_cfg->other_config,
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 01304a5..d13297a 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -222,6 +222,17 @@
+
+
+ The maximum unkeep operations that for each dump in revalidator thread
+ If the vlaue is 0, there is no limitation for unkeep operation
+
+
+ The default is 0.
+
+
+