diff mbox series

[ovs-dev,3/5] controller: move put_load&resubmit for port-binding in function

Message ID 20230519181859.1195040-4-odivlad@gmail.com
State Accepted
Headers show
Series VTEP lport ARP handling fixes & GARP support | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Vladislav Odintsov May 19, 2023, 6:18 p.m. UTC
This is done to simplify and remove duplication of code.
New function will be used in next patch.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 controller/physical.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

Comments

Dumitru Ceara May 30, 2023, 2:52 p.m. UTC | #1
On 5/19/23 20:18, Vladislav Odintsov wrote:
> This is done to simplify and remove duplication of code.
> New function will be used in next patch.
> 
> Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
> ---

Applied to main branch, thanks!
diff mbox series

Patch

diff --git a/controller/physical.c b/controller/physical.c
index ec861f49c..2925dcd1d 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -1704,6 +1704,13 @@  chassis_is_vtep(const struct sbrec_chassis *chassis)
     return smap_get_bool(&chassis->other_config, "is-vtep", false);
 }
 
+static void
+local_output_pb(int64_t tunnel_key, struct ofpbuf *ofpacts)
+{
+    put_load(tunnel_key, MFF_LOG_OUTPORT, 0, 32, ofpacts);
+    put_resubmit(OFTABLE_CHECK_LOOPBACK, ofpacts);
+}
+
 static void
 consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
                   enum mf_field_id mff_ovn_geneve,
@@ -1773,13 +1780,9 @@  consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
 
         if (!strcmp(port->type, "patch")) {
             if (ldp->is_transit_switch) {
-                put_load(port->tunnel_key, MFF_LOG_OUTPORT, 0, 32,
-                         &ofpacts);
-                put_resubmit(OFTABLE_CHECK_LOOPBACK, &ofpacts);
+                local_output_pb(port->tunnel_key, &ofpacts);
             } else {
-                put_load(port->tunnel_key, MFF_LOG_OUTPORT, 0, 32,
-                         &remote_ofpacts);
-                put_resubmit(OFTABLE_CHECK_LOOPBACK, &remote_ofpacts);
+                local_output_pb(port->tunnel_key, &remote_ofpacts);
             }
         } if (!strcmp(port->type, "remote")) {
             if (port->chassis) {
@@ -1790,18 +1793,14 @@  consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
                                   port->tunnel_key, &remote_ofpacts);
             }
         } else if (!strcmp(port->type, "localport")) {
-            put_load(port->tunnel_key, MFF_LOG_OUTPORT, 0, 32,
-                     &remote_ofpacts);
-            put_resubmit(OFTABLE_CHECK_LOOPBACK, &remote_ofpacts);
+            local_output_pb(port->tunnel_key, &remote_ofpacts);
         } else if ((port->chassis == chassis
                     || is_additional_chassis(port, chassis))
                    && (local_binding_get_primary_pb(local_bindings, lport_name)
                        || !strcmp(port->type, "l3gateway"))) {
-            put_load(port->tunnel_key, MFF_LOG_OUTPORT, 0, 32, &ofpacts);
-            put_resubmit(OFTABLE_CHECK_LOOPBACK, &ofpacts);
+            local_output_pb(port->tunnel_key, &ofpacts);
         } else if (simap_contains(patch_ofports, port->logical_port)) {
-            put_load(port->tunnel_key, MFF_LOG_OUTPORT, 0, 32, &ofpacts);
-            put_resubmit(OFTABLE_CHECK_LOOPBACK, &ofpacts);
+            local_output_pb(port->tunnel_key, &ofpacts);
         } else if (!strcmp(port->type, "chassisredirect")
                    && port->chassis == chassis) {
             const char *distributed_port = smap_get(&port->options,
@@ -1812,9 +1811,7 @@  consider_mc_group(struct ovsdb_idl_index *sbrec_port_binding_by_name,
                                            distributed_port);
                 if (distributed_binding
                     && port->datapath == distributed_binding->datapath) {
-                    put_load(distributed_binding->tunnel_key, MFF_LOG_OUTPORT,
-                             0, 32, &ofpacts);
-                    put_resubmit(OFTABLE_CHECK_LOOPBACK, &ofpacts);
+                    local_output_pb(distributed_binding->tunnel_key, &ofpacts);
                 }
             }
         } else if (!get_localnet_port(local_datapaths,