2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

dpif-netdev: Add command line and function pointer for miniflow extract

This patch introduces the MFEX function pointers which allows
the user to switch between different miniflow extract implementations
which are provided by the OVS based on optimized ISA CPU.

The user can query for the available minflow extract variants available
for that CPU by following commands:

$ovs-appctl dpif-netdev/miniflow-parser-get

Similarly an user can set the miniflow implementation by the following
command :

$ ovs-appctl dpif-netdev/miniflow-parser-set name

This allows for more performance and flexibility to the user to choose
the miniflow implementation according to the needs.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
Co-authored-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Kumar Amber
2021-07-15 21:36:07 +05:30
committed by Ian Stokes
parent 3e82604b7c
commit 3d8f47bc04
7 changed files with 419 additions and 5 deletions

View File

@@ -149,6 +149,15 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
* // do all processing (HWOL->MFEX->EMC->SMC)
* }
*/
/* Do a batch minfilow extract into keys. */
uint32_t mf_mask = 0;
miniflow_extract_func mfex_func;
atomic_read_relaxed(&pmd->miniflow_extract_opt, &mfex_func);
if (mfex_func) {
mf_mask = mfex_func(packets, keys, batch_size, in_port, pmd);
}
uint32_t lookup_pkts_bitmask = (1ULL << batch_size) - 1;
uint32_t iter = lookup_pkts_bitmask;
while (iter) {
@@ -167,6 +176,13 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
pkt_metadata_init(&packet->md, in_port);
struct dp_netdev_flow *f = NULL;
struct netdev_flow_key *key = &keys[i];
/* Check the minfiflow mask to see if the packet was correctly
* classifed by vector mfex else do a scalar miniflow extract
* for that packet.
*/
bool mfex_hit = !!(mf_mask & (1 << i));
/* Check for a partial hardware offload match. */
if (hwol_enabled) {
@@ -177,7 +193,13 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
}
if (f) {
rules[i] = &f->cr;
pkt_meta[i].tcp_flags = parse_tcp_flags(packet);
/* If AVX512 MFEX already classified the packet, use it. */
if (mfex_hit) {
pkt_meta[i].tcp_flags = miniflow_get_tcp_flags(&key->mf);
} else {
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);
@@ -185,9 +207,10 @@ dp_netdev_input_outer_avx512(struct dp_netdev_pmd_thread *pmd,
}
}
/* Do miniflow extract into keys. */
struct netdev_flow_key *key = &keys[i];
miniflow_extract(packet, &key->mf);
if (!mfex_hit) {
/* Do a scalar miniflow extract into keys. */
miniflow_extract(packet, &key->mf);
}
/* Cache TCP and byte values for all packets. */
pkt_meta[i].bytes = dp_packet_size(packet);