[ovs-dev] [PATCH v3 3/5] conntrack: r/w upper limit connection value.

antonio.fischetti at intel.com antonio.fischetti at intel.com
Fri Oct 13 08:25:15 UTC 2017


Read/Write the upper limit value for connections.

Example:
   # set a new upper limit
   ovs-appctl dpctl/ct-set-glbl-cfg maxconn=1000000

   # display cur upper limit
   ovs-appctl dpctl/ct-get-glbl-cfg maxconn

CC: Darrell Ball <dlu998 at gmail.com>
CC: Kevin Traynor <ktraynor at redhat.com>
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 29889c9..68d9030 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -2492,8 +2492,28 @@ conntrack_flush(struct conntrack *ct, const uint16_t *zone)
     return 0;
 }
 
+/* Set a new value for the upper limit of connections. */
+static int
+ct_wr_max_conn(struct conntrack *ct, uint32_t new_val) {
+    atomic_init(&ct->n_conn_limit, new_val);
+    return 0;
+}
+
+/* Read the current upper limit of connections. */
+static int
+ct_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. */
+/* Max nr of connections managed by CT module. */
+#define CT_RW_MAX_CONN "maxconn"
+
 /* List of parameters that can be read/written at run-time. */
-struct ct_cfg_params cfg_params[] = {};
+struct ct_cfg_params cfg_params[] = {
+    {CT_RW_MAX_CONN, ct_wr_max_conn, ct_rd_max_conn},
+};
 
 int
 conntrack_set_param(struct conntrack *ct,
-- 
2.4.11



More information about the dev mailing list