diff mbox series

[ovs-dev,v2] openflow: allow to configure ofp_desc fields on bridge other_config

Message ID 20210811210903.86829-1-miguel-r-freitas@alticelabs.com
State Deferred
Headers show
Series [ovs-dev,v2] openflow: allow to configure ofp_desc fields on bridge other_config | expand

Checks

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

Commit Message

Miguel Borges de Freitas Aug. 11, 2021, 9:09 p.m. UTC
From: Miguel Borges de Freitas <miguel-r-freitas@alticelabs.com>

Allow to configure all the missing ofp_desc fields (mfr_desc, hw_desc, sw_desc) on the bridge other_config.
Default values are still used (Nicira, Inc.; Open vSwitch; current ovs version) if no values are configured.

Rationale: SDN controllers such as ONOS make use of the information provided from the switch in the reply to
OFPMP_DESC to load SDN controller drivers that define and control the pipeline (i.e. the sequence of tables
and what match fields/actions are available in certain tables). Most of these drivers (if not all) are
compatible with openvswitch. Some of them, for instance ofdpa-ovs are even designed to emulate physical
pipelines (ofdpa) on top of the OVS dataplane. It'd be nice that we could configure those fields on
OVS so that the appropriate driver is loaded automatically when ovs attempts to connect to the controller,
avoiding driver hot-reload which is prone to cause errors.

Signed-off-by: Miguel Borges de Freitas <miguel-r-freitas@alticelabs.com>
---
 ofproto/ofproto.c    | 21 +++++++++++++++++++++
 ofproto/ofproto.h    |  3 +++
 vswitchd/bridge.c    | 30 +++++++++++++++++-------------
 vswitchd/vswitch.xml | 21 +++++++++++++++++++++
 4 files changed, 62 insertions(+), 13 deletions(-)

Comments

Simon Horman Oct. 10, 2023, 12:46 p.m. UTC | #1
On Wed, Aug 11, 2021 at 10:09:03PM +0100, miguelborgesdefreitas@gmail.com wrote:
> From: Miguel Borges de Freitas <miguel-r-freitas@alticelabs.com>
> 
> Allow to configure all the missing ofp_desc fields (mfr_desc, hw_desc, sw_desc) on the bridge other_config.
> Default values are still used (Nicira, Inc.; Open vSwitch; current ovs version) if no values are configured.
> 
> Rationale: SDN controllers such as ONOS make use of the information provided from the switch in the reply to
> OFPMP_DESC to load SDN controller drivers that define and control the pipeline (i.e. the sequence of tables
> and what match fields/actions are available in certain tables). Most of these drivers (if not all) are
> compatible with openvswitch. Some of them, for instance ofdpa-ovs are even designed to emulate physical
> pipelines (ofdpa) on top of the OVS dataplane. It'd be nice that we could configure those fields on
> OVS so that the appropriate driver is loaded automatically when ovs attempts to connect to the controller,
> avoiding driver hot-reload which is prone to cause errors.
> 
> Signed-off-by: Miguel Borges de Freitas <miguel-r-freitas@alticelabs.com>

Hi Miguel,

This patch appears to have gone stale in patchwork, for one reason or
another. If it is still relevant then I think it needs to be revisited,
by being reposted after appropriate preparation.

As such I'm marking this patch as "Deferred" in patchwork.

No action is required unless there is a desire to revisit this patch.
diff mbox series

Patch

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index bd6103b1c..a523f4a67 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -796,6 +796,27 @@  ofproto_set_threads(int n_handlers_, int n_revalidators_)
     n_handlers = MAX(n_handlers_, 0);
 }
 
