Skip to content

Commit 567bbc0

Browse files
authored
Fix: st20 redundant packets counting causes error packets increment (#1210)
This PR is related to issue #1157 - Added logic to count only redundant packet drops if slot is already received
1 parent 756b592 commit 567bbc0

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

lib/src/st2110/st_rx_video_session.c

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,13 +1525,15 @@ static int rv_handle_frame_pkt(struct st_rx_video_session_impl* s, struct rte_mb
15251525
/* find the target slot by tmstamp */
15261526
bool exist_ts = false;
15271527
struct st_rx_video_slot_impl* slot = rv_slot_by_tmstamp(s, tmstamp, NULL, &exist_ts);
1528-
if (!slot || !slot->frame) {
1529-
if (exist_ts) {
1530-
s->stat_pkts_redundant_dropped++;
1531-
slot->pkts_recv_per_port[s_port]++;
1532-
} else {
1533-
s->stat_pkts_no_slot++;
1534-
}
1528+
/* Based on rv_slot_by_tmstamp - exist_ts is only true when slot is found */
1529+
if (exist_ts && !slot->frame) {
1530+
s->stat_pkts_redundant_dropped++;
1531+
slot->pkts_recv_per_port[s_port]++;
1532+
return 0;
1533+
}
1534+
1535+
if ((!slot || !slot->frame) && !exist_ts) {
1536+
s->stat_pkts_no_slot++;
15351537
return -EIO;
15361538
}
15371539

@@ -1941,13 +1943,15 @@ static int rv_handle_st22_pkt(struct st_rx_video_session_impl* s, struct rte_mbu
19411943
/* find the target slot by tmstamp */
19421944
bool exist_ts = false;
19431945
struct st_rx_video_slot_impl* slot = rv_slot_by_tmstamp(s, tmstamp, NULL, &exist_ts);
1944-
if (!slot || !slot->frame) {
1945-
if (exist_ts) {
1946-
s->stat_pkts_redundant_dropped++;
1947-
slot->pkts_recv_per_port[s_port]++;
1948-
} else {
1949-
s->stat_pkts_no_slot++;
1950-
}
1946+
/* Based on rv_slot_by_tmstamp - exist_ts is only true when slot is found */
1947+
if (exist_ts && !slot->frame) {
1948+
s->stat_pkts_redundant_dropped++;
1949+
slot->pkts_recv_per_port[s_port]++;
1950+
return 0;
1951+
}
1952+
1953+
if ((!slot || !slot->frame) && !exist_ts) {
1954+
s->stat_pkts_no_slot++;
19511955
return -EIO;
19521956
}
19531957
uint8_t* bitmap = slot->frame_bitmap;
@@ -2111,13 +2115,15 @@ static int rv_handle_hdr_split_pkt(struct st_rx_video_session_impl* s,
21112115
/* find the target slot by tmstamp */
21122116
bool exist_ts = false;
21132117
struct st_rx_video_slot_impl* slot = rv_slot_by_tmstamp(s, tmstamp, payload, &exist_ts);
2114-
if (!slot || !slot->frame) {
2115-
if (exist_ts) {
2116-
s->stat_pkts_redundant_dropped++;
2117-
slot->pkts_recv_per_port[s_port]++;
2118-
} else {
2119-
s->stat_pkts_no_slot++;
2120-
}
2118+
/* Based on rv_slot_by_tmstamp - exist_ts is only true when slot is found */
2119+
if (exist_ts && !slot->frame) {
2120+
s->stat_pkts_redundant_dropped++;
2121+
slot->pkts_recv_per_port[s_port]++;
2122+
return 0;
2123+
}
2124+
2125+
if ((!slot || !slot->frame) && !exist_ts) {
2126+
s->stat_pkts_no_slot++;
21212127
return -EIO;
21222128
}
21232129
uint8_t* bitmap = slot->frame_bitmap;

0 commit comments

Comments
 (0)