Right now consider_port_binding first extracts *a* tunnel for a
chassis, then later in put_remote_port_redirect_overlay it fetches
*the* proper tunnel before configuring encapsulation.

Instead of doing it in two steps, just extract the proper tunnel info
earlier.

Signed-off-by: Ihar Hrachyshka <ihrac...@redhat.com>
---
 controller/physical.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/controller/physical.c b/controller/physical.c
index 0426098b2..6f5197955 100644
--- a/controller/physical.c
+++ b/controller/physical.c
@@ -301,17 +301,14 @@ put_remote_port_redirect_overlay(const struct
 {
     if (!is_ha_remote) {
         /* Setup encapsulation */
-        const struct chassis_tunnel *rem_tun =
-            get_port_binding_tun(binding->encap, binding->chassis,
-            chassis_tunnels);
-        if (!rem_tun) {
+        if (!tun) {
             return;
         }
         put_encapsulation(mff_ovn_geneve, tun, binding->datapath, port_key,
                           !strcmp(binding->type, "vtep"),
                           ofpacts_p);
         /* Output to tunnel. */
-        ofpact_put_OUTPUT(ofpacts_p)->port = rem_tun->ofport;
+        ofpact_put_OUTPUT(ofpacts_p)->port = tun->ofport;
     } else {
         /* Make sure all tunnel endpoints use the same encapsulation,
          * and set it up */
@@ -1079,8 +1076,8 @@ consider_port_binding(struct ovsdb_idl_index 
*sbrec_port_binding_by_name,
                 if (!binding->chassis) {
                     goto out;
                 }
-                tun = chassis_tunnel_find(chassis_tunnels,
-                                          binding->chassis->name, NULL);
+                tun = get_port_binding_tun(binding->encap, binding->chassis,
+                                           chassis_tunnels);
                 if (!tun) {
                     goto out;
                 }
-- 
2.34.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to