numam-dpdk/drivers/net/ionic/ionic_osdep.h
Sunil Kumar Kori e40303eb0f net/ionic: use standard boolean type
Any DPDK public header file which includes stdbool.h may conflict with
local definition of bool, if any, which further results in compilation
error. To avoid, used standard stdbool.h instead of defining bool
internally.

I observed this issue during a development where I included rte_uuid.h
into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
throwing error as given below:

  CC ionic_rxtx.o
In file included from .../dpdk/build/include/rte_uuid.h:17:0,
                 from .../dpdk/build/include/rte_ethdev.h:161,
                 from .../dpdk/build/include/rte_ethdev_driver.h:18,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:17:
    error: two or more data types in declaration specifiers
typedef uint8_t bool;
                 ^
In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
                 from .../dpdk/drivers/net/ionic/ionic.h:13,
                 from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:1:
    warning: useless type name in empty declaration
typedef uint8_t bool;
^~~~~~~
cc1: warning: unrecognized command line option
				‘-Wno-address-of-packed-member’
.../dpdk/mk/internal/rte.compile-pre.mk:114:
			recipe for target 'ionic_rxtx.o' failed

Fixes: 5ef518098e ("net/ionic: register and initialize adapter")
Cc: stable@dpdk.org

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Alfredo Cardigliano <cardigliano@ntop.org>
2020-03-18 10:21:42 +01:00

59 lines
1.3 KiB
C

/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
* Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
*/
#ifndef _IONIC_OSDEP_
#define _IONIC_OSDEP_
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdarg.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_cycles.h>
#include <rte_log.h>
#include <rte_byteorder.h>
#include <rte_io.h>
#include <rte_memory.h>
#include "ionic_logs.h"
#define DELAY(x) rte_delay_us(x)
#define usec_delay(x) DELAY(x)
#define msec_delay(x) DELAY(1000 * (x))
#define BIT(nr) (1UL << (nr))
#define BIT_ULL(nr) (1ULL << (nr))
#define BITS_TO_LONGS(nr) div_round_up(nr, 8 * sizeof(long))
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
#define PAGE_SIZE (1 << PAGE_SHIFT)
#endif
#define __iomem
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef uint16_t __le16;
typedef uint32_t __le32;
typedef uint64_t __le64;
static inline uint32_t div_round_up(uint32_t n, uint32_t d)
{
return (n + d - 1) / d;
}
#define ioread8(reg) rte_read8(reg)
#define ioread32(reg) rte_read32(reg)
#define iowrite8(value, reg) rte_write8(value, reg)
#define iowrite32(value, reg) rte_write32(value, reg)
#define writeq(value, reg) rte_write64(value, reg)
#endif