|
|
@ -6310,6 +6310,13 @@ static void fill_queue(struct thr_info *mythr, struct cgpu_info *cgpu, struct de |
|
|
|
} while (!drv->queue_full(cgpu)); |
|
|
|
} while (!drv->queue_full(cgpu)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a work item to a cgpu's queued hashlist */ |
|
|
|
|
|
|
|
void __add_queued(struct cgpu_info *cgpu, struct work *work) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
cgpu->queued_count++; |
|
|
|
|
|
|
|
HASH_ADD_INT(cgpu->queued_work, id, work); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* This function is for retrieving one work item from the unqueued pointer and
|
|
|
|
/* This function is for retrieving one work item from the unqueued pointer and
|
|
|
|
* adding it to the hashtable of queued work. Code using this function must be |
|
|
|
* adding it to the hashtable of queued work. Code using this function must be |
|
|
|
* able to handle NULL as a return which implies there is no work available. */ |
|
|
|
* able to handle NULL as a return which implies there is no work available. */ |
|
|
@ -6320,7 +6327,7 @@ struct work *get_queued(struct cgpu_info *cgpu) |
|
|
|
wr_lock(&cgpu->qlock); |
|
|
|
wr_lock(&cgpu->qlock); |
|
|
|
if (cgpu->unqueued_work) { |
|
|
|
if (cgpu->unqueued_work) { |
|
|
|
work = cgpu->unqueued_work; |
|
|
|
work = cgpu->unqueued_work; |
|
|
|
HASH_ADD_INT(cgpu->queued_work, id, work); |
|
|
|
__add_queued(cgpu, work); |
|
|
|
cgpu->unqueued_work = NULL; |
|
|
|
cgpu->unqueued_work = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
wr_unlock(&cgpu->qlock); |
|
|
|
wr_unlock(&cgpu->qlock); |
|
|
@ -6328,6 +6335,22 @@ struct work *get_queued(struct cgpu_info *cgpu) |
|
|
|
return work; |
|
|
|
return work; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void add_queued(struct cgpu_info *cgpu, struct work *work) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
wr_lock(&cgpu->qlock); |
|
|
|
|
|
|
|
__add_queued(cgpu, work); |
|
|
|
|
|
|
|
wr_unlock(&cgpu->qlock); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get fresh work and add it to cgpu's queued hashlist */ |
|
|
|
|
|
|
|
struct work *get_queue_work(struct thr_info *thr, struct cgpu_info *cgpu, int thr_id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
struct work *work = get_work(thr, thr_id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_queued(cgpu, work); |
|
|
|
|
|
|
|
return work; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* This function is for finding an already queued work item in the
|
|
|
|
/* This function is for finding an already queued work item in the
|
|
|
|
* given que hashtable. Code using this function must be able |
|
|
|
* given que hashtable. Code using this function must be able |
|
|
|
* to handle NULL as a return which implies there is no matching work. |
|
|
|
* to handle NULL as a return which implies there is no matching work. |
|
|
|