mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
dpif-netdev: optmizing emc_processing()
Commit d262ac2c60
introduced a slight
performance drop for the fast path, where every packets hits the
emc cache. This patch removes that performance drop by only reloading
the key pointer on emc cache miss.
Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
This commit is contained in:
@@ -3297,6 +3297,7 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
|
|||||||
struct packet_batch batches[], size_t *n_batches)
|
struct packet_batch batches[], size_t *n_batches)
|
||||||
{
|
{
|
||||||
struct emc_cache *flow_cache = &pmd->flow_cache;
|
struct emc_cache *flow_cache = &pmd->flow_cache;
|
||||||
|
struct netdev_flow_key *key = &keys[0];
|
||||||
size_t i, n_missed = 0, n_dropped = 0;
|
size_t i, n_missed = 0, n_dropped = 0;
|
||||||
|
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
@@ -3314,7 +3315,6 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
|
|||||||
OVS_PREFETCH(dp_packet_data(packets[i+1]));
|
OVS_PREFETCH(dp_packet_data(packets[i+1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct netdev_flow_key *key = &keys[n_missed];
|
|
||||||
miniflow_extract(packet, &key->mf);
|
miniflow_extract(packet, &key->mf);
|
||||||
key->len = 0; /* Not computed yet. */
|
key->len = 0; /* Not computed yet. */
|
||||||
key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
|
key->hash = dpif_netdev_packet_get_rss_hash(packet, &key->mf);
|
||||||
@@ -3326,7 +3326,8 @@ emc_processing(struct dp_netdev_pmd_thread *pmd, struct dp_packet **packets,
|
|||||||
} else {
|
} else {
|
||||||
/* Exact match cache missed. Group missed packets together at
|
/* Exact match cache missed. Group missed packets together at
|
||||||
* the beginning of the 'packets' array. */
|
* the beginning of the 'packets' array. */
|
||||||
packets[n_missed++] = packet;
|
packets[n_missed] = packet;
|
||||||
|
key = &keys[n_missed++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user