From patchwork Mon Dec 19 16:18:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717476 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hhh52CYF; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbQ075432z1ydb for ; Tue, 20 Dec 2022 03:19:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 15C69408CA; Mon, 19 Dec 2022 16:19:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 15C69408CA Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hhh52CYF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IBSrQFcim6gg; Mon, 19 Dec 2022 16:19:49 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id E313E408B6; Mon, 19 Dec 2022 16:19:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org E313E408B6 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B6A14C00D5; Mon, 19 Dec 2022 16:19:46 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 22288C0092 for ; Mon, 19 Dec 2022 16:19:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 04D50814BA for ; Mon, 19 Dec 2022 16:18:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 04D50814BA Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hhh52CYF X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pfAHVES3qe2z for ; Mon, 19 Dec 2022 16:18:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4BF3E812C5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4BF3E812C5 for ; Mon, 19 Dec 2022 16:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466713; 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: in-reply-to:in-reply-to:references:references; bh=6wKKZb8dD0XN92iHNF3O8AkmBdoE5JZF0Va8mAsaAgI=; b=hhh52CYFendE7Aag6OUVDFHA9FXZQucUqTv5bucTm+1ua0Miw55+bvheGw5yeYbXAuU7qo oRQQD7dmYfNowJNNBc/XyWwhDBeVsejXcx3pGQF9VAZQRHM2cAbY4KXkMz1O16LI8ADaCp cESKaoqn9+nfieNb43cFmwOOZeaYD70= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-X-JlaAl2MxSD-JjrY-mMKg-1; Mon, 19 Dec 2022 11:18:24 -0500 X-MC-Unique: X-JlaAl2MxSD-JjrY-mMKg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 168AE2A59557 for ; Mon, 19 Dec 2022 16:18:24 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59D392026D4B; Mon, 19 Dec 2022 16:18:23 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:09 +0100 Message-Id: <20221219161814.55422-2-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/6] controller: fix recompute pflows if sampling changes 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The engine handler needs to return "false" in order to trigger a full recompute of the physical flows. Fixes: a42c808f30b4 ("northd: add drop sampling") Signed-off-by: Adrian Moreno --- controller/ovn-controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index f0fd24820..88eeee2d9 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -3779,10 +3779,11 @@ pflow_output_sb_sb_global_handler(struct engine_node *node, void *data) if (pfo->debug.collector_set_id != collector_set_id || pfo->debug.obs_domain_id != obs_domain_id) { - engine_set_node_state(node, EN_UPDATED); pfo->debug.collector_set_id = collector_set_id; pfo->debug.obs_domain_id = obs_domain_id; + return false; } + engine_set_node_state(node, EN_UPDATED); return true; } From patchwork Mon Dec 19 16:18:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f7M2gVtL; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbPzc4j14z1ydb for ; Tue, 20 Dec 2022 03:19:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8C5E680C3E; Mon, 19 Dec 2022 16:19:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 8C5E680C3E Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f7M2gVtL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TLCUhJfnV2gL; Mon, 19 Dec 2022 16:19:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id AC33380C3B; Mon, 19 Dec 2022 16:19:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org AC33380C3B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7A30EC008D; Mon, 19 Dec 2022 16:19:20 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 85711C0088 for ; Mon, 19 Dec 2022 16:19:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BCBCA8125A for ; Mon, 19 Dec 2022 16:18:28 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org BCBCA8125A X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y_a18Br0F8TA for ; Mon, 19 Dec 2022 16:18:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 916A880898 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 916A880898 for ; Mon, 19 Dec 2022 16:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466706; 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: in-reply-to:in-reply-to:references:references; bh=MUGGlJwpxWSWHKbpIPiLJq/RAXSJWCUzW0/SbYTWhes=; b=f7M2gVtLI8/EbYFFBVlW59qOiFU1zVIlnqcxs/n0oCKPNhHPWb9r2IXHIL8p8GBSv5oF2I FIlpabjI79aeCJqQ0DyZPOgYfaB1k7oOy7HTuQa0ANb0jZcsS34dU/JU1c9O94+Q6sWN+W IIb0hMIRlp8drGNGdDNtJb4Ky+/Gehk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-38-jvBPGEU7Pb6Pci178ShHkg-1; Mon, 19 Dec 2022 11:18:25 -0500 X-MC-Unique: jvBPGEU7Pb6Pci178ShHkg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20D1685C06A for ; Mon, 19 Dec 2022 16:18:25 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FE6D2026D4B; Mon, 19 Dec 2022 16:18:24 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:10 +0100 Message-Id: <20221219161814.55422-3-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/6] northd: fix unsampled drops and unit test 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Some drops were left unsampled and a change in IFS made the test fail to detect them. This patch fixes it. Fixes: a42c808f30b4 ("northd: add drop sampling") Signed-off-by: Adrian Moreno Acked-by: Mark Michelson Acked-by: Mark Michelson --- northd/northd.c | 17 ++++++++++------- tests/ovn.at | 7 +++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 7c48bb3b4..beba219d6 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -5557,7 +5557,7 @@ build_lswitch_port_sec_op(struct ovn_port *op, struct hmap *lflows, ds_put_format(match, "outport == %s", op->json_key); ovn_lflow_add_with_lport_and_hint( lflows, op->od, S_SWITCH_IN_L2_UNKNOWN, 50, ds_cstr(match), - "drop;", op->key, &op->nbsp->header_); + debug_drop_action(), op->key, &op->nbsp->header_); return; } @@ -5651,7 +5651,7 @@ build_lswitch_output_port_sec_od(struct ovn_datapath *od, REGBIT_PORT_SEC_DROP" = check_out_port_sec(); next;"); ovn_lflow_add(lflows, od, S_SWITCH_OUT_APPLY_PORT_SEC, 50, - REGBIT_PORT_SEC_DROP" == 1", "drop;"); + REGBIT_PORT_SEC_DROP" == 1", debug_drop_action()); ovn_lflow_add(lflows, od, S_SWITCH_OUT_APPLY_PORT_SEC, 0, "1", "output;"); @@ -6587,7 +6587,8 @@ build_acls(struct ovn_datapath *od, const struct chassis_features *features, struct hmap *lflows, const struct hmap *port_groups, const struct shash *meter_groups) { - const char *default_acl_action = default_acl_drop ? "drop;" : "next;"; + const char *default_acl_action = default_acl_drop ? debug_drop_action() : + "next;"; bool has_stateful = od->has_stateful_acl || od->has_lb_vip; const char *ct_blocked_match = features->ct_no_masked_label ? "ct_mark.blocked" @@ -6656,7 +6657,7 @@ build_acls(struct ovn_datapath *od, const struct chassis_features *features, REGBIT_CONNTRACK_COMMIT" = 1; next;"); default_acl_action = default_acl_drop - ? "drop;" + ? debug_drop_action() : REGBIT_CONNTRACK_COMMIT" = 1; next;"; ovn_lflow_add(lflows, od, S_SWITCH_IN_ACL, 1, "ip && !ct.est", default_acl_action); @@ -8964,7 +8965,8 @@ build_lswitch_ip_unicast_lookup(struct ovn_port *op, * or IPv6 addresses (or both). */ struct eth_addr mac; bool lsp_enabled = lsp_is_enabled(op->nbsp); - char *action = lsp_enabled ? "outport = %s; output;" : "drop;"; + const char *action = lsp_enabled ? "outport = %s; output;" : + debug_drop_action(); if (ovs_scan(op->nbsp->addresses[i], ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mac))) { ds_clear(match); @@ -12763,12 +12765,13 @@ build_gateway_redirect_flows_for_lrouter( nat_entry_is_v6(nat) ? "6" : "4", nat->nb->external_ip); ovn_lflow_add(lflows, od, S_ROUTER_IN_GW_REDIRECT, 70, - ds_cstr(&match_ext), "drop;"); + ds_cstr(&match_ext), debug_drop_action()); add_def_flow = false; } } else if (nat->nb->exempted_ext_ips) { ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_GW_REDIRECT, - 75, ds_cstr(&match_ext), "drop;", + 75, ds_cstr(&match_ext), + debug_drop_action(), stage_hint); } ds_destroy(&match_ext); diff --git a/tests/ovn.at b/tests/ovn.at index f3bd53242..4953bee49 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -33253,9 +33253,12 @@ check_sample_drops() { AT_CAPTURE_FILE([oflows_sample]) # Check that every drop has now contains a "sample" action. - for flow in "$drop_matches"; do - AT_CHECK([grep -q "$flow actions=.*sample.*" oflows_sample], [0], [ignore], [ignore], [echo "Flow $flow has a drop and did not get sampled"]) + save_IFS=$IFS + IFS=$'\n' + for flow in $drop_matches; do + AT_CHECK([grep "${flow}actions=.*sample.*" oflows_sample], [0], [ignore], [ignore], [echo "Flow $flow has a drop and did not get sampled"]) done + IFS=$save_IFS } check_drops() { From patchwork Mon Dec 19 16:18:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZdfSkbii; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbPyg5NC2z1ydb for ; Tue, 20 Dec 2022 03:18:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1434A608B7; Mon, 19 Dec 2022 16:18:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1434A608B7 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZdfSkbii X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ncTQYYT4su0s; Mon, 19 Dec 2022 16:18:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4F53260585; Mon, 19 Dec 2022 16:18:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4F53260585 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05D8AC0032; Mon, 19 Dec 2022 16:18:32 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A61EEC0032 for ; Mon, 19 Dec 2022 16:18:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7CC8040116 for ; Mon, 19 Dec 2022 16:18:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7CC8040116 Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZdfSkbii X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6HmUw0jWdmc7 for ; Mon, 19 Dec 2022 16:18:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D801E40502 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id D801E40502 for ; Mon, 19 Dec 2022 16:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466707; 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: in-reply-to:in-reply-to:references:references; bh=QI8iKybu4GVLCc3ISphmv/FWnYWWuR4mC25dzG7V+gA=; b=ZdfSkbiiE0ZLTpjchahlvJilzopqXX9/7ATUZuemmxP8Mvx0DzG7QpoyBP+tp1rqXTKsH4 xzh3v0g5X+pfw3YrJyhv1MgowYZgNAQ8m0tePZG0aJFYAC584bZXtEuoCkJcPjZt1mIQY+ AiOeCCItVMEC5GHqwCj3C3NJxalvz5s= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-aDETwDkIPqO5gQXLhNgOJQ-1; Mon, 19 Dec 2022 11:18:26 -0500 X-MC-Unique: aDETwDkIPqO5gQXLhNgOJQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 561BA3815D39 for ; Mon, 19 Dec 2022 16:18:26 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9817C2026D4B; Mon, 19 Dec 2022 16:18:25 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:11 +0100 Message-Id: <20221219161814.55422-4-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 3/6] controller: add missing drop to loopback check table 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The drop was implicit (using empty actions). Make it explicit and sampled. Fixes: a42c808f30b4 ("northd: add drop sampling") Signed-off-by: Adrian Moreno Acked-by: Mark Michelson --- controller/physical.c | 1 + 1 file changed, 1 insertion(+) diff --git a/controller/physical.c b/controller/physical.c index bda64741e..2444d3ebd 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -1498,6 +1498,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name, if (!strcmp(binding->type, "localnet")) { /* do not forward traffic from localport to localnet port */ ofpbuf_clear(ofpacts_p); + put_drop(debug, OFTABLE_CHECK_LOOPBACK, ofpacts_p); match_outport_dp_and_port_keys(&match, dp_key, port_key); match_set_reg_masked(&match, MFF_LOG_FLAGS - MFF_REG0, MLF_LOCALPORT, MLF_LOCALPORT); From patchwork Mon Dec 19 16:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BzL10NsA; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbPym0csTz1ydb for ; Tue, 20 Dec 2022 03:18:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8AF7A60BFC; Mon, 19 Dec 2022 16:18:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8AF7A60BFC Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BzL10NsA X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OqOEY4de8BC5; Mon, 19 Dec 2022 16:18:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 81C2660E45; Mon, 19 Dec 2022 16:18:35 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 81C2660E45 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 859FEC007B; Mon, 19 Dec 2022 16:18:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id E96DDC002D for ; Mon, 19 Dec 2022 16:18:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C4BCD608B7 for ; Mon, 19 Dec 2022 16:18:30 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C4BCD608B7 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j2z-kC__fAdL for ; Mon, 19 Dec 2022 16:18:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 12F8E60585 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 12F8E60585 for ; Mon, 19 Dec 2022 16:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466709; 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: in-reply-to:in-reply-to:references:references; bh=Vqa2bB1mBs6PRyKhoLXANg4oYIVw7L7Gv95rTFBCiPA=; b=BzL10NsA0LgWvnQfZSwcuK4OpXAW7e2B1FeX9BT/8pIVaVhid8vGF9Tj6tnPtWZXLGm5Z5 cQSs49LIvOXoPYfTjXo5NIOKFzVxCKGxwwhoF0X57HkyBT4tibnr0XQTQoj8JBbJ9aXDZq YIMReUFl9LdrsOSx+UjPHk4rNoqtrKY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-378-XmHtDygYO2Ox9qoNZfLOGw-1; Mon, 19 Dec 2022 11:18:27 -0500 X-MC-Unique: XmHtDygYO2Ox9qoNZfLOGw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4A0BD85C06C for ; Mon, 19 Dec 2022 16:18:27 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id A74732026D4B; Mon, 19 Dec 2022 16:18:26 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:12 +0100 Message-Id: <20221219161814.55422-5-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 4/6] controller: set sampling port to OFP_NONE for drops 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The default zero value can lead to sampling errors if the pipeline sets an the input port to OFP_NONE during flow processing. Fixes: a42c808f30b4 ("northd: add drop sampling") Signed-off-by: Adrian Moreno Acked-by: Mark Michelson --- controller/physical.c | 1 + 1 file changed, 1 insertion(+) diff --git a/controller/physical.c b/controller/physical.c index 2444d3ebd..d715c2bfa 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -843,6 +843,7 @@ put_drop(const struct physical_debug *debug, uint8_t table_id, os->collector_set_id = debug->collector_set_id; os->obs_domain_id = (debug->obs_domain_id << 24); os->obs_point_id = table_id; + os->sampling_port = OFPP_NONE; } } From patchwork Mon Dec 19 16:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i6Y5fYuT; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbPzx1Q6Nz1ydb for ; Tue, 20 Dec 2022 03:19:41 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 698D3818E8; Mon, 19 Dec 2022 16:19:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 698D3818E8 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i6Y5fYuT X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mQkEjxpg9pjl; Mon, 19 Dec 2022 16:19:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id E844B81322; Mon, 19 Dec 2022 16:19:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E844B81322 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8C516C00B7; Mon, 19 Dec 2022 16:19:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 33D57C0032 for ; Mon, 19 Dec 2022 16:19:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1286A813A0 for ; Mon, 19 Dec 2022 16:18:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1286A813A0 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nMv8wk2rsV7a for ; Mon, 19 Dec 2022 16:18:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B7C6E8109A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id B7C6E8109A for ; Mon, 19 Dec 2022 16:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466709; 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: in-reply-to:in-reply-to:references:references; bh=umj1NTN3VA5aYKWP8JapdylSMWQyyFElLeqBhd21Vwo=; b=i6Y5fYuTJVHwagbeZb0HbTV4VkVm2F3W1zc0M2HdAFZAsZMYgSJWNeMyoljc00zlATlC6Y 2fQO6e4suPf+Oi/hcHp7tC6QAUGCyKfipMKvhfUVQmfS1CUBLOOXGP7cogvJbdZWlbsDvh KQnQKe+py90HpXKvm9XR/Y3zc1yfuwU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-41-g17wZZ85OOatakOwXsELQw-1; Mon, 19 Dec 2022 11:18:28 -0500 X-MC-Unique: g17wZZ85OOatakOwXsELQw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58431858F09 for ; Mon, 19 Dec 2022 16:18:28 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 930892026D4B; Mon, 19 Dec 2022 16:18:27 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:13 +0100 Message-Id: <20221219161814.55422-6-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 5/6] controller: only sample flow if Collector Set exists 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Adding a OFPACT_SAMPLE action to a flow is useless (and even detrimental in terms of performance) if a Flow_Sample_Collector_Set row does not exist with the correspondent id. The sample (i.e: upcall) would take place but ovs-vswitchd would not have a target IPFIX collector to send the sample to. In order to be able to control what Chassis perform sampling without incurring in any performance cost if not needed, this patch makes the controller only encode the OFPACT_SAMPLE if there's a valid Flow_Sample_Collector_Set configured on that chassis. In order to do that, a new input is added to the en_lflow_output engine node that is associated with the OVSDB table. But since the information has to be available in the lib/actions layer, an intermediate helper struct is added (in lib/ovn-util.{h,c}) to help store and query the configured collector set ids instead of using the idl directly. Signed-off-by: Adrian Moreno Acked-by: Mark Michelson --- controller/lflow.c | 1 + controller/lflow.h | 8 ++++-- controller/ovn-controller.c | 56 ++++++++++++++++++++++++++++++++++++- include/ovn/actions.h | 4 +++ lib/actions.c | 9 +++++- lib/ovn-util.c | 51 +++++++++++++++++++++++++++++++++ lib/ovn-util.h | 27 +++++++++++++++--- tests/ovn-performance.at | 24 ++++++++++++++++ tests/ovn.at | 8 ++++++ tests/test-ovn.c | 9 ++++++ 10 files changed, 188 insertions(+), 9 deletions(-) diff --git a/controller/lflow.c b/controller/lflow.c index bb47bb0c7..d2d0a6d1c 100644 --- a/controller/lflow.c +++ b/controller/lflow.c @@ -911,6 +911,7 @@ add_matches_to_flow_table(const struct sbrec_logical_flow *lflow, .is_switch = ldp->is_switch, .group_table = l_ctx_out->group_table, .meter_table = l_ctx_out->meter_table, + .collector_ids = l_ctx_in->collector_ids, .lflow_uuid = lflow->header_.uuid, .dp_key = ldp->datapath->tunnel_key, diff --git a/controller/lflow.h b/controller/lflow.h index 9e8f9afd3..9bb61c039 100644 --- a/controller/lflow.h +++ b/controller/lflow.h @@ -43,11 +43,12 @@ #include "openvswitch/uuid.h" #include "openvswitch/list.h" -struct ovn_extend_table; -struct ovsdb_idl_index; -struct ovn_desired_flow_table; struct hmap; struct hmap_node; +struct ovn_desired_flow_table; +struct ovn_extend_table; +struct ovsdb_idl_index; +struct ovsrec_flow_sample_collector_set_table; struct sbrec_chassis; struct sbrec_load_balancer; struct sbrec_logical_flow_table; @@ -114,6 +115,7 @@ struct lflow_ctx_in { const struct hmap *dhcpv6_opts; const struct controller_event_options *controller_event_opts; const struct smap *template_vars; + const struct flow_collector_ids *collector_ids; bool lb_hairpin_use_ct_mark; }; diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 88eeee2d9..09f843541 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -988,6 +988,8 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) ovsdb_idl_add_column(ovs_idl, &ovsrec_ssl_col_private_key); ovsdb_idl_add_table(ovs_idl, &ovsrec_table_datapath); ovsdb_idl_add_column(ovs_idl, &ovsrec_datapath_col_capabilities); + ovsdb_idl_add_table(ovs_idl, &ovsrec_table_flow_sample_collector_set); + chassis_register_ovs_idl(ovs_idl); encaps_register_ovs_idl(ovs_idl); binding_register_ovs_idl(ovs_idl); @@ -1004,6 +1006,10 @@ ctrl_register_ovs_idl(struct ovsdb_idl *ovs_idl) ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_name); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_interfaces); ovsdb_idl_track_add_column(ovs_idl, &ovsrec_port_col_external_ids); + ovsdb_idl_track_add_column(ovs_idl, + &ovsrec_flow_sample_collector_set_col_bridge); + ovsdb_idl_track_add_column(ovs_idl, + &ovsrec_flow_sample_collector_set_col_id); } #define SB_NODES \ @@ -1042,7 +1048,8 @@ enum sb_engine_node { OVS_NODE(bridge, "bridge") \ OVS_NODE(port, "port") \ OVS_NODE(interface, "interface") \ - OVS_NODE(qos, "qos") + OVS_NODE(qos, "qos") \ + OVS_NODE(flow_sample_collector_set, "flow_sample_collector_set") enum ovs_engine_node { #define OVS_NODE(NAME, NAME_STR) OVS_##NAME, @@ -2813,6 +2820,9 @@ struct ed_type_lflow_output { /* Fixed controller_event supported options. */ struct controller_event_options controller_event_opts; + + /* Configured Flow Sample Collector Sets. */ + struct flow_collector_ids collector_ids; }; static void @@ -2951,6 +2961,7 @@ init_lflow_ctx(struct engine_node *node, l_ctx_in->dhcpv6_opts = &dhcp_opts->v6_opts; l_ctx_in->controller_event_opts = &fo->controller_event_opts; l_ctx_in->template_vars = &template_vars->local_templates; + l_ctx_in->collector_ids = &fo->collector_ids; l_ctx_out->flow_table = &fo->flow_table; l_ctx_out->group_table = &fo->group_table; @@ -2980,6 +2991,7 @@ en_lflow_output_init(struct engine_node *node OVS_UNUSED, data->hd.pool = id_pool_create(1, UINT32_MAX - 1); nd_ra_opts_init(&data->nd_ra_opts); controller_event_opts_init(&data->controller_event_opts); + flow_collector_ids_init(&data->collector_ids); return data; } @@ -3006,6 +3018,7 @@ en_lflow_output_cleanup(void *data) id_pool_destroy(flow_output_data->hd.pool); nd_ra_opts_destroy(&flow_output_data->nd_ra_opts); controller_event_opts_destroy(&flow_output_data->controller_event_opts); + flow_collector_ids_destroy(&flow_output_data->collector_ids); } static void @@ -3075,6 +3088,45 @@ lflow_output_sb_logical_flow_handler(struct engine_node *node, void *data) return handled; } +static bool +lflow_output_flow_sample_collector_set_handler(struct engine_node *node, + void *data OVS_UNUSED) +{ + const struct ovsrec_flow_sample_collector_set_table *flow_collector_table = + EN_OVSDB_GET(engine_get_input("OVS_flow_sample_collector_set", node)); + const struct ovsrec_open_vswitch_table *ovs_table = + EN_OVSDB_GET(engine_get_input("OVS_open_vswitch", node)); + const struct ovsrec_bridge_table *bridge_table = + EN_OVSDB_GET(engine_get_input("OVS_bridge", node)); + + const struct ovsrec_open_vswitch *cfg = + ovsrec_open_vswitch_table_first(ovs_table); + if (!cfg) { + return true; + } + + const struct ovsrec_bridge *br_int; + br_int = get_bridge(bridge_table, br_int_name(cfg)); + if (!br_int) { + return true; + } + + const struct ovsrec_flow_sample_collector_set *set; + OVSREC_FLOW_SAMPLE_COLLECTOR_SET_TABLE_FOR_EACH_TRACKED (set, + flow_collector_table) { + if (set->bridge == br_int) { + struct ed_type_lflow_output *lfo = data; + flow_collector_ids_clear(&lfo->collector_ids); + flow_collector_ids_init_from_table(&lfo->collector_ids, + flow_collector_table); + return false; + } + } + + engine_set_node_state(node, EN_UPDATED); + return true; +} + static bool lflow_output_sb_mac_binding_handler(struct engine_node *node, void *data) { @@ -4179,6 +4231,8 @@ main(int argc, char *argv[]) engine_add_input(&en_lflow_output, &en_ovs_open_vswitch, NULL); engine_add_input(&en_lflow_output, &en_ovs_bridge, NULL); + engine_add_input(&en_lflow_output, &en_ovs_flow_sample_collector_set, + lflow_output_flow_sample_collector_set_handler); engine_add_input(&en_lflow_output, &en_sb_mac_binding, lflow_output_sb_mac_binding_handler); diff --git a/include/ovn/actions.h b/include/ovn/actions.h index a56351081..ed166cdd0 100644 --- a/include/ovn/actions.h +++ b/include/ovn/actions.h @@ -33,6 +33,7 @@ struct ofpbuf; struct shash; struct simap; struct ovn_extend_table; +struct collector_set_ids; /* List of OVN logical actions. * @@ -814,6 +815,9 @@ struct ovnact_encode_params { /* A struct to figure out the meter_id for meter actions. */ struct ovn_extend_table *meter_table; + /* A struct to lookup Flow_Sample_Collector_Set ids */ + const struct flow_collector_ids *collector_ids; + /* The logical flow uuid that drove this action. */ struct uuid lflow_uuid; diff --git a/lib/actions.c b/lib/actions.c index 47ec654e1..523a51890 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -4337,7 +4337,14 @@ encode_SAMPLE(const struct ovnact_sample *sample, const struct ovnact_encode_params *ep, struct ofpbuf *ofpacts) { - struct ofpact_sample *os = ofpact_put_SAMPLE(ofpacts); + struct ofpact_sample *os; + if (!ep->collector_ids || + !flow_collector_ids_lookup(ep->collector_ids, + sample->collector_set_id)) { + return; + } + + os = ofpact_put_SAMPLE(ofpacts); os->probability = sample->probability; os->collector_set_id = sample->collector_set_id; os->obs_domain_id = diff --git a/lib/ovn-util.c b/lib/ovn-util.c index 86b98acf7..670c7e2ad 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -965,3 +965,54 @@ lr_lb_address_set_ref(uint32_t lr_tunnel_key, int addr_family) { return lr_lb_address_set_name_(lr_tunnel_key, "$", addr_family); } + +void flow_collector_ids_init(struct flow_collector_ids *ids) +{ + ovs_list_init(&ids->list); +} + +void flow_collector_ids_init_from_table(struct flow_collector_ids *ids, + const struct ovsrec_flow_sample_collector_set_table *table) +{ + flow_collector_ids_init(ids); + const struct ovsrec_flow_sample_collector_set *ovs_collector_set; + OVSREC_FLOW_SAMPLE_COLLECTOR_SET_TABLE_FOR_EACH (ovs_collector_set, + table) { + flow_collector_ids_add(ids, ovs_collector_set->id); + } +} + +void flow_collector_ids_add(struct flow_collector_ids *ids, + uint64_t id) +{ + struct flow_collector_id *collector = xzalloc(sizeof *collector); + collector->id = id; + ovs_list_push_back(&ids->list, &collector->node); +} + +bool flow_collector_ids_lookup(const struct flow_collector_ids *ids, + uint32_t id) +{ + struct flow_collector_id *collector; + LIST_FOR_EACH (collector, node, &ids->list) { + if (collector->id == id) { + return true; + } + } + return false; +} + +void flow_collector_ids_destroy(struct flow_collector_ids *ids) +{ + struct flow_collector_id *collector; + LIST_FOR_EACH_SAFE (collector, node, &ids->list) { + ovs_list_remove(&collector->node); + free(collector); + } +} + +void flow_collector_ids_clear(struct flow_collector_ids *ids) +{ + flow_collector_ids_destroy(ids); + flow_collector_ids_init(ids); +} diff --git a/lib/ovn-util.h b/lib/ovn-util.h index 809ff1d36..a60e65ca3 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -28,15 +28,16 @@ #define ROUTE_ORIGIN_CONNECTED "connected" #define ROUTE_ORIGIN_STATIC "static" +struct eth_addr; struct nbrec_logical_router_port; +struct ovsrec_flow_sample_collector_set_table; +struct sbrec_datapath_binding; struct sbrec_logical_flow; +struct sbrec_port_binding; +struct smap; struct svec; struct uuid; -struct eth_addr; -struct sbrec_port_binding; -struct sbrec_datapath_binding; struct unixctl_conn; -struct smap; struct ipv4_netaddr { ovs_be32 addr; /* 192.168.10.123 */ @@ -318,4 +319,22 @@ int64_t daemon_startup_ts(void); char *lr_lb_address_set_name(uint32_t lr_tunnel_key, int addr_family); char *lr_lb_address_set_ref(uint32_t lr_tunnel_key, int addr_family); +/* flow_collector_ids is a helper struct used to store and lookup + * Flow_Sample_Collector_Set ids. */ +struct flow_collector_id { + struct ovs_list node; /* In flow_collector_ids->list */ + uint64_t id; +}; +struct flow_collector_ids { + struct ovs_list list; +}; +void flow_collector_ids_init(struct flow_collector_ids *); +void flow_collector_ids_init_from_table(struct flow_collector_ids *, + const struct ovsrec_flow_sample_collector_set_table *); +void flow_collector_ids_add(struct flow_collector_ids *, uint64_t); +bool flow_collector_ids_lookup(const struct flow_collector_ids *, uint32_t); +void flow_collector_ids_destroy(struct flow_collector_ids *); +void flow_collector_ids_clear(struct flow_collector_ids *); + + #endif /* OVN_UTIL_H */ diff --git a/tests/ovn-performance.at b/tests/ovn-performance.at index db0e5272e..f3143409e 100644 --- a/tests/ovn-performance.at +++ b/tests/ovn-performance.at @@ -586,6 +586,30 @@ OVN_CONTROLLER_EXPECT_NO_HIT( [ovn-nbctl --wait=hv meter-del meter0] ) +OVN_CONTROLLER_EXPECT_HIT( + [hv1], [lflow_run], + [as hv1 ovs-vsctl --id=@br get Bridge br-int -- \ + --id=@i create IPFIX targets=\"192.168.1.1\" -- \ + create Flow_Sample_Collector_Set bridge=@br id=1 ipfix=@i] +) + +OVN_CONTROLLER_EXPECT_NO_HIT( + [hv3], [lflow_run], + [as hv2 ovs-vsctl --id=@br get Bridge br-int -- \ + --id=@i create IPFIX targets=\"192.168.1.1\" -- \ + create Flow_Sample_Collector_Set bridge=@br id=1 ipfix=@i] +) + +OVN_CONTROLLER_EXPECT_NO_HIT( + [hv1], [lflow_run], + [as hv1 ovs-vsctl set IPFIX . targets=\"192.168.1.2\"] +) + +OVN_CONTROLLER_EXPECT_HIT( + [hv1], [lflow_run], + [as hv1 ovs-vsctl destroy Flow_Sample_Collector_Set .] +) + for i in 1 2; do j=$((i%2 + 1)) lp=lp$i diff --git a/tests/ovn.at b/tests/ovn.at index 4953bee49..2c3762e63 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2171,6 +2171,10 @@ sample(probability=10); formats as sample(probability=10,collector_set=0,obs_domain=0,obs_point=0); encodes as sample(probability=10,collector_set_id=0,obs_domain_id=11259375,obs_point_id=0) +# sample with a collector_set_id that is not configured in the chassis. +sample(probability=100,collector_set=999,obs_domain=0,obs_point=1000); + encodes as drop + sample(probability=0,collector_set=200,obs_domain=0,obs_point=1000); probability must be greater than zero @@ -33245,6 +33249,10 @@ check_sample_drops() { # Take match part of flows that contain "drop". drop_matches="$(grep 'drop' oflows_nosample | grep -oP 'table=\d*, priority=.* ')" + ovs-vsctl --id=@br get Bridge br-int -- \ + --id=@i create IPFIX targets=\"192.168.1.1\" -- \ + create Flow_Sample_Collector_Set bridge=@br id=123 ipfix=@i + check ovn-nbctl -- set NB_Global . options:debug_drop_collector_set="123" \ -- set NB_Global . options:debug_drop_domain_id="1" check ovn-nbctl --wait=hv sync diff --git a/tests/test-ovn.c b/tests/test-ovn.c index 64b0a2e20..d58350dcf 100644 --- a/tests/test-ovn.c +++ b/tests/test-ovn.c @@ -34,6 +34,7 @@ #include "ovn/logical-fields.h" #include "lib/ovn-l7.h" #include "lib/extend-table.h" +#include "lib/ovn-util.h" #include "ovs-thread.h" #include "ovstest.h" #include "openvswitch/shash.h" @@ -1302,6 +1303,12 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED) struct ovn_extend_table meter_table; ovn_extend_table_init(&meter_table); + /* Initialize collector sets. */ + struct flow_collector_ids collector_ids; + flow_collector_ids_init(&collector_ids); + flow_collector_ids_add(&collector_ids, 0); + flow_collector_ids_add(&collector_ids, 200); + simap_init(&ports); simap_put(&ports, "eth0", 5); simap_put(&ports, "eth1", 6); @@ -1348,6 +1355,7 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED) .is_switch = true, .group_table = &group_table, .meter_table = &meter_table, + .collector_ids = &collector_ids, .pipeline = OVNACT_P_INGRESS, .ingress_ptable = OFTABLE_LOG_INGRESS_PIPELINE, @@ -1434,6 +1442,7 @@ test_parse_actions(struct ovs_cmdl_context *ctx OVS_UNUSED) smap_destroy(&template_vars); ovn_extend_table_destroy(&group_table); ovn_extend_table_destroy(&meter_table); + flow_collector_ids_destroy(&collector_ids); exit(ok ? EXIT_SUCCESS : EXIT_FAILURE); } From patchwork Mon Dec 19 16:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1717475 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjhQtiFB; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NbQ0319Thz1ydb for ; Tue, 20 Dec 2022 03:19:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6B0A240351; Mon, 19 Dec 2022 16:19:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6B0A240351 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjhQtiFB X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l7hmuqFjISzT; Mon, 19 Dec 2022 16:19:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id C38EC4033D; Mon, 19 Dec 2022 16:19:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C38EC4033D Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 126DEC00C7; Mon, 19 Dec 2022 16:19:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 817EEC0078 for ; Mon, 19 Dec 2022 16:19:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C2EF88109A for ; Mon, 19 Dec 2022 16:18:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C2EF88109A Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YjhQtiFB X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0CXfRRYt-hfR for ; Mon, 19 Dec 2022 16:18:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org DAD36812C5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id DAD36812C5 for ; Mon, 19 Dec 2022 16:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671466710; 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: in-reply-to:in-reply-to:references:references; bh=ZMDy9czskT6JYXxskXqGVw0ZINAJvKfjwtXKhzH2iic=; b=YjhQtiFBCY5qQw/B+Jnh1laZciSi/dYMXBKyz92LxFqJosR8SIFYQ6sGmbY0lKfhQlTgDa 3fibCed7uOWNFdrJw166Aj0OUzCrk/nE3hEN4TffT5GprLFUVt1HnwTBRGgraCMGAORQzM DVQP2UqRZtAz/pTmD+dC5kmlTXalEfc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-329-73juxkPNOpm3zTy7nrZYyg-1; Mon, 19 Dec 2022 11:18:29 -0500 X-MC-Unique: 73juxkPNOpm3zTy7nrZYyg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B75D3C0F23A for ; Mon, 19 Dec 2022 16:18:29 +0000 (UTC) Received: from antares.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC1D62026D4B; Mon, 19 Dec 2022 16:18:28 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Mon, 19 Dec 2022 17:18:14 +0100 Message-Id: <20221219161814.55422-7-amorenoz@redhat.com> In-Reply-To: <20221219161814.55422-1-amorenoz@redhat.com> References: <20221219161814.55422-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 6/6] controller: only sample pflow if Collector Set exists 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Make physical (pflow) engine node also depend on Flow_Sample_Collector_Set table and only enable flow sampling if the right collector set exists. Signed-off-by: Adrian Moreno Acked-by: Mark Michelson --- controller/ovn-controller.c | 104 ++++++++++++++++++++++++++---------- 1 file changed, 75 insertions(+), 29 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 09f843541..b2af0298d 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -3127,6 +3127,64 @@ lflow_output_flow_sample_collector_set_handler(struct engine_node *node, return true; } +static void +pflow_output_get_debug(struct engine_node *node, struct physical_debug *debug) +{ + const struct ovsrec_open_vswitch_table *ovs_table = + EN_OVSDB_GET(engine_get_input("OVS_open_vswitch", node)); + const struct ovsrec_bridge_table *bridge_table = + EN_OVSDB_GET(engine_get_input("OVS_bridge", node)); + const struct sbrec_sb_global_table *sb_global_table = + EN_OVSDB_GET(engine_get_input("SB_sb_global", node)); + const struct sbrec_sb_global *sb_global = + sbrec_sb_global_table_first(sb_global_table); + + if (!debug) { + return; + } + debug->collector_set_id = 0; + debug->obs_domain_id = 0; + + const struct ovsrec_open_vswitch *ovs_cfg = + ovsrec_open_vswitch_table_first(ovs_table); + if (!ovs_cfg) { + return; + } + + const struct ovsrec_bridge *br_int; + br_int = get_bridge(bridge_table, br_int_name(ovs_cfg)); + if (!br_int) { + return; + } + + const uint32_t debug_collector_set = + smap_get_uint(&sb_global->options, "debug_drop_collector_set", 0); + if (!debug_collector_set) { + return; + } + + struct ovsdb_idl_index *ovsrec_flow_sample_collector_set_by_id = + engine_ovsdb_node_get_index( + engine_get_input("OVS_flow_sample_collector_set", node), "id"); + + struct ovsrec_flow_sample_collector_set *s = + ovsrec_flow_sample_collector_set_index_init_row( + ovsrec_flow_sample_collector_set_by_id); + + ovsrec_flow_sample_collector_set_index_set_id(s, debug_collector_set); + ovsrec_flow_sample_collector_set_index_set_bridge(s, br_int); + if (!ovsrec_flow_sample_collector_set_index_find( + ovsrec_flow_sample_collector_set_by_id, s)) { + ovsrec_flow_sample_collector_set_index_destroy_row(s); + return; + } + ovsrec_flow_sample_collector_set_index_destroy_row(s); + + debug->collector_set_id = debug_collector_set; + debug->obs_domain_id = smap_get_uint(&sb_global->options, + "debug_drop_domain_id", 0); +} + static bool lflow_output_sb_mac_binding_handler(struct engine_node *node, void *data) { @@ -3577,11 +3635,6 @@ static void init_physical_ctx(struct engine_node *node, chassis = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); } - const struct sbrec_sb_global_table *sb_global_table = - EN_OVSDB_GET(engine_get_input("SB_sb_global", node)); - const struct sbrec_sb_global *sb_global = - sbrec_sb_global_table_first(sb_global_table); - ovs_assert(br_int && chassis); struct ed_type_ct_zones *ct_zones_data = @@ -3603,13 +3656,8 @@ static void init_physical_ctx(struct engine_node *node, p_ctx->local_bindings = &rt_data->lbinding_data.bindings; p_ctx->patch_ofports = &non_vif_data->patch_ofports; p_ctx->chassis_tunnels = &non_vif_data->chassis_tunnels; - p_ctx->debug.collector_set_id = smap_get_uint(&sb_global->options, - "debug_drop_collector_set", - 0); - p_ctx->debug.obs_domain_id = smap_get_uint(&sb_global->options, - "debug_drop_domain_id", - 0); + pflow_output_get_debug(node, &p_ctx->debug); } static void * @@ -3813,26 +3861,16 @@ pflow_output_activated_ports_handler(struct engine_node *node, void *data) } static bool -pflow_output_sb_sb_global_handler(struct engine_node *node, void *data) +pflow_output_debug_handler(struct engine_node *node, void *data) { - const struct sbrec_sb_global_table *sb_global_table = - EN_OVSDB_GET(engine_get_input("SB_sb_global", node)); - const struct sbrec_sb_global *sb_global = - sbrec_sb_global_table_first(sb_global_table); - struct ed_type_pflow_output *pfo = data; + struct physical_debug debug; + + pflow_output_get_debug(node, &debug); - uint32_t collector_set_id = smap_get_uint(&sb_global->options, - "debug_drop_collector_set", - 0); - uint32_t obs_domain_id = smap_get_uint(&sb_global->options, - "debug_drop_domain_id", - 0); - - if (pfo->debug.collector_set_id != collector_set_id || - pfo->debug.obs_domain_id != obs_domain_id) { - pfo->debug.collector_set_id = collector_set_id; - pfo->debug.obs_domain_id = obs_domain_id; + if (pfo->debug.collector_set_id != debug.collector_set_id || + pfo->debug.obs_domain_id != debug.obs_domain_id) { + pfo->debug = debug; return false; } engine_set_node_state(node, EN_UPDATED); @@ -3989,6 +4027,10 @@ main(int argc, char *argv[]) struct ovsdb_idl_index *ovsrec_port_by_interfaces = ovsdb_idl_index_create1(ovs_idl_loop.idl, &ovsrec_port_col_interfaces); + struct ovsdb_idl_index *ovsrec_flow_sample_collector_set_by_id + = ovsdb_idl_index_create2(ovs_idl_loop.idl, + &ovsrec_flow_sample_collector_set_col_bridge, + &ovsrec_flow_sample_collector_set_col_id); ovsdb_idl_get_initial_snapshot(ovs_idl_loop.idl); @@ -4189,8 +4231,10 @@ main(int argc, char *argv[]) engine_add_input(&en_pflow_output, &en_mff_ovn_geneve, NULL); engine_add_input(&en_pflow_output, &en_ovs_open_vswitch, NULL); engine_add_input(&en_pflow_output, &en_ovs_bridge, NULL); + engine_add_input(&en_pflow_output, &en_ovs_flow_sample_collector_set, + pflow_output_debug_handler); engine_add_input(&en_pflow_output, &en_sb_sb_global, - pflow_output_sb_sb_global_handler); + pflow_output_debug_handler); engine_add_input(&en_northd_options, &en_sb_sb_global, en_northd_options_sb_sb_global_handler); @@ -4327,6 +4371,8 @@ main(int argc, char *argv[]) sbrec_static_mac_binding_by_datapath); engine_ovsdb_node_add_index(&en_sb_chassis_template_var, "chassis", sbrec_chassis_template_var_index_by_chassis); + engine_ovsdb_node_add_index(&en_ovs_flow_sample_collector_set, "id", + ovsrec_flow_sample_collector_set_by_id); struct ed_type_lflow_output *lflow_output_data = engine_get_internal_data(&en_lflow_output);