[v2,01/66] net/ice/base: add macro for rounding up
diff mbox series

Message ID 20190611155221.2703-2-leyi.rong@intel.com
State Superseded, archived
Delegated to: Qi Zhang
Headers show
  • shared code update
Related show


Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

Leyi Rong June 11, 2019, 3:51 p.m. UTC
Add macro ROUND_UP for rounding up to an arbitrary multiple.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
 drivers/net/ice/base/ice_type.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff mbox series

diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index e4979b832..d994ea3d2 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -18,6 +18,18 @@ 
+#ifndef ROUND_UP
+ * ROUND_UP - round up to next arbitrary multiple (not a power of 2)
+ * @a: value to round up
+ * @b: arbitrary multiple
+ *
+ * Round up to the next multiple of the arbitrary b.
+ * Note, when b is a power of 2 use ICE_ALIGN() instead.
+ */
+#define ROUND_UP(a, b)	((b) * DIVIDE_AND_ROUND_UP((a), (b)))
 #ifndef MIN_T
 #define MIN_T(_t, _a, _b)	min((_t)(_a), (_t)(_b))