From patchwork Thu Jun 3 12:29:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1487214 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=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FwlZk4FCsz9sxS for ; Thu, 3 Jun 2021 22:29:34 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5873E60824; Thu, 3 Jun 2021 12:29:32 +0000 (UTC) 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 XSNyLDgXEebC; Thu, 3 Jun 2021 12:29:28 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTP id B737760811; Thu, 3 Jun 2021 12:29:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9DCD0C000D; Thu, 3 Jun 2021 12:29:27 +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 18D79C000F for ; Thu, 3 Jun 2021 12:29:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BD216400E5 for ; Thu, 3 Jun 2021 12:29:24 +0000 (UTC) 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 ITPx3VIvKHsR for ; Thu, 3 Jun 2021 12:29:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by smtp2.osuosl.org (Postfix) with ESMTPS id 3604D40529 for ; Thu, 3 Jun 2021 12:29:18 +0000 (UTC) Received: (Authenticated sender: numans@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id DBBE9C0014; Thu, 3 Jun 2021 12:29:16 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Thu, 3 Jun 2021 08:29:12 -0400 Message-Id: <20210603122912.2066891-1-numans@ovn.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210603122721.2066524-1-numans@ovn.org> References: <20210603122721.2066524-1-numans@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v9 4/5] physical: Set the port binding uuid as cookie for flows where relevant. 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: Numan Siddique Some of the OF flows added by physical.c in tables LOCAL_OUTPUT, CHECK_LOOPBACK, SAVE_INPORT can store the port binding uuid as flow cookie because these flows matches on port binding key in the MFF_LOG_OUTPORT field. Whereas right now it stores 0 as cookie. This patch stores the port binding uuid as cookie for these flows. When a port binding is deleted, the port binding handler for flow_output engine node flood removes the flows with the port binding uuid and such flows wont get removed. Right now this is not a problem because deleting a port binding also triggers in physical_run() being called and it recomputes all the physical flows. This patch is required for an upcoming patch which do not call physical_run() for port binding deletes. Signed-off-by: Numan Siddique --- controller/physical.c | 44 ++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/controller/physical.c b/controller/physical.c index e70efc71d..17ca5afbb 100644 --- a/controller/physical.c +++ b/controller/physical.c @@ -739,20 +739,23 @@ put_replace_router_port_mac_flows(struct ovsdb_idl_index } static void -put_local_common_flows(uint32_t dp_key, uint32_t port_key, - uint32_t parent_port_key, +put_local_common_flows(uint32_t dp_key, + const struct sbrec_port_binding *pb, + const struct sbrec_port_binding *parent_pb, const struct zone_ids *zone_ids, struct ofpbuf *ofpacts_p, struct ovn_desired_flow_table *flow_table) { struct match match; - /* Table 33, priority 100. + uint32_t port_key = pb->tunnel_key; + + /* Table 38, priority 100. * ======================= * * Implements output to local hypervisor. Each flow matches a * logical output port on the local hypervisor, and resubmits to - * table 34. + * table 39. */ match_init_catchall(&match); @@ -774,12 +777,13 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, } } - /* Resubmit to table 34. */ + /* Resubmit to table 39. */ put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts_p); - ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 100, 0, - &match, ofpacts_p, hc_uuid); + ofctrl_add_flow(flow_table, OFTABLE_LOCAL_OUTPUT, 100, + pb->header_.uuid.parts[0], &match, ofpacts_p, + &pb->header_.uuid); - /* Table 34, Priority 100. + /* Table 39, Priority 100. * ======================= * * Drop packets whose logical inport and outport are the same @@ -791,8 +795,9 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, 0, MLF_ALLOW_LOOPBACK); match_set_reg(&match, MFF_LOG_INPORT - MFF_REG0, port_key); match_set_reg(&match, MFF_LOG_OUTPORT - MFF_REG0, port_key); - ofctrl_add_flow(flow_table, OFTABLE_CHECK_LOOPBACK, 100, 0, - &match, ofpacts_p, hc_uuid); + ofctrl_add_flow(flow_table, OFTABLE_CHECK_LOOPBACK, 100, + pb->header_.uuid.parts[0], &match, ofpacts_p, + &pb->header_.uuid); /* Table 64, Priority 100. * ======================= @@ -806,7 +811,7 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, * table 65 for logical-to-physical translation, then restore * the port number. * - * If 'parent_port_key' is set, then the 'port_key' represents a nested + * If 'parent_pb' is not NULL, then the 'pb' represents a nested * container. * * Note:We can set in_port to 0 too. But if recirculation happens @@ -815,7 +820,7 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, * in_port is 0. * */ - bool nested_container = parent_port_key ? true: false; + bool nested_container = parent_pb ? true: false; match_init_catchall(&match); ofpbuf_clear(ofpacts_p); match_set_metadata(&match, htonll(dp_key)); @@ -829,8 +834,9 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, put_load(ofp_to_u16(OFPP_NONE), MFF_IN_PORT, 0, 16, ofpacts_p); put_resubmit(OFTABLE_LOG_TO_PHY, ofpacts_p); put_stack(MFF_IN_PORT, ofpact_put_STACK_POP(ofpacts_p)); - ofctrl_add_flow(flow_table, OFTABLE_SAVE_INPORT, 100, 0, - &match, ofpacts_p, hc_uuid); + ofctrl_add_flow(flow_table, OFTABLE_SAVE_INPORT, 100, + pb->header_.uuid.parts[0], &match, ofpacts_p, + &pb->header_.uuid); if (nested_container) { /* It's a nested container and when the packet from the nested @@ -852,7 +858,8 @@ put_local_common_flows(uint32_t dp_key, uint32_t port_key, match_init_catchall(&match); ofpbuf_clear(ofpacts_p); match_set_metadata(&match, htonll(dp_key)); - match_set_reg(&match, MFF_LOG_OUTPORT - MFF_REG0, parent_port_key); + match_set_reg(&match, MFF_LOG_OUTPORT - MFF_REG0, + parent_pb->tunnel_key); match_set_reg_masked(&match, MFF_LOG_FLAGS - MFF_REG0, MLF_NESTED_CONTAINER, MLF_NESTED_CONTAINER); @@ -941,7 +948,7 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name, } struct zone_ids binding_zones = get_zone_ids(binding, ct_zones); - put_local_common_flows(dp_key, port_key, 0, &binding_zones, + put_local_common_flows(dp_key, binding, NULL, &binding_zones, ofpacts_p, flow_table); match_init_catchall(&match); @@ -1141,10 +1148,9 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name, */ struct zone_ids zone_ids = get_zone_ids(binding, ct_zones); - uint32_t parent_port_key = parent_port ? parent_port->tunnel_key : 0; - /* Pass the parent port tunnel key if the port is a nested + /* Pass the parent port binding if the port is a nested * container. */ - put_local_common_flows(dp_key, port_key, parent_port_key, &zone_ids, + put_local_common_flows(dp_key, binding, parent_port, &zone_ids, ofpacts_p, flow_table); /* Table 0, Priority 150 and 100.