Skip to content

Commit 7c9b061

Browse files
Fix: revert redundant mode in st30 st40 st41 rx sessions (#1294)
Due to the seq_id wraparound the functionality didnt work, revert for now. TODO: Add a patch that addresses issue described in 806c56b. This reverts commit 806c56b.
1 parent b5fd728 commit 7c9b061

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

lib/src/mt_util.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ 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+
100107
struct rte_mbuf* mt_build_pad(struct mtl_main_impl* impl, struct rte_mempool* mempool,
101108
enum mtl_port port, uint16_t ether_type, uint16_t len);
102109

lib/src/st2110/st_rx_ancillary_session.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,16 @@ 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)) {
136-
s->latest_seq_id = seq_id - 1;
137-
}
138-
135+
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
139136
/* drop old packet */
140-
if (seq_id <= s->latest_seq_id) {
137+
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
141138
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
142139
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
143140
return 0;
144141
}
145142
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
146143
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
147144
}
148-
149145
/* update seq id */
150146
s->latest_seq_id = seq_id;
151147

lib/src/st2110/st_rx_audio_session.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,28 +293,22 @@ 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)) {
297-
s->latest_seq_id = seq_id - 1;
298-
}
299-
296+
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
300297
/* drop old packet */
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);
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);
304300
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
305301
if (s->enable_timing_parser) {
306302
enum mtl_port port = mt_port_logic2phy(s->port_maps, s_port);
307303
ra_tp_on_packet(s, s_port, tmstamp, mt_mbuf_time_stamp(impl, mbuf, port));
308304
}
309305
return -EIO;
310306
}
311-
312307
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
313308
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
314-
info("%s(%d,%d), ooo, seq now %u last %d\n", __func__, s->idx, s_port, seq_id,
315-
s->latest_seq_id);
309+
dbg("%s(%d,%d), ooo, seq now %u last %d\n", __func__, s->idx, s_port, seq_id,
310+
s->latest_seq_id);
316311
}
317-
318312
/* update seq id */
319313
s->latest_seq_id = seq_id;
320314

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

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

lib/src/st2110/st_rx_fastmetadata_session.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,13 @@ 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)) {
119-
s->latest_seq_id = seq_id - 1;
120-
}
121-
118+
if (unlikely(s->latest_seq_id == -1)) s->latest_seq_id = seq_id - 1;
122119
/* drop old packet */
123-
if (seq_id <= s->latest_seq_id) {
120+
if (st_rx_seq_drop(seq_id, s->latest_seq_id, 5)) {
124121
dbg("%s(%d,%d), drop as pkt seq %d is old\n", __func__, s->idx, s_port, seq_id);
125122
ST_SESSION_STAT_INC(s, port_user_stats, stat_pkts_redundant);
126123
return 0;
127124
}
128-
129125
if (seq_id != (uint16_t)(s->latest_seq_id + 1)) {
130126
ST_SESSION_STAT_INC(s, port_user_stats.common, stat_pkts_out_of_order);
131127
}

0 commit comments

Comments
 (0)