From patchwork Fri May 20 01:47:01 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cheng Li
X-Patchwork-Id: 1633618
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.136; helo=smtp3.osuosl.org;
envelope-from=ovs-dev-bounces@openvswitch.org; receiver=)
Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest
SHA256)
(No client certificate requested)
by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L48k163FFz9sFx
for ; Fri, 20 May 2022 11:47:36 +1000 (AEST)
Received: from localhost (localhost [127.0.0.1])
by smtp3.osuosl.org (Postfix) with ESMTP id B049A60E4A;
Fri, 20 May 2022 01:47:34 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from smtp3.osuosl.org ([127.0.0.1])
by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 8hqktokg7mUC; Fri, 20 May 2022 01:47:33 +0000 (UTC)
Received: from lists.linuxfoundation.org (lf-lists.osuosl.org
[IPv6:2605:bc80:3010:104::8cd3:938])
by smtp3.osuosl.org (Postfix) with ESMTPS id D0BCC607EC;
Fri, 20 May 2022 01:47:32 +0000 (UTC)
Received: from lf-lists.osuosl.org (localhost [127.0.0.1])
by lists.linuxfoundation.org (Postfix) with ESMTP id AB03BC0032;
Fri, 20 May 2022 01:47:32 +0000 (UTC)
X-Original-To: dev@openvswitch.org
Delivered-To: ovs-dev@lists.linuxfoundation.org
Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133])
by lists.linuxfoundation.org (Postfix) with ESMTP id 09E4AC002D
for ; Fri, 20 May 2022 01:47:32 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
by smtp2.osuosl.org (Postfix) with ESMTP id E53AE40105
for ; Fri, 20 May 2022 01:47:31 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
Received: from smtp2.osuosl.org ([127.0.0.1])
by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id BOoTpzyb7pKe for ;
Fri, 20 May 2022 01:47:30 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0
Received: from chinatelecom.cn (prt-mail.chinatelecom.cn [42.123.76.228])
by smtp2.osuosl.org (Postfix) with ESMTP id E5CE14000B
for ; Fri, 20 May 2022 01:47:29 +0000 (UTC)
HMM_SOURCE_IP: 172.18.0.218:54768.2037502795
HMM_ATTACHE_NUM: 0000
HMM_SOURCE_TYPE: SMTP
Received: from clientip-36.111.64.85 (unknown [172.18.0.218])
by chinatelecom.cn (HERMES) with SMTP id 2A6732800F6;
Fri, 20 May 2022 09:47:16 +0800 (CST)
X-189-SAVE-TO-SEND: +lic121@chinatelecom.cn
Received: from ([172.18.0.218])
by app0025 with ESMTP id b82223cf850742628c348378b4db6e53 for
dev@openvswitch.org; Fri, 20 May 2022 09:47:18 CST
X-Transaction-ID: b82223cf850742628c348378b4db6e53
X-Real-From: lic121@chinatelecom.cn
X-Receive-IP: 172.18.0.218
X-MEDUSA-Status: 0
From: lic121
To: dev@openvswitch.org,
aconole@redhat.com
Date: Fri, 20 May 2022 01:47:01 +0000
Message-Id: <1653011221-17553-1-git-send-email-lic121@chinatelecom.cn>
X-Mailer: git-send-email 1.8.3.1
Subject: [ovs-dev] [PATCH v3] dpif-netdev: ct maxconns config persistence
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: ,
MIME-Version: 1.0
Errors-To: ovs-dev-bounces@openvswitch.org
Sender: "dev"
Max allowed userspace dp conntrack entries is configurable with
'ovs-appctl dpctl/ct-set-maxconns' command. In real scenarios,
this configuration is expected to survive from host reboot, from
ovs service restart.
Signed-off-by: lic121
Acked-by: Aaron Conole
---
Notes:
v3:
- add a warning to dpctl_ct_set_maxconns
- add NEWS entry
v2:
- rename "ct-maxconns" to "userspace-ct-maxconns"
NEWS | 5 +++++
lib/dpctl.c | 3 +++
lib/dpctl.man | 4 +++-
lib/dpif-netdev.c | 11 +++++++++++
tests/system-traffic.at | 10 ++++++++++
vswitchd/vswitch.xml | 7 +++++++
6 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index eece0d0..e75b2af 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,11 @@ Post-v2.17.0
- Windows:
* Conntrack support for TCPv6, UDPv6, ICMPv6, FTPv6.
* IPv6 Geneve tunnel support.
+ - Userspace datapath:
+ * 'ovs-appctl dpctl/ct-set-maxconns' is deprecated for lack of persistence
+ capabilitiy.
+ * New configuration knob 'other_config:userspace-ct-maxconns' to set
+ maximum number of connection tracker entries for userspace datapath.
v2.17.0 - 17 Feb 2022
diff --git a/lib/dpctl.c b/lib/dpctl.c
index 29041fa..73cf14c 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -1990,6 +1990,9 @@ dpctl_ct_set_maxconns(int argc, const char *argv[],
struct dpif *dpif;
int error = opt_dpif_open(argc, argv, dpctl_p, 3, &dpif);
if (!error) {
+ dpctl_print(dpctl_p,
+ "Warning: dpctl/ct-set-maxconns is deprecated by "
+ "other_config:userspace-ct-maxconns");
uint32_t maxconns;
if (ovs_scan(argv[argc - 1], "%"SCNu32, &maxconns)) {
error = ct_dpif_set_maxconns(dpif, maxconns);
diff --git a/lib/dpctl.man b/lib/dpctl.man
index c100d0a..4f08a3f 100644
--- a/lib/dpctl.man
+++ b/lib/dpctl.man
@@ -343,7 +343,9 @@ system due to connection tracking or simply limiting connection
tracking. If the number of connections is already over the new maximum
limit request then the new maximum limit will be enforced when the
number of connections decreases to that limit, which normally happens
-due to connection expiry. Only supported for userspace datapath.
+due to connection expiry. Only supported for userspace datapath. This
+command is deprecated by ovsdb cfg other_config:userspace-ct-maxconns
+because of persistence capability.
.
.TP
\*(DX\fBct\-get\-maxconns\fR [\fIdp\fR]
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 21277b2..bfbe6db 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4828,6 +4828,17 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
}
}
+ uint32_t ct_maxconns, cur_maxconns;
+ ct_maxconns = smap_get_int(other_config, "userspace-ct-maxconns",
+ UINT32_MAX);
+ /* Leave runtime value as it is when cfg is removed. */
+ if (ct_maxconns < UINT32_MAX) {
+ conntrack_get_maxconns(dp->conntrack, &cur_maxconns);
+ if (ct_maxconns != cur_maxconns) {
+ conntrack_set_maxconns(dp->conntrack, ct_maxconns);
+ }
+ }
+
bool smc_enable = smap_get_bool(other_config, "smc-enable", false);
bool cur_smc;
atomic_read_relaxed(&dp->smc_enable_db, &cur_smc);
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 1d20366..cb1eb16 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -2305,6 +2305,16 @@ AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl
10
])
+AT_CHECK([ovs-vsctl set Open_vswitch . other_config:userspace-ct-maxconns=20], [0])
+AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl
+20
+])
+
+AT_CHECK([ovs-vsctl remove Open_vswitch . other_config userspace-ct-maxconns], [0])
+AT_CHECK([ovs-appctl dpctl/ct-get-maxconns], [], [dnl
+20
+])
+
OVS_TRAFFIC_VSWITCHD_STOP
AT_CLEANUP
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index cc1dd77..f2324be 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -183,6 +183,13 @@
+
+ The maximum number of connection tracker entries allowed in the
+ userspace datapath. This deprecates "ovs-appctl dpctl/ct-set-maxconns"
+ command.
+
+