From patchwork Fri Jul 19 05:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Li,Rongqing via dev" X-Patchwork-Id: 1133903 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=none (p=none dis=none) header.from=openvswitch.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=altencalsoftlabs.com header.i=@altencalsoftlabs.com header.b="KoJbBS5J"; 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 45qfkh1nnxz9s3l for ; Fri, 19 Jul 2019 15:31:38 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4328E21A8; Fri, 19 Jul 2019 05:31:34 +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 90BA4215B for ; Fri, 19 Jul 2019 05:31:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.altencalsoftlabs.com (mail.altencalsoftlabs.com [182.73.72.41]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8D064F8 for ; Fri, 19 Jul 2019 05:31:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.altencalsoftlabs.com (Postfix) with ESMTP id E51E4442175A for ; Fri, 19 Jul 2019 11:01:16 +0530 (IST) Received: from mail.altencalsoftlabs.com ([127.0.0.1]) by localhost (mail.altencalsoftlabs.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RzsDlpQ-q0N4; Fri, 19 Jul 2019 11:01:16 +0530 (IST) Received: from localhost (localhost [127.0.0.1]) by mail.altencalsoftlabs.com (Postfix) with ESMTP id 3E6354421757; Fri, 19 Jul 2019 11:01:16 +0530 (IST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.altencalsoftlabs.com 3E6354421757 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altencalsoftlabs.com; s=selector; t=1563514276; bh=zmrEtFj01zbPKgsWz7AOxed4mfYBpzlD9VfNhJITHYs=; h=From:To:Date:Message-Id:MIME-Version; b=KoJbBS5JmkuzQ50jfV6Pbynvr/MLnRjx/OArVckD1OB+1jPDujAkWcmUhaoRFlv37 0lRqdTKboNVHju173y0BVA2V50y/TFPZSg0E6QlIKu2YcT6uXjunn7ZQPvoNurX3gp UoWvdOp6+sUkz92pD29RqRmDfkX5+Lvfs/tnm9W0= X-Virus-Scanned: amavisd-new at altencalsoftlabs.com Received: from mail.altencalsoftlabs.com ([127.0.0.1]) by localhost (mail.altencalsoftlabs.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Y7qP8l2nw2IA; Fri, 19 Jul 2019 11:01:16 +0530 (IST) Received: from localhost.localdomain (unknown [10.1.0.4]) by mail.altencalsoftlabs.com (Postfix) with ESMTPSA id 6ACDE442173A; Fri, 19 Jul 2019 11:01:15 +0530 (IST) To: ovs-dev@openvswitch.org Date: Fri, 19 Jul 2019 11:05:19 +0530 Message-Id: <1563514519-11061-1-git-send-email-rudrasurya.r@altencalsoftlabs.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Surya Rudra Subject: [ovs-dev] [PATCH] ofproto-dpif: Fix for recirc issue with mpls traffic with dp_hash 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: , X-Patchwork-Original-From: Surya Rudra via dev From: "Li,Rongqing via dev" Reply-To: Surya Rudra Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Fix infinite recirculation loop for MPLS packets sent to dp_hash-based select group Issue: When a MPLS encapsulated packet is received, the MPLS header is removed, a recirculation id assigned and then recirculated into the pipeline. If the flow rules require the packet to be then sent over DP-HASH based select group buckets, the packet has to be recirculated again. However, the same recirculation id was used and this resulted in the packet being repeatedly recirculated until it got dropped because the maximum recirculation limit was hit. Fix: Include the “was_mpls” boolean which indicates whether the packet was MPLS encapsulated when computing the hash. After popping the MPLS header this will result in a different hash value than before and new recirculation id will get generated. DPCTL flows with and without the fix are shown below Without Fix: recirc_id(0x1),dp_hash(0x5194bf18/0xf),in_port(2),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:20, bytes:1960, used:0.329s, actions:1 recirc_id(0x1),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800), ipv4(frag=no), packets:20, bytes:1960, used:0.329s, actions:hash(sym_l4(0)),recirc(0x1) recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x8847), mpls(label=22/0xfffff,tc=0/0,ttl=64/0x0,bos=1/1), packets:20, bytes:2040, used:0.329s, actions:pop_mpls(eth_type=0x800),recirc(0x1) With Fix: recirc_id(0x2),dp_hash(0x5194bf18/0xf),in_port(3),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:12481, bytes:1223138, used:0.588s, actions:1 recirc_id(0x1),in_port(3),packet_type(ns=0,id=0),eth_type(0x0800), ipv4(frag=no), packets:74431, bytes:7294238, used:0.386s, actions:hash(sym_l4(0)),recirc(0x2) recirc_id(0x2),dp_hash(0xb952470d/0xf),in_port(3),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:12441, bytes:1219218, used:0.482s, actions:1 recirc_id(0x2),dp_hash(0xeff6ad76/0xf),in_port(3),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:12385, bytes:1213730, used:0.908s, actions:1 recirc_id(0),in_port(3),packet_type(ns=0,id=0),eth_type(0x8847), mpls(label=22/0xfffff,tc=0/0,ttl=64/0x0,bos=1/1), packets:74431, bytes:7591962, used:0.386s, actions:pop_mpls(eth_type=0x800),recirc(0x1) recirc_id(0x2),dp_hash(0xb6233fbe/0xf),in_port(3),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:12369, bytes:1212162, used:0.386s, actions:1 recirc_id(0x2),dp_hash(0xa3670459/0xf),in_port(3),packet_type(ns=0,id=0), eth_type(0x0800),ipv4(frag=no), packets:24751, bytes:2425598, used:0.483s, actions:1 Signed-off-by: Surya Rudra Signed-off-by: Surya Rudra Signed-off-by: Surya Rudra --- ofproto/ofproto-dpif-rid.c | 2 ++ ofproto/ofproto-dpif-rid.h | 1 + ofproto/ofproto-dpif-xlate.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ofproto/ofproto-dpif-rid.c b/ofproto/ofproto-dpif-rid.c index 79412c2..29aafc2 100644 --- a/ofproto/ofproto-dpif-rid.c +++ b/ofproto/ofproto-dpif-rid.c @@ -130,6 +130,7 @@ frozen_state_hash(const struct frozen_state *state) hash = hash_bytes64((const uint64_t *) &state->metadata, sizeof state->metadata, hash); hash = hash_boolean(state->conntracked, hash); + hash = hash_boolean(state->was_mpls, hash); if (state->stack && state->stack_size) { hash = hash_bytes(state->stack, state->stack_size, hash); } @@ -158,6 +159,7 @@ frozen_state_equal(const struct frozen_state *a, const struct frozen_state *b) && !memcmp(a->stack, b->stack, a->stack_size) && a->mirrors == b->mirrors && a->conntracked == b->conntracked + && a->was_mpls == b->was_mpls && ofpacts_equal(a->ofpacts, a->ofpacts_len, b->ofpacts, b->ofpacts_len) && ofpacts_equal(a->action_set, a->action_set_len, diff --git a/ofproto/ofproto-dpif-rid.h b/ofproto/ofproto-dpif-rid.h index ab5b87a..147ef9c 100644 --- a/ofproto/ofproto-dpif-rid.h +++ b/ofproto/ofproto-dpif-rid.h @@ -143,6 +143,7 @@ struct frozen_state { size_t stack_size; mirror_mask_t mirrors; /* Mirrors already output. */ bool conntracked; /* Conntrack occurred prior to freeze. */ + bool was_mpls; /* MPLS packet */ struct uuid xport_uuid; /* UUID of 1st port packet received on. */ /* Actions to be translated when thawing. */ diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 73966a4..d4edf9c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4764,6 +4764,7 @@ xlate_controller_action(struct xlate_ctx *ctx, int len, .stack_size = ctx->stack.size, .mirrors = ctx->mirrors, .conntracked = ctx->conntracked, + .was_mpls = ctx->was_mpls, .ofpacts = NULL, .ofpacts_len = 0, .action_set = NULL, @@ -4838,6 +4839,7 @@ finish_freezing__(struct xlate_ctx *ctx, uint8_t table) .stack_size = ctx->stack.size, .mirrors = ctx->mirrors, .conntracked = ctx->conntracked, + .was_mpls = ctx->was_mpls, .xport_uuid = ctx->xin->xport_uuid, .ofpacts = ctx->frozen_actions.data, .ofpacts_len = ctx->frozen_actions.size,