[ovs-dev,V3] packets: Fix using outdated RSS hash after MPLS decapsulation.
diff mbox series

Message ID 1567010527-15564-1-git-send-email-nitin.katiyar@ericsson.com
State Accepted
Headers show
Series
  • [ovs-dev,V3] packets: Fix using outdated RSS hash after MPLS decapsulation.
Related show

Commit Message

Nitin Katiyar Aug. 28, 2019, 4:42 p.m. UTC
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 MPLS encapsulated packet is received, the MPLS header is popped
and the packet is recirculated. Since the RSS hash has not been
invalidated here, the EMC lookup for all decapsulated packets will hit
the same entry even though these packets will have different tuple
values. This degrades performance severely as different inner packets
from the same MPLS tunnel would hit the same EMC entry.

This patch invalidates RSS hash (by resetting offload flags) after MPLS
header is popped.

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

Comments

Ilya Maximets Aug. 29, 2019, 3:33 p.m. UTC | #1
On 28.08.2019 19:42, Nitin Katiyar wrote:
> 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 MPLS encapsulated packet is received, the MPLS header is popped
> and the packet is recirculated. Since the RSS hash has not been
> invalidated here, the EMC lookup for all decapsulated packets will hit
> the same entry even though these packets will have different tuple
> values. This degrades performance severely as different inner packets
> from the same MPLS tunnel would hit the same EMC entry.
> 
> This patch invalidates RSS hash (by resetting offload flags) after MPLS
> header is popped.
> 
> Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>

Thanks! Applied to master and branch-2.12.

Best regards, Ilya Maximets.

Patch
diff mbox series

diff --git a/lib/packets.c b/lib/packets.c
index ab0b1a3..12053df 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -411,6 +411,10 @@  pop_mpls(struct dp_packet *packet, ovs_be16 ethtype)
         /* Shift the l2 header forward. */
         memmove((char*)dp_packet_data(packet) + MPLS_HLEN, dp_packet_data(packet), len);
         dp_packet_resize_l2_5(packet, -MPLS_HLEN);
+
+        /* Invalidate offload flags as they are not valid after
+         * decapsulation of MPLS header. */
+        dp_packet_reset_offload(packet);
     }
 }