[dpdk-dev,v8,11/19] enic: fix re-define freebsd compile complain

Message ID 1424138896-28618-12-git-send-email-cunming.liang@intel.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Cunming Liang Feb. 17, 2015, 2:08 a.m. UTC
Some macro already been defined by freebsd 'sys/param.h'.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
 v5 changes:
   rename the redefined MACRO instead of undefine them

 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(-)
  

Patch

diff --git a/lib/librte_pmd_enic/enic.h b/lib/librte_pmd_enic/enic.h
index c43417c..57b9c80 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 b1af838..40c9b44 100644
--- a/lib/librte_pmd_enic/enic_compat.h
+++ b/lib/librte_pmd_enic/enic_compat.h
@@ -67,7 +67,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 6407994..38b7f25 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);