Skip to content

Commit 2ce93f4

Browse files
Add: Unified stats retrival api
Add unified api to retrive the sessions stats, for both the legacy and pipeline sessions. This could be made much more elegantly with a union but for the sake of unifying the approach i decided to add all this boilerplate, 3.6 times more code, not great not terrible
1 parent 439b4fd commit 2ce93f4

31 files changed

+1216
-470
lines changed

include/experimental/st40_pipeline_api.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,34 @@ struct st40p_tx_ops {
135135
uint8_t tx_dst_mac[MTL_SESSION_PORT_MAX][MTL_MAC_ADDR_LEN];
136136
};
137137

138+
/**
139+
* Retrieve the general statistics(I/O) for one rx st2110-40(pipeline) session.
140+
*
141+
* @param handle
142+
* The handle to the rx st2110-40(pipeline) session.
143+
* @param port
144+
* The port index.
145+
* @param stats
146+
* A pointer to stats structure.
147+
* @return
148+
* - >=0 succ.
149+
* - <0: Error code.
150+
*/
151+
int st40p_tx_get_session_stats(st40p_tx_handle handle, struct st40_tx_users_stats* stats);
152+
153+
/**
154+
* Reset the general statistics(I/O) for one rx st2110-40(pipeline) session.
155+
*
156+
* @param handle
157+
* The handle to the rx st2110-40(pipeline) session.
158+
* @param port
159+
* The port index.
160+
* @return
161+
* - >=0 succ.
162+
* - <0: Error code.
163+
*/
164+
int st40p_tx_reset_session_stats(st40p_tx_handle handle);
165+
138166
/** Create one tx st2110-40 pipeline session */
139167
st40p_tx_handle st40p_tx_create(mtl_handle mt, struct st40p_tx_ops* ops);
140168

include/st20_api.h

Lines changed: 74 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,31 +1679,75 @@ struct st22_rx_ops {
16791679
};
16801680

