lib: fix missing includes in exported headers

Many exported headers rely on definitions found in rte_config.h without
including it, as shown by the following command:

 grep -L '^#include <rte_config.h>' -- \
  $(grep -Rl \
    $(sed -n '/^#define \([^ ]\+\).*$/{s//\1/;H;};${x;s/\n//;s/\n/\\|/g;p;}' \
      build/include/rte_config.h) \
    -- build/include/)

We cannot assume external applications will include rte_config.h on their
own, neither directly nor through a -include parameter like DPDK does
internally.

This not only causes obvious compilation failures that can be reproduced
with check-includes.sh such as:

 [...]/rte_memory.h:88:43: error: ‘RTE_CACHE_LINE_SIZE’ was not declared in
     this scope
  #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
                                            ^

It also results in less visible issues, for instance rte_hash_crc.h relying
on RTE_ARCH_X86_64's presence to provide dedicated inline functions.

This patch partially reverts the commit below and adds missing include
lines to the remaining files.

Fixes: f1a7a5c5f4 ("remove include of generated config header")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
Adrien Mazarguil 2017-12-21 14:00:04 +01:00 committed by Thomas Monjalon
parent 34c709f9b2
commit 0d440d081c
41 changed files with 44 additions and 0 deletions

View file

@ -63,6 +63,7 @@
#else
#include <stdint.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_memory.h>
#include <rte_ether.h>
#include <rte_atomic.h>

View file