+void
+ofproto_set_mfr_desc(struct ofproto *p, const char *mfr_desc)
+{
+    free(p->mfr_desc);
+    p->mfr_desc = nullable_xstrdup(mfr_desc);
+}
+
+void
+ofproto_set_hw_desc(struct ofproto *p, const char *hw_desc)
+{
+    free(p->hw_desc);
+    p->hw_desc = nullable_xstrdup(hw_desc);
+}
+
+void
+ofproto_set_sw_desc(struct ofproto *p, const char *sw_desc)
+{
+    free(p->sw_desc);
+    p->sw_desc = nullable_xstrdup(sw_desc);
+}
+
 void
 ofproto_set_dp_desc(struct ofproto *p, const char *dp_desc)
 {
diff --git a/ofproto/ofproto.h b/ofproto/ofproto.h
index b0262da2d..e1e02383d 100644
--- a/ofproto/ofproto.h
+++ b/ofproto/ofproto.h
@@ -350,6 +350,9 @@  int ofproto_port_set_mcast_snooping(struct ofproto *ofproto, void *aux,
 void ofproto_set_threads(int n_handlers, int n_revalidators);
 void ofproto_type_set_config(const char *type,
                              const struct smap *other_config);
+void ofproto_set_mfr_desc(struct ofproto *, const char *mfr_desc);
+void ofproto_set_hw_desc(struct ofproto *, const char *hw_desc);
+void ofproto_set_sw_desc(struct ofproto *, const char *sw_desc);
 void ofproto_set_dp_desc(struct ofproto *, const char *dp_desc);
 void ofproto_set_serial_desc(struct ofproto *p, const char *serial_desc);
 int ofproto_set_snoops(struct ofproto *, const struct sset *snoops);
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index cb7c5cb76..ab0b1295d 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -287,8 +287,7 @@  static void bridge_configure_sflow(struct bridge *, int *sflow_bridge_number);
 static void bridge_configure_ipfix(struct bridge *);
 static void bridge_configure_spanning_tree(struct bridge *);
 static void bridge_configure_tables(struct bridge *);
-static void bridge_configure_dp_desc(struct bridge *);
-static void bridge_configure_serial_desc(struct bridge *);
+static void bridge_configure_ofp_desc(struct bridge *);
 static void bridge_configure_aa(struct bridge *);
 static void bridge_aa_refresh_queued(struct bridge *);
 static bool bridge_aa_need_refresh(struct bridge *);
@@ -942,8 +941,7 @@  bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
         bridge_configure_ipfix(br);
         bridge_configure_spanning_tree(br);
         bridge_configure_tables(br);
-        bridge_configure_dp_desc(br);
-        bridge_configure_serial_desc(br);
+        bridge_configure_ofp_desc(br);
         bridge_configure_aa(br);
     }
     free(managers);
@@ -4123,17 +4121,23 @@  bridge_configure_tables(struct bridge *br)
 }
 
 static void
-bridge_configure_dp_desc(struct bridge *br)
-{
-    ofproto_set_dp_desc(br->ofproto,
-                        smap_get(&br->cfg->other_config, "dp-desc"));
-}
-
-static void
-bridge_configure_serial_desc(struct bridge *br)
-{
+bridge_configure_ofp_desc(struct bridge *br)
+{
+    /* Manufacturer description */
+    ofproto_set_mfr_desc(br->ofproto,
+                         smap_get(&br->cfg->other_config, "mfr-desc"));
+    /* Hardware description */
+    ofproto_set_hw_desc(br->ofproto,
+                        smap_get(&br->cfg->other_config, "hw-desc"));
+    /* Software description */
+    ofproto_set_sw_desc(br->ofproto,
+                        smap_get(&br->cfg->other_config, "sw-desc"));
+    /* Serial number */
     ofproto_set_serial_desc(br->ofproto,
                         smap_get(&br->cfg->other_config, "dp-sn"));
+    /* DP description */
+    ofproto_set_dp_desc(br->ofproto,
+                        smap_get(&br->cfg->other_config, "dp-desc"));
 }
 
 static struct aa_mapping *
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 026b5e2ca..dbe8f8f02 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1309,6 +1309,27 @@ 
         prefix or be exactly 16 hex digits long.  May not be all-zero.
       </column>
 
+      <column name="other_config" key="mfr-desc">
+        Manufacturer description. Defaults to "Nicira, Inc.".
+        The value is returned by the switch as a part of reply to OFPMP_DESC
+        request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes
+        the ofp_desc structure to contaion "NULL terminated ASCII strings".
+      </column>
+
+      <column name="other_config" key="hw-desc">
+        Hardware description. Defaults to "Open vSwitch".
+        The value is returned by the switch as a part of reply to OFPMP_DESC
+        request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes
+        the ofp_desc structure to contaion "NULL terminated ASCII strings".
+      </column>
+
+      <column name="other_config" key="sw-desc">
+        Software description. Defaults to the current Open vSwitch version.
+        The value is returned by the switch as a part of reply to OFPMP_DESC
+        request (ofp_desc). The OpenFlow specification (e.g. 1.3.5) describes
+        the ofp_desc structure to contaion "NULL terminated ASCII strings".
+      </column>
+
       <column name="other_config" key="dp-desc">
         Human readable description of datapath.  It is a maximum 256
         byte-long free-form string to describe the datapath for