Skip to content

Commit 519134d

Browse files
committed
igc: set the RX packet buffer size for TSN mode
Author: Faizal Rahim <faizal.abdul.rahim@linux.intel.com> In preparation for supporting frame preemption, when entering TSN mode, set the receive packet buffer to 15KB for the Express MAC, 15KB for the Preemptible MAC and 2KB for the BMC. References: I225/I226 SW User Manual, Section 4.7.9, Section 7.1.3.2, Section 8.3.1 The newly introduced macros follow the naming from the i226 SW User Manual for easy reference. Co-developed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.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 7663370) JIRA: https://issues.redhat.com/browse/RHEL-83575 Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
1 parent 8b1959e commit 519134d

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,17 +399,22 @@
399399
/* Mask for RX packet buffer size */
400400
#define IGC_RXPBSIZE_EXP_MASK GENMASK(5, 0)
401401
#define IGC_BMC2OSPBSIZE_MASK GENMASK(11, 6)
402+
#define IGC_RXPBSIZE_BE_MASK GENMASK(17, 12)
402403
/* Mask for timestamp in RX buffer */
403404
#define IGC_RXPBS_CFG_TS_EN_MASK GENMASK(31, 31)
404405
/* High-priority RX packet buffer size (KB). Used for Express traffic when preemption is enabled */
405406
#define IGC_RXPBSIZE_EXP(x) FIELD_PREP(IGC_RXPBSIZE_EXP_MASK, (x))
406407
/* BMC to OS packet buffer size in KB */
407408
#define IGC_BMC2OSPBSIZE(x) FIELD_PREP(IGC_BMC2OSPBSIZE_MASK, (x))
409+
/* Low-priority RX packet buffer size (KB). Used for BE traffic when preemption is enabled */
410+
#define IGC_RXPBSIZE_BE(x) FIELD_PREP(IGC_RXPBSIZE_BE_MASK, (x))
408411
/* Enable RX packet buffer for timestamp descriptor, saving 16 bytes per packet if set */
409412
#define IGC_RXPBS_CFG_TS_EN FIELD_PREP(IGC_RXPBS_CFG_TS_EN_MASK, 1)
410413
/* Default value following I225/I226 SW User Manual Section 8.3.1 */
411414
#define IGC_RXPBSIZE_EXP_BMC_DEFAULT ( \
412415
IGC_RXPBSIZE_EXP(34) | IGC_BMC2OSPBSIZE(2))
416+
#define IGC_RXPBSIZE_EXP_BMC_BE_TSN ( \
417+
IGC_RXPBSIZE_EXP(15) | IGC_BMC2OSPBSIZE(2) | IGC_RXPBSIZE_BE(15))
413418

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

drivers/net/ethernet/intel/igc/igc_tsn.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,29 @@ static void igc_tsn_tx_arb(struct igc_adapter *adapter, u16 *queue_per_tc)
125125
wr32(IGC_TXARB, txarb);
126126
}
127127

128+
/**
129+
* igc_tsn_set_rxpbsize - Set the receive packet buffer size
130+
* @adapter: Pointer to the igc_adapter structure
131+
* @rxpbs_exp_bmc_be: Value to set the receive packet buffer size, including
132+
* express buffer, BMC buffer, and Best Effort buffer
133+
*
134+
* The IGC_RXPBS register value may include allocations for the Express buffer,
135+
* BMC buffer, Best Effort buffer, and the timestamp descriptor buffer
136+
* (IGC_RXPBS_CFG_TS_EN).
137+
*/
138+
static void igc_tsn_set_rxpbsize(struct igc_adapter *adapter,
139+
u32 rxpbs_exp_bmc_be)
140+
{
141+
struct igc_hw *hw = &adapter->hw;
142+
u32 rxpbs = rd32(IGC_RXPBS);
143+
144+
rxpbs &= ~(IGC_RXPBSIZE_EXP_MASK | IGC_BMC2OSPBSIZE_MASK |
145+
IGC_RXPBSIZE_BE_MASK);
146+
rxpbs |= rxpbs_exp_bmc_be;
147+
148+
wr32(IGC_RXPBS, rxpbs);
149+
}
150+
128151
/* Returns the TSN specific registers to their default values after
129152
* the adapter is reset.
130153
*/
@@ -139,6 +162,8 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter)
139162
wr32(IGC_TXPBS, IGC_TXPBSIZE_DEFAULT);
140163
wr32(IGC_DTXMXPKTSZ, IGC_DTXMXPKTSZ_DEFAULT);
141164

165+
igc_tsn_set_rxpbsize(adapter, IGC_RXPBSIZE_EXP_BMC_DEFAULT);
166+
142167
if (igc_is_device_id_i226(hw))
143168
igc_tsn_restore_retx_default(adapter);
144169

@@ -202,6 +227,8 @@ static int igc_tsn_enable_offload(struct igc_adapter *adapter)
202227
wr32(IGC_DTXMXPKTSZ, IGC_DTXMXPKTSZ_TSN);
203228
wr32(IGC_TXPBS, IGC_TXPBSIZE_TSN);
204229

230+
igc_tsn_set_rxpbsize(adapter, IGC_RXPBSIZE_EXP_BMC_BE_TSN);
231+
205232
if (igc_is_device_id_i226(hw))
206233
igc_tsn_set_retx_qbvfullthreshold(adapter);
207234

0 commit comments

Comments
 (0)