Thread (49 messages) flat view 49 messages, 4 authors, 1d ago

Re: [PATCH v2 00/14] Introduce RTE_DIV_ROUND_UP

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2026-09-22 00:36:43

On Thu, 13 Aug 2026 10:22:25 -0700
Joshua Washington [off-list ref] wrote:
Numerous drivers independently define the DIV_ROUND_UP macro, using the
same definition. Attempt to commonize by introducing RTE_DIV_ROUND_UP to
rte_common.h and replacing usages of DIV_ROUND_UP with RTE_DIV_ROUND_UP.

Looks ok, predates use of AI review, so ran it manually.

The biggest issue reported is tat changing base/ code here
is problematic. You can do it a base/ wrapper header but
not directly at call sites.

Tested: applies cleanly to main, builds with -Werror on x86/gcc for all
touched drivers, and no DIV_ROUND_UP users remain.

Patch 1:

    Needs a test in app/test/test_common.c (exact, remainder, n=0, d=1).
    Needs a release notes entry.
    Doxygen should document the params and the caveats: d evaluated twice,
    unsigned only, and n + d - 1 can wrap (RTE_DIV_ROUND_UP(UINT32_MAX, 2)
    on uint32_t is 0). Consider ((n) / (d) + ((n) % (d) != 0)) instead.
    DIV_CEIL in app/test/test_compressdev.c and
    app/test-compress-perf/comp_perf_test_common.c could be converted too.

Base code (qede, cxgbe, ena):
Please don't edit call sites under base/. That code is synced from
vendor trees (ena-com is shared with Linux and FreeBSD) and this will
conflict on the next update. Do what i40e/ice/idpf did: keep
#define DIV_ROUND_UP(n, d) RTE_DIV_ROUND_UP(n, d)
in the osdep/platform header and leave base/ alone.

Minor:

    qede, nfp: drop the rewraps; the original lines fit in 100 columns.
    hinic: the "X must be nonnegative" comment is lost; move it to the
    rte_common.h doxygen.
    ena: leaves a double blank line in ena_plat_dpdk.h.
    13/14: subject should be "net/nfp:", not "drivers:".

The osdep-only patches (i40e, idpf, ice, hns3, bnx2x, ifpga, procinfo)
look fine.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help