From d2f8ffe5da5b30a45708cf079b84760e976e61e7 Mon Sep 17 00:00:00 2001 From: Frank Du Date: Wed, 26 Jun 2024 12:52:30 +0800 Subject: [PATCH] ptp: fix panic if run rx timing with pf (#913) Signed-off-by: Frank Du --- lib/src/mt_ptp.c | 6 +++++- lib/src/st2110/st_rx_video_session.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/mt_ptp.c b/lib/src/mt_ptp.c index 4a12481d2..cc3d04a85 100644 --- a/lib/src/mt_ptp.c +++ b/lib/src/mt_ptp.c @@ -1559,8 +1559,12 @@ static int ptp_stat(void* priv) { int mt_ptp_init(struct mtl_main_impl* impl) { int socket = mt_socket_id(impl, MTL_PORT_P); int ret; + int num_port = mt_num_ports(impl); + + for (int i = 0; i < num_port; i++) { + /* only probe on the MTL_PORT_P */ + if ((i != MTL_PORT_P) && !mt_if_has_offload_timestamp(impl, i)) continue; - for (int i = 0; i < 1; i++) { /* only probe on the MTL_PORT_P */ struct mt_ptp_impl* ptp = mt_rte_zmalloc_socket(sizeof(*ptp), socket); if (!ptp) { err("%s(%d), ptp malloc fail\n", __func__, i); diff --git a/lib/src/st2110/st_rx_video_session.c b/lib/src/st2110/st_rx_video_session.c index f345bdd81..3d8611cb9 100644 --- a/lib/src/st2110/st_rx_video_session.c +++ b/lib/src/st2110/st_rx_video_session.c @@ -2579,7 +2579,7 @@ static int rv_handle_detect_pkt(struct st_rx_video_session_impl* s, struct rte_m ops->fps = meta->fps; ops->packing = meta->packing; ops->interlaced = meta->interlaced; - if (ops->notify_detected) { + if (ops->notify_detected && (ops->flags & ST20_RX_FLAG_AUTO_DETECT)) { struct st20_detect_reply reply = {0}; ret = ops->notify_detected(ops->priv, meta, &reply); if (ret < 0) {