From 0e2e511b380cbf71cb744e5910f1f4969e8cd4e9 Mon Sep 17 00:00:00 2001 From: Cunming Liang Date: Tue, 17 Feb 2015 10:08:08 +0800 Subject: [PATCH] enic: fix bsd namespace conflict Some macros already been defined by freebsd 'sys/param.h'. Signed-off-by: Cunming Liang Acked-by: Olivier Matz Acked-by: Konstantin Ananyev --- lib/librte_pmd_enic/enic.h | 4 ++-- lib/librte_pmd_enic/enic_compat.h | 2 +- lib/librte_pmd_enic/vnic/vnic_dev.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h index c43417c278..57b9c80e9e 100644 --- a/lib/librte_pmd_enic/enic.h +++ b/lib/librte_pmd_enic/enic.h @@ -66,9 +66,9 @@ #define ENIC_CALC_IP_CKSUM 1 #define ENIC_CALC_TCP_UDP_CKSUM 2 #define ENIC_MAX_MTU 9000 -#define PAGE_SIZE 4096 +#define ENIC_PAGE_SIZE 4096 #define PAGE_ROUND_UP(x) \ - ((((unsigned long)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1))) + ((((unsigned long)(x)) + ENIC_PAGE_SIZE-1) & (~(ENIC_PAGE_SIZE-1))) #define ENICPMD_VFIO_PATH "/dev/vfio/vfio" /*#define ENIC_DESC_COUNT_MAKE_ODD (x) do{if ((~(x)) & 1) { (x)--; } }while(0)*/ diff --git a/lib/librte_pmd_enic/enic_compat.h b/lib/librte_pmd_enic/enic_compat.h index 67c092d212..0670c1e34c 100644 --- a/lib/librte_pmd_enic/enic_compat.h +++ b/lib/librte_pmd_enic/enic_compat.h @@ -68,7 +68,7 @@ #define pr_warn(y, args...) dev_warning(0, y, ##args) #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__) -#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) +#define VNIC_ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) #define udelay usleep #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c b/lib/librte_pmd_enic/vnic/vnic_dev.c index 6407994d89..38b7f25e59 100644 --- a/lib/librte_pmd_enic/vnic/vnic_dev.c +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c @@ -242,9 +242,9 @@ unsigned int vnic_dev_desc_ring_size(struct vnic_dev_ring *ring, if (desc_count == 0) desc_count = 4096; - ring->desc_count = ALIGN(desc_count, count_align); + ring->desc_count = VNIC_ALIGN(desc_count, count_align); - ring->desc_size = ALIGN(desc_size, desc_align); + ring->desc_size = VNIC_ALIGN(desc_size, desc_align); ring->size = ring->desc_count * ring->desc_size; ring->size_unaligned = ring->size + ring->base_align; @@ -294,7 +294,7 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused)) struct vnic_dev *vdev, ring->base_addr_unaligned = (dma_addr_t)rz->phys_addr; - ring->base_addr = ALIGN(ring->base_addr_unaligned, + ring->base_addr = VNIC_ALIGN(ring->base_addr_unaligned, ring->base_align); ring->descs = (u8 *)ring->descs_unaligned + (ring->base_addr - ring->base_addr_unaligned); -- 2.20.1