forked from mirrors/linux
		
	xen: update ring.h
Update include/xen/interface/io/ring.h to its newest version. Switch the two improper use cases of RING_HAS_UNCONSUMED_RESPONSES() to XEN_RING_NR_UNCONSUMED_RESPONSES() in order to avoid the nasty XEN_RING_HAS_UNCONSUMED_IS_BOOL #define. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
		
							parent
							
								
									888fd787f3
								
							
						
					
					
						commit
						6fac592cca
					
				
					 2 changed files with 16 additions and 7 deletions
				
			
		|  | @ -866,7 +866,7 @@ static void xennet_set_rx_rsp_cons(struct netfront_queue *queue, RING_IDX val) | ||||||
| 
 | 
 | ||||||
| 	spin_lock_irqsave(&queue->rx_cons_lock, flags); | 	spin_lock_irqsave(&queue->rx_cons_lock, flags); | ||||||
| 	queue->rx.rsp_cons = val; | 	queue->rx.rsp_cons = val; | ||||||
| 	queue->rx_rsp_unconsumed = RING_HAS_UNCONSUMED_RESPONSES(&queue->rx); | 	queue->rx_rsp_unconsumed = XEN_RING_NR_UNCONSUMED_RESPONSES(&queue->rx); | ||||||
| 	spin_unlock_irqrestore(&queue->rx_cons_lock, flags); | 	spin_unlock_irqrestore(&queue->rx_cons_lock, flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1498,7 +1498,7 @@ static bool xennet_handle_rx(struct netfront_queue *queue, unsigned int *eoi) | ||||||
| 		return false; | 		return false; | ||||||
| 
 | 
 | ||||||
| 	spin_lock_irqsave(&queue->rx_cons_lock, flags); | 	spin_lock_irqsave(&queue->rx_cons_lock, flags); | ||||||
| 	work_queued = RING_HAS_UNCONSUMED_RESPONSES(&queue->rx); | 	work_queued = XEN_RING_NR_UNCONSUMED_RESPONSES(&queue->rx); | ||||||
| 	if (work_queued > queue->rx_rsp_unconsumed) { | 	if (work_queued > queue->rx_rsp_unconsumed) { | ||||||
| 		queue->rx_rsp_unconsumed = work_queued; | 		queue->rx_rsp_unconsumed = work_queued; | ||||||
| 		*eoi = 0; | 		*eoi = 0; | ||||||
|  |  | ||||||
|  | @ -72,9 +72,8 @@ typedef unsigned int RING_IDX; | ||||||
|  * of the shared memory area (PAGE_SIZE, for instance). To initialise |  * of the shared memory area (PAGE_SIZE, for instance). To initialise | ||||||
|  * the front half: |  * the front half: | ||||||
|  * |  * | ||||||
|  *     mytag_front_ring_t front_ring; |  *     mytag_front_ring_t ring; | ||||||
|  *     SHARED_RING_INIT((mytag_sring_t *)shared_page); |  *     XEN_FRONT_RING_INIT(&ring, (mytag_sring_t *)shared_page, PAGE_SIZE); | ||||||
|  *     FRONT_RING_INIT(&front_ring, (mytag_sring_t *)shared_page, PAGE_SIZE); |  | ||||||
|  * |  * | ||||||
|  * Initializing the back follows similarly (note that only the front |  * Initializing the back follows similarly (note that only the front | ||||||
|  * initializes the shared ring): |  * initializes the shared ring): | ||||||
|  | @ -146,6 +145,11 @@ struct __name##_back_ring {                                             \ | ||||||
| 
 | 
 | ||||||
| #define FRONT_RING_INIT(_r, _s, __size) FRONT_RING_ATTACH(_r, _s, 0, __size) | #define FRONT_RING_INIT(_r, _s, __size) FRONT_RING_ATTACH(_r, _s, 0, __size) | ||||||
| 
 | 
 | ||||||
|  | #define XEN_FRONT_RING_INIT(r, s, size) do {                            \ | ||||||
|  |     SHARED_RING_INIT(s);                                                \ | ||||||
|  |     FRONT_RING_INIT(r, s, size);                                        \ | ||||||
|  | } while (0) | ||||||
|  | 
 | ||||||
| #define BACK_RING_ATTACH(_r, _s, _i, __size) do {                       \ | #define BACK_RING_ATTACH(_r, _s, _i, __size) do {                       \ | ||||||
|     (_r)->rsp_prod_pvt = (_i);                                          \ |     (_r)->rsp_prod_pvt = (_i);                                          \ | ||||||
|     (_r)->req_cons = (_i);                                              \ |     (_r)->req_cons = (_i);                                              \ | ||||||
|  | @ -170,16 +174,21 @@ struct __name##_back_ring {                                             \ | ||||||
|     (RING_FREE_REQUESTS(_r) == 0) |     (RING_FREE_REQUESTS(_r) == 0) | ||||||
| 
 | 
 | ||||||
| /* Test if there are outstanding messages to be processed on a ring. */ | /* Test if there are outstanding messages to be processed on a ring. */ | ||||||
| #define RING_HAS_UNCONSUMED_RESPONSES(_r)                               \ | #define XEN_RING_NR_UNCONSUMED_RESPONSES(_r)                            \ | ||||||
|     ((_r)->sring->rsp_prod - (_r)->rsp_cons) |     ((_r)->sring->rsp_prod - (_r)->rsp_cons) | ||||||
| 
 | 
 | ||||||
| #define RING_HAS_UNCONSUMED_REQUESTS(_r) ({                             \ | #define XEN_RING_NR_UNCONSUMED_REQUESTS(_r) ({                          \ | ||||||
|     unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;          \ |     unsigned int req = (_r)->sring->req_prod - (_r)->req_cons;          \ | ||||||
|     unsigned int rsp = RING_SIZE(_r) -                                  \ |     unsigned int rsp = RING_SIZE(_r) -                                  \ | ||||||
|         ((_r)->req_cons - (_r)->rsp_prod_pvt);                          \ |         ((_r)->req_cons - (_r)->rsp_prod_pvt);                          \ | ||||||
|     req < rsp ? req : rsp;                                              \ |     req < rsp ? req : rsp;                                              \ | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
|  | #define RING_HAS_UNCONSUMED_RESPONSES(_r) \ | ||||||
|  |     (!!XEN_RING_NR_UNCONSUMED_RESPONSES(_r)) | ||||||
|  | #define RING_HAS_UNCONSUMED_REQUESTS(_r)  \ | ||||||
|  |     (!!XEN_RING_NR_UNCONSUMED_REQUESTS(_r)) | ||||||
|  | 
 | ||||||
| /* Direct access to individual ring elements, by index. */ | /* Direct access to individual ring elements, by index. */ | ||||||
| #define RING_GET_REQUEST(_r, _idx)                                      \ | #define RING_GET_REQUEST(_r, _idx)                                      \ | ||||||
|     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) |     (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Juergen Gross
						Juergen Gross