public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH net-next v2 04/10] lib: packing: add pack() and unpack() wrappers over packing()
Date: Thu, 3 Oct 2024 18:13:12 +0300	[thread overview]
Message-ID: <20241003151312.ewo3dpadnjmv3beu@skbuf> (raw)
In-Reply-To: <20241002-packing-kunit-tests-and-split-pack-unpack-v2-4-8373e551eae3@intel.com>

On Wed, Oct 02, 2024 at 02:51:53PM -0700, Jacob Keller wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Geert Uytterhoeven described packing() as "really bad API" because of
> not being able to enforce const correctness. The same function is used
> both when "pbuf" is input and "uval" is output, as in the other way
> around.
> 
> Create 2 wrapper functions where const correctness can be ensured.
> Do ugly type casts inside, to be able to reuse packing() as currently
> implemented - which will _not_ modify the input argument.
> 
> Also, take the opportunity to change the type of startbit and endbit to
> size_t - an unsigned type - in these new function prototypes. When int,
> an extra check for negative values is necessary. Hopefully, when
> packing() goes away completely, that check can be dropped.
> 
> My concern is that code which does rely on the conditional directionality
> of packing() is harder to refactor without blowing up in size. So it may
> take a while to completely eliminate packing(). But let's make alternatives
> available for those who do not need that.
> 
> Link: https://lore.kernel.org/netdev/20210223112003.2223332-1-geert+renesas@glider.be/
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

  reply	other threads:[~2024-10-03 15:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 21:51 [PATCH net-next v2 00/10] packing: various improvements and KUnit tests Jacob Keller
2024-10-02 21:51 ` [PATCH net-next v2 01/10] lib: packing: refuse operating on bit indices which exceed size of buffer Jacob Keller
2024-10-03 15:02   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 02/10] lib: packing: adjust definitions and implementation for arbitrary buffer lengths Jacob Keller
2024-10-03 15:05   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 03/10] lib: packing: remove kernel-doc from header file Jacob Keller
2024-10-03 15:05   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 04/10] lib: packing: add pack() and unpack() wrappers over packing() Jacob Keller
2024-10-03 15:13   ` Vladimir Oltean [this message]
2024-10-02 21:51 ` [PATCH net-next v2 05/10] lib: packing: duplicate pack() and unpack() implementations Jacob Keller
2024-10-03 15:11   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 06/10] lib: packing: add KUnit tests adapted from selftests Jacob Keller
2024-10-03 15:18   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 07/10] lib: packing: add additional KUnit tests Jacob Keller
2024-10-03 15:21   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 08/10] lib: packing: fix QUIRK_MSB_ON_THE_RIGHT behavior Jacob Keller
2024-10-03 15:22   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 09/10] lib: packing: use BITS_PER_BYTE instead of 8 Jacob Keller
2024-10-03 15:23   ` Vladimir Oltean
2024-10-02 21:51 ` [PATCH net-next v2 10/10] lib: packing: use GENMASK() for box_mask Jacob Keller
2024-10-03 23:10 ` [PATCH net-next v2 00/10] packing: various improvements and KUnit tests patchwork-bot+netdevbpf

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=20241003151312.ewo3dpadnjmv3beu@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=jacob.e.keller@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=przemyslaw.kitszel@intel.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