[dpdk-dev] [PATCH 2/5] cxgbe: add cxgbe poll mode driver.

Stephen Hemminger stephen at networkplumber.org
Fri May 22 18:42:50 CEST 2015


On Fri, 22 May 2015 18:54:20 +0530
Rahul Lakkireddy <rahul.lakkireddy at chelsio.com> wrote:

> +#define pr_err(y, args...) dev_err(0, y, ##args)
> +#define pr_warn(y, args...) dev_warn(0, y, ##args)
> +#define pr_info(y, args...) dev_info(0, y, ##args)
> +#define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
> +
> +#define ASSERT(x) do {\
> +	if (!(x)) \
> +		rte_panic("CXGBE: x"); \
> +} while (0)
> +#define BUG_ON(x) ASSERT(!(x))
> +
> +#ifndef WARN_ON
> +#define WARN_ON(x) do { \
> +	int ret = !!(x); \
> +	if (unlikely(ret)) \
> +		pr_warn("WARN_ON: \"" #x "\" at %s:%d\n", __func__, __LINE__); \
> +} while (0)
> +#endif
> +
> +#define __iomem
> +
> +#ifndef BIT
> +#define BIT(n) (1 << (n))
> +#endif
> +
> +#define L1_CACHE_SHIFT  6
> +#define L1_CACHE_BYTES  BIT(L1_CACHE_SHIFT)
> +
> +#define PAGE_SHIFT  12
> +#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
> +#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
> +
> +#define VLAN_HLEN 4
> +
> +#define rmb()     rte_rmb() /* dpdk rte provided rmb */
> +#define wmb()     rte_wmb() /* dpdk rte provided wmb */
> +
> +typedef uint8_t   u8;
> +typedef int8_t    s8;
> +typedef uint16_t  u16;
> +typedef uint32_t  u32;
> +typedef int32_t   s32;
> +typedef uint64_t  u64;
> +typedef int       bool;
> +typedef uint64_t  dma_addr_t;
> +
> +#ifndef __le16
> +#define __le16	uint16_t
> +#endif
> +#ifndef __le32
> +#define __le32	uint32_t
> +#endif
> +#ifndef __le64
> +#define __le64	uint64_t
> +#endif
> +#ifndef __be16
> +#define __be16	uint16_t
> +#endif
> +#ifndef __be32
> +#define __be32	uint32_t
> +#endif
> +#ifndef __be64
> +#define __be64	uint64_t
> +#endif
> +#ifndef __u8
> +#define __u8	uint8_t
> +#endif
> +#ifndef __u16
> +#define __u16	uint16_t
> +#endif
> +#ifndef __u32
> +#define __u32	uint32_t
> +#endif
> +#ifndef __u64
> +#define __u64	uint64_t
> +#endif
> +
> +#define FALSE	0
> +#define TRUE	1
> +#define false	0
> +#define true	1
> +
> +#define min(a, b) RTE_MIN(a, b)
> +#define max(a, b) RTE_MAX(a, b)

This is not Linux kernel.
Please don't create wrappers for all the stuff in Linux to port your driver.


More information about the dev mailing list