Lines Matching refs:_r
140 #define FRONT_RING_ATTACH(_r, _s, _i, __size) do { \ argument
141 (_r)->req_prod_pvt = (_i); \
142 (_r)->rsp_cons = (_i); \
143 (_r)->nr_ents = __RING_SIZE(_s, __size); \
144 (_r)->sring = (_s); \
147 #define FRONT_RING_INIT(_r, _s, __size) FRONT_RING_ATTACH(_r, _s, 0, __size) argument
149 #define BACK_RING_ATTACH(_r, _s, _i, __size) do { \ argument
150 (_r)->rsp_prod_pvt = (_i); \
151 (_r)->req_cons = (_i); \
152 (_r)->nr_ents = __RING_SIZE(_s, __size); \
153 (_r)->sring = (_s); \
156 #define BACK_RING_INIT(_r, _s, __size) BACK_RING_ATTACH(_r, _s, 0, __size) argument
159 #define RING_SIZE(_r) \ argument
160 ((_r)->nr_ents)
163 #define RING_FREE_REQUESTS(_r) \ argument
164 (RING_SIZE(_r) - ((_r)->req_prod_pvt - (_r)->rsp_cons))
169 #define RING_FULL(_r) \ argument
170 (RING_FREE_REQUESTS(_r) == 0)
173 #define RING_HAS_UNCONSUMED_RESPONSES(_r) \ argument
174 ((_r)->sring->rsp_prod - (_r)->rsp_cons)
176 #define RING_HAS_UNCONSUMED_REQUESTS(_r) ({ \ argument
177 unsigned int req = (_r)->sring->req_prod - (_r)->req_cons; \
178 unsigned int rsp = RING_SIZE(_r) - \
179 ((_r)->req_cons - (_r)->rsp_prod_pvt); \
184 #define RING_GET_REQUEST(_r, _idx) \ argument
185 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req))
187 #define RING_GET_RESPONSE(_r, _idx) \ argument
188 (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp))
208 #define RING_REQUEST_CONS_OVERFLOW(_r, _cons) \ argument
209 (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
212 #define RING_REQUEST_PROD_OVERFLOW(_r, _prod) \ argument
213 (((_prod) - (_r)->rsp_prod_pvt) > RING_SIZE(_r))
216 #define RING_RESPONSE_PROD_OVERFLOW(_r, _prod) \ argument
217 (((_prod) - (_r)->rsp_cons) > RING_SIZE(_r))
219 #define RING_PUSH_REQUESTS(_r) do { \ argument
221 (_r)->sring->req_prod = (_r)->req_prod_pvt; \
224 #define RING_PUSH_RESPONSES(_r) do { \ argument
226 (_r)->sring->rsp_prod = (_r)->rsp_prod_pvt; \
259 #define RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(_r, _notify) do { \ argument
260 RING_IDX __old = (_r)->sring->req_prod; \
261 RING_IDX __new = (_r)->req_prod_pvt; \
263 (_r)->sring->req_prod = __new; \
265 (_notify) = ((RING_IDX)(__new - (_r)->sring->req_event) < \
269 #define RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(_r, _notify) do { \ argument
270 RING_IDX __old = (_r)->sring->rsp_prod; \
271 RING_IDX __new = (_r)->rsp_prod_pvt; \
273 (_r)->sring->rsp_prod = __new; \
275 (_notify) = ((RING_IDX)(__new - (_r)->sring->rsp_event) < \
279 #define RING_FINAL_CHECK_FOR_REQUESTS(_r, _work_to_do) do { \ argument
280 (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
282 (_r)->sring->req_event = (_r)->req_cons + 1; \
284 (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r); \
287 #define RING_FINAL_CHECK_FOR_RESPONSES(_r, _work_to_do) do { \ argument
288 (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \
290 (_r)->sring->rsp_event = (_r)->rsp_cons + 1; \
292 (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r); \