mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +00:00
dpif-netdev: Avoid copying netdev_flow_key in emc_processing().
Before this commit, emc_processing() copied a netdev_flow_key if there was no exact-match cache (EMC) hit. This commit eliminates the copy by constructing the netdev_flow_key in the place it would be copied. Found by inspection. Shahbaz (CCed) reports that this reduces the cost of an EMC miss by 72 cycles in his test case in which the EMC is disabled. Presumably this is similarly valuable in cases where the EMC merely has few hits. For the original version of this patch, which was against a slightly earlier version of OVS, Daniele reported that: - With EMC disabled, this increases throughput from 4.8 Mpps to 5.4 Mpps. - With EMC enabled, this decreases throughput from 12.4 to 12.0 Mpps. CC: Muhammad Shahbaz <mshahbaz@cs.princeton.edu> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org> Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -352,6 +352,7 @@ Mike Kruze mkruze@nicira.com
|
||||
Min Chen ustcer.tonychan@gmail.com
|
||||
Mikael Doverhag mdoverhag@nicira.com
|
||||
Mrinmoy Das mrdas@ixiacom.com
|
||||
Muhammad Shahbaz mshahbaz@cs.princeton.edu
|
||||
Murali R muralirdev@gmail.com
|
||||
Nagi Reddy Jonnala njonnala@Brocade.com
|
||||
Niels van Adrichem N.L.M.vanAdrichem@tudelft.nl
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -3297,7 +3297,6 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
|
||||
struct packet_batch batches[], size_t *n_batches)
|
||||
{
|
||||
struct emc_cache *flow_cache = &pmd->flow_cache;
|
||||
struct netdev_flow_key key;
|
||||
size_t i, n_missed = 0, n_dropped = 0;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
@@ -3314,19 +3313,19 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
|
||||
OVS_PREFETCH(dp_packet_data(packets[i+1]));
|
||||
}
|
||||
|
||||
miniflow_extract(packets[i], &key.mf);
|
||||
key.len = 0; /* Not computed yet. */
|
||||
key.hash = dpif_netdev_packet_get_rss_hash(packets[i], &key.mf);
|
||||
struct netdev_flow_key *key = &keys[n_missed];
|
||||
miniflow_extract(packets[i], &key->mf);
|
||||
key->len = 0; /* Not computed yet. */
|
||||
key->hash = dpif_netdev_packet_get_rss_hash(packets[i], &key->mf);
|
||||
|
||||
flow = emc_lookup(flow_cache, &key);
|
||||
flow = emc_lookup(flow_cache, key);
|
||||
if (OVS_LIKELY(flow)) {
|
||||
dp_netdev_queue_batches(packets[i], flow, &key.mf, batches,
|
||||
dp_netdev_queue_batches(packets[i], flow, &key->mf, batches,
|
||||
n_batches);
|
||||
} else {
|
||||
/* Exact match cache missed. Group missed packets together at
|
||||
* the beginning of the 'packets' array. */
|
||||
packets[n_missed] = packets[i];
|
||||
keys[n_missed++] = key;
|
||||
packets[n_missed++] = packets[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user