DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Joshua Washington <joshwash@google.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v3 00/16] Introduce RTE_DIV_ROUND_UP
Date: Wed, 23 Sep 2026 10:32:13 -0700	[thread overview]
Message-ID: <20260923103213.75ac6d81@phoenix.local> (raw)
In-Reply-To: <20260923010742.2468145-1-joshwash@google.com>

On Tue, 22 Sep 2026 18:07:23 -0700
Joshua Washington <joshwash@google.com> wrote:

> Numerous components 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. Similarly, replace DIV_CEIL, which is
> functionally identical, to RTE_DIV_ROUND_UP.
> 
> Changes in v3:
>   - eal: Add unit tests in app/test/test_common.c.
>   - eal: Add release notes entry for RTE_DIV_ROUND_UP.
>   - eal: Expand Doxygen documentation with parameters and caveats
>     (divisor evaluation, non-negative inputs, wraparound).
>   - base code (qede, cxgbe, ena): Keep DIV_ROUND_UP macro in osdep/platform
>     headers and avoid modifying call sites under base/.
>   - nfp: Change commit subject prefix from "drivers:" to "net/nfp:".
>   - qede, nfp: Drop unnecessary line rewraps.
>   - ena: Remove extraneous blank line in ena_plat_dpdk.h.
>   - app: Convert DIV_CEIL in app/test and app/test-compress-perf to
>     RTE_DIV_ROUND_UP.
> 
> Changes in v2:
>   - Split single patch into series.
> 
> Joshua Washington (16):
>   eal: introduce division round up macro
>   net/i40e: use common division round up macro
>   net/idpf: use common division round up macro
>   net/ice: use common division round up macro
>   net/qede: use common division round up macro
>   net/rnp: use common division round up macro
>   net/hns3: use common division round up macro
>   net/hinic: use common division round up macro
>   net/bnx2x: use common division round up macro
>   net/cxgbe: use common division round up macro
>   net/ena: use common division round up macro
>   raw/ifpga/base: use common division round up macro
>   net/nfp: use common division round up macro
>   app/procinfo: use common division round up macro
>   app/test: use common division round up macro
>   app/test-compress-perf: use common division round up macro
> 
>  app/proc-info/main.c                           |  3 +--
>  app/test-compress-perf/comp_perf_test_common.c | 13 +++++--------
>  app/test/test_common.c                         | 10 ++++++++++
>  app/test/test_compressdev.c                    |  4 +---
>  doc/guides/rel_notes/release_26_11.rst         |  5 +++++
>  drivers/common/nfp/nfp_platform.h              |  2 --
>  drivers/net/bnx2x/bnx2x.c                      |  4 ++--
>  drivers/net/bnx2x/bnx2x.h                      | 11 ++++-------
>  drivers/net/cxgbe/cxgbe_compat.h               |  2 +-
>  drivers/net/cxgbe/cxgbe_filter.c               |  6 +++---
>  drivers/net/cxgbe/cxgbe_ofld.h                 |  4 ++--
>  drivers/net/cxgbe/sge.c                        | 14 +++++++-------
>  drivers/net/ena/base/ena_plat_dpdk.h           |  2 +-
>  drivers/net/hinic/base/hinic_compat.h          |  5 +----
>  drivers/net/hns3/hns3_ethdev.h                 |  2 --
>  drivers/net/hns3/hns3_fdir.c                   |  2 +-
>  drivers/net/hns3/hns3_regs.c                   |  8 ++++----
>  drivers/net/hns3/hns3_rss.c                    |  8 ++++----
>  drivers/net/intel/i40e/base/i40e_osdep.h       |  3 +--
>  drivers/net/intel/ice/base/ice_osdep.h         |  3 +--
>  drivers/net/intel/idpf/base/idpf_osdep.h       |  3 +--
>  drivers/net/nfp/nfdk/nfp_nfdk.h                |  2 +-
>  drivers/net/nfp/nfdk/nfp_nfdk_dp.c             |  2 +-
>  drivers/net/nfp/nfpcore/nfp_nsp.c              |  2 +-
>  drivers/net/qede/base/bcm_osal.h               |  1 -
>  drivers/net/qede/qede_debug.c                  | 16 ++++++++--------
>  drivers/net/rnp/base/rnp_osdep.h               |  5 ++---
>  drivers/net/rnp/rnp_rxtx.c                     |  2 +-
>  drivers/raw/ifpga/base/opae_osdep.h            |  3 +--
>  lib/eal/include/rte_common.h                   | 18 ++++++++++++++++++
>  30 files changed, 88 insertions(+), 77 deletions(-)
> 

