From patchwork Fri Nov 6 15:32:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Ivanov X-Patchwork-Id: 1395713 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.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CSPXS4Sf4z9sVK for ; Sat, 7 Nov 2020 02:32:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 326B886A33; Fri, 6 Nov 2020 15:32:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3i57GyFCccUC; Fri, 6 Nov 2020 15:32:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2D851869C0; Fri, 6 Nov 2020 15:32:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0F5F4C1AD4; Fri, 6 Nov 2020 15:32:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id BD4B2C0889 for ; Fri, 6 Nov 2020 15:32:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8EA8E2E13A for ; Fri, 6 Nov 2020 15:32:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id krXRiKmKeeys for ; Fri, 6 Nov 2020 15:32:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.kot-begemot.co.uk (ivanoab7.miniserver.com [37.128.132.42]) by silver.osuosl.org (Postfix) with ESMTPS id CA81C2E143 for ; Fri, 6 Nov 2020 15:32:19 +0000 (UTC) Received: from tun252.jain.kot-begemot.co.uk ([192.168.18.6] helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kb3is-0008NS-7r; Fri, 06 Nov 2020 15:32:18 +0000 Received: from jain.kot-begemot.co.uk ([192.168.3.3]) by jain.kot-begemot.co.uk with esmtp (Exim 4.92) (envelope-from ) id 1kb3ip-0001Wl-Dm; Fri, 06 Nov 2020 15:32:17 +0000 From: anton.ivanov@cambridgegreys.com To: mmichels@redhat.com, dev@openvswitch.org Date: Fri, 6 Nov 2020 15:32:02 +0000 Message-Id: <20201106153204.5805-6-anton.ivanov@cambridgegreys.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201106153204.5805-1-anton.ivanov@cambridgegreys.com> References: <20201106153204.5805-1-anton.ivanov@cambridgegreys.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett Cc: Anton Ivanov Subject: [ovs-dev] [PATCH ovn v6 6/8] ovn-northd: Reorganize lrouter flow processing 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" From: Anton Ivanov Move several per-port/per-datapath processing functions from earlier patch series into the combined processing loops. Signed-off-by: Anton Ivanov --- northd/ovn-northd.c | 131 ++------------------------------------------ 1 file changed, 4 insertions(+), 127 deletions(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 072a81ba0..9fa5c8d4f 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -8790,119 +8790,6 @@ build_lrouter_force_snat_flows(struct hmap *lflows, struct ovn_datapath *od, ds_destroy(&actions); } - -/* Logical router ingress table 0: Admission control framework. */ -static void -build_adm_ctrl_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows); - -/* Logical router ingress table 0: Admission control framework. */ -static void -build_adm_ctrl_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Logical router ingress table 1: LOOKUP_NEIGHBOR and - * table 2: LEARN_NEIGHBOR. */ -static void -build_neigh_learning_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct ds *match, struct ds *actions); - -static void -build_neigh_learning_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Logical router ingress table ND_RA_OPTIONS & ND_RA_RESPONSE: RS -* responder. */ -static void -build_ND_RA_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows); - -/* Logical router ingress table ND_RA_OPTIONS & ND_RA_RESPONSE: IPv6 Router - * Adv (RA) options and response. */ -static void -build_ND_RA_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Logical router ingress table IP_ROUTING: IP Routing. - */ -static void -build_ip_routing_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows); - -/* Convert the static routes to flows. */ -static void -build_static_route_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct hmap *ports); - -static void -build_mcast_lookup_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Logical router ingress table POLICY. */ -static void -build_ingress_policy_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct hmap *ports); - -/* Local router ingress table ARP_RESOLVE: ARP Resolution. */ -static void -build_arp_resolve_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows); -static void -build_arp_resolve_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct hmap *ports, - struct ds *match, struct ds *actions); - -/* Local router ingress table CHK_PKT_LEN: Check packet length. */ -static void -build_check_pkt_len_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct hmap *ports, - struct ds *match, struct ds *actions); - -/* Logical router ingress table GW_REDIRECT: Gateway redirect. */ -static void -build_gateway_redirect_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Local router ingress table ARP_REQUEST: ARP request. */ -static void -build_arp_request_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Logical router egress table DELIVERY: Delivery (priority 100-110). */ -static void -build_egress_delivery_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match, struct ds *actions); - -/* Filter rules for various local traffic which should not be forwarded - * by default */ -static void -build_misc_local_traffic_drop_flows_for_lrouter( - struct ovn_datapath *od, struct hmap *lflows); - -/* DHCPv6 reply handling */ -static void -build_dhcpv6_reply_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match); - -/* Logical router ingress table 1: IP Input for IPv6. */ -static void -build_ipv6_input_flows_for_lrouter_port( - struct ovn_port *op, struct hmap *lflows, - struct ds *match, struct ds *actions); - static void build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, struct hmap *lflows, struct shash *meter_groups, @@ -8963,10 +8850,6 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, } } - HMAP_FOR_EACH (od, key_node, datapaths) { - build_misc_local_traffic_drop_flows_for_lrouter(od, lflows); - } - /* Logical router ingress table 3: IP Input for IPv4. */ HMAP_FOR_EACH (op, key_node, ports) { if (!op->nbrp) { @@ -9214,16 +9097,6 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, } } - HMAP_FOR_EACH (op, key_node, ports) { - build_dhcpv6_reply_flows_for_lrouter_port( - op, lflows, &match); - } - - HMAP_FOR_EACH (op, key_node, ports) { - build_ipv6_input_flows_for_lrouter_port( - op, lflows, &match, &actions); - } - /* NAT, Defrag and load balancing. */ HMAP_FOR_EACH (od, key_node, datapaths) { if (!od->nbr) { @@ -11333,6 +11206,7 @@ build_lswitch_and_lrouter_iterate_by_od( &lsi->actions); build_arp_request_flows_for_lrouter(od, lsi->lflows, &lsi->match, &lsi->actions); + build_misc_local_traffic_drop_flows_for_lrouter(od, lsi->lflows); } /* Helper function to combine all lflow generation which is iterated by port. @@ -11359,6 +11233,9 @@ build_lswitch_and_lrouter_iterate_by_op( &lsi->match, &lsi->actions); build_egress_delivery_flows_for_lrouter_port(op, lsi->lflows, &lsi->match, &lsi->actions); + build_dhcpv6_reply_flows_for_lrouter_port(op, lsi->lflows, &lsi->match); + build_ipv6_input_flows_for_lrouter_port(op, lsi->lflows, + &lsi->match, &lsi->actions); } static void