diff mbox series

[ovs-dev,dpdk-latest,v2] sparse: Fix build with DPDK 20.08.

Message ID 20200908111228.8673-1-sunil.pai.g@intel.com
State Accepted
Headers show
Series [ovs-dev,dpdk-latest,v2] sparse: Fix build with DPDK 20.08. | expand

Commit Message

Pai G, Sunil Sept. 8, 2020, 11:12 a.m. UTC
Introduction of C11 atomic instructions in rte_mbuf.h causes the build
to fail with Sparse reporting following errors.

error: undefined identifier '__atomic_add_fetch'
error: undefined identifier '__atomic_store_n'

This patch adds the Sparse header for rte_mbuf.h.

Tested-at: https://travis-ci.org/github/Sunil-Pai-G/ovs-copy/builds/724038561
Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
---
v1->v2:
- address all comments from Dave.
---
 include/sparse/automake.mk |  1 +
 include/sparse/rte_mbuf.h  | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 include/sparse/rte_mbuf.h

Comments

David Marchand Sept. 8, 2020, 11:35 a.m. UTC | #1
On Tue, Sep 8, 2020 at 1:12 PM Sunil Pai G <sunil.pai.g@intel.com> wrote:
>
> Introduction of C11 atomic instructions in rte_mbuf.h causes the build
> to fail with Sparse reporting following errors.
>
> error: undefined identifier '__atomic_add_fetch'
> error: undefined identifier '__atomic_store_n'
>
> This patch adds the Sparse header for rte_mbuf.h.
>
> Tested-at: https://travis-ci.org/github/Sunil-Pai-G/ovs-copy/builds/724038561
> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>

Acked-by: David Marchand <david.marchand@redhat.com>

Thanks.
Stokes, Ian Sept. 11, 2020, 2:30 p.m. UTC | #2
> Introduction of C11 atomic instructions in rte_mbuf.h causes the build to fail
> with Sparse reporting following errors.
> 
> error: undefined identifier '__atomic_add_fetch'
> error: undefined identifier '__atomic_store_n'
> 
> This patch adds the Sparse header for rte_mbuf.h.
> 
> Tested-at: https://travis-ci.org/github/Sunil-Pai-G/ovs-copy/builds/724038561
> Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>

Thanks Sunil, applied.
Regards
Ian
> ---
> v1->v2:
> - address all comments from Dave.
> ---
>  include/sparse/automake.mk |  1 +
>  include/sparse/rte_mbuf.h  | 27 +++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+)
>  create mode 100644 include/sparse/rte_mbuf.h
> 
> diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk index
> c6ced9387..e96637119 100644
> --- a/include/sparse/automake.mk
> +++ b/include/sparse/automake.mk
> @@ -11,6 +11,7 @@ noinst_HEADERS += \
>          include/sparse/netpacket/packet.h \
>          include/sparse/pthread.h \
>          include/sparse/rte_atomic.h \
> +        include/sparse/rte_mbuf.h \
>          include/sparse/rte_memcpy.h \
>          include/sparse/rte_trace_point.h \
>          include/sparse/sys/socket.h \
> diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h new file
> mode 100644 index 000000000..ee461f91e
> --- /dev/null
> +++ b/include/sparse/rte_mbuf.h
> @@ -0,0 +1,27 @@
> +/* Copyright (c) 2020 Intel, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + *     http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef __CHECKER__
> +#error "Use this header only with sparse.  It is not a correct implementation."
> +#endif
> +
> +/* sparse doesn't know about gcc atomic builtins. */ #define
> +__ATOMIC_ACQ_REL 0 #define __ATOMIC_RELAXED 1 #define
> +__atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val)) #define
> +__atomic_store_n(p, val, memorder) (*(p) = (val))
> +
> +/* Get actual <rte_mbuf.h> definitions for us to annotate and build on.
> +*/ #include_next <rte_mbuf.h>
> --
> 2.17.1
diff mbox series

Patch

diff --git a/include/sparse/automake.mk b/include/sparse/automake.mk
index c6ced9387..e96637119 100644
--- a/include/sparse/automake.mk
+++ b/include/sparse/automake.mk
@@ -11,6 +11,7 @@  noinst_HEADERS += \
         include/sparse/netpacket/packet.h \
         include/sparse/pthread.h \
         include/sparse/rte_atomic.h \
+        include/sparse/rte_mbuf.h \
         include/sparse/rte_memcpy.h \
         include/sparse/rte_trace_point.h \
         include/sparse/sys/socket.h \
diff --git a/include/sparse/rte_mbuf.h b/include/sparse/rte_mbuf.h
new file mode 100644
index 000000000..ee461f91e
--- /dev/null
+++ b/include/sparse/rte_mbuf.h
@@ -0,0 +1,27 @@ 
+/* Copyright (c) 2020 Intel, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CHECKER__
+#error "Use this header only with sparse.  It is not a correct implementation."
+#endif
+
+/* sparse doesn't know about gcc atomic builtins. */
+#define __ATOMIC_ACQ_REL 0
+#define __ATOMIC_RELAXED 1
+#define __atomic_add_fetch(p, val, memorder) (*(p) = *(p) + (val))
+#define __atomic_store_n(p, val, memorder) (*(p) = (val))
+
+/* Get actual <rte_mbuf.h> definitions for us to annotate and build on. */
+#include_next <rte_mbuf.h>