[ovs-dev,v3,4/5] conntrack: read current nr of connections.
diff mbox series

Message ID 1507883117-24347-5-git-send-email-antonio.fischetti@intel.com
State Changes Requested
Delegated to: Darrell Ball
Headers show
Series
  • Conntrack: add commands to r/w CT parameters.
Related show

Commit Message

Fischetti, Antonio Oct. 13, 2017, 8:25 a.m. UTC
Example:
  ovs-appctl dpctl/ct-get-glbl-cfg totconn

CC: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/conntrack.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch
diff mbox series

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 68d9030..ed2675b 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -2506,13 +2506,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