From patchwork Sat Apr 6 13:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ? ? X-Patchwork-Id: 1079395 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=hotmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=hotmail.com header.i=@hotmail.com header.b="NtzTQJmo"; 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 44byxP3Tkqz9sPn for ; Sun, 7 Apr 2019 01:00:08 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id C0C15289E; Sat, 6 Apr 2019 14:00:04 +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 4F0A2289A for ; Sat, 6 Apr 2019 13:59:16 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-oln040092255085.outbound.protection.outlook.com [40.92.255.85]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9C79A83A for ; Sat, 6 Apr 2019 13:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1SaUfbYops76uIL64VW8o40OE1TH0FWypt/Oj0ZEywQ=; b=NtzTQJmom4IsibmVxzPO7LvAptgiWYVRiVakZ8MLRSJFpWAxUI2snq+OPWZNiqhlFXVaU2ynZSa2KEMxJGgsukHB2j+BeRwV6Eol0TzLkqC8kkXTaVFRGny9D3tk9olspRXMWBbS1TOIjCBQ+/65u4d1/pu+mhENogBpoCGiTdBITk+j76sHIbvUMtkI7Cj0FG9o7yY2CKZbmoVaPmMGC0ZeeuJ3H/1Dft0EfnUu3dAp1AEzsGeGAd1TxIeUsLR+mNgEb6QdS3YOMM93o0eyLG6D/Fb1iagif2z01IqWGCA7w4opwr825NymIv6AVzKll9zociJ1GAFogZPgwXeqVw== Received: from HK2APC01FT036.eop-APC01.prod.protection.outlook.com (10.152.248.52) by HK2APC01HT141.eop-APC01.prod.protection.outlook.com (10.152.248.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16; Sat, 6 Apr 2019 13:59:13 +0000 Received: from SG2PR03MB3960.apcprd03.prod.outlook.com (10.152.248.53) by HK2APC01FT036.mail.protection.outlook.com (10.152.249.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1771.16 via Frontend Transport; Sat, 6 Apr 2019 13:59:13 +0000 Received: from SG2PR03MB3960.apcprd03.prod.outlook.com ([fe80::c434:f7c8:7af6:bdc3]) by SG2PR03MB3960.apcprd03.prod.outlook.com ([fe80::c434:f7c8:7af6:bdc3%3]) with mapi id 15.20.1771.007; Sat, 6 Apr 2019 13:59:13 +0000 From: ? ? To: "ovs-dev@openvswitch.org" Thread-Topic: [PATCH] bond/mirror: fix duplicate output when mix bond and mirror Thread-Index: AdTrqBwMhpBtKilTSxuOsSTX5kvSrwA2JLIw Date: Sat, 6 Apr 2019 13:59:13 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:4A2AC7601F448982D42FEE5924AD5A76229584CD1260028124ABD562D80A3CFB; UpperCasedChecksum:24EBA4B010E73DC9C74AE371BA7D53832059383D745578D4400AE2D0DDB721BF; SizeAsReceived:6698; Count:41 x-tmn: [+wqULsfiwj9WH/hxaq87Q+h+SOtm5GZfX4dR14rCU5U=] x-ms-publictraffictype: Email x-incomingheadercount: 41 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(9118020)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045); SRVR:HK2APC01HT141; x-ms-traffictypediagnostic: HK2APC01HT141: x-microsoft-antispam-message-info: sMEMVK+Hkgtue51lbtBxHSL79nYc9nDC0a320carn2GY5SKymqMElkc7E5lDkzX6 MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: bc38575d-cb11-4523-a41e-08d6ba980cdc X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Apr 2019 13:59:13.2645 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT141 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 Subject: [ovs-dev] [PATCH] bond/mirror: fix duplicate output when mix bond and mirror 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 we configured bond that use recirc and configure mirror, we observed that mirror destination has duplicated outputs. This is because bond's frozen_state is not updated to reflect the mirror already composed the output, and when the companion recirc flow need to decide its action, the mirror again take effects, causing duplicate outputs. Signed-off-by: Shuang Huang --- ofproto/ofproto-dpif-xlate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index c4014d7..d4f10b7 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -2453,6 +2453,16 @@ output_normal(struct xlate_ctx *ctx, const struct xbundle *out_xbundle, compose_output_action(ctx, xport->ofp_port, use_recirc ? &xr : NULL, false, false); memcpy(&ctx->xin->flow.vlans, &old_vlans, sizeof(old_vlans)); + /* Store mirrors for bond that use recirc to avoid duplicate output */ + if (use_recirc) { + struct recirc_id_node *node = CONST_CAST( + struct recirc_id_node *, recirc_id_node_find(xr.recirc_id)); + if (node) { + struct frozen_state *state = + CONST_CAST(struct frozen_state *, &node->state); + state->mirrors = ctx->mirrors; + } + } } /* A VM broadcasts a gratuitous ARP to indicate that it has resumed after