Merge pull request #482 from DrDoof/perf/rx-budget

rtlplayground: take several packets per loop in handle_rx()
This commit is contained in:
René van Dorst authored and GitHub committed 2026-09-20 13:02:07 +00:00
commit 46e1c955ba
1 file changed
+11 -6
+11 -6
View File
@@ -973,14 +973,19 @@ void tcpip_output(void)
} }
#define RX_BUDGET 4
void handle_rx(void) void handle_rx(void)
{ {
// Check the amount of data available on the NIC/ASIC side __xdata uint8_t budget = RX_BUDGET;
reg_read_m(RTL837X_REG_NIC_RX_BUFF_DATA);
if (sfr_data[2] != 0 || sfr_data[3] != 0) { while (budget--) {
reg_read_m(RTL837X_REG_CPU_RX_CURR_PKT); // Check the amount of data available on the NIC/ASIC side
uint16_t ring_ptr = ((uint16_t)sfr_data[2]) << 8; reg_read(RTL837X_REG_NIC_RX_BUFF_DATA);
ring_ptr |= sfr_data[3]; if (!SFR_DATA_U16)
break;
reg_read(RTL837X_REG_CPU_RX_CURR_PKT);
uint16_t ring_ptr = SFR_DATA_U16;
ring_ptr <<= 3; ring_ptr <<= 3;
if (!nic_rx_header(ring_ptr)) { if (!nic_rx_header(ring_ptr)) {
REG_SET(RTL837X_REG_NIC_RXCMD, 1); REG_SET(RTL837X_REG_NIC_RXCMD, 1);