Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qdio: split do_QDIO()

The callers know what type of queue they want to work with. Introduce
type-specific variants to add buffers on an {Input,Output} queue, so
that we can avoid some function parameters and the de-muxing into
type-specific hot paths.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

authored by

Julian Wiedmann and committed by
Heiko Carstens
a60bffe5 b44995e5

+63 -34
+6 -5
arch/s390/include/asm/qdio.h
··· 336 336 struct qdio_buffer ***output_sbal_addr_array; 337 337 }; 338 338 339 - #define QDIO_FLAG_SYNC_INPUT 0x01 340 - #define QDIO_FLAG_SYNC_OUTPUT 0x02 341 - 342 339 int qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count); 343 340 void qdio_free_buffers(struct qdio_buffer **buf, unsigned int count); 344 341 void qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count); ··· 345 348 extern int qdio_establish(struct ccw_device *cdev, 346 349 struct qdio_initialize *init_data); 347 350 extern int qdio_activate(struct ccw_device *); 348 - extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags, int q_nr, 349 - unsigned int bufnr, unsigned int count, struct qaob *aob); 350 351 extern int qdio_start_irq(struct ccw_device *cdev); 351 352 extern int qdio_stop_irq(struct ccw_device *cdev); 352 353 extern int qdio_inspect_input_queue(struct ccw_device *cdev, unsigned int nr, 353 354 unsigned int *bufnr, unsigned int *error); 354 355 extern int qdio_inspect_output_queue(struct ccw_device *cdev, unsigned int nr, 355 356 unsigned int *bufnr, unsigned int *error); 357 + extern int qdio_add_bufs_to_input_queue(struct ccw_device *cdev, 358 + unsigned int q_nr, unsigned int bufnr, 359 + unsigned int count); 360 + extern int qdio_add_bufs_to_output_queue(struct ccw_device *cdev, 361 + unsigned int q_nr, unsigned int bufnr, 362 + unsigned int count, struct qaob *aob); 356 363 extern int qdio_shutdown(struct ccw_device *, int); 357 364 extern int qdio_free(struct ccw_device *); 358 365 extern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *);
+38 -13
drivers/s390/cio/qdio_main.c
··· 1215 1215 } 1216 1216 1217 1217 /** 1218 + * qdio_add_bufs_to_input_queue - process buffers on an Input Queue 1219 + * @cdev: associated ccw_device for the qdio subchannel 1220 + * @q_nr: queue number 1221 + * @bufnr: buffer number 1222 + * @count: how many buffers to process 1223 + */ 1224 + int qdio_add_bufs_to_input_queue(struct ccw_device *cdev, unsigned int q_nr, 1225 + unsigned int bufnr, unsigned int count) 1226 + { 1227 + struct qdio_irq *irq_ptr = cdev->private->qdio_data; 1228 + 1229 + if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q) 1230 + return -EINVAL; 1231 + 1232 + if (!irq_ptr) 1233 + return -ENODEV; 1234 + 1235 + DBF_DEV_EVENT(DBF_INFO, irq_ptr, "addi b:%02x c:%02x", bufnr, count); 1236 + 1237 + if (irq_ptr->state != QDIO_IRQ_STATE_ACTIVE) 1238 + return -EIO; 1239 + if (!count) 1240 + return 0; 1241 + 1242 + return handle_inbound(irq_ptr->input_qs[q_nr], bufnr, count); 1243 + } 1244 + EXPORT_SYMBOL_GPL(qdio_add_bufs_to_input_queue); 1245 + 1246 + /** 1218 1247 * handle_outbound - process filled outbound buffers 1219 1248 * @q: queue containing the buffers 1220 1249 * @bufnr: first buffer to process ··· 1284 1255 } 1285 1256 1286 1257 /** 1287 - * do_QDIO - process input or output buffers 1258 + * qdio_add_bufs_to_output_queue - process buffers on an Output Queue 1288 1259 * @cdev: associated ccw_device for the qdio subchannel 1289 - * @callflags: input or output and special flags from the program 1290 1260 * @q_nr: queue number 1291 1261 * @bufnr: buffer number 1292 1262 * @count: how many buffers to process 1293 - * @aob: asynchronous operation block (outbound only) 1263 + * @aob: asynchronous operation block 1294 1264 */ 1295 - int do_QDIO(struct ccw_device *cdev, unsigned int callflags, 1296 - int q_nr, unsigned int bufnr, unsigned int count, struct qaob *aob) 1265 + int qdio_add_bufs_to_output_queue(struct ccw_device *cdev, unsigned int q_nr, 1266 + unsigned int bufnr, unsigned int count, 1267 + struct qaob *aob) 1297 1268 { 1298 1269 struct qdio_irq *irq_ptr = cdev->private->qdio_data; 1299 1270 ··· 1303 1274 if (!irq_ptr) 1304 1275 return -ENODEV; 1305 1276 1306 - DBF_DEV_EVENT(DBF_INFO, irq_ptr, 1307 - "do%02x b:%02x c:%02x", callflags, bufnr, count); 1277 + DBF_DEV_EVENT(DBF_INFO, irq_ptr, "addo b:%02x c:%02x", bufnr, count); 1308 1278 1309 1279 if (irq_ptr->state != QDIO_IRQ_STATE_ACTIVE) 1310 1280 return -EIO; 1311 1281 if (!count) 1312 1282 return 0; 1313 - if (callflags & QDIO_FLAG_SYNC_INPUT) 1314 - return handle_inbound(irq_ptr->input_qs[q_nr], bufnr, count); 1315 - else if (callflags & QDIO_FLAG_SYNC_OUTPUT) 1316 - return handle_outbound(irq_ptr->output_qs[q_nr], bufnr, count, aob); 1317 - return -EINVAL; 1283 + 1284 + return handle_outbound(irq_ptr->output_qs[q_nr], bufnr, count, aob); 1318 1285 } 1319 - EXPORT_SYMBOL_GPL(do_QDIO); 1286 + EXPORT_SYMBOL_GPL(qdio_add_bufs_to_output_queue); 1320 1287 1321 1288 /** 1322 1289 * qdio_start_irq - enable interrupt processing for the device
+10 -10
drivers/s390/net/qeth_core_main.c
··· 355 355 qdio_reset_buffers(card->qdio.c_q->qdio_bufs, 356 356 QDIO_MAX_BUFFERS_PER_Q); 357 357 card->qdio.c_q->next_buf_to_init = 127; 358 - rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 1, 0, 127, 359 - NULL); 358 + 359 + rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 1, 0, 127); 360 360 if (rc) { 361 361 QETH_CARD_TEXT_(card, 2, "1err%d", rc); 362 362 goto out; ··· 2926 2926 } 2927 2927 2928 2928 card->qdio.in_q->next_buf_to_init = QDIO_BUFNR(rx_bufs); 2929 - rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 0, rx_bufs, 2930 - NULL); 2929 + rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, 0, rx_bufs); 2931 2930 if (rc) { 2932 2931 QETH_CARD_TEXT_(card, 2, "1err%d", rc); 2933 2932 return rc; ··· 3414 3415 return 0; 3415 3416 } 3416 3417 3417 - rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, 0, 3418 - queue->next_buf_to_init, count, NULL); 3418 + rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, 3419 + queue->next_buf_to_init, 3420 + count); 3419 3421 if (rc) { 3420 3422 QETH_CARD_TEXT(card, 2, "qinberr"); 3421 3423 } ··· 3588 3588 } 3589 3589 3590 3590 QETH_TXQ_STAT_INC(queue, doorbell); 3591 - rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_OUTPUT, queue->queue_no, 3592 - index, count, aob); 3591 + rc = qdio_add_bufs_to_output_queue(CARD_DDEV(card), queue->queue_no, 3592 + index, count, aob); 3593 3593 3594 3594 switch (rc) { 3595 3595 case 0: ··· 3739 3739 } 3740 3740 qeth_scrub_qdio_buffer(buffer, QDIO_MAX_ELEMENTS_PER_BUFFER); 3741 3741 } 3742 - rc = do_QDIO(CARD_DDEV(card), QDIO_FLAG_SYNC_INPUT, queue, 3743 - cq->next_buf_to_init, count, NULL); 3742 + rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), queue, 3743 + cq->next_buf_to_init, count); 3744 3744 if (rc) { 3745 3745 dev_warn(&card->gdev->dev, 3746 3746 "QDIO reported an error, rc=%i\n", rc);
+9 -6
drivers/s390/scsi/zfcp_qdio.c
··· 154 154 /* 155 155 * put SBALs back to response queue 156 156 */ 157 - if (do_QDIO(cdev, QDIO_FLAG_SYNC_INPUT, 0, idx, count, NULL)) 157 + if (qdio_add_bufs_to_input_queue(cdev, 0, idx, count)) 158 158 zfcp_erp_adapter_reopen(qdio->adapter, 0, "qdires2"); 159 159 } 160 160 ··· 326 326 327 327 atomic_sub(sbal_number, &qdio->req_q_free); 328 328 329 - retval = do_QDIO(qdio->adapter->ccw_device, QDIO_FLAG_SYNC_OUTPUT, 0, 330 - q_req->sbal_first, sbal_number, NULL); 329 + retval = qdio_add_bufs_to_output_queue(qdio->adapter->ccw_device, 0, 330 + q_req->sbal_first, sbal_number, 331 + NULL); 331 332 332 333 if (unlikely(retval)) { 333 334 /* Failed to submit the IO, roll back our modifications. */ ··· 396 395 if (!(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP)) 397 396 return; 398 397 399 - /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ 398 + /* 399 + * Clear QDIOUP flag, thus qdio_add_bufs_to_output_queue() is not called 400 + * during qdio_shutdown(). 401 + */ 400 402 spin_lock_irq(&qdio->req_q_lock); 401 403 atomic_andnot(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); 402 404 spin_unlock_irq(&qdio->req_q_lock); ··· 502 498 sbale->addr = 0; 503 499 } 504 500 505 - if (do_QDIO(cdev, QDIO_FLAG_SYNC_INPUT, 0, 0, QDIO_MAX_BUFFERS_PER_Q, 506 - NULL)) 501 + if (qdio_add_bufs_to_input_queue(cdev, 0, 0, QDIO_MAX_BUFFERS_PER_Q)) 507 502 goto failed_qdio; 508 503 509 504 /* set index of first available SBALS / number of available SBALS */