Since the next-net-intel tree is now merged in main this will need
a rebase. Detailed AI review also found other issues:

Review: [PATCH v3 01/16..16/16] common division round up macro

Series
------

Error

Patches 02-04 do not apply to main. The osdep headers moved out of
base/ in:

  968a7e52ef50 ("net/i40e: move editable files out of base folder")
  2eb2950a8e17 ("net/ice: move editable files out of base folder")
  7b8be7b1c614 ("net/idpf: move editable files out of base folder")

Patch 01 also conflicts in release_26_11.rst. Needs a rebase; the
changes carry over as is to drivers/net/intel/{i40e,ice,idpf}/.
With paths adjusted, every commit builds with -Dwerror=true for all
touched drivers and apps, and common_autotest passes.

Warning

Patches 05, 10 and 11 say DIV_ROUND_UP is now redundant, but v3
keeps it in bcm_osal.h, cxgbe_compat.h and ena_plat_dpdk.h as an
alias for base/ code. Update the commit bodies to match, e.g.:

  Map DIV_ROUND_UP to RTE_DIV_ROUND_UP for base code and use
  RTE_DIV_ROUND_UP directly elsewhere in the driver.

For 05, what actually goes away is the local RTE_DIV_ROUND_UP.

Info

Private copies not covered by the series, for a follow-up:

  drivers/crypto/ccp/ccp_dev.h              CCP_DIV_ROUND_UP
  drivers/common/qat/dev/qat_dev_gen_lce.c  LCE_DIV_ROUND_UP (unused)
  drivers/common/sxe2/sxe2_osal.h           SXE2_DIV_ROUND_UP
  examples/ip_fragmentation/main.c          ROUNDUP_DIV (unused)


Patch 01/16 eal: introduce division round up macro
--------------------------------------------------

Warning

The Doxygen block contradicts itself on the divisor:

  + *   Divisor. Must be a positive integer. Evaluated twice.
  + * @note Both @p n and @p d must be non-negative to round correctly.

d == 0 is non-negative. The first two @note lines only repeat the
@param text; drop them. Also @c formats a single word, so
"@c (n) + (d) - 1" renders only "(n)" as code. Suggest:

  /**
   * Divide @p n by @p d, rounding up.
   *
   * @param n
   *   Dividend. Must be non-negative.
   * @param d
   *   Divisor. Must be positive. Evaluated twice.
   * @return
   *   @p n divided by @p d, rounded up.
   *
   * @note (n) + (d) - 1 wraps if @p n is near the maximum of its
   *   type, e.g. RTE_DIV_ROUND_UP(UINT32_MAX, 2) is 0.
   */


Patch 03/16 net/idpf: use common division round up macro
--------------------------------------------------------

Info

Pre-existing, not introduced by this patch. After the rebase
idpf_osdep.h still carries a second copy, with no users in the tree:

  #define DIVIDE_AND_ROUND_UP(a, b) (((a) + (b) - 1) / (b))

Drop it or alias it to RTE_DIV_ROUND_UP.


Patch 04/16 net/ice: use common division round up macro
-------------------------------------------------------

Info

