Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp356113pxb; Fri, 28 Jan 2022 00:12:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwq63M5HHWi6ayfDKF/JrGE/f2qGoZNvZQR39XXdvpiuDJAksDeOHdd1yLbGOIweo9rCGOM X-Received: by 2002:aa7:d3c1:: with SMTP id o1mr6858120edr.271.1643357532618; Fri, 28 Jan 2022 00:12:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643357532; cv=none; d=google.com; s=arc-20160816; b=iXsb+ezLMa8O31YbTb1F21oVJkfjtk6lz+an5QXZIVL4CA03MR5CIP51TUSMJ3RzxE bo7WoQw0ge61bI5JB60QgbFkGSQgunQJM4cubDdlodPo8ktt1c+4F2Z63rBtS64dxsKQ XAIWLXpZQfLSnm3pj6PRk63juVrcYccozF7mH7dREwuDg9hx9TAg6jup0BGUWg2FRUsh KqyURC7CvJcXQ88W1v7/0/GoBTDT2Iv26EqDI8FxCMr9E0MPFKYOKvTNkCTUDTOuH4BS AsWgGu8dSXzIV5ZH7eqgfOu0c51wbPkDQvUaALqj4Ree+2A6mGrDjEXZatIeSqFCUpEL gSqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=H5hwKPeuVj+escErD0wp1PU6aHhW+PQNf4LNC01ji4M=; b=JW4s/tcn7BENZ6KCBw+cgBvYQAAzozB/LwvW/+Mizkb5VO0+oXMzH9+dMW7U8TIj5o /K+nhESTi/+mhyrCZCwwJ3fb/mTr0mkkEzUPZXbLEPegEO8gSjGxyI5q/tBWhf4e3lKZ pa8PvPXnV5BNyv1YGlq0rdYHyj/1pTIoXP+5YdxSqwqQL1pf8RY6EYEvK30CRg/6h7n2 9EfM7GUtR/PMgEBmpFfcMnxdUUsQA9tegqCnRdjmBheNgH1Z+quAbm7xEWt7RCWW/xHn 2YNqkGYGMdqbP/8nqCUf+nkypgtEq3Zr5DtlXCUk3f4dwNZo2talE8/Xjsr8h4WlcSTv O82A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="GtivIG/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si2495887ejn.786.2022.01.28.00.11.48; Fri, 28 Jan 2022 00:12:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="GtivIG/x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242986AbiA0PmJ (ORCPT + 99 others); Thu, 27 Jan 2022 10:42:09 -0500 Received: from mga05.intel.com ([192.55.52.43]:10340 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242931AbiA0PmH (ORCPT ); Thu, 27 Jan 2022 10:42:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643298127; x=1674834127; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ilgXZaqxDA9kqy7YRB+bhcP2wz4pTOi+q3i19NEBc9w=; b=GtivIG/xio5umHBeNYuAuZAcw1zjOSJr6SI1wwbYqTNGVmbLZcs1lNdZ apxrLDoXwfAoEQg5STdbj9Ubm4MyKekgsgu4yV92yDm9bfHv9+sSBzOkY SpUJcbfVRzjyHIOdB7AyUxa6DD7VeRXiRJs6m3+CLnrYXflOSa/o3bhpb uGbZqL3j9o6NcyWq3vxcH1tlUMRdb7K/NkS0b8k63SGJIPB0FGfcC0R+S hjbw2cHqq4RhH+od8Q7o5KiT2uunPoHNC/iJVwfl7DGCIZG9EF1cjFGZT 82wbV1jsK96HLeuh+7Kr/vzgECyQNZvk5RS+A/vWXQextXjIo13ukEWKh w==; X-IronPort-AV: E=McAfee;i="6200,9189,10239"; a="333242522" X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="333242522" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 07:41:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="521282143" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by orsmga007.jf.intel.com with ESMTP; 27 Jan 2022 07:41:47 -0800 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 20RFfjOn028674; Thu, 27 Jan 2022 15:41:45 GMT From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Jesse Brandeburg , Maciej Fijalkowski , Michal Swiatkowski , Martyna Szapar-Mudlaw , "David S. Miller" , Jakub Kicinski , 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 Message-Id: <20220127154009.623304-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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