diff mbox

[ovs-dev,10/31] fixup: Revalidate if 'packet-type-aware' setting changes.

Message ID 20170612222856.14108-11-blp@ovn.org
State Superseded
Headers show

Commit Message

Ben Pfaff June 12, 2017, 10:28 p.m. UTC
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ofproto/ofproto-dpif.c     | 9 +++++++++
 ofproto/ofproto-provider.h | 3 +++
 ofproto/ofproto.c          | 7 ++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

Comments

Jan Scheurich June 14, 2017, 6:25 p.m. UTC | #1
Good spot! Definitely needed.

> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-bounces@openvswitch.org] On Behalf Of Ben Pfaff
> Sent: Tuesday, 13 June, 2017 00:29
> To: dev@openvswitch.org
> Cc: Ben Pfaff <blp@ovn.org>
> Subject: [ovs-dev] [PATCH 10/31] fixup: Revalidate if 'packet-type-aware' setting changes.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  ofproto/ofproto-dpif.c     | 9 +++++++++
>  ofproto/ofproto-provider.h | 3 +++
>  ofproto/ofproto.c          | 7 ++++++-
>  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 752d2304a163..098db18c7ffa 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1792,6 +1792,14 @@ set_tables_version(struct ofproto *ofproto_, ovs_version_t version)
>      ofproto->backer->need_revalidate = REV_FLOW_TABLE;
>  }
> 
> +static void
> +packet_type_aware_changed(struct ofproto *ofproto_)
> +{
> +    struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
> +
> +    ofproto->backer->need_revalidate = REV_RECONFIGURE;
> +}
> +
>  static struct ofport *
>  port_alloc(void)
>  {
> @@ -5644,6 +5652,7 @@ const struct ofproto_class ofproto_dpif_class = {
>      flush,
>      query_tables,
>      set_tables_version,
> +    packet_type_aware_changed,
>      port_alloc,
>      port_construct,
>      port_destruct,
> diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
> index fbf3bdaeac8d..749f61b34f8b 100644
> --- a/ofproto/ofproto-provider.h
> +++ b/ofproto/ofproto-provider.h
> @@ -933,6 +933,9 @@ struct ofproto_class {
>       * can be triggered. */
>      void (*set_tables_version)(struct ofproto *ofproto, ovs_version_t version);
> 
> +    /* Called when 'ofproto->packet_type_aware' has changed. */
> +    void (*packet_type_aware_changed)(struct ofproto *ofproto);
> +
>  /* ## ---------------- ## */
>  /* ## ofport Functions ## */
>  /* ## ---------------- ## */
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 67aaa755f10e..11a26af9f1bb 100644
> --- a/ofproto/ofproto.c
> +++ b/ofproto/ofproto.c
> @@ -787,7 +787,12 @@ ofproto_set_dp_desc(struct ofproto *p, const char *dp_desc)
>  void
>  ofproto_set_packet_type_aware(struct ofproto *p, bool pta)
>  {
> -    p->packet_type_aware = pta;
> +    if (pta != p->packet_type_aware) {
> +        p->packet_type_aware = pta;
> +        if (p->ofproto_class->packet_type_aware_changed) {
> +            p->ofproto_class->packet_type_aware_changed(p);
> +        }
> +    }
>  }
> 
>  int
> --
> 2.10.2
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 752d2304a163..098db18c7ffa 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1792,6 +1792,14 @@  set_tables_version(struct ofproto *ofproto_, ovs_version_t version)
     ofproto->backer->need_revalidate = REV_FLOW_TABLE;
 }
 
+static void
+packet_type_aware_changed(struct ofproto *ofproto_)
+{
+    struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
+
+    ofproto->backer->need_revalidate = REV_RECONFIGURE;
+}
+
 static struct ofport *
 port_alloc(void)
 {
@@ -5644,6 +5652,7 @@  const struct ofproto_class ofproto_dpif_class = {
     flush,
     query_tables,
     set_tables_version,
+    packet_type_aware_changed,
     port_alloc,
     port_construct,
     port_destruct,
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index fbf3bdaeac8d..749f61b34f8b 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -933,6 +933,9 @@  struct ofproto_class {
      * can be triggered. */
     void (*set_tables_version)(struct ofproto *ofproto, ovs_version_t version);
 
+    /* Called when 'ofproto->packet_type_aware' has changed. */
+    void (*packet_type_aware_changed)(struct ofproto *ofproto);
+
 /* ## ---------------- ## */
 /* ## ofport Functions ## */
 /* ## ---------------- ## */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 67aaa755f10e..11a26af9f1bb 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -787,7 +787,12 @@  ofproto_set_dp_desc(struct ofproto *p, const char *dp_desc)
 void
 ofproto_set_packet_type_aware(struct ofproto *p, bool pta)
 {
-    p->packet_type_aware = pta;
+    if (pta != p->packet_type_aware) {
+        p->packet_type_aware = pta;
+        if (p->ofproto_class->packet_type_aware_changed) {
+            p->ofproto_class->packet_type_aware_changed(p);
+        }
+    }
 }
 
 int