From patchwork Tue Mar 18 03:07:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faizal Rahim X-Patchwork-Id: 14020214 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C31A51A08DB; Tue, 18 Mar 2025 03:09:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742267369; cv=none; b=REAqbH1oWd1YYa6MhL5S22xCh0A/KaVyu2R+e2yIWOrSOCGpGjVy8q60CnNMPPEXqC4Bjh8uIMGOB4PHFO6OZQL6ASjIUtq0JTkv9L5OGFkCm21Sljs2XOgpN5IR4LhJ5ncD+y/qYPlXPld9rXmt3sioclw8xMg79KJY9FdWXI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742267369; c=relaxed/simple; bh=RAZGfMmK/uDYInMN3Xs3DNFQYHhdYcUfUBmMsD3eoG0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rdx8RilPoxeNHxekBIe+FXu4OB/GDUKU8ypDpn0Sl0uXgxLUCYEAc/wPC/UMmsouFibQpf9tWZfHv3IzUzrW7TsWJcWssNmgmwW0HumlI5DjXalwDkYh0d0agWQmxRmh6bev9XVumrJCDIc/8C4BxLmaEnh823EzF58nlXEmesI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BE4esuB9; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BE4esuB9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742267367; x=1773803367; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=RAZGfMmK/uDYInMN3Xs3DNFQYHhdYcUfUBmMsD3eoG0=; b=BE4esuB9xPRm+NmmHuic/A7Dg9bFcIh4inBPd6heGwar+rvO1crESpa0 EVYpRLL1h2cZSI0wErb4jVel5WkUu8HFqf8qvgONSc9YQDNbklRYTfoQU DEJeqCqfST2mGI5AvqTCSyZ9Qp2oCzFnX0yqWCh9Ur/iWLtyv7A9kZuFw rg1punUG1fUPw5bh5HIMucp8Mr1I2Ud3kykJBVDoP93ORX9+n7+wIrTtl dXS3UVucmt4JwP+CFs2ui8ObnnKX30aXtX8kwljfhVWhjlqwhYBNwPLrf VpFCwxWDqTDkzuhAWHv0lF9VMKPuf6vQsiw8vBJixBMIMosH/03Pp8XSH A==; X-CSE-ConnectionGUID: IXMDYjPITgKTleZpgIR/+g== X-CSE-MsgGUID: HvziV/BSSnCGcskFiz3qkA== X-IronPort-AV: E=McAfee;i="6700,10204,11376"; a="54383077" X-IronPort-AV: E=Sophos;i="6.14,255,1736841600"; d="scan'208";a="54383077" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2025 20:09:26 -0700 X-CSE-ConnectionGUID: NdZjE5swTIKwx89FIAMv7A== X-CSE-MsgGUID: OYbGeDgtSVec095CgxBV8w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,255,1736841600"; d="scan'208";a="126313887" Received: from mohdfai2-ilbpg12-1.png.intel.com ([10.88.227.73]) by fmviesa003.fm.intel.com with ESMTP; 17 Mar 2025 20:09:18 -0700 From: Faizal Rahim To: Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Simon Horman , Vladimir Oltean , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Furong Xu <0x1207@gmail.com>, Choong Yong Liang , Russell King , Hariprasad Kelam , Xiaolei Wang , Suraj Jaiswal , Kory Maincent , Gal Pressman , Jesper Nilsson , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-stm32@st-md-mailman.stormreply.com, Chwee-Lin Choong , Vinicius Costa Gomes , Faizal Rahim , Kunihiko Hayashi , Serge Semin Subject: [PATCH iwl-next v10 08/14] igc: use FIELD_PREP and GENMASK for existing RX packet buffer size Date: Mon, 17 Mar 2025 23:07:36 -0400 Message-Id: <20250318030742.2567080-9-faizal.abdul.rahim@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250318030742.2567080-1-faizal.abdul.rahim@linux.intel.com> References: <20250318030742.2567080-1-faizal.abdul.rahim@linux.intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Prepare for an upcoming patch that modifies the RX buffer size in TSN mode. Refactor IGC_RXPBSIZE_EXP_BMC_DEFAULT and IGC_RXPBS_CFG_TS_EN using FIELD_PREP and GENMASK to improve clarity and maintainability. Refactor both macros for consistency, even though the upcoming patch only use IGC_RXPBSIZE_EXP_BMC_DEFAULT. The newly introduced macros follow the naming from the i226 SW User Manual for easy reference. I've tested IGC_RXPBSIZE_EXP_BMC_DEFAULT and IGC_RXPBS_CFG_TS_EN before and after the refactoring, and their values remain unchanged. Reviewed-by: Vladimir Oltean Signed-off-by: Faizal Rahim --- drivers/net/ethernet/intel/igc/igc_defines.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_defines.h b/drivers/net/ethernet/intel/igc/igc_defines.h index db937931c646..3564d15df57b 100644 --- a/drivers/net/ethernet/intel/igc/igc_defines.h +++ b/drivers/net/ethernet/intel/igc/igc_defines.h @@ -396,9 +396,20 @@ #define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */ #define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ -/* RXPBSIZE default value for Express and BMC buffer */ -#define IGC_RXPBSIZE_EXP_BMC_DEFAULT 0x000000A2 -#define IGC_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */ +/* Mask for RX packet buffer size */ +#define IGC_RXPBSIZE_EXP_MASK GENMASK(5, 0) +#define IGC_BMC2OSPBSIZE_MASK GENMASK(11, 6) +/* Mask for timestamp in RX buffer */ +#define IGC_RXPBS_CFG_TS_EN_MASK GENMASK(31, 31) +/* High-priority RX packet buffer size (KB). Used for Express traffic when preemption is enabled */ +#define IGC_RXPBSIZE_EXP(x) FIELD_PREP(IGC_RXPBSIZE_EXP_MASK, (x)) +/* BMC to OS packet buffer size in KB */ +#define IGC_BMC2OSPBSIZE(x) FIELD_PREP(IGC_BMC2OSPBSIZE_MASK, (x)) +/* Enable RX packet buffer for timestamp descriptor, saving 16 bytes per packet if set */ +#define IGC_RXPBS_CFG_TS_EN FIELD_PREP(IGC_RXPBS_CFG_TS_EN_MASK, 1) +/* Default value following I225/I226 SW User Manual Section 8.3.1 */ +#define IGC_RXPBSIZE_EXP_BMC_DEFAULT ( \ + IGC_RXPBSIZE_EXP(34) | IGC_BMC2OSPBSIZE(2)) /* Mask for TX packet buffer size */ #define IGC_TXPB0SIZE_MASK GENMASK(5, 0)