Skip to content

Commit 39350d9

Browse files
committed
igc: use FIELD_PREP and GENMASK for existing RX packet buffer size
Author: Faizal Rahim <faizal.abdul.rahim@linux.intel.com> 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 <vladimir.oltean@nxp.com> Signed-off-by: Faizal Rahim <faizal.abdul.rahim@linux.intel.com> Tested-by: Mor Bar-Gabay <morx.bar.gabay@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit 9cd87aa) JIRA: https://issues.redhat.com/browse/RHEL-83571 Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
1 parent f6cc525 commit 39350d9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/net/ethernet/intel/igc/igc_defines.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,20 @@
396396
#define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */
397397
#define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */
398398

399-
/* RXPBSIZE default value for Express and BMC buffer */
400-
#define IGC_RXPBSIZE_EXP_BMC_DEFAULT 0x000000A2
401-
#define IGC_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */
399+
/* Mask for RX packet buffer size */
400+
#define IGC_RXPBSIZE_EXP_MASK GENMASK(5, 0)
401+
#define IGC_BMC2OSPBSIZE_MASK GENMASK(11, 6)
402+
/* Mask for timestamp in RX buffer */
403+
#define IGC_RXPBS_CFG_TS_EN_MASK GENMASK(31, 31)
404+
/* High-priority RX packet buffer size (KB). Used for Express traffic when preemption is enabled */
405+
#define IGC_RXPBSIZE_EXP(x) FIELD_PREP(IGC_RXPBSIZE_EXP_MASK, (x))
406+
/* BMC to OS packet buffer size in KB */
407+
#define IGC_BMC2OSPBSIZE(x) FIELD_PREP(IGC_BMC2OSPBSIZE_MASK, (x))
408+
/* Enable RX packet buffer for timestamp descriptor, saving 16 bytes per packet if set */
409+
#define IGC_RXPBS_CFG_TS_EN FIELD_PREP(IGC_RXPBS_CFG_TS_EN_MASK, 1)
410+
/* Default value following I225/I226 SW User Manual Section 8.3.1 */
411+
#define IGC_RXPBSIZE_EXP_BMC_DEFAULT ( \
412+
IGC_RXPBSIZE_EXP(34) | IGC_BMC2OSPBSIZE(2))
402413

403414
/* Mask for TX packet buffer size */
404415
#define IGC_TXPB0SIZE_MASK GENMASK(5, 0)

0 commit comments

Comments
 (0)