[ovs-dev] [PATCH 2/5] conntrack: r/w upper limit value for connections.
antonio.fischetti at intel.com
antonio.fischetti at intel.com
Mon Sep 18 10:21:28 UTC 2017
Read/Write the upper limit value for connections.
Example:
# set a new upper limit
ovs-appctl dpctl/ct-set maxconn=1000000
# display cur upper limit
ovs-appctl dpctl/ct-get maxconn
Signed-off-by: Antonio Fischetti <antonio.fischetti at intel.com>
---
lib/conntrack.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/lib/conntrack.c b/lib/conntrack.c
index 0642cc8..6d86625 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -2398,8 +2398,28 @@ conntrack_flush(struct conntrack *ct, const uint16_t *zone)
return 0;
}
+/* Set a new value for the upper limit of connections. */
+static int
+wr_max_conn(struct conntrack *ct, uint32_t new_val) {
+ atomic_init(&ct->n_conn_limit, new_val);
+ VLOG_DBG("Set conn upper limit to %d", new_val);
+ return 0;
+}
+
+/* Read the current upper limit of connections. */
+static int
+rd_max_conn(struct conntrack *ct, uint32_t *cur_val) {
+ atomic_read_relaxed(&ct->n_conn_limit, cur_val);
+ return 0;
+}
+
+/* List of managed parameters. */
+#define CT_RW_MAX_CONN "maxconn"
+
/* List of parameters that can be read/written at run-time. */
-struct ct_wk_params wk_params[] = {};
+struct ct_wk_params wk_params[] = {
+ {CT_RW_MAX_CONN, wr_max_conn, rd_max_conn},
+};
int
conntrack_set_param(struct conntrack *ct,
--
2.4.11
More information about the dev
mailing list