diff options
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_task.c')
| -rw-r--r-- | drivers/infiniband/sw/rxe/rxe_task.c | 52 | 
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c index ec2b7de1c497..60b90e33a884 100644 --- a/drivers/infiniband/sw/rxe/rxe_task.c +++ b/drivers/infiniband/sw/rxe/rxe_task.c @@ -4,10 +4,6 @@   * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.   */ -#include <linux/kernel.h> -#include <linux/interrupt.h> -#include <linux/hardirq.h> -  #include "rxe.h"  int __rxe_do_task(struct rxe_task *task) @@ -28,30 +24,31 @@ int __rxe_do_task(struct rxe_task *task)   * a second caller finds the task already running   * but looks just after the last call to func   */ -void rxe_do_task(struct tasklet_struct *t) +static void do_task(struct tasklet_struct *t)  {  	int cont;  	int ret;  	struct rxe_task *task = from_tasklet(task, t, tasklet); +	struct rxe_qp *qp = (struct rxe_qp *)task->arg;  	unsigned int iterations = RXE_MAX_ITERATIONS; -	spin_lock_bh(&task->state_lock); +	spin_lock_bh(&task->lock);  	switch (task->state) {  	case TASK_STATE_START:  		task->state = TASK_STATE_BUSY; -		spin_unlock_bh(&task->state_lock); +		spin_unlock_bh(&task->lock);  		break;  	case TASK_STATE_BUSY:  		task->state = TASK_STATE_ARMED;  		fallthrough;  	case TASK_STATE_ARMED: -		spin_unlock_bh(&task->state_lock); +		spin_unlock_bh(&task->lock);  		return;  	default: -		spin_unlock_bh(&task->state_lock); -		pr_warn("%s failed with bad state %d\n", __func__, task->state); +		spin_unlock_bh(&task->lock); +		rxe_dbg_qp(qp, "failed with bad state %d\n", task->state);  		return;  	} @@ -59,7 +56,7 @@ void rxe_do_task(struct tasklet_struct *t)  		cont = 0;  		ret = task->func(task->arg); -		spin_lock_bh(&task->state_lock); +		spin_lock_bh(&task->lock);  		switch (task->state) {  		case TASK_STATE_BUSY:  			if (ret) { @@ -85,27 +82,25 @@ void rxe_do_task(struct tasklet_struct *t)  			break;  		default: -			pr_warn("%s failed with bad state %d\n", __func__, -				task->state); +			rxe_dbg_qp(qp, "failed with bad state %d\n", +					task->state);  		} -		spin_unlock_bh(&task->state_lock); +		spin_unlock_bh(&task->lock);  	} while (cont);  	task->ret = ret;  } -int rxe_init_task(struct rxe_task *task, -		  void *arg, int (*func)(void *), char *name) +int rxe_init_task(struct rxe_task *task, void *arg, int (*func)(void *))  {  	task->arg	= arg;  	task->func	= func; -	snprintf(task->name, sizeof(task->name), "%s", name);  	task->destroyed	= false; -	tasklet_setup(&task->tasklet, rxe_do_task); +	tasklet_setup(&task->tasklet, do_task);  	task->state = TASK_STATE_START; -	spin_lock_init(&task->state_lock); +	spin_lock_init(&task->lock);  	return 0;  } @@ -121,23 +116,28 @@ void rxe_cleanup_task(struct rxe_task *task)  	task->destroyed = true;  	do { -		spin_lock_bh(&task->state_lock); +		spin_lock_bh(&task->lock);  		idle = (task->state == TASK_STATE_START); -		spin_unlock_bh(&task->state_lock); +		spin_unlock_bh(&task->lock);  	} while (!idle);  	tasklet_kill(&task->tasklet);  } -void rxe_run_task(struct rxe_task *task, int sched) +void rxe_run_task(struct rxe_task *task) +{ +	if (task->destroyed) +		return; + +	do_task(&task->tasklet); +} + +void rxe_sched_task(struct rxe_task *task)  {  	if (task->destroyed)  		return; -	if (sched) -		tasklet_schedule(&task->tasklet); -	else -		rxe_do_task(&task->tasklet); +	tasklet_schedule(&task->tasklet);  }  void rxe_disable_task(struct rxe_task *task)  | 
