From ea327f7ba2950035e1085982695fe6c2a92075fb Mon Sep 17 00:00:00 2001 From: Kano Date: Mon, 1 Apr 2013 13:10:15 +1100 Subject: [PATCH 1/2] work queues - remove new but unnecessary functions --- cgminer.c | 20 ++------------------ miner.h | 4 +--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/cgminer.c b/cgminer.c index 7d5738d8..f2a9e43a 100644 --- a/cgminer.c +++ b/cgminer.c @@ -5786,28 +5786,12 @@ struct work *get_queued(struct cgpu_info *cgpu) return ret; } -/* This function is for including work in the given que hashtable. - * The calling function must lock access to the que if it is required. */ -struct work *add_to_work_que(struct work *que, struct work *work) -{ - HASH_ADD_INT(que, id, work); - return que; -} - -/* This function is for removing work from the given que hashtable. - * The calling function must lock access to the que if it is required. */ -struct work *del_from_work_que(struct work *que, struct work *work) -{ - HASH_DEL(que, work); - return que; -} - /* This function is for finding an already queued work item in the * given que hashtable. Code using this function must be able * to handle NULL as a return which implies there is no matching work. * The calling function must lock access to the que if it is required. * The common values for midstatelen, offset, datalen are 32, 64, 12 */ -struct work *find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen) +struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen) { struct work *work, *tmp, *ret = NULL; @@ -5832,7 +5816,7 @@ struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, struct work *ret; rd_lock(&cgpu->qlock); - ret = find_work_bymidstate(cgpu->queued_work, midstate, midstatelen, data, offset, datalen); + ret = __find_work_bymidstate(cgpu->queued_work, midstate, midstatelen, data, offset, datalen); rd_unlock(&cgpu->qlock); return ret; diff --git a/miner.h b/miner.h index 0595f945..b41e3134 100644 --- a/miner.h +++ b/miner.h @@ -1183,9 +1183,7 @@ struct modminer_fpga_state { extern void get_datestamp(char *, struct timeval *); extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce); extern struct work *get_queued(struct cgpu_info *cgpu); -extern struct work *add_to_work_que(struct work *que, struct work *work); -extern struct work *del_from_work_que(struct work *que, struct work *work); -extern struct work *find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen); +extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen); extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen); extern void work_completed(struct cgpu_info *cgpu, struct work *work); extern void hash_queued_work(struct thr_info *mythr); From f080db5fee9ccf2fd99247b5c498e9b0b2cc793d Mon Sep 17 00:00:00 2001 From: Kano Date: Tue, 2 Apr 2013 09:50:05 +1100 Subject: [PATCH 2/2] generic work structure flags for BFLSC (and usable by other drivers if needed) --- miner.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miner.h b/miner.h index b41e3134..04c8a469 100644 --- a/miner.h +++ b/miner.h @@ -1144,6 +1144,11 @@ struct work { double work_difficulty; + // Allow devices to identify work if multiple sub-devices + int subid; + // Allow devices to flag work for their own purposes + bool devflag; + struct timeval tv_getwork; struct timeval tv_getwork_reply; struct timeval tv_cloned;