Skip to content

Commit 806c56b

Browse files
Fix: Redundant mode in st30 st40 st41 rx sessions
St30 St40 St41 had a bug where we only treated incoming packets as redundant if they were within 5 packets of the latest recieved packet. If the change exceeded 5 packets, we would treat the packet as OOO and put in into frame wchich lead to corrupted streams and log spam when we had stream with latency exceeding that. OOO packets stats are now triggered when the packet is not the next expected packet (last sequence id + 1).
1 parent c340676 commit 806c56b

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

lib/src/mt_util.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ static inline bool st_is_valid_payload_type(int payload_type) {
9797

9898
void mt_eth_macaddr_dump(enum mtl_port port, char* tag, struct rte_ether_addr* mac_addr);
9999

100-
static inline bool st_rx_seq_drop(uint16_t new_id, uint16_t old_id, uint16_t delta) {
101-
if ((new_id <= old_id) && ((old_id - new_id) < delta))
102-
return true;
103-
else
104-
return false;
105-
}
106-
107100
struct rte_mbuf* mt_build_pad(struct mtl_main_impl* impl, struct rte_mempool* mempool,
108101
enum mtl_port port, uint16_t ether_type, uint16_t len);
109102

lib/src/st2110/st_rx_ancillary_session.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,20 @@ static int rx_ancillary_session_handle_pkt(struct mtl_main_impl* impl,
132132
/* 0b00: progressive or not specified, do nothing */
133133

134134
/* set if it is first pkt */
135-
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
135+
if (unlikely(s->latest_seq_id == -1)) {
136+
s->latest_seq_id = seq_id - 1;
137+
}
138+
136139
/* drop old packet */
137-
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
140+
if (seq_id <= s->latest_seq_id) {
138141
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
139142
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
140143
return 0;
141144
}
142145
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
143146
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
144147
}
148+
145149
/* update seq id */
146150
s->latest_seq_id = seq_id;
147151

lib/src/st2110/st_rx_audio_session.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,22 +293,28 @@ static int rx_audio_session_handle_frame_pkt(struct mtl_main_impl* impl,
293293
}
294294

295295
/* set first seq_id - 1 */
296-
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
296+
if (unlikely(s->latest_seq_id == -1)) {
297+
s->latest_seq_id = seq_id - 1;
298+
}
299+
297300
/* drop old packet */
298-
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
299-
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
301+
if (seq_id <= s->latest_seq_id) {
302+
dbg("%s(%d,%d), drop as pkt seq %d is old last %d\n", __func__, s->idx, s_port,
303+
seq_id, s->latest_seq_id);
300304
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
301305
if (s->enable_timing_parser) {
302306
enum mtl_port port = mt_port_logic2phy(s->port_maps, s_port);
303307
ra_tp_on_packet(s, s_port, tmstamp, mt_mbuf_time_stamp(impl, mbuf, port));
304308
}
305309
return -EIO;
306310
}
311+
307312
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
308313
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
309-
dbg("%s(%d,%d), ooo, seq now %u last %d\n", __func__, s->idx, s_port, seq_id,
310-
s->latest_seq_id);
314+
info("%s(%d,%d), ooo, seq now %u last %d\n", __func__, s->idx, s_port, seq_id,
315+
s->latest_seq_id);
311316
}
317+
312318
/* update seq id */
313319
s->latest_seq_id = seq_id;
314320

@@ -434,9 +440,12 @@ static int rx_audio_session_handle_rtp_pkt(struct mtl_main_impl* impl,
434440
}
435441

436442
/* set first seq_id - 1 */
437-
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
443+
if (unlikely(s->latest_seq_id == -1)) {
444+
s->latest_seq_id = seq_id - 1;
445+
}
446+
438447
/* drop old packet */
439-
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
448+
if (seq_id <= s->latest_seq_id) {
440449
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
441450
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
442451
return -EIO;

lib/src/st2110/st_rx_fastmetadata_session.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,17 @@ static int rx_fastmetadata_session_handle_pkt(struct mtl_main_impl* impl,
115115
}
116116

117117
/* set if it is first pkt */
118-
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
118+
if (unlikely(s->latest_seq_id == -1)) {
119+
s->latest_seq_id = seq_id - 1;
120+
}
121+
119122
/* drop old packet */
120-
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
123+
if (seq_id <= s->latest_seq_id) {
121124
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
122125
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
123126
return 0;
124127
}
128+
125129
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
126130
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
127131
}

0 commit comments

Comments
 (0)