Pre-existing, not introduced by this patch. ice_osdep.h has the same
DIVIDE_AND_ROUND_UP copy, used by base code (ice_acl_ctrl.c,
ice_flow.c, ice_sched.c). Now that the file is outside base/, map it
to RTE_DIV_ROUND_UP as done for cxgbe and ena.

  parent reply	other threads:[~2026-09-23 17:32 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 22:30 [PATCH] eal: introduce division round up macro Joshua Washington
2026-08-13  1:29 ` Stephen Hemminger
2026-08-13 17:22 ` [PATCH v2 00/14] Introduce RTE_DIV_ROUND_UP Joshua Washington
2026-08-13 17:22   ` [PATCH v2 01/14] eal: introduce division round up macro Joshua Washington
2026-08-13 17:22   ` [PATCH v2 02/14] net/i40e: use common " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 03/14] net/idpf: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 04/14] net/ice: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 05/14] net/qede: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 06/14] net/rnp: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 07/14] net/hns3: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 08/14] net/hinic: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 09/14] net/bnx2x: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 10/14] net/cxgbe: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 11/14] net/ena: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 12/14] raw/ifpga/base: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 13/14] drivers: " Joshua Washington
2026-08-13 17:22   ` [PATCH v2 14/14] app/procinfo: " Joshua Washington
2026-08-15 15:32   ` [PATCH v2 00/14] Introduce RTE_DIV_ROUND_UP Stephen Hemminger
2026-09-22  0:36   ` Stephen Hemminger
2026-09-23  1:07 ` [PATCH v3 00/16] " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 01/16] eal: introduce division round up macro Joshua Washington
2026-09-23  7:29     ` Bruce Richardson
2026-09-24  7:47     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 02/16] net/i40e: use common " Joshua Washington
2026-09-23  7:30     ` Bruce Richardson
2026-09-23  7:35       ` Bruce Richardson
2026-09-29 22:44         ` Joshua Washington
2026-09-30  7:31           ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 03/16] net/idpf: " Joshua Washington
2026-09-23  7:31     ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 04/16] net/ice: " Joshua Washington
2026-09-23  7:31     ` Bruce Richardson
2026-09-23  1:07   ` [PATCH v3 05/16] net/qede: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 06/16] net/rnp: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 07/16] net/hns3: " Joshua Washington
2026-09-24  7:48     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 08/16] net/hinic: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 09/16] net/bnx2x: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 10/16] net/cxgbe: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 11/16] net/ena: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 12/16] raw/ifpga/base: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 13/16] net/nfp: " Joshua Washington
2026-09-23  1:07   ` [PATCH v3 14/16] app/procinfo: " Joshua Washington
2026-09-24  7:49     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 15/16] app/test: " Joshua Washington
2026-09-23  7:36     ` Bruce Richardson
2026-09-24  7:51     ` fengchengwen
2026-09-23  1:07   ` [PATCH v3 16/16] app/test-compress-perf: " Joshua Washington
2026-09-23  7:36     ` Bruce Richardson
2026-09-24  7:51     ` fengchengwen
2026-09-23 17:32   ` Stephen Hemminger [this message]
2026-10-06  2:30   ` [PATCH v4 00/15] Introduce RTE_DIV_ROUND_UP Joshua Washington
2026-10-06  2:30     ` [PATCH v4 01/15] eal: introduce division round up macro Joshua Washington
2026-10-06  2:30     ` [PATCH v4 02/15] net/i40e: use common " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 03/15] net/idpf: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 04/15] net/ice: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 05/15] net/qede: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 06/15] net/rnp: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 07/15] net/hns3: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 08/15] net/hinic: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 09/15] net/bnx2x: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 10/15] net/cxgbe: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 11/15] net/ena: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 12/15] net/nfp: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 13/15] app/procinfo: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 14/15] app/test: " Joshua Washington
2026-10-06  2:30     ` [PATCH v4 15/15] app/test-compress-perf: " Joshua Washington
2026-10-06 16:38     ` [PATCH v4 00/15] Introduce RTE_DIV_ROUND_UP Stephen Hemminger
2026-10-07 20:21       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923103213.75ac6d81@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=joshwash@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox