diff mbox series

[ovs-dev,5/5] odp-util: Add FLOW_WC_SEQ assertions.

Message ID 20190408182206.15688-5-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,1/5] compiler: Disable BUILD_MESSAGE() when processing with sparse. | expand

Commit Message

Ben Pfaff April 8, 2019, 6:22 p.m. UTC
The assertions make it easier to find all the places that need to be
updated when adding protocol support.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/odp-util.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Numan Siddique April 10, 2019, 6:23 a.m. UTC | #1
On Mon, Apr 8, 2019 at 11:55 PM Ben Pfaff <blp@ovn.org> wrote:

> The assertions make it easier to find all the places that need to be
> updated when adding protocol support.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
>

Acked-by: Numan Siddique <nusiddiq@redhat.com>


> ---
>  lib/odp-util.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 6e545b80ba6c..f60536c1d9dc 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -5819,6 +5819,11 @@ static void
>  odp_flow_key_from_flow__(const struct odp_flow_key_parms *parms,
>                           bool export_mask, struct ofpbuf *buf)
>  {
> +    /* New "struct flow" fields that are visible to the datapath
> (including all
> +     * data fields) should be translated into equivalent datapath flow
> fields
> +     * here (you will have to add a OVS_KEY_ATTR_* for them). */
> +    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 41);
> +
>      struct ovs_key_ethernet *eth_key;
>      size_t encap[FLOW_MAX_VLAN_HEADERS] = {0};
>      size_t max_vlans;
> @@ -6900,6 +6905,11 @@ odp_flow_key_to_flow__(const struct nlattr *key,
> size_t key_len,
>                         struct flow *flow, const struct flow *src_flow,
>                         char **errorp)
>  {
> +    /* New "struct flow" fields that are visible to the datapath
> (including all
> +     * data fields) should be translated from equivalent datapath flow
> fields
> +     * here (you will have to add a OVS_KEY_ATTR_* for them).  */
> +    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 41);
> +
>      enum odp_key_fitness fitness = ODP_FIT_ERROR;
>      if (errorp) {
>          *errorp = NULL;
> --
> 2.20.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ben Pfaff April 12, 2019, 10:12 p.m. UTC | #2
On Wed, Apr 10, 2019 at 11:53:51AM +0530, Numan Siddique wrote:
> On Mon, Apr 8, 2019 at 11:55 PM Ben Pfaff <blp@ovn.org> wrote:
> 
> > The assertions make it easier to find all the places that need to be
> > updated when adding protocol support.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> >
> 
> Acked-by: Numan Siddique <nusiddiq@redhat.com>

Thank you for the reviews!  I applied this series to master.
diff mbox series

Patch

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 6e545b80ba6c..f60536c1d9dc 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -5819,6 +5819,11 @@  static void
 odp_flow_key_from_flow__(const struct odp_flow_key_parms *parms,
                          bool export_mask, struct ofpbuf *buf)
 {
+    /* New "struct flow" fields that are visible to the datapath (including all
+     * data fields) should be translated into equivalent datapath flow fields
+     * here (you will have to add a OVS_KEY_ATTR_* for them). */
+    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 41);
+
     struct ovs_key_ethernet *eth_key;
     size_t encap[FLOW_MAX_VLAN_HEADERS] = {0};
     size_t max_vlans;
@@ -6900,6 +6905,11 @@  odp_flow_key_to_flow__(const struct nlattr *key, size_t key_len,
                        struct flow *flow, const struct flow *src_flow,
                        char **errorp)
 {
+    /* New "struct flow" fields that are visible to the datapath (including all
+     * data fields) should be translated from equivalent datapath flow fields
+     * here (you will have to add a OVS_KEY_ATTR_* for them).  */
+    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 41);
+
     enum odp_key_fitness fitness = ODP_FIT_ERROR;
     if (errorp) {
         *errorp = NULL;