Merge branch 'introduce-define_flex-macro'
authorJakub Kicinski <kuba@kernel.org>
Tue, 3 Oct 2023 19:17:13 +0000 (12:17 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Oct 2023 19:17:13 +0000 (12:17 -0700)
commit0e0c52d603b20e4810542e71337b8c8556054266
tree77af86d41725a3864d5126722039f2945d351910
parente643597346c72ebb961ee79ebec34acc042e8ac2
parente268b972270567e0414836919c5b9f8bc01651a4
Merge branch 'introduce-define_flex-macro'

Przemek Kitszel says:

====================
introduce DEFINE_FLEX() macro

Add DEFINE_FLEX() macro, that helps on-stack allocation of structures
with trailing flex array member.
Expose __struct_size() macro which reads size of data allocated
by DEFINE_FLEX().

Accompany new macros introduction with actual usage,
in the ice driver - hence targeting for netdev tree.

Obvious benefits include simpler resulting code, less heap usage,
less error checking. Less obvious is the fact that compiler has
more room to optimize, and as a whole, even with more stuff on the stack,
we end up with overall better (smaller) report from bloat-o-meter:
add/remove: 8/6 grow/shrink: 7/18 up/down: 2211/-2270 (-59)
(individual results in each patch).
====================

Link: https://lore.kernel.org/r/20230912115937.1645707-1-przemyslaw.kitszel@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>