mbox series

[net-next,v2,00/10] packing: various improvements and KUnit tests

Message ID 20241002-packing-kunit-tests-and-split-pack-unpack-v2-0-8373e551eae3@intel.com (mailing list archive)
Headers show
Series packing: various improvements and KUnit tests | expand

Message

Jacob Keller Oct. 2, 2024, 9:51 p.m. UTC
This series contains a handful of improvements and fixes for the packing
library, including the addition of KUnit tests.

There are two major changes which might be considered bug fixes:

1) The library is updated to handle arbitrary buffer lengths, fixing
   undefined behavior when operating on buffers which are not a multiple of
   4 bytes.

2) The behavior of QUIRK_MSB_ON_THE_RIGHT is fixed to match the intended
   behavior when operating on packings that are not byte aligned.

These are not sent to net because no driver currently depends on this
behavior. For (1), the existing users of the packing API all operate on
buffers which are multiples of 4-bytes. For (2), no driver currently uses
QUIRK_MSB_ON_THE_RIGHT. The incorrect behavior was found while writing
KUnit tests.

This series also includes a handful of minor cleanups from Vladimir, as
well as a change to introduce a separated pack() and unpack() API. This API
is not (yet) used by a driver, but is the first step in implementing
pack_fields() and unpack_fields() which will be used in future changes for
the ice driver and changes Vladimir has in progress for other drivers using
the packing API.

This series is part 1 of a 2-part series for implementing use of
lib/packing in the ice driver. The 2nd part includes a new pack_fields()
and unpack_fields() implementation inspired by the ice driver's existing
bit packing code. It is built on top of the split pack() and unpack()
code. Additionally, the KUnit tests are built on top of pack() and
unpack(), based on original selftests written by Vladimir.

Fitting the entire library changes and drivers changes into a single series
exceeded the usual series limits.

Those interested in seeing the full work along with the ice driver
implementation can find it at:

  https://github.com/jacob-keller/linux/tree/packing/pack-fields-and-ice-implementation

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
Changes in v2:
- Drop the fixes tags, since none of the changes need or want to be
  backported.
- Link to v1: https://lore.kernel.org/r/20240930-packing-kunit-tests-and-split-pack-unpack-v1-0-94b1f04aca85@intel.com

---
Jacob Keller (3):
      lib: packing: add KUnit tests adapted from selftests
      lib: packing: add additional KUnit tests
      lib: packing: fix QUIRK_MSB_ON_THE_RIGHT behavior

Vladimir Oltean (7):
      lib: packing: refuse operating on bit indices which exceed size of buffer
      lib: packing: adjust definitions and implementation for arbitrary buffer lengths
      lib: packing: remove kernel-doc from header file
      lib: packing: add pack() and unpack() wrappers over packing()
      lib: packing: duplicate pack() and unpack() implementations
      lib: packing: use BITS_PER_BYTE instead of 8
      lib: packing: use GENMASK() for box_mask

 include/linux/packing.h            |  32 +--
 lib/packing.c                      | 400 ++++++++++++++++++++++-------------
 lib/packing_test.c                 | 412 +++++++++++++++++++++++++++++++++++++
 Documentation/core-api/packing.rst |  71 +++++++
 MAINTAINERS                        |   1 +
 lib/Kconfig                        |  12 ++
 lib/Makefile                       |   1 +
 7 files changed, 761 insertions(+), 168 deletions(-)
---
base-commit: c824deb1a89755f70156b5cdaf569fca80698719
change-id: 20240930-packing-kunit-tests-and-split-pack-unpack-031d032d584d

Best regards,

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 3, 2024, 11:10 p.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 02 Oct 2024 14:51:49 -0700 you wrote:
> This series contains a handful of improvements and fixes for the packing
> library, including the addition of KUnit tests.
> 
> There are two major changes which might be considered bug fixes:
> 
> 1) The library is updated to handle arbitrary buffer lengths, fixing
>    undefined behavior when operating on buffers which are not a multiple of
>    4 bytes.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,01/10] lib: packing: refuse operating on bit indices which exceed size of buffer
    https://git.kernel.org/netdev/net-next/c/8b3e26677bc6
  - [net-next,v2,02/10] lib: packing: adjust definitions and implementation for arbitrary buffer lengths
    (no matching commit)
  - [net-next,v2,03/10] lib: packing: remove kernel-doc from header file
    https://git.kernel.org/netdev/net-next/c/816ad8f1e498
  - [net-next,v2,04/10] lib: packing: add pack() and unpack() wrappers over packing()
    https://git.kernel.org/netdev/net-next/c/7263f64e16d9
  - [net-next,v2,05/10] lib: packing: duplicate pack() and unpack() implementations
    https://git.kernel.org/netdev/net-next/c/28aec9ca29f0
  - [net-next,v2,06/10] lib: packing: add KUnit tests adapted from selftests
    (no matching commit)
  - [net-next,v2,07/10] lib: packing: add additional KUnit tests
    https://git.kernel.org/netdev/net-next/c/fcd6dd91d0e8
  - [net-next,v2,08/10] lib: packing: fix QUIRK_MSB_ON_THE_RIGHT behavior
    https://git.kernel.org/netdev/net-next/c/e7fdf5dddce5
  - [net-next,v2,09/10] lib: packing: use BITS_PER_BYTE instead of 8
    https://git.kernel.org/netdev/net-next/c/fb02c7c8a577
  - [net-next,v2,10/10] lib: packing: use GENMASK() for box_mask
    https://git.kernel.org/netdev/net-next/c/46e784e94b82

You are awesome, thank you!