@ -61,6 +61,8 @@
#ifndef _CIRBUF_H_
#define _CIRBUF_H_
#include <rte_config.h>
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -49,6 +49,7 @@ extern "C" {
#include "rte_crypto.h"
#include "rte_dev.h"
#include <rte_common.h>
#include <rte_config.h>
extern const char **rte_cyptodev_names;

View file

@ -46,6 +46,7 @@ extern "C" {
#include <string.h>
#include <rte_config.h>
#include <rte_dev.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>

View file

@ -11,6 +11,7 @@ extern "C" {
#include <stdint.h>
#include <rte_common.h>
#include <rte_config.h>
#include <emmintrin.h>
#include "generic/rte_atomic.h"

View file

@ -11,6 +11,7 @@ extern "C" {
#include <stdint.h>
#include <rte_common.h>
#include <rte_config.h>
#include "generic/rte_byteorder.h"
#ifndef RTE_BYTE_ORDER

View file

@ -47,6 +47,7 @@ extern int rte_cycles_vmware_tsc_map;
#include <rte_branch_prediction.h>
#endif
#include <rte_common.h>
#include <rte_config.h>
static inline uint64_t
rte_rdtsc(void)

View file

@ -16,6 +16,7 @@
#include <string.h>
#include <rte_vect.h>
#include <rte_common.h>
#include <rte_config.h>
#ifdef __cplusplus
extern "C" {

View file

@ -12,6 +12,7 @@
*/
#include <stdint.h>
#include <rte_config.h>
#include "generic/rte_vect.h"
#if (defined(__ICC) || (__GNUC__ == 4 && __GNUC_MINOR__ < 4))

View file

@ -22,6 +22,7 @@
#endif
#include <rte_common.h>
#include <rte_config.h>
/*
* Compile-time endianness detection

View file

@ -37,6 +37,7 @@ extern "C" {
#include <string.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_debug.h>
#include <rte_memory.h>
#include <rte_branch_prediction.h>

View file

@ -22,6 +22,8 @@ extern "C" {
#include <errno.h>
#include <limits.h>
#include <rte_config.h>
#ifndef typeof
#define typeof __typeof__
#endif

View file

@ -49,6 +49,7 @@ extern "C" {
#include <stdio.h>
#include <sys/queue.h>
#include <rte_config.h>
#include <rte_log.h>
__attribute__((format(printf, 2, 0)))

View file

@ -14,6 +14,7 @@
#include <stdint.h>
#include <sched.h>
#include <rte_config.h>
#include <rte_per_lcore.h>
#include <rte_bus.h>

View file

@ -5,6 +5,7 @@
#ifndef _RTE_EAL_MEMCONFIG_H_
#define _RTE_EAL_MEMCONFIG_H_
#include <rte_config.h>
#include <rte_tailq.h>
#include <rte_memory.h>
#include <rte_memzone.h>

View file

@ -39,6 +39,7 @@
#ifndef _KEEPALIVE_H_
#define _KEEPALIVE_H_
#include <rte_config.h>
#include <rte_memory.h>
#ifndef RTE_KEEPALIVE_MAXCORES

View file

@ -11,6 +11,7 @@
* API for lcore and socket manipulation
*
*/
#include <rte_config.h>
#include <rte_per_lcore.h>
#include <rte_eal.h>
#include <rte_launch.h>

View file

@ -22,6 +22,7 @@ extern "C" {
#include <stdarg.h>
#include <rte_common.h>
#include <rte_config.h>
struct rte_log_dynamic_type;

View file

@ -20,6 +20,7 @@ extern "C" {
#endif
#include <rte_common.h>
#include <rte_config.h>
__extension__
enum rte_page_sizes {

View file

@ -31,6 +31,7 @@ extern "C" {
#include <stdint.h>
#include <sys/queue.h>
#include <rte_config.h>
#include <rte_lcore.h>
#define RTE_SERVICE_NAME_MAX 32

View file

@ -11,6 +11,7 @@
#define RTE_STD_C11
#else
#include <rte_common.h>
#include <rte_config.h>
#endif
/**

View file

@ -152,6 +152,7 @@ extern "C" {
#include <rte_devargs.h>
#include <rte_errno.h>
#include <rte_common.h>
#include <rte_config.h>
#include "rte_ether.h"
#include "rte_eth_ctrl.h"

View file

@ -37,6 +37,7 @@
#include <rte_malloc.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
#include <rte_config.h>
#include <rte_ethdev.h>
/**

View file

@ -34,6 +34,7 @@
#ifndef _RTE_ETHDEV_VDEV_H_
#define _RTE_ETHDEV_VDEV_H_
#include <rte_config.h>
#include <rte_malloc.h>
#include <rte_bus_vdev.h>
#include <rte_ethdev.h>

View file

@ -239,6 +239,7 @@ extern "C" {
#endif
#include <rte_common.h>
#include <rte_config.h>
#include <rte_memory.h>
#include <rte_errno.h>

View file

@ -20,6 +20,7 @@ extern "C" {
#include <string.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_dev.h>
#include <rte_log.h>
#include <rte_malloc.h>

View file

@ -20,6 +20,7 @@ extern "C" {
#include <string.h>
#include <rte_config.h>
#include <rte_eal.h>
#include <rte_lcore.h>
#include <rte_pci.h>

View file

@ -19,6 +19,7 @@ extern "C" {
#include <string.h>
#include <rte_config.h>
#include <rte_debug.h>
#include <rte_eal.h>
#include <rte_bus_vdev.h>

View file

@ -25,6 +25,7 @@ extern "C" {
#include <string.h>
#include <rte_config.h>
#ifndef RTE_FBK_HASH_FUNC_DEFAULT
#if defined(RTE_ARCH_X86) || defined(RTE_MACHINE_CPUFLAG_CRC32)
#include <rte_hash_crc.h>

View file

@ -16,6 +16,7 @@ extern "C" {
#endif
#include <stdint.h>
#include <rte_config.h>
#include <rte_cpuflags.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>

View file

@ -48,6 +48,7 @@ extern "C" {
#include <string.h>
#include <limits.h>
#include <rte_config.h>
#include <rte_log.h>
#include <rte_byteorder.h>

View file

@ -53,6 +53,7 @@ extern "C" {
#include <stdint.h>
#include <rte_byteorder.h>
#include <rte_config.h>
#include <rte_ip.h>
#include <rte_common.h>

View file

@ -19,6 +19,7 @@ extern "C" {
#include <stdint.h>
#include <stdio.h>
#include <rte_config.h>
#include <rte_malloc.h>
#include <rte_memory.h>
#include <rte_ip.h>

View file

@ -16,6 +16,7 @@
#include <stdlib.h>
#include <rte_branch_prediction.h>
#include <rte_byteorder.h>
#include <rte_config.h>
#include <rte_memory.h>
#include <rte_common.h>
#include <rte_vect.h>

View file

@ -62,6 +62,7 @@
#include <stdint.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_mempool.h>
#include <rte_memory.h>
#include <rte_atomic.h>

View file

@ -52,6 +52,7 @@ extern "C" {
#include <stdint.h>
#include <rte_common.h>
#include <rte_config.h>
/** The set ID type that stored internally in hash table based set summary. */
typedef uint16_t member_set_t;

View file

@ -69,6 +69,7 @@
#include <inttypes.h>
#include <sys/queue.h>
#include <rte_config.h>
#include <rte_spinlock.h>
#include <rte_log.h>
#include <rte_debug.h>

View file

@ -96,6 +96,7 @@ extern "C" {
#include <sys/queue.h>
#include <errno.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_memory.h>
#include <rte_lcore.h>
#include <rte_atomic.h>

View file

@ -9,6 +9,7 @@
extern "C" {
#endif
#include <rte_config.h>
#ifdef RTE_ARCH_X86_64
#include "rte_lru_x86.h"
#elif defined(RTE_ARCH_ARM64)

View file

@ -11,6 +11,8 @@ extern "C" {
#include <stdint.h>
#include <rte_config.h>
#ifndef RTE_TABLE_HASH_LRU_STRATEGY
#define RTE_TABLE_HASH_LRU_STRATEGY 2
#endif

View file

@ -38,6 +38,7 @@
#include <stdint.h>
#include <stddef.h>
#include <rte_common.h>
#include <rte_config.h>
#ifdef __cplusplus
extern "C" {