#define MIN_MULTPLIER_TX_MIN_FRAG 0 #define MAX_MULTPLIER_TX_MIN_FRAG 3 /* Frag size is based on the Section 8.12.2 of the SW User Manual */ #define TX_MIN_FRAG_SIZE 64 #define TX_MAX_FRAG_SIZE (TX_MIN_FRAG_SIZE * \
(MAX_MULTPLIER_TX_MIN_FRAG + 1))
/** * igc_tsn_set_rxpbsize - Set the receive packet buffer size * @adapter: Pointer to the igc_adapter structure * @rxpbs_exp_bmc_be: Value to set the receive packet buffer size, including * express buffer, BMC buffer, and Best Effort buffer * * The IGC_RXPBS register value may include allocations for the Express buffer, * BMC buffer, Best Effort buffer, and the timestamp descriptor buffer * (IGC_RXPBS_CFG_TS_EN).
*/ staticvoid igc_tsn_set_rxpbsize(struct igc_adapter *adapter,
u32 rxpbs_exp_bmc_be)
{ struct igc_hw *hw = &adapter->hw;
u32 rxpbs = rd32(IGC_RXPBS);
/* Returns the TSN specific registers to their default values after * the adapter is reset.
*/ staticint igc_tsn_disable_offload(struct igc_adapter *adapter)
{ struct igc_hw *hw = &adapter->hw;
u32 tqavctrl; int i;
/* Restore the default Tx arbitration: Priority 0 has the highest * priority and is assigned to queue 0 and so on and so forth.
*/
igc_tsn_tx_arb(adapter, false);
adapter->flags &= ~IGC_FLAG_TSN_QBV_ENABLED;
return 0;
}
/* To partially fix i226 HW errata, reduce MAC internal buffering from 192 Bytes * to 88 Bytes by setting RETX_CTL register using the recommendation from: * a) Ethernet Controller I225/I226 Specification Update Rev 2.1 * Item 9: TSN: Packet Transmission Might Cross the Qbv Window * b) I225/6 SW User Manual Rev 1.2.4: Section 8.11.5 Retry Buffer Control
*/ staticvoid igc_tsn_set_retx_qbvfullthreshold(struct igc_adapter *adapter)
{ struct igc_hw *hw = &adapter->hw;
u32 retxctl, watermark;
retxctl = rd32(IGC_RETX_CTL);
watermark = retxctl & IGC_RETX_CTL_WATERMARK_MASK; /* Set QBVFULLTH value using watermark and set QBVFULLEN */
retxctl |= (watermark << IGC_RETX_CTL_QBVFULLTH_SHIFT) |
IGC_RETX_CTL_QBVFULLEN;
wr32(IGC_RETX_CTL, retxctl);
}
/* Find the smallest supported size that is >= frag_size */ for (int i = 0; i < ARRAY_SIZE(supported_sizes); i++) { if (frag_size <= supported_sizes[i]) return supported_sizes[i];
}
/* Should not happen */ return TX_MAX_FRAG_SIZE;
}
if (adapter->taprio_offload_enable) { /* If taprio_offload_enable is set we are in "taprio" * mode and we need to be strict about the * cycles: only transmit a packet if it can be * completed during that cycle. * * If taprio_offload_enable is NOT true when * enabling TSN offload, the cycle should have * no external effects, but is only used internally * to adapt the base time register after a second * has passed. * * Enabling strict mode in this case would * unnecessarily prevent the transmission of * certain packets (i.e. at the boundary of a * second) and thus interfere with the launchtime * feature that promises transmission at a * certain point in time.
*/
txqctl |= IGC_TXQCTL_STRICT_CYCLE |
IGC_TXQCTL_STRICT_END;
}
if (ring->launchtime_enable)
txqctl |= IGC_TXQCTL_QUEUE_MODE_LAUNCHT;
if (!adapter->fpe.tx_enabled) { /* fpe inactive: clear both flags */
txqctl &= ~IGC_TXQCTL_PREEMPTIBLE;
txdctl &= ~IGC_TXDCTL_PRIORITY_HIGH;
} elseif (ring->preemptible) { /* fpe active + preemptible: enable preemptible queue + set low priority */
txqctl |= IGC_TXQCTL_PREEMPTIBLE;
txdctl &= ~IGC_TXDCTL_PRIORITY_HIGH;
} else { /* fpe active + express: enable express queue + set high priority */
txqctl &= ~IGC_TXQCTL_PREEMPTIBLE;
txdctl |= IGC_TXDCTL_PRIORITY_HIGH;
}
wr32(IGC_TXDCTL(ring->reg_idx), txdctl);
/* Skip configuring CBS for Q2 and Q3 */ if (i > 1) goto skip_cbs;
if (ring->cbs_enable) { if (i == 0)
txqctl |= IGC_TXQCTL_QAV_SEL_CBS0; else
txqctl |= IGC_TXQCTL_QAV_SEL_CBS1;
/* According to i225 datasheet section 7.5.2.7, we * should set the 'idleSlope' field from TQAVCC * register following the equation: * * value = link-speed 0x7736 * BW * 0.2 * ---------- * ----------------- (E1) * 100Mbps 2.5 * * Note that 'link-speed' is in Mbps. * * 'BW' is the percentage bandwidth out of full * link speed which can be found with the * following equation. Note that idleSlope here * is the parameter from this function * which is in kbps. * * BW = idleSlope * ----------------- (E2) * link-speed * 1000 * * That said, we can come up with a generic * equation to calculate the value we should set * it TQAVCC register by replacing 'BW' in E1 by E2. * The resulting equation is: * * value = link-speed * 0x7736 * idleSlope * 0.2 * ------------------------------------- (E3) * 100 * 2.5 * link-speed * 1000 * * 'link-speed' is present in both sides of the * fraction so it is canceled out. The final * equation is the following: * * value = idleSlope * 61036 * ----------------- (E4) * 2500000 * * NOTE: For i225, given the above, we can see * that idleslope is represented in * 40.959433 kbps units by the value at * the TQAVCC register (2.5Gbps / 61036), * which reduces the granularity for * idleslope increments. * * In i225 controller, the sendSlope and loCredit * parameters from CBS are not configurable * by software so we don't do any * 'controller configuration' in respect to * these parameters.
*/
cbs_value = DIV_ROUND_UP_ULL(ring->idleslope
* 61036ULL, 2500000);
/* According to datasheet section 7.5.2.9.3.3, FutScdDis bit * has to be configured before the cycle time and base time. * Tx won't hang if a GCL is already running, * so in this case we don't need to set FutScdDis.
*/ if (!(rd32(IGC_BASET_H) || rd32(IGC_BASET_L)))
tqavctrl |= IGC_TQAVCTRL_FUTSCDDIS;
/* In i226, Future base time is only supported when FutScdDis bit * is enabled and only active for re-configuration. * In this case, initialize the base time with zero to create * "re-configuration" scenario then only set the desired base time.
*/ if (tqavctrl & IGC_TQAVCTRL_FUTSCDDIS)
wr32(IGC_BASET_L, 0);
wr32(IGC_BASET_L, baset_l);
return 0;
}
int igc_tsn_reset(struct igc_adapter *adapter)
{ unsignedint new_flags; int err = 0;
if (adapter->fpe.mmsv.pmac_enabled) {
err = igc_enable_empty_addr_recv(adapter); if (err && net_ratelimit())
netdev_err(adapter->netdev, "Error adding empty address to MAC filter\n");
} else {
igc_disable_empty_addr_recv(adapter);
}
new_flags = igc_tsn_new_flags(adapter);
if (!(new_flags & IGC_FLAG_TSN_ANY_ENABLED)) return igc_tsn_disable_offload(adapter);
err = igc_tsn_enable_offload(adapter); if (err < 0) return err;
int igc_tsn_offload_apply(struct igc_adapter *adapter)
{ /* Per I225/6 HW Design Section 7.5.2.1 guideline, if tx mode change * from legacy->tsn or tsn->legacy, then reset adapter is needed.
*/ if (netif_running(adapter->netdev) &&
igc_tsn_will_tx_mode_change(adapter)) {
schedule_work(&adapter->reset_task); return 0;
}
igc_tsn_reset(adapter);
return 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.