From patchwork Tue Aug 13 17:49:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitin Katiyar X-Patchwork-Id: 1146160 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="BN4qt+L5"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4677G66q5Jz9s7T for ; Tue, 13 Aug 2019 19:49:02 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 19D58BA9; Tue, 13 Aug 2019 09:48:59 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id DF7FEB62 for ; Tue, 13 Aug 2019 09:48:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3734CCF for ; Tue, 13 Aug 2019 09:48:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1565689735; x=1568281735; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Qe8SOP8AiALQtiZ21SlIYsNLVK93xu/APjQdmlKEBYM=; b=BN4qt+L5cIeK/2feXXLbAI+I1ZqCnP37JRjGOnjkqgNb/+8v5BC3AAZKmdwCwUCO bnQAE+lm+uywvnOe6A6TftW5vahMuhczUjoCM3zPDHhzm+sm77jihunPaghcDbfy vV1TinghVLGowHYtjl6jos+G+obKvYZggEMkQDrtCz0=; X-AuditID: c1b4fb30-6ddff70000001814-49-5d528787a9bd Received: from ESESSMB505.ericsson.se (Unknown_Domain [153.88.183.123]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id FF.C4.06164.787825D5; Tue, 13 Aug 2019 11:48:55 +0200 (CEST) Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMB505.ericsson.se (153.88.183.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 13 Aug 2019 11:48:55 +0200 Received: from ESESSHC003.ericsson.se (153.88.183.27) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256) id 15.1.1713.5 via Frontend Transport; Tue, 13 Aug 2019 11:48:55 +0200 Received: from ESGSCHC001.ericsson.se (146.11.116.68) by ESESSHC003.ericsson.se (153.88.183.27) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 13 Aug 2019 11:48:55 +0200 Received: from localhost.localdomain (146.11.116.127) by smtps-ao.internal.ericsson.com (146.11.116.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 13 Aug 2019 17:48:49 +0800 From: Nitin Katiyar To: Date: Tue, 13 Aug 2019 23:19:47 +0530 Message-ID: <1565718587-3178-1-git-send-email-nitin.katiyar@ericsson.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [146.11.116.127] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLLMWRmVeSWpSXmKPExsUyM2J7tW57e1CswYpWFYu5n54zOjB6PLv5 nzGAMYrLJiU1J7MstUjfLoEr4/e6GywF37grln16xNjAuJ6zi5GTQ0LAROLNl2bmLkYuDiGB o4wSX96+YIRwvjFKTP69lwnC6WSSuLD9JiuEs5lRov3eKajMbkaJZ2vnsoAMYxMwkNh+cRI7 iC0iICvRsOEfUJyDg1lAT2LBXlaQsLCAn8Snlw/BbBYBVYk7rbuYQGxeAU+J5839LBA3yUmc PDaZFSIuKHFy5hOwOLOAhMTBFy+YQWwhAXWJJ4+6mSDqlSSefVvOOoFRcBaSlllIWhYwMq1i FC1OLU7KTTcy0kstykwuLs7P08tLLdnECAzEg1t+G+xgfPnc8RCjAAejEg/v2y3isUKsiWXF lbmHGCU4mJVEeCXPicQK8aYkVlalFuXHF5XmpBYfYpTmYFES513v/S9GSCA9sSQ1OzW1ILUI JsvEwSnVwJjwz/9EesH8R/ODblaf5Y+3+fZreu0LDoFPMye8/XypxNIsNPf1mUMm5xy3bjK+ 58N3YO7fVXeqjne5qamUdT9KvKnwyfjR3nOBNrJyGazXxc837NrDF1zovSnispg6l6uo+Zxu aaEDrtMfnTlt+256jsSF6Ln/3nmZL5n57v8mm3TNtSKNEw8psRRnJBpqMRcVJwIApwU7nUAC AAA= X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Nitin Katiyar Subject: [ovs-dev] [PATCH] Improve MPLSoGRE performance by reducing EMC hash collisions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 severely. This patch invalides RSS hash after MPLS header is popped. Signed-off-by: Nitin Katiyar --- 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);