From patchwork Tue Nov 5 12:52:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1189675 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.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=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="AB56OxiU"; 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 476qMq5XFSz9sPZ for ; Tue, 5 Nov 2019 23:53:11 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 23FD6DC8; Tue, 5 Nov 2019 12:53:09 +0000 (UTC) X-Original-To: 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 99ADAAD8 for ; Tue, 5 Nov 2019 12:53:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 10CF98A0 for ; Tue, 5 Nov 2019 12:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572958385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3+pzSH1hAGtcRH83txTtTyR3i/1x/QG/Xizl4EEriXM=; b=AB56OxiUT1J6W3hpL8KmXmTcAE1BNjHla5L6ZNvVATH8MDTxlF7RN99fXd/Ewy5rMcMVS6 Ttse/0ZIhiYuoUlu1c+FohzmXhTL3KRxeaJ9Ndo/MyHJfe1IL+BqWDqVvP8bjqSxm7cqel 9gFwP1tZH6sUM1KuwgLbpc3yJr5lIvM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-2ZdJupuwPGGvImIiSfyeqA-1; Tue, 05 Nov 2019 07:53:03 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 61EA1477; Tue, 5 Nov 2019 12:53:02 +0000 (UTC) Received: from dceara.remote.csb (ovpn-117-128.ams2.redhat.com [10.36.117.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC3995C553; Tue, 5 Nov 2019 12:53:00 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Tue, 5 Nov 2019 13:52:49 +0100 Message-Id: <20191105125242.4760.67348.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 2ZdJupuwPGGvImIiSfyeqA-1 X-Mimecast-Spam-Score: 0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,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: hzhou@ovn.org Subject: [ovs-dev] [RFC PATCH v2 ovn 0/5] Add CoPP (Control Plane Protection). 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 This series adds support for user configured control plane protection policies. Such policies are implemented through OVS meters and are useful for protecting ovn-controller from being overloaded by control traffic (any type of traffic that requires ovn-controller additional processing). First, logical flows are extended to allow ovn-northd to refer to a specific Meter that would be used when traffic matching logical flows is punted to ovn-controller. The following commit builds the infrastructure required for configuring control plane policies and adds code to ovn-northd to allow creation of logical flows that have an associated control meter. Then CoPP is implemented for all types of traffic that currently gets punted to ovn-controller. CoPP can be applied at different levels: logical switch port, logical router port, logical switch, logical router. Whenever a CoPP policy is configured for a logical port, it will take precedence over the policy configured at router/switch level. However, per port CoPP policies are allowed only for types of traffic that are currently handled by ovn-northd through logical flows that also match on "inport". This could be further refined by follow-up commits. Post-RFC remaining items: - add autotests for CoPP Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2019-September/362732.html CC: Han Zhou CC: Numan Siddique > Signed-off-by: Dumitru Ceara Dumitru Ceara (5): ovn-controller: Add support for Logical_Flow control meters. ovn-northd: Add support for CoPP. ovn-northd: Add CoPP policies for flows that punt packets to ovn-controller. ovn-northd: Extend metering to Controller-Events NEWS: Add CoPP support. NEWS | 1 controller/lflow.c | 37 ++++ controller/ofctrl.c | 29 +++ controller/ofctrl.h | 13 + controller/physical.c | 3 include/ovn/actions.h | 3 lib/actions.c | 104 ++++------- lib/automake.mk | 2 lib/copp.c | 99 +++++++++++ lib/copp.h | 58 ++++++ northd/ovn-northd.c | 300 ++++++++++++++++++++++----------- ovn-nb.ovsschema | 24 ++- ovn-nb.xml | 91 ++++++++++ ovn-sb.ovsschema | 6 - ovn-sb.xml | 6 + tests/ovn.at | 3 utilities/ovn-nbctl.8.xml | 94 ++++++++++ utilities/ovn-nbctl.c | 412 +++++++++++++++++++++++++++++++++++++++++++++ 18 files changed, 1099 insertions(+), 186 deletions(-) create mode 100644 lib/copp.c create mode 100644 lib/copp.h --- v2: - Address Han's comment and split the RFC in a series. - Simplify a bit the logic of applying CoPP on logical ports.