summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qedf
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2017-09-07 15:12:43 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2017-09-07 15:12:43 -0400
commit2441500a41a9b17ff657626eb81972f62bc8cc5a (patch)
treea73d114149de8daa1da3713d4048930ba7421384 /drivers/scsi/qedf
parenta45a1f3614182267803baadba657b59e2ddc0545 (diff)
parente6f77540c067b48dee10f1e33678415bfcc89017 (diff)
Merge branch 'fixes' into misc
Diffstat (limited to 'drivers/scsi/qedf')
-rw-r--r--drivers/scsi/qedf/qedf.h3
-rw-r--r--drivers/scsi/qedf/qedf_els.c14
-rw-r--r--drivers/scsi/qedf/qedf_main.c20
3 files changed, 19 insertions, 18 deletions
diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index 0cfd9917ed94..9bf7b227e69a 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -526,7 +526,8 @@ struct fip_vlan {
526#define QEDF_WRITE (1 << 0) 526#define QEDF_WRITE (1 << 0)
527#define MAX_FIBRE_LUNS 0xffffffff 527#define MAX_FIBRE_LUNS 0xffffffff
528 528
529#define QEDF_MAX_NUM_CQS 8 529#define MIN_NUM_CPUS_MSIX(x) min_t(u32, x->dev_info.num_cqs, \
530 num_online_cpus())
530 531
531/* 532/*
532 * PCI function probe defines 533 * PCI function probe defines
diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index eb07f1de8afa..59c18ca4cda9 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
489 489
490 /* If a SRR times out, simply free resources */ 490 /* If a SRR times out, simply free resources */
491 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO) 491 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
492 goto out_free; 492 goto out_put;
493 493
494 /* Normalize response data into struct fc_frame */ 494 /* Normalize response data into struct fc_frame */
495 mp_req = &(srr_req->mp_req); 495 mp_req = &(srr_req->mp_req);
@@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
501 if (!fp) { 501 if (!fp) {
502 QEDF_ERR(&(qedf->dbg_ctx), 502 QEDF_ERR(&(qedf->dbg_ctx),
503 "fc_frame_alloc failure.\n"); 503 "fc_frame_alloc failure.\n");
504 goto out_free; 504 goto out_put;
505 } 505 }
506 506
507 /* Copy frame header from firmware into fp */ 507 /* Copy frame header from firmware into fp */
@@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
526 } 526 }
527 527
528 fc_frame_free(fp); 528 fc_frame_free(fp);
529out_free: 529out_put:
530 /* Put reference for original command since SRR completed */ 530 /* Put reference for original command since SRR completed */
531 kref_put(&orig_io_req->refcount, qedf_release_cmd); 531 kref_put(&orig_io_req->refcount, qedf_release_cmd);
532out_free:
532 kfree(cb_arg); 533 kfree(cb_arg);
533} 534}
534 535
@@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
780 781
781 /* If a REC times out, free resources */ 782 /* If a REC times out, free resources */
782 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO) 783 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
783 goto out_free; 784 goto out_put;
784 785
785 /* Normalize response data into struct fc_frame */ 786 /* Normalize response data into struct fc_frame */
786 mp_req = &(rec_req->mp_req); 787 mp_req = &(rec_req->mp_req);
@@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
792 if (!fp) { 793 if (!fp) {
793 QEDF_ERR(&(qedf->dbg_ctx), 794 QEDF_ERR(&(qedf->dbg_ctx),
794 "fc_frame_alloc failure.\n"); 795 "fc_frame_alloc failure.\n");
795 goto out_free; 796 goto out_put;
796 } 797 }
797 798
798 /* Copy frame header from firmware into fp */ 799 /* Copy frame header from firmware into fp */
@@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
884 885
885out_free_frame: 886out_free_frame:
886 fc_frame_free(fp); 887 fc_frame_free(fp);
887out_free: 888out_put:
888 /* Put reference for original command since REC completed */ 889 /* Put reference for original command since REC completed */
889 kref_put(&orig_io_req->refcount, qedf_release_cmd); 890 kref_put(&orig_io_req->refcount, qedf_release_cmd);
891out_free:
890 kfree(cb_arg); 892 kfree(cb_arg);
891} 893}
892 894
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index c390a4110a3a..7c0064500cc5 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -2797,11 +2797,9 @@ static int qedf_set_fcoe_pf_param(struct qedf_ctx *qedf)
2797 * we allocation is the minimum off: 2797 * we allocation is the minimum off:
2798 * 2798 *
2799 * Number of CPUs 2799 * Number of CPUs
2800 * Number of MSI-X vectors 2800 * Number allocated by qed for our PCI function
2801 * Max number allocated in hardware (QEDF_MAX_NUM_CQS)
2802 */ 2801 */
2803 qedf->num_queues = min((unsigned int)QEDF_MAX_NUM_CQS, 2802 qedf->num_queues = MIN_NUM_CPUS_MSIX(qedf);
2804 num_online_cpus());
2805 2803
2806 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Number of CQs is %d.\n", 2804 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Number of CQs is %d.\n",
2807 qedf->num_queues); 2805 qedf->num_queues);
@@ -2999,6 +2997,13 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
2999 goto err1; 2997 goto err1;
3000 } 2998 }
3001 2999
3000 /* Learn information crucial for qedf to progress */
3001 rc = qed_ops->fill_dev_info(qedf->cdev, &qedf->dev_info);
3002 if (rc) {
3003 QEDF_ERR(&(qedf->dbg_ctx), "Failed to dev info.\n");
3004 goto err1;
3005 }
3006
3002 /* queue allocation code should come here 3007 /* queue allocation code should come here
3003 * order should be 3008 * order should be
3004 * slowpath_start 3009 * slowpath_start
@@ -3014,13 +3019,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
3014 } 3019 }
3015 qed_ops->common->update_pf_params(qedf->cdev, &qedf->pf_params); 3020 qed_ops->common->update_pf_params(qedf->cdev, &qedf->pf_params);
3016 3021
3017 /* Learn information crucial for qedf to progress */
3018 rc = qed_ops->fill_dev_info(qedf->cdev, &qedf->dev_info);
3019 if (rc) {
3020 QEDF_ERR(&(qedf->dbg_ctx), "Failed to dev info.\n");
3021 goto err1;
3022 }
3023
3024 /* Record BDQ producer doorbell addresses */ 3022 /* Record BDQ producer doorbell addresses */
3025 qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr; 3023 qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr;
3026 qedf->bdq_secondary_prod = qedf->dev_info.secondary_bdq_rq_addr; 3024 qedf->bdq_secondary_prod = qedf->dev_info.secondary_bdq_rq_addr;