From 5118917ea4ae75bac6984ba8ce33397aab016ff5 Mon Sep 17 00:00:00 2001 From: Eldad Zinger Date: Mon, 2 Aug 2010 15:05:12 +0300 Subject: [PATCH] sdp: rx_irq should use tasklet instead of timer due to latency issue mod_timer(..., 0) measured to add 4ms delay. Signed-off-by: Eldad Zinger --- drivers/infiniband/ulp/sdp/sdp.h | 1 + drivers/infiniband/ulp/sdp/sdp_rx.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/ulp/sdp/sdp.h b/drivers/infiniband/ulp/sdp/sdp.h index 1cab58c3fc56..2fc4f8f61830 100644 --- a/drivers/infiniband/ulp/sdp/sdp.h +++ b/drivers/infiniband/ulp/sdp/sdp.h @@ -322,6 +322,7 @@ struct sdp_rx_ring { spinlock_t lock; struct timer_list timer; + struct tasklet_struct tasklet; }; struct sdp_device { diff --git a/drivers/infiniband/ulp/sdp/sdp_rx.c b/drivers/infiniband/ulp/sdp/sdp_rx.c index 8b12cf04e8e6..abe11e4a7dff 100644 --- a/drivers/infiniband/ulp/sdp/sdp_rx.c +++ b/drivers/infiniband/ulp/sdp/sdp_rx.c @@ -833,7 +833,10 @@ static void sdp_rx_irq(struct ib_cq *cq, void *cq_context) sdp_prf(sk, NULL, "rx irq"); - mod_timer(&ssk->rx_ring.timer, 0); + /* We could use rx_ring.timer instead, but mod_timer(..., 0) + * measured to add 4ms delay. + */ + tasklet_hi_schedule(&ssk->rx_ring.tasklet); } static inline int sdp_should_rearm(struct sock *sk) @@ -969,7 +972,8 @@ int sdp_rx_ring_create(struct sdp_sock *ssk, struct ib_device *device) INIT_WORK(&ssk->rx_comp_work, sdp_rx_comp_work); ssk->rx_ring.timer.function = sdp_process_rx_timer; ssk->rx_ring.timer.data = (unsigned long) ssk; - + tasklet_init(&ssk->rx_ring.tasklet, sdp_process_rx_timer, + (unsigned long) ssk); sdp_arm_rx_cq(&ssk->isk.sk); return 0; @@ -1000,10 +1004,11 @@ void sdp_rx_ring_destroy(struct sdp_sock *ssk) } } - /* the timer should be deleted only after the rx_cq is destroyed, - * so there won't be rx_irq any more, meaning the timer will never be + /* the tasklet should be killed only after the rx_cq is destroyed, + * so there won't be rx_irq any more, meaning the tasklet will never be * enabled. */ del_timer_sync(&ssk->rx_ring.timer); + tasklet_kill(&ssk->rx_ring.tasklet); SDP_WARN_ON(ring_head(ssk->rx_ring) != ring_tail(ssk->rx_ring)); } -- 2.50.1