From patchwork Fri Apr 5 13:26:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ? ? X-Patchwork-Id: 1078406 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="Us3mF0UH"; 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 44bLFp5jFmz9sPW for ; Sat, 6 Apr 2019 00:27:10 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9881B246D; Fri, 5 Apr 2019 13:27:08 +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 CD8E1245F for ; Fri, 5 Apr 2019 13:26:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-oln040092254099.outbound.protection.outlook.com [40.92.254.99]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1AD24852 for ; Fri, 5 Apr 2019 13:26:32 +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=MIYx94bwtEwHuhh6vAXbd8JyKjU5qML60wy3joVxKFg=; b=Us3mF0UHFyTlqmV+p616AJBLDy0Off/xTCY32QCptxm7DPxON7JVaARmLp7XSr+s20tQwhwe2MJ21sVTK/AHFtlYBZ5pzTTzd9kn3WN8DKNF533siUHRkTH8RhEgM9dJy6a5OE0MaIhggVGJe9iHbVb9pltwn05+HAOCESwzwgIbFGSuVJswLbsoOGDGYkYJbpL+PrIogF7JqNSpedJGudscp3a4ndPYa9+67G15Fqex4ISmiVEp/vlAQlzZFIzs9iVfqankK3b/zbT1YsLKYdoSKdenC2yypBdDdPBIRPC4sw65K9cwNk9qtJm2cvdX43u9feyCeD1nQEYceAtDzQ== Received: from SG2APC01FT062.eop-APC01.prod.protection.outlook.com (10.152.250.52) by SG2APC01HT098.eop-APC01.prod.protection.outlook.com (10.152.251.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1750.16; Fri, 5 Apr 2019 13:26:29 +0000 Received: from SG2PR03MB3960.apcprd03.prod.outlook.com (10.152.250.56) by SG2APC01FT062.mail.protection.outlook.com (10.152.251.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.16 via Frontend Transport; Fri, 5 Apr 2019 13:26:29 +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; Fri, 5 Apr 2019 13:26:29 +0000 From: ? ? To: "ovs-dev@openvswitch.org" Thread-Topic: [PATCH] bond/mirror: fix duplicate output when mix bond and mirror Thread-Index: AdTrqBwMhpBtKilTSxuOsSTX5kvSrwACtLWw Date: Fri, 5 Apr 2019 13:26:29 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:69020468EF4B4D18CE6AE5AEB09D8F8BD20E00453A6FDF4FC97B37BD9F135F75; UpperCasedChecksum:71885BC07B750BB46BFD74306E086B21C5D55B0915FFE21FB027449ADC4744F2; SizeAsReceived:6785; Count:42 x-tmn: [Na6oy1zHm2ElIykJNujWHqnpDeJJtKskrYoCzkzsnsk=] x-ms-publictraffictype: Email x-incomingheadercount: 42 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:SG2APC01HT098; x-ms-traffictypediagnostic: SG2APC01HT098: x-microsoft-antispam-message-info: MmiPR0SoXrhivOmYXMXKTwyf2Vd//PuDWUQ26UAjLQFjzIyHucOlSmUmX4l7RQhA 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: e02e9794-fddb-43a7-028f-08d6b9ca4fbc X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2019 13:26:29.1277 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2APC01HT098 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 Cc: "hanxueluo@gmail.com" 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 is duplicated output. 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 output. 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