From patchwork Mon Feb 3 10:32:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li,Rongqing via dev" X-Patchwork-Id: 1232703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.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=ericsson.com header.i=@ericsson.com header.a=rsa-sha256 header.s=selector1 header.b=gdPsHPtA; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48B4yQ4yvyz9sPK for ; Mon, 3 Feb 2020 22:16:13 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B38FB87598; Mon, 3 Feb 2020 11:16:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GrI5q7wulP8A; Mon, 3 Feb 2020 11:16:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 3EC91877FF; Mon, 3 Feb 2020 11:16:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2DAC9C1D80; Mon, 3 Feb 2020 11:16:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1E118C0174 for ; Mon, 3 Feb 2020 11:16:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1518E85F9B for ; Mon, 3 Feb 2020 11:16:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eo53lDHf9k+9 for ; Mon, 3 Feb 2020 11:16:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70084.outbound.protection.outlook.com [40.107.7.84]) by whitealder.osuosl.org (Postfix) with ESMTPS id CCFFE85A1D for ; Mon, 3 Feb 2020 11:16:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oj2u5Fp8YSzHNUXyDxPoe+RhIICp0l8EeX6Y4AMRcl+4JcMPT81WHd2GQz9YvjE4WpVT0CfEO9Dm5v7Cofm5Fo9isNGN+xaosss4FiGxZYVBAR7f72+UpbAvjmrxw7fD9yHw6Ma0vsDia+g4Zl9PLmjrYdmJmz3xdMZe2+wvtksrQQUadEnicOpEQiYyIgPgAXN8/s0TcRUkkXp8amlgtBVvHDC7aTTdzS9SJAZ5XovP3vvPEfRsGX55NdzgsipIay7V544hPZ3/x1KWKVVYZ0HJx6qirCUCAfaePzxmTJcbJLRH55SwK8a5z5p3o3FwxGuqRteBLGrX7lKnTKOsQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkmGidg0pKmbyZ9RGzkRBt7jQr5N3kkzB1bkpMmamX8=; b=ANsdainYAqHAMSFTXz9+9wG9I+hiN+0R0TqDAl+2k8tlc0T/i7yIWUcQt+KBOTsL3p68PrH6qoa6E9psYAu97rzKnMqIlbMwqvua5cHRLqCwszTSXp7tkgTNz/3g/1qD/r6C8yRzw+m+OPLJiTRt3Bh5/H7jOH4XtnBM2kBc0Uw/qetaZUf2xfbuuSJLJmL63QaAqajJzgsLzGPHuIEW2HTJOwvQR+srr96BJ1WsMn5e8nOHjtYgIEnBPF46br7yXunUYDPo+/uvtjm0ZYJ1Cfyy5QO9gm6CxtxOeO5RVihrZzF97PX6NwsC9Mdfh6TMBYOi0vm3UpA5nCAxlADX/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mkmGidg0pKmbyZ9RGzkRBt7jQr5N3kkzB1bkpMmamX8=; b=gdPsHPtAIYYqjr6qcq+0CKMNevpLFItLoBlsfelqI9cNNWQ9UP78ARRe4o+q3sKmdmUOzFyg58RVWjNVHJqEJgB1BBOK/reazYyh3/PRk9eoPjfSIZgvgQcAkXB0VopG6X6gXZ/W8KumAAYtC6yDUV/xxGK9Crqgdd8U9G/GJx0= Received: from AM0PR07CA0016.eurprd07.prod.outlook.com (2603:10a6:208:ac::29) by AM0PR0702MB3746.eurprd07.prod.outlook.com (2603:10a6:208:1d::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.18; Mon, 3 Feb 2020 10:42:42 +0000 Received: from VE1EUR02FT064.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e06::205) by AM0PR07CA0016.outlook.office365.com (2603:10a6:208:ac::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2707.10 via Frontend Transport; Mon, 3 Feb 2020 10:42:42 +0000 Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; openvswitch.org; dkim=none (message not signed) header.d=none;openvswitch.org; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT064.mail.protection.outlook.com (10.152.13.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2686.25 via Frontend Transport; Mon, 3 Feb 2020 10:42:42 +0000 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 3 Feb 2020 11:42:38 +0100 Received: from ubuntu-16.04 (153.88.183.153) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 3 Feb 2020 11:42:37 +0100 To: Date: Mon, 3 Feb 2020 11:32:46 +0100 Message-ID: <1580725966-9177-1-git-send-email-vishal.deep.ajmera@ericsson.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [153.88.183.153] X-ClientProxiedBy: ESESBMB501.ericsson.se (153.88.183.168) To ESESSMB501.ericsson.se (153.88.183.162) X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(346002)(376002)(39860400002)(199004)(189003)(7636002)(86362001)(356004)(6666004)(6916009)(36756003)(246002)(107886003)(5660300002)(4326008)(336012)(956004)(2616005)(2906002)(8936002)(16526019)(26005)(186003)(478600001)(316002)(70586007)(70206006)(54906003)(8676002)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0702MB3746; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 52b96ffc-fab3-4208-ae15-08d7a895cc10 X-MS-TrafficTypeDiagnostic: AM0PR0702MB3746: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-Forefront-PRVS: 0302D4F392 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jJDGESRdpZ4B6kKlgfr8aG4LS8s1fztcTBg6uOzMXMPvcV8IbL4n1bo0u81Hw0v6L2+Kj8X97P2kHWFifMuljKcxL0iPzWRbgAPIpWllOO6u+WGjimTpoSoshubfwH4Gg0fF+b8z46vmytHDq4OtZT+SdpGqYcqiOoh97ZssgYVKDaYVKzulOwRo6viqYu6u/5WlvijEiOdxx1rK5feFf1gFX9ajROhKgn2QO0Q8stlBeKLGt77xLp0EaPT2W+vyhXCQAphhO67zBPZSkWlb9YNpCEtTqHAY0I7dTailHJETv/Wyj46yC7hobFzyFknUzU1OMTqllZYdGNT0L36PLZNTbeBLLaJy0HyP6H46stG8Yx77FupYVGFQzyGTFXXyU+RuRfvwyTThi6SPUGR5N9O8PfMDoivXpEOrZJyHDI72kNi2KeYIaZ/0N+wa+NsCV2SuDLRDaPjgCOOOEUPt4YFGLMHMyF/bnT3IU4de/cIGy7pZQer/ibE6njSz37zp X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2020 10:42:42.2712 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52b96ffc-fab3-4208-ae15-08d7a895cc10 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0702MB3746 Subject: [ovs-dev] [PATCH repost] ofproto: Add support to watch controller port liveness in fast-failover group X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vishal Deep Ajmera via dev From: "Li,Rongqing via dev" Reply-To: Vishal Deep Ajmera Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Currently fast-failover group does not support checking liveness of controller port (OFPP_CONTROLLER). However this feature can be useful for selecting alternate pipeline when controller connection itself is down for e.g. by using local DHCP server to reply for any DHCP request originating from VMs. This patch adds the support for watching controller port liveness in fast- failover group. Controller port is considered live when atleast one of-connection is alive. Example usage: ovs-ofctl add-group br-int 'group_id=1234,type=ff, bucket=watch_port:CONTROLLER,actions:, bucket=watch_port:1,actions: Signed-off-by: Vishal Deep Ajmera --- NEWS | 1 + lib/ofp-group.c | 3 ++- ofproto/ofproto-dpif-xlate.c | 5 ++++- ofproto/ofproto-dpif.c | 10 ++++++++++ ofproto/ofproto-dpif.h | 3 +++ ofproto/ofproto.c | 3 ++- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9bbe71d..354291a 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Post-v2.13.0 - OpenFlow: * The OpenFlow ofp_desc/serial_num may now be configured by setting the value of other-config:dp-sn in the Bridge table. + * Added support to watch CONTROLLER port status in fast failover group. v2.13.0 - xx xxx xxxx diff --git a/lib/ofp-group.c b/lib/ofp-group.c index b675e80..bf0f8af 100644 --- a/lib/ofp-group.c +++ b/lib/ofp-group.c @@ -660,7 +660,8 @@ parse_bucket_str(struct ofputil_bucket *bucket, char *str_, } else if (!strcasecmp(key, "watch_port")) { if (!ofputil_port_from_string(value, port_map, &bucket->watch_port) || (ofp_to_u16(bucket->watch_port) >= ofp_to_u16(OFPP_MAX) - && bucket->watch_port != OFPP_ANY)) { + && bucket->watch_port != OFPP_ANY + && bucket->watch_port != OFPP_CONTROLLER)) { error = xasprintf("%s: invalid watch_port", value); } } else if (!strcasecmp(key, "watch_group")) { diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 0b45ecf..adf57a5 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -1888,9 +1888,12 @@ bucket_is_alive(const struct xlate_ctx *ctx, return (!ofputil_bucket_has_liveness(bucket) || (bucket->watch_port != OFPP_ANY + && bucket->watch_port != OFPP_CONTROLLER && odp_port_is_alive(ctx, bucket->watch_port)) || (bucket->watch_group != OFPG_ANY - && group_is_alive(ctx, bucket->watch_group, depth + 1))); + && group_is_alive(ctx, bucket->watch_group, depth + 1)) + || (bucket->watch_port == OFPP_CONTROLLER + && ofproto_is_alive(&ctx->xbridge->ofproto->up))); } static void diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 0222ec8..65f214a 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1798,6 +1798,7 @@ run(struct ofproto *ofproto_) { struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_); uint64_t new_seq, new_dump_seq; + bool is_connected; if (mbridge_need_revalidate(ofproto->mbridge)) { ofproto->backer->need_revalidate = REV_RECONFIGURE; @@ -1866,6 +1867,15 @@ run(struct ofproto *ofproto_) ofproto->backer->need_revalidate = REV_MCAST_SNOOPING; } + /* Check if controller connection is toggled. */ + is_connected = ofproto_is_alive(&ofproto->up); + if (ofproto->is_controller_connected != is_connected) { + ofproto->is_controller_connected = is_connected; + /* Trigger revalidation as fast failover group monitoring + * controller port may need to check liveness again. */ + ofproto->backer->need_revalidate = REV_RECONFIGURE; + } + new_dump_seq = seq_read(udpif_dump_seq(ofproto->backer->udpif)); if (ofproto->dump_seq != new_dump_seq) { struct rule *rule, *next_rule; diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index c9d5df3..aee61d6 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -342,6 +342,9 @@ struct ofproto_dpif { struct guarded_list ams; /* Contains "struct ofproto_async_msgs"s. */ struct seq *ams_seq; /* For notifying 'ams' reception. */ uint64_t ams_seqno; + + bool is_controller_connected; /* True if any controller admitted this + * switch connection. */ }; struct ofproto_dpif *ofproto_dpif_lookup_by_name(const char *name); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e259128..0fbd6c3 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1906,7 +1906,8 @@ ofproto_wait(struct ofproto *p) bool ofproto_is_alive(const struct ofproto *p) { - return connmgr_has_controllers(p->connmgr); + return (connmgr_has_controllers(p->connmgr) + && connmgr_is_any_controller_admitted(p->connmgr)); } /* Adds some memory usage statistics for 'ofproto' into 'usage', for use with