summaryrefslogtreecommitdiff
path: root/ofproto
diff options
context:
space:
mode:
authorJianbo Liu <jianbol@nvidia.com>2020-12-06 10:16:45 +0200
committerSimon Horman <simon.horman@netronome.com>2020-12-07 07:30:15 +0100
commitaf06184705072804a4c1374f9c824c9e4c241c26 (patch)
tree7231acbcfaf73d467661fd9e6574b2c4571eb511 /ofproto
parent97dbef6de9d8ac72a20d4ccbb3bcdba3e308f6b9 (diff)
downloadopenvswitch-af06184705072804a4c1374f9c824c9e4c241c26.tar.gz
dpif-netlink: Count the number of offloaded rules
Add a counter for the offloaded rules, and display it in the command of "ovs-appctl upcall/show". Signed-off-by: Jianbo Liu <jianbol@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
Diffstat (limited to 'ofproto')
-rw-r--r--ofproto/ofproto-dpif-upcall.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index e022fde27..19b92dfe0 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -175,6 +175,7 @@ struct udpif {
/* n_flows_mutex prevents multiple threads updating these concurrently. */
atomic_uint n_flows; /* Number of flows in the datapath. */
+ atomic_uint n_offloaded_flows; /* Number of the offloaded flows. */
atomic_llong n_flows_timestamp; /* Last time n_flows was updated. */
struct ovs_mutex n_flows_mutex;
@@ -730,6 +731,8 @@ udpif_get_n_flows(struct udpif *udpif)
dpif_get_dp_stats(udpif->dpif, &stats);
flow_count = stats.n_flows;
atomic_store_relaxed(&udpif->n_flows, flow_count);
+ atomic_store_relaxed(&udpif->n_offloaded_flows,
+ stats.n_offloaded_flows);
ovs_mutex_unlock(&udpif->n_flows_mutex);
} else {
atomic_read_relaxed(&udpif->n_flows, &flow_count);
@@ -2904,6 +2907,7 @@ upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
struct udpif *udpif;
LIST_FOR_EACH (udpif, list_node, &all_udpifs) {
+ unsigned int n_offloaded_flows;
unsigned int flow_limit;
bool ufid_enabled;
size_t i;
@@ -2915,6 +2919,8 @@ upcall_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED,
ds_put_format(&ds, " flows : (current %lu)"
" (avg %u) (max %u) (limit %u)\n", udpif_get_n_flows(udpif),
udpif->avg_n_flows, udpif->max_n_flows, flow_limit);
+ atomic_read_relaxed(&udpif->n_offloaded_flows, &n_offloaded_flows);
+ ds_put_format(&ds, " offloaded flows : %u\n", n_offloaded_flows);
ds_put_format(&ds, " dump duration : %lldms\n", udpif->dump_duration);
ds_put_format(&ds, " ufid enabled : ");
if (ufid_enabled) {