[ovs-dev] [PATCH v2 4/4] conntrack: read current nr of connections.

antonio.fischetti at intel.com antonio.fischetti at intel.com
Tue Sep 26 12:35:24 UTC 2017


Example:
  ovs-appctl dpctl/ct-get-glbl-cfg totconn

CC: Kevin Traynor <ktraynor at redhat.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti at intel.com>
---
 lib/conntrack.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 684e468..b04ffb9 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -2412,13 +2412,23 @@ ct_rd_max_conn(struct conntrack *ct, uint32_t *cur_val) {
     return 0;
 }
 
+/* Read the total nr of connections currently managed. */
+static int
+rd_tot_conn(struct conntrack *ct, uint32_t *cur_val) {
+    *cur_val = atomic_count_get(&ct->n_conn);
+    return 0;
+}
+
 /* List of managed parameters. */
 /* Max nr of connections managed by CT module. */
 #define CT_RW_MAX_CONN "maxconn"
+/* Total nr of connections currently managed by CT module. */
+#define CT_RW_TOT_CONN "totconn"
 
 /* List of parameters that can be read/written at run-time. */
 struct ct_cfg_params cfg_params[] = {
     {CT_RW_MAX_CONN, ct_wr_max_conn, ct_rd_max_conn},
+    {CT_RW_TOT_CONN, NULL, rd_tot_conn},
 };
 
 int
-- 
2.4.11



More information about the dev mailing list