16811681
/**
1682-
* A structure used to retrieve general statistics(I/O) for a st20 tx port.
1683-
*/
1684-
struct st20_tx_port_status {
1685-
/** Total number of transmitted packets. */
1686-
uint64_t packets;
1687-
/** Total number of transmitted bytes. */
1688-
uint64_t bytes;
1689-
/** Total number of build packets. */
1690-
uint64_t build;
1691-
/** Total number of transmitted frames. */
1692-
uint64_t frames;
1682+
* A structure used to retrieve general statistics(I/O) for a st20 tx session.
1683+
*/
1684+
struct st20_tx_users_stats {
1685+
struct st_tx_port_stats port[MTL_SESSION_PORT_MAX];
1686+
uint64_t stat_pkts_dummy;
1687+
uint64_t stat_epoch_troffset_mismatch;
1688+
uint64_t stat_trans_troffset_mismatch;
1689+
uint64_t stat_trans_recalculate_warmup;
1690+
uint64_t stat_epoch_drop;
1691+
uint64_t stat_epoch_onward;
1692+
uint64_t stat_exceed_frame_time;
1693+
uint64_t stat_error_user_timestamp;
1694+
uint64_t stat_user_busy;
1695+
uint64_t stat_lines_not_ready;
1696+
uint64_t stat_vsync_mismatch;
1697+
uint64_t stat_pkts_chain_realloc_fail;
1698+
uint64_t stat_user_meta_cnt;
1699+
uint64_t stat_user_meta_pkt_cnt;
1700+
uint64_t stat_recoverable_error;
1701+
uint64_t stat_unrecoverable_error;
1702+
uint64_t stat_interlace_first_field;
1703+
uint64_t stat_interlace_second_field;
16931704
};
16941705

16951706
/**
1696-
* A structure used to retrieve general statistics(I/O) for a st20 rx port.
1697-
*/
1698-
struct st20_rx_port_status {
1699-
/** Total number of received packets. */
1700-
uint64_t packets;
1701-
/** Total number of received bytes. */
1702-
uint64_t bytes;
1703-
/** Total number of received frames. */
1704-
uint64_t frames;
1705-
/** Total number of received packets which are not valid. */
1706-
uint64_t err_packets;
1707+
* A structure used to retrieve general statistics(I/O) for a st20 rx session.
1708+
*/
1709+
struct st20_rx_user_stats {
1710+
struct st_rx_port_stats port[MTL_SESSION_PORT_MAX];
1711+
uint64_t stat_pkts_received;
1712+
uint64_t stat_bytes_received;
1713+
uint64_t stat_slices_received;
1714+
uint64_t stat_pkts_idx_dropped;
1715+
uint64_t stat_pkts_offset_dropped;
1716+
uint64_t stat_frames_dropped;
1717+
uint64_t stat_pkts_idx_oo_bitmap;
1718+
uint64_t stat_frames_pks_missed;
1719+
uint64_t stat_pkts_rtp_ring_full;
1720+
uint64_t stat_pkts_no_slot;
1721+
uint64_t stat_pkts_out_of_order;
1722+
uint64_t stat_pkts_redundant_dropped;
1723+
uint64_t stat_pkts_wrong_pt_dropped;
1724+
uint64_t stat_pkts_wrong_interlace_dropped;
1725+
uint64_t stat_pkts_wrong_len_dropped;
1726+
uint64_t stat_pkts_enqueue_fallback;
1727+
uint64_t stat_pkts_dma;
1728+
uint64_t stat_pkts_slice_fail;
1729+
uint64_t stat_pkts_slice_merged;
1730+
uint64_t stat_pkts_multi_segments_received;
1731+
uint64_t stat_pkts_not_bpm;
1732+
uint64_t stat_pkts_wrong_payload_hdr_split;
1733+
uint64_t stat_mismatch_hdr_split_frame;
1734+
uint64_t stat_pkts_copy_hdr_split;
1735+
uint64_t stat_vsync_mismatch;
1736+
uint64_t stat_slot_get_frame_fail;
1737+
uint64_t stat_slot_query_ext_fail;
1738+
uint64_t stat_pkts_simulate_loss;
1739+
uint64_t stat_pkts_user_meta;
1740+
uint64_t stat_pkts_user_meta_err;
1741+
uint64_t stat_pkts_retransmit;
1742+
uint64_t stat_interlace_first_field;
1743+
uint64_t stat_interlace_second_field;
1744+
uint64_t stat_st22_boxes;
1745+
uint64_t stat_burst_pkts_max;
1746+
uint64_t stat_burst_succ_cnt;
1747+
uint64_t stat_burst_pkts_sum;
1748+
uint64_t stat_pkts_wrong_ssrc_dropped;
1749+
uint64_t incomplete_frames_cnt;
1750+
uint64_t stat_pkts_wrong_kmod_dropped;
17071751
};
17081752

17091753
/**
@@ -1837,7 +1881,7 @@ int st20_tx_put_mbuf(st20_tx_handle handle, void* mbuf, uint16_t len);
18371881
int st20_tx_get_sch_idx(st20_tx_handle handle);
18381882

18391883
/**
1840-
* Retrieve the general statistics(I/O) for one tx st2110-20(video) session port.
1884+
* Retrieve the general statistics(I/O) for one tx st2110-20(video) session.
18411885
*
18421886
* @param handle
18431887
* The handle to the tx st2110-20(video) session.
@@ -1849,11 +1893,10 @@ int st20_tx_get_sch_idx(st20_tx_handle handle);
18491893
* - >=0 succ.
18501894
* - <0: Error code.
18511895
*/
1852-
int st20_tx_get_port_stats(st20_tx_handle handle, enum mtl_session_port port,
1853-
struct st20_tx_port_status* stats);
1896+
int st20_tx_get_session_stats(st20_tx_handle handle, struct st20_tx_users_stats* stats);
18541897

18551898
/**
1856-
* Reset the general statistics(I/O) for one tx st2110-20(video) session port.
1899+
* Reset the general statistics(I/O) for one tx st2110-20(video) session.
18571900
*
18581901
* @param handle
18591902
* The handle to the tx st2110-20(video) session.
@@ -1863,7 +1906,7 @@ int st20_tx_get_port_stats(st20_tx_handle handle, enum mtl_session_port port,
18631906
* - >=0 succ.
18641907
* - <0: Error code.
18651908
*/
1866-
int st20_tx_reset_port_stats(st20_tx_handle handle, enum mtl_session_port port);
1909+
int st20_tx_reset_session_stats(st20_tx_handle handle);
18671910

18681911
/**
18691912
* Retrieve the pixel group info from st2110-20(video) format.
@@ -2187,7 +2230,7 @@ bool st20_rx_dma_enabled(st20_rx_handle handle);
21872230
int st20_rx_timing_parser_critical(st20_rx_handle handle, struct st20_rx_tp_pass* pass);
21882231

21892232
/**
2190-
* Retrieve the general statistics(I/O) for one rx st2110-20(video) session port.
2233+
* Retrieve the general statistics(I/O) for one rx st2110-20(video) session.
21912234
*
21922235
* @param handle
21932236
* The handle to the rx st2110-20(video) session.
@@ -2199,11 +2242,10 @@ int st20_rx_timing_parser_critical(st20_rx_handle handle, struct st20_rx_tp_pass
21992242
* - >=0 succ.
22002243
* - <0: Error code.
22012244
*/
2202-
int st20_rx_get_port_stats(st20_rx_handle handle, enum mtl_session_port port,
2203-
struct st20_rx_port_status* stats);
2245+
int st20_rx_get_session_stats(st20_rx_handle handle, struct st20_rx_user_stats* stats);
22042246

22052247
/**
2206-
* Reset the general statistics(I/O) for one rx st2110-20(video) session port.
2248+
* Reset the general statistics(I/O) for one rx st2110-20(video) session.
22072249
*
22082250
* @param handle
22092251
* The handle to the rx st2110-20(video) session.
@@ -2213,7 +2255,7 @@ int st20_rx_get_port_stats(st20_rx_handle handle, enum mtl_session_port port,
22132255
* - >=0 succ.
22142256
* - <0: Error code.
22152257
*/
2216-
int st20_rx_reset_port_stats(st20_rx_handle handle, enum mtl_session_port port);
2258+
int st20_rx_reset_session_stats(st20_rx_handle handle);
22172259

22182260
/**
22192261
* Create one rx st2110-22(compressed video) session.

include/st30_api.h

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,98 @@ struct st30_rx_ops {
528528
uint16_t sample_num __mtl_deprecated_msg("Not use anymore, plan to remove");
529529
};
530530

531+
/**
532+
* A structure used to retrieve general statistics(I/O) for a st30 tx session.
533+
*/
534+
struct st30_tx_users_stats {
535+
struct st_tx_port_stats port[MTL_SESSION_PORT_MAX];
536+
uint64_t stat_epoch_mismatch;
537+
uint64_t stat_epoch_drop;
538+
uint64_t stat_epoch_onward;
539+
uint64_t stat_epoch_late;
540+
uint64_t stat_exceed_frame_time;
541+
uint64_t stat_error_user_timestamp;
542+
uint64_t stat_recoverable_error;
543+
uint64_t stat_unrecoverable_error;
544+
uint64_t stat_pkts_burst;
545+
uint64_t stat_pad_pkts_burst;
546+
uint64_t stat_warmup_pkts_burst;
547+
uint64_t stat_mismatch_sync_point;
548+
uint64_t stat_recalculate_warmup;
549+
uint64_t stat_hit_backup_cp;
550+
};
551+
552+
/**
553+
* A structure used to retrieve general statistics(I/O) for a st30 rx session.
554+
*/
555+
struct st30_rx_user_stats {
556+
struct st_rx_port_stats port[MTL_SESSION_PORT_MAX];
557+
uint64_t stat_pkts_received;
558+
uint64_t stat_pkts_redundant;
559+
uint64_t stat_pkts_out_of_order;
560+
uint64_t stat_pkts_dropped;
561+
uint64_t stat_pkts_wrong_ssrc_dropped;
562+
uint64_t stat_pkts_wrong_pt_dropped;
563+
uint64_t stat_pkts_len_mismatch_dropped;
564+
uint64_t stat_slot_get_frame_fail;
565+
};
566+
567+
/**
568+
* Retrieve the general statistics(I/O) for one tx st2110-30(audio) session.
569+
*
570+
* @param handle
571+
* The handle to the tx st2110-30(audio) session.
572+
* @param port
573+
* The port index.
574+
* @param stats
575+
* A pointer to stats structure.
576+
* @return
577+
* - >=0 succ.
578+
* - <0: Error code.
579+
*/
580+
int st30_tx_get_session_stats(st30_tx_handle handle, struct st30_tx_users_stats* stats);
581+
582+
/**
583+
* Reset the general statistics(I/O) for one tx st2110-30(audio) session.
584+
*
585+
* @param handle
586+
* The handle to the tx st2110-30(audio) session.
587+
* @param port
588+
* The port index.
589+
* @return
590+
* - >=0 succ.
591+
* - <0: Error code.
592+
*/
593+
int st30_tx_reset_session_stats(st30_tx_handle handle);
594+
595+
/**
596+
* Retrieve the general statistics(I/O) for one rx st2110-30(audio) session.
597+
*
598+
* @param handle
599+
* The handle to the rx st2110-30(audio) session.
600+
* @param port
601+
* The port index.
602+
* @param stats
603+
* A pointer to stats structure.
604+
* @return
605+
* - >=0 succ.
606+
* - <0: Error code.
607+
*/
608+
int st30_rx_get_session_stats(st30_rx_handle handle, struct st30_rx_user_stats* stats);
609+
610+
/**
611+
* Reset the general statistics(I/O) for one rx st2110-30(audio) session.
612+
*
613+
* @param handle
614+
* The handle to the rx st2110-30(audio) session.
615+
* @param port
616+
* The port index.
617+
* @return
618+
* - >=0 succ.
619+
* - <0: Error code.
620+
*/
621+
int st30_rx_reset_session_stats(st30_rx_handle handle);
622+
531623
/**
532624
* Create one tx st2110-30(audio) session.
533625
*

include/st30_pipeline_api.h

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,34 @@ struct st30p_tx_ops {
158158
int socket_id;
159159
};
160160

161+
/**
162+
* Retrieve the general statistics(I/O) for one rx st2110-30(pipeline) session.
163+
*
164+
* @param handle
165+
* The handle to the rx st2110-30(pipeline) session.
166+
* @param port
167+
* The port index.
168+
* @param stats
169+
* A pointer to stats structure.
170+
* @return
171+
* - >=0 succ.
172+
* - <0: Error code.
173+
*/
174+
int st30p_tx_get_session_stats(st30p_tx_handle handle, struct st30_tx_users_stats* stats);
175+
176+
/**
177+
* Reset the general statistics(I/O) for one rx st2110-30(pipeline) session.
178+
*
179+
* @param handle
180+
* The handle to the rx st2110-30(pipeline) session.
181+
* @param port
182+
* The port index.
183+
* @return
184+
* - >=0 succ.
185+
* - <0: Error code.
186+
*/
187+
int st30p_tx_reset_session_stats(st30p_tx_handle handle);
188+
161189
/**
162190
* Get one tx frame from the tx st2110-30 pipeline session.
163191
* Call st30p_tx_put_frame to return the frame to session.
@@ -235,6 +263,34 @@ struct st30p_rx_ops {
235263
int socket_id;
236264
};
237265

266+
/**
267+
* Retrieve the general statistics(I/O) for one rx st2110-30(pipeline) session.
268+
*
269+
* @param handle
270+
* The handle to the rx st2110-30(pipeline) session.
271+
* @param port
272+
* The port index.
273+
* @param stats
274+
* A pointer to stats structure.
275+
* @return
276+
* - >=0 succ.
277+
* - <0: Error code.
278+
*/
279+
int st30p_rx_get_session_stats(st30p_rx_handle handle, struct st30_rx_user_stats* stats);
280+
281+
/**
282+
* Reset the general statistics(I/O) for one rx st2110-30(pipeline) session.
283+
*
284+
* @param handle
285+
* The handle to the rx st2110-30(pipeline) session.
286+
* @param port
287+
* The port index.
288+
* @return
289+
* - >=0 succ.
290+
* - <0: Error code.
291+
*/
292+
int st30p_rx_reset_session_stats(st30p_rx_handle handle);
293+
238294
/**
239295
* Get one rx frame from the rx st2110-30 pipeline session.
240296
* Call st30p_rx_put_frame to return the frame to session.

0 commit comments

Comments
 (0)