[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230810103509.163225-1-przemyslaw.kitszel@intel.com>
Date: Thu, 10 Aug 2023 06:35:02 -0400
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Kees Cook <keescook@...omium.org>,
netdev@...r.kernel.org
Cc: Jacob Keller <jacob.e.keller@...el.com>,
intel-wired-lan@...ts.osuosl.org,
Alexander Lobakin <aleksander.lobakin@...el.com>,
linux-hardening@...r.kernel.org,
Steven Zou <steven.zou@...el.com>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>
Subject: [PATCH net-next v1 0/7] introduce DEFINE_FLEX() macro
Add DEFINE_FLEX() macro, that helps on-stack allocation of structures
with trailing flex array member.
Add const_flex_size() macro which is a wrapper to get 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).
Przemek Kitszel (7):
overflow: add DEFINE_FLEX() for on-stack allocs
ice: ice_sched_remove_elems: replace 1 elem array param by u32
ice: drop two params of ice_aq_move_sched_elems()
ice: make use of DEFINE_FLEX() in ice_ddp.c
ice: make use of DEFINE_FLEX() for struct ice_aqc_add_tx_qgrp
ice: make use of DEFINE_FLEX() for struct ice_aqc_dis_txq_item
ice: make use of DEFINE_FLEX() in ice_switch.c
drivers/net/ethernet/intel/ice/ice_common.c | 20 ++-----
drivers/net/ethernet/intel/ice/ice_ddp.c | 39 ++++---------
drivers/net/ethernet/intel/ice/ice_lag.c | 48 ++++------------
drivers/net/ethernet/intel/ice/ice_lib.c | 23 ++------
drivers/net/ethernet/intel/ice/ice_sched.c | 56 ++++++------------
drivers/net/ethernet/intel/ice/ice_sched.h | 6 +-
drivers/net/ethernet/intel/ice/ice_switch.c | 63 +++++----------------
drivers/net/ethernet/intel/ice/ice_xsk.c | 22 +++----
include/linux/overflow.h | 27 +++++++++
9 files changed, 101 insertions(+), 203 deletions(-)
base-commit: 052059b663c957aea5a90f206ece4849f88f34bf
--
2.40.1
Powered by blists - more mailing lists