Skip to content

Commit

Permalink
Fix: enable and fixing debug logging when 'debug' build type is used. (
Browse files Browse the repository at this point in the history
…#1003)

PR introduce fixing logging when DEBUG directive is used.

Debug also enabled when MTL is built with 'debug' flag, e.g.: 
`./build.sh debugonly`
and  `mtl_log_level log_level` set to `MTL_LOG_LEVEL_DEBUG` according to

https://github.com/OpenVisualCloud/Media-Transport-Library/blob/main/doc/design.md#71-logging

---------
Co-authored-by: DawidWesierski4 <[email protected]>
  • Loading branch information
PanKaker and DawidWesierski4 authored Oct 29, 2024
1 parent ba8a8f7 commit 77196e3
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 55 deletions.
4 changes: 2 additions & 2 deletions lib/src/datapath/mt_shared_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ static int rsq_rx(struct mt_rsq_queue* rsq_queue) {
rsq_entry = NULL;

hdr = rte_pktmbuf_mtod(pkts[i], struct mt_udp_hdr*);
dbg("%s(%u), pkt %u ip %u.%u.%u.%u, port dst %u src %u\n", __func__, q, i,
ntohs(hdr->udp.dst_port), ntohs(hdr->udp.src_port));
dbg("%s, pkt %u ip %u, port dst %u src %u\n", __func__, q, i,
(unsigned int)ntohs(hdr->udp.dst_port), (unsigned int)ntohs(hdr->udp.src_port));

MT_TAILQ_FOREACH(rsq_entry, &rsq_queue->head, next) {
bool matched = mt_udp_matched(&rsq_entry->flow, hdr);
Expand Down
12 changes: 6 additions & 6 deletions lib/src/dev/mt_af_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ static void xdp_tx_poll_done(struct mt_xdp_queue* xq) {
static inline void xdp_tx_check_free(struct mt_xdp_queue* xq) {
struct xsk_ring_cons* cq = &xq->tx_cons;
uint32_t cq_avail = xsk_cons_nb_avail(cq, xq->umem_ring_size);
dbg("%s(%d, %u), cq_avail %u\n", __func__, port, q, cq_avail);
dbg("%s(%d, %u), cq_avail %u\n", __func__, xq->port, xq->q, cq_avail);
if (cq_avail >= xq->tx_free_thresh) {
xdp_tx_poll_done(xq);
}
Expand All @@ -524,7 +524,7 @@ static void xdp_tx_wakeup(struct mt_xdp_queue* xq) {
if (xsk_ring_prod__needs_wakeup(&xq->tx_prod)) {
int ret = send(xq->socket_fd, NULL, 0, MSG_DONTWAIT);
xq->stat_tx_wakeup++;
dbg("%s(%d, %u), wake up %d\n", __func__, port, q, ret);
dbg("%s(%d, %u), wake up %d\n", __func__, xq->port, xq->q, ret);
if (ret < 0) {
dbg("%s(%d, %u), wake up fail %d(%s)\n", __func__, xq->port, xq->q, ret,
strerror(errno));
Expand Down Expand Up @@ -555,14 +555,14 @@ static uint16_t xdp_tx(struct mtl_main_impl* impl, struct mt_xdp_queue* xq,
struct rte_mbuf* m = tx_pkts[i];
struct rte_mbuf* local = rte_pktmbuf_alloc(mbuf_pool);
if (!local) {
dbg("%s(%d, %u), local mbuf alloc fail\n", __func__, port, q);
dbg("%s(%d, %u), local mbuf alloc fail\n", __func__, port, xq->q);
xq->stat_tx_mbuf_alloc_fail++;
goto exit;
}

uint32_t idx;
if (!xsk_ring_prod__reserve(pd, 1, &idx)) {
dbg("%s(%d, %u), socket_tx reserve fail\n", __func__, port, q);
dbg("%s(%d, %u), socket_tx reserve fail\n", __func__, port, xq->q);
xq->stat_tx_prod_reserve_fail++;
rte_pktmbuf_free(local);
xdp_tx_wakeup(xq);
Expand Down Expand Up @@ -590,14 +590,14 @@ static uint16_t xdp_tx(struct mtl_main_impl* impl, struct mt_xdp_queue* xq,
tx_bytes += desc->len;
rte_pktmbuf_free(m);
dbg("%s(%d, %u), tx local mbuf %p umem pkt %p addr 0x%" PRIu64 "\n", __func__, port,
q, local, pkt, addr);
xq->q, local, pkt, addr);
xq->stat_tx_copy++;
tx++;
}

exit:
if (tx) {
dbg("%s(%d, %u), submit %u\n", __func__, port, q, tx);
dbg("%s(%d, %u), submit %u\n", __func__, port, xq->q, tx);
xsk_ring_prod__submit(pd, tx);
xdp_tx_wakeup(xq); /* do we need wakeup for every submit? */
if (stats) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/dev/mt_rdma_ud.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static uint16_t rdma_rx(struct mt_rx_rdma_entry* entry, struct rte_mbuf** rx_pkt
struct rte_mbuf* fill[rx];
int ret = rte_pktmbuf_alloc_bulk(rxq->mbuf_pool, fill, rx);
if (ret < 0) {
dbg("%s(%d, %u), mbuf alloc bulk %u fail\n", __func__, port, q, rx);
dbg("%s(%d, %u), mbuf alloc bulk %u fail\n", __func__, port, rxq->q, rx);
rxq->stat_rx_mbuf_alloc_fail++;
return 0;
}
Expand All @@ -380,7 +380,7 @@ static uint16_t rdma_rx(struct mt_rx_rdma_entry* entry, struct rte_mbuf** rx_pkt
}
uint32_t flow_hash = ntohl(wc[i].imm_data);
if (flow_hash != rxq->flow_hash) {
dbg("%s(%d, %u), flow_hash mismatch %u %u\n", __func__, port, q, flow_hash,
dbg("%s(%d, %u), flow_hash mismatch %u %u\n", __func__, port, rxq->q, flow_hash,
rxq->flow_hash);
rxq->stat_rx_pkt_invalid++;
rte_pktmbuf_free(pkt);
Expand Down Expand Up @@ -577,7 +577,7 @@ static int rdma_tx_mrs_init(struct mt_rdma_tx_queue* txq) {
}
mrs[i] = mr;
dbg("%s(%d, %u), mr registered, buffer %p size %" PRIu64 " mr_lkey %u\n", __func__,
port, q, buffers[i], sizes[i], mr->lkey);
port, q, buffer, sz, mr->lkey);
}

txq->send_mrs = mrs;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/mt_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ mtl_log_printer_t mt_get_usdt_log_printer(void);

/* Debug-level messages */
#ifdef DEBUG
#define dbg(...) \
do { \
MT_LOG(DEBUG, MT, __VA_ARGS__); \
#define dbg(...) \
do { \
MT_LOG(DEBUG, MTL, __VA_ARGS__); \
} while (0)
#else
#define dbg(...) \
Expand Down
4 changes: 2 additions & 2 deletions lib/src/mt_ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static inline int ptp_timesync_read_tx_time(struct mt_ptp_impl* ptp, uint64_t* t
ret = rte_eth_timesync_read_tx_timestamp(port_id, &spec);
ptp_timesync_unlock(ptp);

if (ret < 0) dbg("%s(%d), err %d\n", __func__, port, ret);
if (ret < 0) dbg("%s(%d), err %d\n", __func__, ptp->port, ret);
if (tai) *tai = mt_timespec_to_ns(&spec);
return ret;
}
Expand Down Expand Up @@ -517,7 +517,7 @@ static void ptp_adjust_delta(struct mt_ptp_impl* ptp, int64_t delta, bool error_
#else
if (!ptp_timesync_adjust_time(ptp, delta))
dbg("%s(%d), master offset: %" PRId64 " path delay: %" PRId64 " adjust time.\n",
__func__, ptp->port_id, delta, ptp->path_delay);
__func__, ptp->port_id, delta, ptp->stat_path_delay_max);
else
err("%s(%d), PHC time adjust failed.\n", __func__, ptp->port_id);
if (ptp->phc2sys_active) phc2sys_adjust(ptp);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/mt_sch.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ static int sch_tasklet_sleep(struct mtl_main_impl* impl, struct mtl_sch_impl* sc
sch->sleep_ratio_sleep_ns += delta;
uint64_t sleep_ratio_dur_ns = end - sch->sleep_ratio_start_ns;
if (sleep_ratio_dur_ns > (5 * (uint64_t)NS_PER_S)) {
dbg("%s(%d), sleep %" PRIu64 "ns, total %" PRIu64 "ns\n", __func__, idx,
dbg("%s(%d), sleep %" PRIu64 "ns, total %" PRIu64 "ns\n", __func__, sch->idx,
sch->sleep_ratio_sleep_ns, sleep_ratio_dur_ns);
dbg("%s(%d), end %" PRIu64 "ns, start %" PRIu64 "ns\n", __func__, idx, end,
dbg("%s(%d), end %" PRIu64 "ns, start %" PRIu64 "ns\n", __func__, sch->idx, end,
sch->sleep_ratio_start_ns);
sch->sleep_ratio_score =
(float)sch->sleep_ratio_sleep_ns * 100.0 / sleep_ratio_dur_ns;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/mt_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ int mt_u64_fifo_read_any(struct mt_u64_fifo* fifo, uint64_t* item, int skip) {
return -EIO;
}
if (skip < 0 || skip >= fifo->used) {
dbg("%s, fail as idx(%d) is invalid\n", __func__, idx);
dbg("%s, fail as idx(%d) is invalid\n", __func__, skip);
return -EIO;
}
int read_idx = fifo->read_idx + skip;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/st2110/pipeline/st30_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static int tx_st30p_create_transport(struct mtl_main_impl* impl, struct st30p_tx
struct st30_frame* frame = &frames[i].frame;

frame->addr = st30_tx_get_framebuffer(transport, i);
dbg("%s(%d), fb %p on %u\n", __func__, idx, frame->addr);
dbg("%s(%d), fb %p\n", __func__, idx, frame->addr);
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/st2110/st_rx_audio_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static struct st_frame_trans* rx_audio_session_get_frame(
frame_info = &s->st30_frames[i];

if (0 == rte_atomic32_read(&frame_info->refcnt)) {
dbg("%s(%d), find frame at %d\n", __func__, idx, i);
dbg("%s(%d), find frame at %d\n", __func__, s->idx, i);
rte_atomic32_inc(&frame_info->refcnt);
return frame_info;
}
Expand Down Expand Up @@ -441,7 +441,7 @@ static int rx_audio_session_handle_rtp_pkt(struct mtl_main_impl* impl,
/* enqueue the packet ring to app */
int ret = rte_ring_sp_enqueue(s->st30_rtps_ring, (void*)mbuf);
if (ret < 0) {
dbg("%s(%d,%d), drop as rtps ring full, seq id %d\n", __func__, seq_id, s_port);
dbg("%s(%d,%d), drop as rtps ring full\n", __func__, seq_id, s_port);
s->st30_stat_pkts_rtp_ring_full++;
return -EIO;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/src/st2110/st_rx_timing_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ void rv_tp_slot_parse_result(struct st_rx_video_session_impl* s,
slot->meta.cinst_avg = cinst_avg;
slot->meta.vrx_avg = vrx_avg;
slot->meta.ipt_avg = ipt_avg;
dbg("%s(%d), Cinst AVG %.2f MIN %d MAX %d test %s!\n", __func__, s->idx, cinst_avg,
slot->cinst_min, slot->cinst_max, rv_tp_cinst_result(tp, slot));
dbg("%s(%d), VRX AVG %.2f MIN %d MAX %d test %s!\n", __func__, s->idx, vrx_avg,
slot->vrx_min, slot->vrx_max, rv_tp_vrx_result(tp, slot));
dbg("%s(%d), Cinst AVG %.2f MIN %d MAX %d \n", __func__, s->idx, cinst_avg,
slot->meta.cinst_min, slot->meta.cinst_max);
dbg("%s(%d), VRX AVG %.2f MIN %d MAX %d \n", __func__, s->idx, vrx_avg,
slot->meta.vrx_min, slot->meta.vrx_max);
dbg("%s(%d), Inter-packet time(ns) AVG %.2f MIN %d MAX %d!\n", __func__, s->idx,
ipt_avg, slot->ipt_min, slot->ipt_max);
ipt_avg, slot->meta.ipt_max, slot->meta.ipt_min);

/* parse tp compliant for current frame */
enum st_rx_tp_compliant compliant = rv_tp_compliant(tp, slot);
Expand Down
18 changes: 10 additions & 8 deletions lib/src/st2110/st_rx_video_session.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ static struct st_rx_video_slot_impl* rv_slot_by_tmstamp(
/* still in progress of previous frame, drop current pkt */
rte_atomic32_inc(&s->dma_previous_busy_cnt);
dbg("%s(%d): still has dma inflight %u\n", __func__, s->idx,
s->dma_dev->nb_borrowed[s->dma_lender]);
s->dma_dev->nb_borrowed[s->dma_dev].nb_borrowed);
return NULL;
}

Expand Down Expand Up @@ -1795,7 +1795,8 @@ static int rv_handle_rtp_pkt(struct st_rx_video_session_impl* s, struct rte_mbuf
}
bool is_set = mt_bitmap_test_and_set(bitmap, pkt_idx);
if (is_set) {
dbg("%s(%d,%d), drop as pkt %d already received\n", __func__, idx, s_port, pkt_idx);
dbg("%s(%d,%d), drop as pkt %d already received\n", __func__, s->idx, s_port,
pkt_idx);
s->stat_pkts_redundant_dropped++;
return 0;
}
Expand All @@ -1811,7 +1812,7 @@ static int rv_handle_rtp_pkt(struct st_rx_video_session_impl* s, struct rte_mbuf
s->port_user_stats[MTL_SESSION_PORT_P].frames++;
mt_bitmap_test_and_set(bitmap, 0);
pkt_idx = 0;
dbg("%s(%d,%d), seq_id_base %d tmstamp %u\n", __func__, idx, s_port, seq_id,
dbg("%s(%d,%d), seq_id_base %d tmstamp %u\n", __func__, s->idx, s_port, seq_id,
tmstamp);
} else {
dbg("%s(%d,%d), drop seq_id %d as base seq id %d not got\n", __func__, s->idx,
Expand All @@ -1825,8 +1826,8 @@ static int rv_handle_rtp_pkt(struct st_rx_video_session_impl* s, struct rte_mbuf
/* enqueue the packet ring to app */
int ret = rte_ring_sp_enqueue(s->rtps_ring, (void*)mbuf);
if (ret < 0) {
dbg("%s(%d,%d), drop as rtps ring full, pkt_idx %d base %u\n", __func__, idx, s_port,
pkt_idx, slot->seq_id_base);
dbg("%s(%d,%d), drop as rtps ring full, pkt_idx %d base %u\n", __func__, s->idx,
s_port, pkt_idx, slot->seq_id_base);
s->stat_pkts_rtp_ring_full++;
return -EIO;
}
Expand Down Expand Up @@ -2196,7 +2197,7 @@ static int rv_handle_hdr_split_pkt(struct st_rx_video_session_impl* s,
hdr_split->cur_frame_mbuf_idx =
(payload - RTE_PKTMBUF_HEADROOM - hdr_split->frames) / ST_VIDEO_BPM_SIZE;
dbg("%s(%d,%d), cur_frame_addr %p cur_frame_idx %u\n", __func__, s->idx, s_port,
hdr_split->cur_frame_addr, slot->cur_frame_mbuf_idx);
hdr_split->cur_frame_addr, hdr_split->cur_frame_mbuf_idx);
if (hdr_split->cur_frame_mbuf_idx % hdr_split->mbufs_per_frame) {
s->stat_mismatch_hdr_split_frame++;
dbg("%s(%d,%d), cur_frame_addr %p cur_frame_idx %u mbufs_per_frame %u\n", __func__,
Expand Down Expand Up @@ -2236,7 +2237,7 @@ static int rv_handle_hdr_split_pkt(struct st_rx_video_session_impl* s,
/* check if frame is full */
size_t frame_recv_size = rv_slot_get_frame_size(slot);
if (frame_recv_size >= s->st20_frame_size) {
dbg("%s(%d,%d): full frame on %p(%d)\n", __func__, s->idx, s_port, slot->frame->addr,
dbg("%s(%d,%d): full frame on %p(%zu)\n", __func__, s->idx, s_port, slot->frame->addr,
frame_recv_size);
dbg("%s(%d,%d): tmstamp %u slot %d\n", __func__, s->idx, s_port, slot->tmstamp,
slot->idx);
Expand Down Expand Up @@ -2671,7 +2672,8 @@ static bool rv_simulate_pkt_loss(struct st_rx_video_session_impl* s) {
}
/* continue drop pkt in current burst */
s->burst_loss_cnt--;
dbg("%s(%d,%d), drop as simulate pkt loss\n", __func__, s->idx, s_port);
dbg("%s(%d,%d), drop as simulate pkt loss\n", __func__, s->idx,
s->stat_pkts_simulate_loss);
s->stat_pkts_simulate_loss++;
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/st2110/st_tx_ancillary_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,8 @@ static int tx_ancillary_session_tasklet_frame(struct mtl_main_impl* impl,
if (frame_end_time > pacing->tsc_time_cursor) {
s->stat_exceed_frame_time++;
dbg("%s(%d), frame %d build time out %" PRIu64 " us\n", __func__, idx,
s->st40_frame_idx, (frame_end_time - pacing->tsc_time_cursor) / NS_PER_US);
s->st40_frame_idx,
(uint64_t)((frame_end_time - pacing->tsc_time_cursor) / NS_PER_US));
}
s->check_frame_done_time = false;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/src/st2110/st_tx_audio_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ static int tx_audio_session_sync_pacing(struct mtl_main_impl* impl,
pacing->rtp_time_stamp);

if (sync) {
dbg("%s(%d), delay to epoch_time %f, cur %" PRIu64 "\n", __func__, s->idx,
dbg("%s(%d), delay to epoch_time %" PRIu64 ", cur %" PRIu64 "\n", __func__, s->idx,
pacing->tsc_time_cursor, mt_get_tsc(impl));
mt_tsc_delay_to(impl, pacing->tsc_time_cursor);
}
Expand Down Expand Up @@ -1317,8 +1317,8 @@ static void tx_audio_session_rl_inc_pkt_idx(struct st_tx_audio_session_rl_info*
struct st_tx_audio_session_rl_port* rl_port) {
rl_port->cur_pkt_idx++;
if (rl_port->cur_pkt_idx >= rl->pkts_per_sync) {
dbg("%s(%d,%d), switch to next queue, cur queue %d pkts %d send\n", __func__, idx,
s_port, cur_queue, rl_port->cur_pkt_idx);
dbg("%s, switch to next queue, cur queue %d pkts %d send\n", __func__,
rl_port->cur_queue, rl_port->cur_pkt_idx);
rl_port->cur_pkt_idx = 0;
tx_audio_session_rl_switch_queue(rl_port);
}
Expand Down Expand Up @@ -1420,16 +1420,16 @@ static uint16_t tx_audio_session_rl_first_pkt(struct mtl_main_impl* impl,
uint32_t trs = s->pacing.trs;
uint32_t delta_pkts = delta_tsc / trs;
if (delta_pkts > rl->max_warmup_trs) {
dbg("%s(%d,%d), delta_pkts %u too large\n", __func__, idx, s_port, delta_pkts);
dbg("%s(%d,%d), delta_pkts %u too large\n", __func__, s->idx, s_port, delta_pkts);
return 0;
}
uint32_t accuracy = delta_tsc % trs;
if (accuracy > rl->required_accuracy_ns) {
dbg("%s(%d,%d), accuracy %u too large, delta_tsc %u trs %u\n", __func__, idx, s_port,
accuracy, delta_tsc, trs);
dbg("%s(%d,%d), accuracy %u too large, delta_tsc %u trs %u\n", __func__, s->idx,
s_port, accuracy, delta_tsc, trs);
return 0;
}
dbg("%s(%d,%d), accuracy %u succ\n", __func__, idx, s_port, accuracy);
dbg("%s(%d,%d), accuracy %u succ\n", __func__, s->idx, s_port, accuracy);
if (delta_pkts != rl->max_warmup_trs) {
/* hit on backup check point */
rl_port->stat_hit_backup_cp++;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/st2110/st_tx_fastmetadata_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ static int tx_fastmetadata_session_tasklet_frame(
uint64_t frame_end_time = mt_get_tsc(impl);
if (frame_end_time > pacing->tsc_time_cursor) {
s->stat_exceed_frame_time++;
dbg("%s(%d), frame %d build time out %" PRIu64 " us\n", __func__, idx,
dbg("%s(%d), frame %" PRIu16 " build time out %f us\n", __func__, idx,
s->st41_frame_idx, (frame_end_time - pacing->tsc_time_cursor) / NS_PER_US);
}
s->check_frame_done_time = false;
Expand Down
15 changes: 9 additions & 6 deletions lib/src/st2110/st_tx_video_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ static int tv_build_st22(struct st_tx_video_session_impl* s, struct rte_mbuf* pk
rtp->base.marker = 1;
rtp->last_packet = 1;
dbg("%s(%d), maker on pkt %d(total %d)\n", __func__, s->idx, s->st20_pkt_idx,
s->st22_total_pkts);
s->st20_total_pkts);
}
rtp->base.seq_number = htons((uint16_t)s->st20_seq_id);
s->st20_seq_id++;
Expand Down Expand Up @@ -1425,7 +1425,7 @@ static int tv_build_st22(struct st_tx_video_session_impl* s, struct rte_mbuf* pk
uint32_t offset = s->st20_pkt_idx * s->st20_pkt_len;
uint16_t left_len = RTE_MIN(s->st20_pkt_len, st22_info->cur_frame_size - offset);
dbg("%s(%d), data len %u on pkt %d(total %d)\n", __func__, s->idx, left_len,
s->st20_pkt_idx, s->st22_total_pkts);
s->st20_pkt_idx, s->st20_total_pkts);

/* copy payload */
struct st_frame_trans* frame_info = &s->st20_frames[s->st20_frame_idx];
Expand Down Expand Up @@ -1470,7 +1470,7 @@ static int tv_build_st22_chain(struct st_tx_video_session_impl* s, struct rte_mb
rtp->base.marker = 1;
rtp->last_packet = 1;
dbg("%s(%d), maker on pkt %d(total %d)\n", __func__, s->idx, s->st20_pkt_idx,
s->st22_total_pkts);
s->st20_total_pkts);
}
rtp->base.seq_number = htons((uint16_t)s->st20_seq_id);
s->st20_seq_id++;
Expand Down Expand Up @@ -1501,7 +1501,7 @@ static int tv_build_st22_chain(struct st_tx_video_session_impl* s, struct rte_mb
uint32_t offset = s->st20_pkt_idx * s->st20_pkt_len;
uint16_t left_len = RTE_MIN(s->st20_pkt_len, st22_info->cur_frame_size - offset);
dbg("%s(%d), data len %u on pkt %d(total %d)\n", __func__, s->idx, left_len,
s->st20_pkt_idx, s->st22_total_pkts);
s->st20_pkt_idx, s->st20_total_pkts);

/* attach payload to chainbuf */
struct st_frame_trans* frame_info = &s->st20_frames[s->st20_frame_idx];
Expand Down Expand Up @@ -1966,6 +1966,8 @@ static int tv_tasklet_rtp(struct mtl_main_impl* impl,
struct rte_ring* ring_p = s->ring[MTL_SESSION_PORT_P];
struct rte_ring* ring_r = NULL;

ret = -1;

if (rte_ring_full(ring_p)) {
s->stat_build_ret_code = -STI_RTP_RING_FULL;
return MTL_TASKLET_ALL_DONE;
Expand Down Expand Up @@ -3898,9 +3900,7 @@ int st20_tx_queue_fatal_error(struct mtl_main_impl* impl,
/* only st20 frame mode has this callback */
int st20_frame_tx_start(struct mtl_main_impl* impl, struct st_tx_video_session_impl* s,
enum mtl_session_port s_port, struct st_frame_trans* frame) {
dbg("%s(%d,%d), start trans for frame %p\n", __func__, s->idx, port, frame);
if (!frame->user_meta_data_size) return 0;

enum mtl_port port = mt_port_logic2phy(s->port_maps, s_port);
/* tx the user meta */
struct rte_mbuf* pkt;
Expand All @@ -3912,7 +3912,10 @@ int st20_frame_tx_start(struct mtl_main_impl* impl, struct st_tx_video_session_i
struct rte_mempool* pool = mt_drv_no_sys_txq(impl, port)
? s->mbuf_mempool_hdr[s_port]
: mt_sys_tx_mempool(impl, port);
dbg("%s(%d,%d), start trans for frame %p\n", __func__, s->idx, port, frame);
pkt = rte_pktmbuf_alloc(pool);

dbg("%s(%d,%d), start trans for frame %p\n", __func__, s->idx, port, frame);
if (!pkt) {
err("%s(%d), pkt alloc fail\n", __func__, port);
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/st2110/st_video_transmitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static int _video_trs_rl_tasklet(struct mtl_main_impl* impl,
video_burst_packet(impl, s, s_port, pkts, valid_bulk, false);
rte_pktmbuf_free_bulk(&pkts[valid_bulk], bulk - valid_bulk);
s->stat_pkts_burst_dummy += bulk - valid_bulk;
dbg("%s(%d), pkt_idx %" PRIu64 " ts %" PRIu64 "\n", __func__, idx, pkt_idx,
dbg("%s(%d), pkt_idx %" PRIu64 " ts %" PRIu64 "\n", __func__, idx, (uint64_t)pkt_idx,
st_tx_mbuf_get_tsc(pkts[0]));
*ret_status = -STI_RLTRS_BURST_HAS_DUMMY;
return MTL_TASKLET_HAS_PENDING;
Expand Down
Loading

0 comments on commit 77196e3

Please sign in to comment.