From: Jacob Keller <jacob.e.keller@intel.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
Masahiro Yamada <masahiroy@kernel.org>,
netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v7 6/9] ice: use <linux/packing.h> for Tx and Rx queue context data
Date: Tue, 3 Dec 2024 10:01:04 -0800 [thread overview]
Message-ID: <dfdf794b-01f2-4a61-a208-0907e410b9c1@intel.com> (raw)
In-Reply-To: <20241203134354.mormzine4gt37xha@skbuf>
On 12/3/2024 5:43 AM, Vladimir Oltean wrote:
> On Mon, Dec 02, 2024 at 04:26:29PM -0800, Jacob Keller wrote:
>> +/**
>> + * ice_pack_rxq_ctx - Pack Rx queue context into a HW buffer
>> + * @ctx: the Rx queue context to pack
>> + * @buf: the HW buffer to pack into
>> + *
>> + * Pack the Rx queue context from the CPU-friendly unpacked buffer into its
>> + * bit-packed HW layout.
>> + */
>> +static void ice_pack_rxq_ctx(const struct ice_rlan_ctx *ctx,
>> + ice_rxq_ctx_buf_t *buf)
>> +{
>> + pack_fields(buf, sizeof(*buf), ctx, ice_rlan_ctx_fields,
>> + QUIRK_LITTLE_ENDIAN | QUIRK_LSW32_IS_FIRST);
>
> An alternative pack_fields() design would enforce that the pbuf argument
> has a sizeof() which reveals the packed buffer size. Pro: one macro
> argument less. Con: too intrusive in forcing authors to write code in a
> certain way maybe?
>
Yea, I had it that way in an earlier version, but I ultimately felt like
the resulting macro was less friendly, as existing code may not have
structured types with the appropriate sizes.
We still have to enforce that the size value is a constant (to get the
compile time checks) which I guess has its own downsides over forcing it
to be sizeof().
I think I'd prefer to keep the simplicity of the 5 argument style that
does not require forcing your buffers to be structures.
>> +}
next prev parent reply other threads:[~2024-12-03 18:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 0:26 [PATCH net-next v7 0/9] lib: packing: introduce and use (un)pack_fields Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 1/9] lib: packing: create __pack() and __unpack() variants without error checking Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 2/9] lib: packing: demote truncation error in pack() to a warning in __pack() Jacob Keller
2024-12-03 12:43 ` Vladimir Oltean
2024-12-03 17:50 ` Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 3/9] lib: packing: add pack_fields() and unpack_fields() Jacob Keller
2024-12-03 13:36 ` Vladimir Oltean
2024-12-03 17:57 ` Jacob Keller
2024-12-03 13:39 ` Vladimir Oltean
2024-12-03 17:57 ` Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 4/9] ice: remove int_q_state from ice_tlan_ctx Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 5/9] ice: use structures to keep track of queue context size Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 6/9] ice: use <linux/packing.h> for Tx and Rx queue context data Jacob Keller
2024-12-03 13:43 ` Vladimir Oltean
2024-12-03 18:01 ` Jacob Keller [this message]
2024-12-03 0:26 ` [PATCH net-next v7 7/9] ice: reduce size of queue context fields Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 8/9] ice: move prefetch enable to ice_setup_rx_ctx Jacob Keller
2024-12-03 0:26 ` [PATCH net-next v7 9/9] ice: cleanup Rx queue context programming functions Jacob Keller
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=dfdf794b-01f2-4a61-a208-0907e410b9c1@intel.com \
--to=jacob.e.keller@intel.com \
--cc=akpm@linux-foundation.org \
--cc=anthony.l.nguyen@intel.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=masahiroy@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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