A number of drivers define the DIV_ROUND_UP macro -- add it to
rte_common.h so that other code looking to use that functionality
doesn't have to re-define it.

Signed-off-by: Joshua Washington <[email protected]>
---
Changes in v2:
  - Split out patches replacing usages
---
 lib/eal/include/rte_common.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 79d2a0ab93..168b0fe592 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -717,6 +717,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), 
used)) func(void)
                (ceil - (v)) > ((v) - floor) ? floor : ceil;    \
        })
 
+/**
+ * Macro to divide dividend n by divisor d, rounding up if d does not divide n.
+ */
+#define RTE_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
 /**
  * Checks if a pointer is aligned to a given power-of-two value
  *
-- 
2.55.0.691.gc56d675ccc-goog

Reply via email to