summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCian Ferriter <cian.ferriter@intel.com>2021-07-09 15:58:20 +0000
committerIan Stokes <ian.stokes@intel.com>2021-07-09 17:13:55 +0100
commitd76a719a7aa0e040e943dfbc75e482fbb6350475 (patch)
tree3cdd7bdc3452fe9e0beeb15bd0629a7ad8bbf164 /lib
parent3f86fdf5ce951cfaf0588b4620e3054f4b5b7136 (diff)
downloadopenvswitch-d76a719a7aa0e040e943dfbc75e482fbb6350475.tar.gz
dpif-netdev: Add a partial HWOL PMD statistic.
It is possible for packets traversing the userspace datapath to match a flow before hitting on EMC by using a mark ID provided by a NIC. Add a PMD statistic for this hit. Signed-off-by: Cian Ferriter <cian.ferriter@intel.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dpif-netdev-avx512.c3
-rw-r--r--lib/dpif-netdev-perf.c3
-rw-r--r--lib/dpif-netdev-perf.h1
-rw-r--r--lib/dpif-netdev-unixctl.man1
-rw-r--r--lib/dpif-netdev.c9
5 files changed, 15 insertions, 2 deletions
diff --git a/lib/dpif-netdev-avx512.c b/lib/dpif-netdev-avx512.c
index 1ae66ca6c..6f9aa8284 100644
--- a/lib/dpif-netdev-avx512.c
+++ b/lib/dpif-netdev-avx512.c
@@ -127,6 +127,7 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
uint32_t emc_hits = 0;
uint32_t smc_hits = 0;
+ uint32_t phwol_hits = 0;
/* A 1 bit in this mask indicates a hit, so no DPCLS lookup on the pkt. */
uint32_t hwol_emc_smc_hitmask = 0;
@@ -178,6 +179,7 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
rules[i] = &f->cr;
pkt_meta[i].tcp_flags = parse_tcp_flags(packet);
pkt_meta[i].bytes = dp_packet_size(packet);
+ phwol_hits++;
hwol_emc_smc_hitmask |= (1 << i);
continue;
}
@@ -286,6 +288,7 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
/* At this point we don't return error anymore, so commit stats here. */
pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_RECV, batch_size);
+ pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_PHWOL_HIT, phwol_hits);
pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_HIT, emc_hits);
pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_HIT, smc_hits);
pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_MASKED_HIT,
diff --git a/lib/dpif-netdev-perf.c b/lib/dpif-netdev-perf.c
index 9560e7c3c..7103a2d4d 100644
--- a/lib/dpif-netdev-perf.c
+++ b/lib/dpif-netdev-perf.c
@@ -246,6 +246,7 @@ pmd_perf_format_overall_stats(struct ds *str, struct pmd_perf_stats *s,
ds_put_format(str,
" Rx packets: %12"PRIu64" (%.0f Kpps, %.0f cycles/pkt)\n"
" Datapath passes: %12"PRIu64" (%.2f passes/pkt)\n"
+ " - PHWOL hits: %12"PRIu64" (%5.1f %%)\n"
" - EMC hits: %12"PRIu64" (%5.1f %%)\n"
" - SMC hits: %12"PRIu64" (%5.1f %%)\n"
" - Megaflow hits: %12"PRIu64" (%5.1f %%, %.2f "
@@ -255,6 +256,8 @@ pmd_perf_format_overall_stats(struct ds *str, struct pmd_perf_stats *s,
rx_packets, (rx_packets / duration) / 1000,
1.0 * stats[PMD_CYCLES_ITER_BUSY] / rx_packets,
passes, rx_packets ? 1.0 * passes / rx_packets : 0,
+ stats[PMD_STAT_PHWOL_HIT],
+ 100.0 * stats[PMD_STAT_PHWOL_HIT] / passes,
stats[PMD_STAT_EXACT_HIT],
100.0 * stats[PMD_STAT_EXACT_HIT] / passes,
stats[PMD_STAT_SMC_HIT],
diff --git a/lib/dpif-netdev-perf.h b/lib/dpif-netdev-perf.h
index 72645b6b3..8b1a52387 100644
--- a/lib/dpif-netdev-perf.h
+++ b/lib/dpif-netdev-perf.h
@@ -56,6 +56,7 @@ extern "C" {
/* Set of counter types maintained in pmd_perf_stats. */
enum pmd_stat_type {
+ PMD_STAT_PHWOL_HIT, /* Packets that had a partial HWOL hit (phwol). */
PMD_STAT_EXACT_HIT, /* Packets that had an exact match (emc). */
PMD_STAT_SMC_HIT, /* Packets that had a sig match hit (SMC). */
PMD_STAT_MASKED_HIT, /* Packets that matched in the flow table. */
diff --git a/lib/dpif-netdev-unixctl.man b/lib/dpif-netdev-unixctl.man
index 5f9256215..83ce4f1c5 100644
--- a/lib/dpif-netdev-unixctl.man
+++ b/lib/dpif-netdev-unixctl.man
@@ -135,6 +135,7 @@ pmd thread numa_id 0 core_id 1:
- busy iterations: 86009 ( 84.1 % of used cycles)
Rx packets: 2399607 (2381 Kpps, 848 cycles/pkt)
Datapath passes: 3599415 (1.50 passes/pkt)
+ - PHWOL hits: 0 ( 0.0 %)
- EMC hits: 336472 ( 9.3 %)
- SMC hits: 0 ( 0.0 %)
- Megaflow hits: 3262943 ( 90.7 %, 1.00 subtbl lookups/hit)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index f7b2163bf..610949f36 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -646,6 +646,7 @@ pmd_info_show_stats(struct ds *reply,
" packets received: %"PRIu64"\n"
" packet recirculations: %"PRIu64"\n"
" avg. datapath passes per packet: %.02f\n"
+ " phwol hits: %"PRIu64"\n"
" emc hits: %"PRIu64"\n"
" smc hits: %"PRIu64"\n"
" megaflow hits: %"PRIu64"\n"
@@ -654,7 +655,8 @@ pmd_info_show_stats(struct ds *reply,
" miss with failed upcall: %"PRIu64"\n"
" avg. packets per output batch: %.02f\n",
total_packets, stats[PMD_STAT_RECIRC],
- passes_per_pkt, stats[PMD_STAT_EXACT_HIT],
+ passes_per_pkt, stats[PMD_STAT_PHWOL_HIT],
+ stats[PMD_STAT_EXACT_HIT],
stats[PMD_STAT_SMC_HIT],
stats[PMD_STAT_MASKED_HIT], lookups_per_hit,
stats[PMD_STAT_MISS], stats[PMD_STAT_LOST],
@@ -1683,6 +1685,7 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
CMAP_FOR_EACH (pmd, node, &dp->poll_threads) {
stats->n_flows += cmap_count(&pmd->flow_table);
pmd_perf_read_counters(&pmd->perf_stats, pmd_stats);
+ stats->n_hit += pmd_stats[PMD_STAT_PHWOL_HIT];
stats->n_hit += pmd_stats[PMD_STAT_EXACT_HIT];
stats->n_hit += pmd_stats[PMD_STAT_SMC_HIT];
stats->n_hit += pmd_stats[PMD_STAT_MASKED_HIT];
@@ -6805,7 +6808,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
bool md_is_valid, odp_port_t port_no)
{
struct netdev_flow_key *key = &keys[0];
- size_t n_missed = 0, n_emc_hit = 0;
+ size_t n_missed = 0, n_emc_hit = 0, n_phwol_hit = 0;
struct dfc_cache *cache = &pmd->flow_cache;
struct dp_packet *packet;
const size_t cnt = dp_packet_batch_size(packets_);
@@ -6852,6 +6855,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
}
if (OVS_LIKELY(flow)) {
tcp_flags = parse_tcp_flags(packet);
+ n_phwol_hit++;
if (OVS_LIKELY(batch_enable)) {
dp_netdev_queue_batches(packet, flow, tcp_flags, batches,
n_batches);
@@ -6914,6 +6918,7 @@ dfc_processing(struct dp_netdev_pmd_thread *pmd,
/* Count of packets which are not flow batched. */
*n_flows = map_cnt;
+ pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_PHWOL_HIT, n_phwol_hit);
pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_EXACT_HIT, n_emc_hit);
if (!smc_enable_db) {