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

Message ID 1506429324-10416-5-git-send-email-antonio.fischetti@intel.com
State New
Headers show
Series
  • Conntrack: add commands to r/w CT parameters.
Related show

Commit Message

Fischetti, Antonio Sept. 26, 2017, 12:35 p.m.
Example:
  ovs-appctl dpctl/ct-get-glbl-cfg totconn

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

Patch

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