Hi Josh,
On 16/6/26 00:18, Josh Hilke wrote:
Integrate throttling logic into the transmission path. In
`igb_start_xmit`, check if the queue is currently throttled. Accumulate
bytes sent, calculate the transmission delay based on the configured
target rate, and if a throttle is triggered, set the virtual timer, mark
the queue as throttled, and defer remaining packets. Implement the
timer callback to clear the throttled state and resume transmission when
the timer expires.
Signed-off-by: Josh Hilke <[email protected]>
---
hw/net/igb_core.c | 42 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c
index fac4c44..17eeba4 100644
--- a/hw/net/igb_core.c
+++ b/hw/net/igb_core.c
@@ -876,6 +876,12 @@ igb_tx_enabled(IGBCore *core, const E1000ERingInfo *txi)
(core->mac[TXDCTL0 + (qn * 16)] & E1000_TXDCTL_QUEUE_ENABLE);
}
+static uint64_t igb_trl_calculate_delay(uint64_t target_rate,
+ size_t bytes_sent)
+{
+ return (uint64_t)bytes_sent * NANOSECONDS_PER_SECOND / target_rate;
Please use the safer muldiv64() helper. Rest LGTM.
+}