The iface_hint structure is used during startup to communicate the
caller's understanding of the initial port configuration.  Adding
the interface type allows ofproto implementations to make decisions
based on the port type before the netdev is created.

Signed-off-by: Reuven Plevinsky <[email protected]>
---
 ofproto/ofproto-dpif.c | 2 ++
 ofproto/ofproto.c      | 2 ++
 ofproto/ofproto.h      | 1 +
 vswitchd/bridge.c      | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index c40da62cf691..06e966503ae6 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -280,6 +280,7 @@ init(const struct shash *iface_hints)
 
         new_hint->br_name = xstrdup(orig_hint->br_name);
         new_hint->br_type = xstrdup(orig_hint->br_type);
+        new_hint->iface_type = xstrdup(orig_hint->iface_type);
         new_hint->ofp_port = orig_hint->ofp_port;
 
         shash_add(&init_ofp_ports, node->name, new_hint);
@@ -1838,6 +1839,7 @@ construct(struct ofproto *ofproto_)
 
             free(iface_hint->br_name);
             free(iface_hint->br_type);
+            free(iface_hint->iface_type);
             free(iface_hint);
             shash_delete(&init_ofp_ports, node);
         }
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 9b47869c28e8..02f82c51912f 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -352,6 +352,7 @@ ofproto_init(const struct shash *iface_hints)
 
         new_hint->br_name = xstrdup(orig_hint->br_name);
         new_hint->br_type = xstrdup(br_type);
+        new_hint->iface_type = xstrdup(orig_hint->iface_type);
         new_hint->ofp_port = orig_hint->ofp_port;
 
         shash_add(&init_ofp_ports, node->name, new_hint);
@@ -2945,6 +2946,7 @@ init_ports(struct ofproto *p)
         if (!strcmp(iface_hint->br_name, p->name)) {
             free(iface_hint->br_name);
             free(iface_hint->br_type);
+            free(iface_hint->iface_type);
             free(iface_hint);
             shash_delete(&init_ofp_ports, node);
         }
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index 3f85509a1add..b1cb8fb3354a 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -266,6 +266,7 @@ void ofproto_parse_name(const char *name, char **dp_name, 
char **dp_type);
 struct iface_hint {
     char *br_name;              /* Name of owning bridge. */
     char *br_type;              /* Type of owning bridge. */
+    char *iface_type;           /* Type of interface. */
     ofp_port_t ofp_port;        /* OpenFlow port number. */
 };
 
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 694fbb149aeb..c00abd295a7c 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -391,6 +391,8 @@ bridge_init_ofproto(const struct ovsrec_open_vswitch *cfg)
                     iface_hint = xmalloc(sizeof *iface_hint);
                     iface_hint->br_name = br_cfg->name;
                     iface_hint->br_type = br_cfg->datapath_type;
+                    iface_hint->iface_type =
+                        CONST_CAST(char *, iface_get_type(if_cfg, br_cfg));
                     iface_hint->ofp_port = iface_pick_ofport(if_cfg);
 
                     shash_add(&iface_hints, if_cfg->name, iface_hint);
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to