From 1d7501fb2c2b76072eab609859f4c01daa1d97f0 Mon Sep 17 00:00:00 2001 From: Amir Hanania Date: Mon, 19 Sep 2016 16:44:25 -0700 Subject: [PATCH] mpxyd: let TX thread sleep if no open devices are referenced Signed-off-by: Arlin Davis Signed-off-by: Amir Hanania --- dapl/svc/mpxyd.c | 14 +++++--------- doc/mpxyd.conf | 8 ++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dapl/svc/mpxyd.c b/dapl/svc/mpxyd.c index 3df50e8..9f2d01d 100644 --- a/dapl/svc/mpxyd.c +++ b/dapl/svc/mpxyd.c @@ -504,6 +504,11 @@ static int init_smd_send_op_mmap(mcm_scif_dev_t *smd) smd->mm_s_place_holder = NULL; smd->mm_r_head = 0; smd->mm_r_last = DAT_MIX_MMAP_WR_MAX; + smd->mm_r_addr = NULL; + + /* Activate send OP via mmap only when polling mode is set */ + if (!mcm_op_poll) + return -1; len = ALIGN_PAGE(DAT_MIX_MMAP_WR_MAX * (sizeof(dat_mix_mmap_wr_t))); smd->mm_r_len = len; @@ -1046,9 +1051,6 @@ void mpxy_tx_thread(void *mic_client) mc->tx_busy = data; time_ms = (data) ? 0:-1; - if (time_ms && mcm_op_poll) - time_ms = 0; - mpxy_unlock(&mc->txlock); if (time_ms == -1) mlog(0x10," sleep\n"); mcm_select(set, time_ms); @@ -1137,9 +1139,6 @@ void mpxy_op_thread(void *mic_client) /* data-path, loop if busy or device open & single core */ if ((mc->tx_busy || mc->rx_busy) || (smd_cnt && mcm_op_poll)) time_ms = 0; - else { - time_ms = 0; - } mcm_select(set, time_ms); /* Another sched yield */ if (time_ms == -1) mlog(0x10," OP wake\n"); @@ -1305,9 +1304,6 @@ void mpxy_rx_thread(void *mic_client) mc->rx_busy = data; time_ms = data ? 0:-1; - if (time_ms && mcm_op_poll) - time_ms = 0; - mpxy_unlock(&mc->rxlock); if (time_ms == -1) mlog(0x10," RX sleep\n"); mcm_select(set, time_ms); diff --git a/doc/mpxyd.conf b/doc/mpxyd.conf index 349a1c0..b16f1f2 100644 --- a/doc/mpxyd.conf +++ b/doc/mpxyd.conf @@ -59,6 +59,14 @@ scif_listen_qlen 240 # The default is 1 mcm_affinity 1 + +# mcm_op_poll: +# For the OP thread. Use FD wake or use pollong for next OP +# If 0, FD wake up will be used. +# If 1, use polling for the next OP. +# +# The default is 1 + mcm_op_poll 1 # mcm_affinity_base_mic: -- 2.46.0