Skip to content

Commit 311adfb

Browse files
committed
Jaguar1/2/3: unified tx_retry knob (DEVOURER_TX_RETRY_LIMIT, default 0)
All three Jaguar generations hardcoded a per-frame TX retry limit of 12 (jaguar1: SET_TX_DESC_DATA_RETRY_LIMIT, jaguar2/3: RTS_DATA_RTY_LMT in the fill_data_tx_desc builders). On a busy half-duplex link the chip retried each frame up to 12x on collision, flooding the air and blinding the receiver — consecutive video fragments lost, downlink FEC cannot repair. Now every chip honors cfg.tx.retry_limit (env DEVOURER_TX_RETRY_LIMIT), applied per frame with tx_desc re-checksum; the A-MPDU path uses it too. Default 0 restores the pre-regression behaviour (verified: 0 losses with alink enabled on 8812AU).
1 parent a71060f commit 311adfb

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

examples/common/env_config.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ devourer::DeviceConfig devourer_config_from_env() {
106106
if (devourer::parse_ampdu_mode(e, m))
107107
cfg.tx.ampdu = m;
108108
}
109+
if (env_long("DEVOURER_TX_RETRY_LIMIT", &v))
110+
cfg.tx.retry_limit = static_cast<int>(v < 0 ? 0 : (v > 63 ? 63 : v));
109111

