Lines Matching refs:qedf
8 #include "qedf.h"
11 void qedf_cmd_timer_set(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
14 queue_delayed_work(qedf->timer_work_queue, &io_req->timeout_work,
23 struct qedf_ctx *qedf;
32 qedf = fcport->qedf;
36 if (qedf == NULL) {
38 "qedf is NULL for ABTS xid=0x%x.\n",
43 QEDF_ERR((&qedf->dbg_ctx), "ABTS timeout, xid=0x%x.\n",
66 if (!qedf) {
68 "qedf is NULL for ELS xid=0x%x.\n",
81 QEDF_ERR(&(qedf->dbg_ctx), "ELS timeout, xid=0x%x.\n",
93 QEDF_ERR(&(qedf->dbg_ctx), "Sequence cleanup timeout, "
97 qedf_process_seq_cleanup_compl(qedf, NULL, io_req);
100 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
109 struct qedf_ctx *qedf = cmgr->qedf;
121 QEDF_ERR(&qedf->dbg_ctx, "io_bdt_pool is NULL.\n");
129 dma_free_coherent(&qedf->pdev->dev, bd_tbl_sz,
152 dma_free_coherent(&qedf->pdev->dev,
172 struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf)
184 if (!qedf->num_queues) {
185 QEDF_ERR(&(qedf->dbg_ctx), "num_queues is not set.\n");
190 QEDF_WARN(&(qedf->dbg_ctx), "Invalid min_xid 0x%x and "
195 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "min xid 0x%x, max xid "
202 QEDF_WARN(&(qedf->dbg_ctx), "Failed to alloc cmd mgr.\n");
206 cmgr->qedf = qedf;
223 io_req->sense_buffer = dma_alloc_coherent(&qedf->pdev->dev,
227 QEDF_ERR(&qedf->dbg_ctx,
236 QEDF_ERR(&(qedf->dbg_ctx),
249 QEDF_ERR(&(qedf->dbg_ctx),
261 QEDF_WARN(&(qedf->dbg_ctx), "Failed to alloc io_bdt_pool.\n");
269 QEDF_WARN(&(qedf->dbg_ctx),
277 bdt_info->bd_tbl = dma_alloc_coherent(&qedf->pdev->dev,
281 QEDF_WARN(&(qedf->dbg_ctx),
287 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
300 struct qedf_ctx *qedf = fcport->qedf;
301 struct qedf_cmd_mgr *cmd_mgr = qedf->cmd_mgr;
312 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
321 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
329 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
353 QEDF_ERR(&qedf->dbg_ctx,
382 QEDF_ERR(&(qedf->dbg_ctx), "bd_tbl is NULL, xid=%x.\n", xid);
399 qedf->alloc_failures++;
406 struct qedf_ctx *qedf = io_req->fcport->qedf;
411 dma_free_coherent(&qedf->pdev->dev, sz,
416 dma_free_coherent(&qedf->pdev->dev, sz,
421 dma_free_coherent(&qedf->pdev->dev, QEDF_PAGE_SIZE,
426 dma_free_coherent(&qedf->pdev->dev, QEDF_PAGE_SIZE,
441 QEDF_WARN(&fcport->qedf->dbg_ctx,
455 QEDF_WARN(&(fcport->qedf->dbg_ctx), "active_ios < 0.\n");
476 struct qedf_ctx *qedf = lport_priv(lport);
486 sg_count = dma_map_sg(&qedf->pdev->dev, scsi_sglist(sc),
521 QEDF_ERR(&(qedf->dbg_ctx), "byte_count = %d != "
596 struct qedf_ctx *qedf = fcport->qedf;
597 uint16_t cq_idx = smp_processor_id() % qedf->num_queues;
671 qedf->slow_sge_ios++;
673 qedf->fast_sge_ios++;
681 struct qedf_ctx *qedf = io_req->fcport->qedf;
687 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
691 qedf->control_requests++;
803 struct qedf_ctx *qedf = fcport->qedf;
808 spin_lock_irqsave(&qedf->io_trace_lock, flags);
810 io_log = &qedf->io_trace_buf[qedf->io_trace_idx];
839 qedf->io_trace_idx++;
840 if (qedf->io_trace_idx == QEDF_IO_TRACE_SIZE)
841 qedf->io_trace_idx = 0;
843 spin_unlock_irqrestore(&qedf->io_trace_lock, flags);
851 struct qedf_ctx *qedf = lport_priv(lport);
867 qedf->input_requests++;
870 qedf->output_requests++;
873 qedf->control_requests++;
880 QEDF_ERR(&(qedf->dbg_ctx), "BD list creation failed.\n");
889 QEDF_ERR(&(qedf->dbg_ctx), "Session not offloaded yet.\n");
905 task_ctx = qedf_get_task_mem(&qedf->tasks, xid);
907 QEDF_WARN(&(qedf->dbg_ctx), "task_ctx is NULL, xid=%d.\n",
933 struct qedf_ctx *qedf = lport_priv(lport);
945 QEDF_ERR(&qedf->dbg_ctx,
953 if (test_bit(QEDF_UNLOADING, &qedf->flags) ||
954 test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) {
955 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
957 qedf->flags);
963 if (!qedf->pdev->msix_enabled) {
964 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
974 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
983 if (test_bit(QEDF_DRAIN_ACTIVE, &qedf->flags)) {
984 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Drain active.\n");
990 atomic_read(&qedf->link_state) != QEDF_LINK_UP) {
991 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Link down.\n");
1038 QEDF_WARN(&(qedf->dbg_ctx), "Unable to post io_req\n");
1054 struct qedf_ctx *qedf = io_req->fcport->qedf;
1085 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1092 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1106 static void qedf_unmap_sg_list(struct qedf_ctx *qedf, struct qedf_ioreq *io_req)
1111 dma_unmap_sg(&qedf->pdev->dev, scsi_sglist(sc),
1117 void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
1137 QEDF_ERR(&qedf->dbg_ctx,
1147 QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd is NULL!\n");
1152 QEDF_WARN(&(qedf->dbg_ctx),
1158 QEDF_ERR(&qedf->dbg_ctx,
1164 QEDF_WARN(&(qedf->dbg_ctx), "request->q is NULL so request "
1178 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1186 qedf_unmap_sg_list(qedf, io_req);
1190 QEDF_ERR(&(qedf->dbg_ctx),
1201 QEDF_ERR(&qedf->dbg_ctx,
1228 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1232 qedf->lport->host->host_no, sc_cmd->device->id,
1258 qedf->task_set_fulls++;
1260 qedf->busy++;
1272 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1277 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1290 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1291 "combination of scope = %d and qualifier = %d is not handled in qedf.\n",
1297 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "fcp_status=%d.\n",
1319 void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
1326 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "io_req is NULL\n");
1331 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1346 QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd is NULL!\n");
1351 QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%p is not valid.", sc_cmd);
1356 QEDF_WARN(&(qedf->dbg_ctx),
1362 QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %p is NULL.\n",
1368 QEDF_ERR(&qedf->dbg_ctx,
1374 QEDF_ERR(&qedf->dbg_ctx,
1381 QEDF_ERR(&qedf->dbg_ctx,
1387 qedf_unmap_sg_list(qedf, io_req);
1391 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%lld: Completing "
1394 qedf->lport->host->host_no, sc_cmd->device->id,
1428 void qedf_process_warning_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
1437 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1443 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "Warning CQE, "
1445 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx),
1449 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "tx_buff_off=%08x, "
1470 QEDF_ERR(&(qedf->dbg_ctx), "REC timer expired.\n");
1494 QEDF_ERR(&(qedf->dbg_ctx), "Failed to queue ABTS.\n");
1498 void qedf_process_error_detect(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
1514 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1519 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "Error detection CQE, "
1521 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx),
1525 QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "tx_buff_off=%08x, "
1535 QEDF_ERR(&qedf->dbg_ctx,
1541 if (qedf->stop_io_on_error) {
1542 qedf_stop_all_io(qedf);
1549 QEDF_ERR(&(qedf->dbg_ctx), "Failed to queue ABTS.\n");
1552 static void qedf_flush_els_req(struct qedf_ctx *qedf,
1555 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1586 struct qedf_ctx *qedf;
1605 qedf = fcport->qedf;
1607 if (!qedf) {
1608 QEDF_ERR(NULL, "qedf is NULL.\n");
1616 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1629 cmd_mgr = qedf->cmd_mgr;
1631 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1635 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Locking flush mutex.\n");
1637 mutex_lock(&qedf->flush_mutex);
1658 QEDF_ERR(&qedf->dbg_ctx,
1678 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1688 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1704 QEDF_ERR(&(qedf->dbg_ctx),
1711 qedf_flush_els_req(qedf, io_req);
1724 QEDF_ERR(&(qedf->dbg_ctx),
1732 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1736 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1743 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1762 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1782 QEDF_ERR(&(qedf->dbg_ctx), "Could not get kref for "
1787 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
1799 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1806 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1812 QEDF_ERR(&qedf->dbg_ctx,
1824 QEDF_ERR(&qedf->dbg_ctx,
1843 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Unlocking flush mutex.\n");
1844 mutex_unlock(&qedf->flush_mutex);
1856 struct qedf_ctx *qedf;
1871 qedf = fcport->qedf;
1875 QEDF_ERR(&qedf->dbg_ctx, "stale rport\n");
1880 lport = qedf->lport;
1883 QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n");
1888 if (atomic_read(&qedf->link_down_tmo_valid) > 0) {
1889 QEDF_ERR(&(qedf->dbg_ctx), "link_down_tmo active.\n");
1896 QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n");
1902 QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n");
1911 QEDF_ERR(&qedf->dbg_ctx,
1926 qedf->control_requests++;
1927 qedf->packet_aborts++;
1933 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
1937 qedf_cmd_timer_set(qedf, io_req, QEDF_ABORT_TIMEOUT);
1957 void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
1964 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "Entered with xid = "
1974 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1986 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
1993 QEDF_ERR(&qedf->dbg_ctx,
1999 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM,
2004 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
2013 queue_delayed_work(qedf->dpc_wq, &io_req->rrq_work,
2014 msecs_to_jiffies(qedf->lport->r_a_tov));
2019 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM,
2024 QEDF_ERR(&(qedf->dbg_ctx), "Unknown ABTS response\n");
2032 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
2036 qedf_scsi_done(qedf, io_req, DID_ERROR);
2050 struct qedf_ctx *qedf = io_req->fcport->qedf;
2054 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_MP_REQ, "Entered.\n");
2065 mp_req->req_buf = dma_alloc_coherent(&qedf->pdev->dev, QEDF_PAGE_SIZE,
2068 QEDF_ERR(&(qedf->dbg_ctx), "Unable to alloc MP req buffer\n");
2073 mp_req->resp_buf = dma_alloc_coherent(&qedf->pdev->dev,
2076 QEDF_ERR(&(qedf->dbg_ctx), "Unable to alloc TM resp "
2084 mp_req->mp_req_bd = dma_alloc_coherent(&qedf->pdev->dev, sz,
2087 QEDF_ERR(&(qedf->dbg_ctx), "Unable to alloc MP req bd\n");
2092 mp_req->mp_resp_bd = dma_alloc_coherent(&qedf->pdev->dev, sz,
2095 QEDF_ERR(&(qedf->dbg_ctx), "Unable to alloc MP resp bd\n");
2125 static void qedf_drain_request(struct qedf_ctx *qedf)
2127 if (test_bit(QEDF_DRAIN_ACTIVE, &qedf->flags)) {
2128 QEDF_ERR(&(qedf->dbg_ctx), "MCP drain already active.\n");
2133 set_bit(QEDF_DRAIN_ACTIVE, &qedf->flags);
2136 qed_ops->common->drain(qedf->cdev);
2142 clear_bit(QEDF_DRAIN_ACTIVE, &qedf->flags);
2153 struct qedf_ctx *qedf;
2173 qedf = fcport->qedf;
2174 if (!qedf) {
2175 QEDF_ERR(NULL, "qedf is NULL.\n");
2185 QEDF_ERR(&(qedf->dbg_ctx), "io_req xid=0x%x already in "
2195 QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n");
2202 QEDF_ERR(&qedf->dbg_ctx,
2211 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
2242 QEDF_ERR(&(qedf->dbg_ctx), "Cleanup command timeout, "
2246 QEDF_ERR(&(qedf->dbg_ctx), "Issuing MCP drain request.\n");
2247 qedf_drain_request(qedf);
2263 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
2267 qedf_scsi_done(qedf, io_req, DID_ERROR);
2278 void qedf_process_cleanup_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
2281 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "Entered xid = 0x%x\n",
2295 struct qedf_ctx *qedf = fcport->qedf;
2296 struct fc_lport *lport = qedf->lport;
2306 QEDF_ERR(&qedf->dbg_ctx, "sc_cmd is NULL\n");
2312 QEDF_ERR(&(qedf->dbg_ctx), "fcport not offloaded\n");
2319 QEDF_ERR(&(qedf->dbg_ctx), "Failed TMF");
2325 qedf->lun_resets++;
2327 qedf->target_resets++;
2348 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "TMF io_req xid = "
2352 task = qedf_get_task_mem(&qedf->tasks, xid);
2373 QEDF_ERR(&(qedf->dbg_ctx), "wait for tm_cmpl timeout!\n");
2389 QEDF_ERR(&qedf->dbg_ctx,
2404 QEDF_ERR(&(qedf->dbg_ctx), "task mgmt command failed...\n");
2407 QEDF_ERR(&(qedf->dbg_ctx), "task mgmt command success...\n");
2418 struct qedf_ctx *qedf;
2465 qedf = fcport->qedf;
2467 if (!qedf) {
2468 QEDF_ERR(NULL, "qedf is NULL.\n");
2474 QEDF_ERR(&qedf->dbg_ctx, "Connection is getting uploaded.\n");
2479 if (test_bit(QEDF_UNLOADING, &qedf->flags) ||
2480 test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) {
2486 QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n");
2493 QEDF_ERR(&qedf->dbg_ctx, "fcport %p is uploading.\n",
2496 QEDF_ERR(&qedf->dbg_ctx,
2510 void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
2524 void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
2538 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_UNSOL,
2544 qedf->bdq_prod_idx, pktlen);
2548 QEDF_ERR(&(qedf->dbg_ctx), "bdq_idx is out of range %d.\n",
2553 bdq_addr = qedf->bdq[bdq_idx].buf_addr;
2555 QEDF_ERR(&(qedf->dbg_ctx), "bdq_addr is NULL, dropping "
2561 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_UNSOL,
2569 fp = fc_frame_alloc(qedf->lport, payload_len);
2571 QEDF_ERR(&(qedf->dbg_ctx), "Could not allocate fp.\n");
2579 QEDF_WARN(&qedf->dbg_ctx,
2587 fr_dev(fp) = qedf->lport;
2596 io_work = mempool_alloc(qedf->io_mempool, GFP_ATOMIC);
2598 QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate "
2610 io_work->qedf = qedf;
2615 spin_lock_irqsave(&qedf->hba_lock, flags);
2618 qedf->bdq_prod_idx++;
2621 if (qedf->bdq_prod_idx == 0xffff)
2622 qedf->bdq_prod_idx = 0;
2624 writew(qedf->bdq_prod_idx, qedf->bdq_primary_prod);
2625 readw(qedf->bdq_primary_prod);
2626 writew(qedf->bdq_prod_idx, qedf->bdq_secondary_prod);
2627 readw(qedf->bdq_secondary_prod);
2629 spin_unlock_irqrestore(&qedf->hba_lock, flags);