net/enic: move macro to the correct file
diff mbox series

Message ID 20200114002451.16248-3-johndale@cisco.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • net/enic: move macro to the correct file
Related show

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail Compilation issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

John Daley Jan. 14, 2020, 12:24 a.m. UTC
Move a macro from a widely included header file to a header file
used only by the one caller of the macro.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
---
 drivers/net/enic/enic_compat.h | 10 ----------
 drivers/net/enic/enic_res.h    | 11 ++++++++++-
 2 files changed, 10 insertions(+), 11 deletions(-)

Comments

Ferruh Yigit Jan. 14, 2020, 5:59 p.m. UTC | #1
On 1/14/2020 12:24 AM, John Daley wrote:
> Move a macro from a widely included header file to a header file
> used only by the one caller of the macro.
> 
> Signed-off-by: John Daley <johndale@cisco.com>
> Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>

Applied to dpdk-next-net/master, thanks.
Thomas Monjalon Jan. 19, 2020, 8:23 p.m. UTC | #2
14/01/2020 01:24, John Daley:
> +#define min_t(type, x, y) ({                    \
> +	type __min1 = (x);                      \
> +	type __min2 = (y);                      \
> +	__min1 < __min2 ? __min1 : __min2; })
> +
> +#define max_t(type, x, y) ({                    \
> +	type __max1 = (x);                      \
> +	type __max2 = (y);                      \
> +	__max1 > __max2 ? __max1 : __max2; })

Why not using RTE_MIN/RTE_MAX which use typeof?
You need to specify a type?
John Daley Jan. 21, 2020, 7:49 p.m. UTC | #3
You are right, just need to cast #define parameters, then can use the RTE_MIN and MAX.
Will do a patch.
Thanks,
john

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Sunday, January 19, 2020 12:24 PM
> To: John Daley (johndale) <johndale@cisco.com>; Hyong Youb Kim
> (hyonkim) <hyonkim@cisco.com>
> Cc: ferruh.yigit@intel.com; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/enic: move macro to the correct file
> 
> 14/01/2020 01:24, John Daley:
> > +#define min_t(type, x, y) ({                    \
> > +	type __min1 = (x);                      \
> > +	type __min2 = (y);                      \
> > +	__min1 < __min2 ? __min1 : __min2; })
> > +
> > +#define max_t(type, x, y) ({                    \
> > +	type __max1 = (x);                      \
> > +	type __max2 = (y);                      \
> > +	__max1 > __max2 ? __max1 : __max2; })
> 
> Why not using RTE_MIN/RTE_MAX which use typeof?
> You need to specify a type?
>

Patch
diff mbox series

diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h
index eb1fc941e4..7741273037 100644
--- a/drivers/net/enic/enic_compat.h
+++ b/drivers/net/enic/enic_compat.h
@@ -73,14 +73,4 @@  static inline void writel(unsigned int val, volatile void __iomem *addr)
 	rte_write32(val, addr);
 }
 
-#define min_t(type, x, y) ({                    \
-	type __min1 = (x);                      \
-	type __min2 = (y);                      \
-	__min1 < __min2 ? __min1 : __min2; })
-
-#define max_t(type, x, y) ({                    \
-	type __max1 = (x);                      \
-	type __max2 = (y);                      \
-	__max1 > __max2 ? __max1 : __max2; })
-
 #endif /* _ENIC_COMPAT_H_ */
diff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h
index 9700b0d3e6..b3bd4b27d3 100644
--- a/drivers/net/enic/enic_res.h
+++ b/drivers/net/enic/enic_res.h
@@ -11,6 +11,16 @@ 
 #include "vnic_wq.h"
 #include "vnic_rq.h"
 
+#define min_t(type, x, y) ({                    \
+	type __min1 = (x);                      \
+	type __min2 = (y);                      \
+	__min1 < __min2 ? __min1 : __min2; })
+
+#define max_t(type, x, y) ({                    \
+	type __max1 = (x);                      \
+	type __max2 = (y);                      \
+	__max1 > __max2 ? __max1 : __max2; })
+
 #define ENIC_MIN_WQ_DESCS		64
 #define ENIC_MAX_WQ_DESCS		4096
 #define ENIC_MIN_RQ_DESCS		64
@@ -55,7 +65,6 @@ 
 
 #define ENIC_SETTING(enic, f) ((enic->config.flags & VENETF_##f) ? 1 : 0)
 
-
 struct enic;
 
 int enic_get_vnic_config(struct enic *);