netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
	Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 net-next 0/4] ice: switch: debloat packet templates code
Date: Thu, 27 Jan 2022 16:40:05 +0100	[thread overview]
Message-ID: <20220127154009.623304-1-alexandr.lobakin@intel.com> (raw)

This hunts down several places around packet templates/dummies for
switch rules which are either repetitive, fragile or just not
really readable code.
It's a common need to add new packet templates and to review such
changes as well, try to simplify both with the help of a pair
macros and aliases.

bloat-o-meter is happy about that (built w/ LLVM 13):

add/remove: 0/1 grow/shrink: 2/0 up/down: 148/-202 (-54)
Function                                     old     new   delta
ice_add_adv_rule                            2383    2529    +146
ice_fill_adv_dummy_packet                    289     291      +2
ice_adv_add_update_vsi_list                  202       -    -202
Total: Before=395813, After=395759, chg -0.01%

Diffstat also looks nice, and adding new packet templates now takes
less lines.

We'll probably come out with dynamic template crafting in a while,
but for now let's improve what we have currently.

Note: this will conflict with [1] going through net-next,
a followup will be sent once accepted.

From v1 ([0]):
 - rebase on top of the latest next-queue (to fix #3 not applying);
 - adjust the kdoc accordingly to the function proto changes in #3;
 - no functional changes.

[0] https://lore.kernel.org/netdev/20220124173116.739083-1-alexandr.lobakin@intel.com
[1] https://lore.kernel.org/netdev/20220127125525.125805-1-marcin.szycik@linux.intel.com

Alexander Lobakin (4):
  ice: switch: add and use u16[] aliases to ice_adv_lkup_elem::{h,m}_u
  ice: switch: unobscurify bitops loop in ice_fill_adv_dummy_packet()
  ice: switch: use a struct to pass packet template params
  ice: switch: use convenience macros to declare dummy pkt templates

 drivers/net/ethernet/intel/ice/ice_switch.c | 273 ++++++++------------
 drivers/net/ethernet/intel/ice/ice_switch.h |  12 +-
 2 files changed, 123 insertions(+), 162 deletions(-)

-- 
2.34.1


             reply	other threads:[~2022-01-27 15:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 15:40 Alexander Lobakin [this message]
2022-01-27 15:40 ` [PATCH v2 net-next 1/4] ice: switch: add and use u16[] aliases to ice_adv_lkup_elem::{h,m}_u Alexander Lobakin
2022-02-18  5:18   ` [Intel-wired-lan] [PATCH v2 net-next 1/4] ice: switch: add and use u16[] aliases to ice_adv_lkup_elem::{h, m}_u Penigalapati, Sandeep
2022-01-27 15:40 ` [PATCH v2 net-next 2/4] ice: switch: unobscurify bitops loop in ice_fill_adv_dummy_packet() Alexander Lobakin
2022-02-18  5:19   ` [Intel-wired-lan] " Penigalapati, Sandeep
2022-01-27 15:40 ` [PATCH v2 net-next 3/4] ice: switch: use a struct to pass packet template params Alexander Lobakin
2022-02-18  5:19   ` [Intel-wired-lan] " Penigalapati, Sandeep
2022-01-27 15:40 ` [PATCH v2 net-next 4/4] ice: switch: use convenience macros to declare dummy pkt templates Alexander Lobakin
2022-02-18  5:20   ` [Intel-wired-lan] " Penigalapati, Sandeep

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=20220127154009.623304-1-alexandr.lobakin@intel.com \
    --to=alexandr.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=martyna.szapar-mudlaw@intel.com \
    --cc=michal.swiatkowski@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).