110112
/* ---- bf ---- */
111113
if (const char *snd = env_str("DEVOURER_BF_ARM_SOUNDER")) {

src/DeviceConfig.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ struct DeviceConfig {
175175
* Runtime equivalent: StartCwTone/StopCwTone on the concrete device. */
176176
bool cw_tone = false;
177177
uint8_t cw_tone_gain = 0;
178+
/* env: DEVOURER_TX_RETRY_LIMIT — per-frame hardware retry limit (0..63).
179+
* Maps to the TX descriptor DATA_RETRY_LIMIT / RTS_DATA_RTY_LMT field
180+
* (Dword4 bits 18-23). 0 = no retries (WFB default: FEC provides
181+
* reliability, not MAC retries). On a busy half-duplex link retries flood
182+
* the air and blind the receiver. */
183+
int retry_limit = 0;
178184
/* env: DEVOURER_TX_USB_AGG — USB TX aggregation: max frames packed into
179185
* one bulk-OUT URB by send_packets (0 = off, the default: send_packets
180186
* degrades to a per-frame loop and every TX path is byte-identical to

src/jaguar1/RtlJaguarDevice.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,10 @@ size_t RtlJaguarDevice::build_tx_block(const uint8_t *packet, size_t length,
11711171
SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(usb_frame, 1);
11721172
if (!is_8814a) {
11731173
/* 88XXau leaves DATA_RETRY_LIMIT=0 for monitor injection on 8814A
1174-
* (RETRY_LIMIT_ENABLE stays set to 1 in both). */
1175-
SET_TX_DESC_DATA_RETRY_LIMIT_8812(usb_frame, 12);
1174+
* (RETRY_LIMIT_ENABLE stays set to 1 in both).
1175+
* Use cfg.tx.retry_limit (DEVOURER_TX_RETRY_LIMIT, default 0) instead of
1176+
* the hardcoded 12 — retries flood the air on a busy half-duplex link. */
1177+
SET_TX_DESC_DATA_RETRY_LIMIT_8812(usb_frame, _cfg.tx.retry_limit);
11761178
}
11771179
if (sgi) {
11781180
_logger->info("short gi enabled,set sgi");
@@ -1228,7 +1230,7 @@ size_t RtlJaguarDevice::build_tx_block(const uint8_t *packet, size_t length,
12281230
SET_TX_DESC_AGG_ENABLE_8812(usb_frame, 1);
12291231
SET_TX_DESC_MAX_AGG_NUM_8812(usb_frame, am.max_num & 0x1f);
12301232
SET_TX_DESC_AMPDU_DENSITY_8812(usb_frame, am.density & 0x7);
1231-
SET_TX_DESC_DATA_RETRY_LIMIT_8812(usb_frame, am.no_ack ? 0 : 12);
1233+
SET_TX_DESC_DATA_RETRY_LIMIT_8812(usb_frame, am.no_ack ? 0 : _cfg.tx.retry_limit);
12321234
}
12331235
if (_cfg.debug.tx_qsel)
12341236
SET_TX_DESC_QUEUE_SEL_8812(usb_frame, *_cfg.debug.tx_qsel);

src/jaguar2/RtlJaguar2Device.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,12 @@ size_t RtlJaguar2Device::build_tx_block(const uint8_t *packet, size_t length,
15291529
SET_TX_DESC_SW_DEFINE_8822B(out, _tx_rpt_tag.fetch_add(1) & 0xff);
15301530
jaguar2::cal_txdesc_chksum_8822b(out);
15311531
}
1532+
/* Per-frame retry limit from cfg (DEVOURER_TX_RETRY_LIMIT, default 0) —
1533+
* the fill_data_tx_desc builder hardcodes 12, which floods a busy
1534+
* half-duplex link. Both fields sit inside the checksummed span. */
1535+
SET_TX_DESC_RTY_LMT_EN_8822B(out, 1);
1536+
SET_TX_DESC_RTS_DATA_RTY_LMT_8822B(out, _cfg.tx.retry_limit);
1537+
jaguar2::cal_txdesc_chksum_8822b(out);
15321538
const devourer::AmpduMode am = _ampdu; /* one lock-free load */
15331539
if (am.enabled || _cfg.debug.tx_qsel || _cfg.debug.tx_ampdu_max) {
15341540
/* A-MPDU descriptor half. The product SetAmpduMode state applies first
@@ -1541,7 +1547,7 @@ size_t RtlJaguar2Device::build_tx_block(const uint8_t *packet, size_t length,
15411547
SET_TX_DESC_AGG_EN_8822B(out, 1);
15421548
SET_TX_DESC_MAX_AGG_NUM_8822B(out, am.max_num & 0x1f);
15431549
SET_TX_DESC_AMPDU_DENSITY_8822B(out, am.density & 0x7);
1544-
SET_TX_DESC_RTS_DATA_RTY_LMT_8822B(out, am.no_ack ? 0 : 12);
1550+
SET_TX_DESC_RTS_DATA_RTY_LMT_8822B(out, am.no_ack ? 0 : _cfg.tx.retry_limit);
15451551
}
15461552
if (_cfg.debug.tx_qsel)
15471553
SET_TX_DESC_QSEL_8822B(out, *_cfg.debug.tx_qsel);

src/jaguar3/RtlJaguar3Device.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,12 @@ size_t RtlJaguar3Device::build_tx_block(const uint8_t *packet, size_t length,
20062006
SET_TX_DESC_SW_DEFINE_8822C(out, _tx_rpt_tag.fetch_add(1) & 0xff);
20072007
jaguar3::cal_txdesc_chksum_8822c(out);
20082008
}
2009+
/* Per-frame retry limit from cfg (DEVOURER_TX_RETRY_LIMIT, default 0) —
2010+
* the fill_data_tx_desc builder hardcodes 12, which floods a busy
2011+
* half-duplex link. Both fields sit inside the checksummed span. */
2012+
SET_TX_DESC_RTY_LMT_EN_8822C(out, 1);
2013+
SET_TX_DESC_RTS_DATA_RTY_LMT_8822C(out, _cfg.tx.retry_limit);
2014+
jaguar3::cal_txdesc_chksum_8822c(out);
20092015
const devourer::AmpduMode am = _ampdu; /* one lock-free load */
20102016
if (am.enabled || _cfg.debug.tx_qsel || _cfg.debug.tx_ampdu_max) {
20112017
/* A-MPDU descriptor half. The product SetAmpduMode state applies first,
@@ -2017,7 +2023,7 @@ size_t RtlJaguar3Device::build_tx_block(const uint8_t *packet, size_t length,
20172023
SET_TX_DESC_AGG_EN_8822C(out, 1);
20182024
SET_TX_DESC_MAX_AGG_NUM_8822C(out, am.max_num & 0x1f);
20192025
SET_TX_DESC_AMPDU_DENSITY_8822C(out, am.density & 0x7);
2020-
SET_TX_DESC_RTS_DATA_RTY_LMT_8822C(out, am.no_ack ? 0 : 12);
2026+
SET_TX_DESC_RTS_DATA_RTY_LMT_8822C(out, am.no_ack ? 0 : _cfg.tx.retry_limit);
20212027
}
20222028
if (_cfg.debug.tx_qsel)
20232029
SET_TX_DESC_QSEL_8822C(out, *_cfg.debug.tx_qsel);

0 commit comments

Comments
 (0)