[ovs-dev] [PATCH] Improve MPLSoGRE performance by reducing EMC hash collisions.

Nitin Katiyar nitin.katiyar at ericsson.com
Tue Aug 13 17:49:47 UTC 2019

When a packet is received, the RSS hash is calculated if it is not
already available. The Exact Match Cache (EMC) entry is then looked up
using this RSS hash.

When a MPLSoGRE encapsulated packet is received, the GRE header is
popped, the RSS hash is invalidated and the packet is recirculated for
further processing. When the recirculated packet is processed, the MPLS
header is popped and the packet is recirculated again. Since the RSS
hash has not been invalidated here, the EMC lookup will hit the same
entry as that after the first recirculation. This degrades performance

This patch invalides RSS hash after MPLS header is popped.

Signed-off-by: Nitin Katiyar <nitin.katiyar at ericsson.com>
 lib/packets.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/packets.c b/lib/packets.c
index ab0b1a3..35fa3c7 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -404,6 +404,11 @@ pop_mpls(struct dp_packet *packet, ovs_be16 ethtype)
         struct mpls_hdr *mh = dp_packet_l2_5(packet);
         size_t len = packet->l2_5_ofs;
+        /* Invalidate the hash so that it is recomputed using inner packet
+         * header after recirculation. Else it would cause EMC collision for
+         * packets recirculated after popping mpls header. */
+        dp_packet_reset_offload(packet);
         set_ethertype(packet, ethtype);
         if (get_16aligned_be32(&mh->mpls_lse) & htonl(MPLS_BOS_MASK)) {
             dp_packet_set_l2_5(packet, NULL);

More information about the dev mailing list