qed: Inform qedi the number of possible CQs
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Thu, 6 Apr 2017 12:58:33 +0000 (15:58 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Apr 2017 21:26:31 +0000 (14:26 -0700)
Now that management firmware is capable of telling us the number of CQs
available for a given PF, qed needs to communicate the number to qedi
so it would know have many to use.

Signed-off-by: Yuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qed/qed.h
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_iscsi.c
include/linux/qed/qed_iscsi_if.h

index d8bcc21a4f697b68c7d7086a7a9ecd53aa41c716..4896ee0cc458b4e1666ae9bd3c643a4c6d95a7aa 100644 (file)
@@ -225,8 +225,9 @@ enum QED_FEATURE {
        QED_PF_L2_QUE,
        QED_VF,
        QED_RDMA_CNQ,
-       QED_VF_L2_QUE,
+       QED_ISCSI_CQ,
        QED_FCOE_CQ,
+       QED_VF_L2_QUE,
        QED_MAX_FEATURES,
 };
 
index fb759ba34b8d33300508785aaabdde78236e44cf..fad73195010d01b4d50ad80ff5c7e399787daa94 100644 (file)
@@ -2045,12 +2045,17 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
                                                         QED_VF_L2_QUE));
        }
 
+       if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
+               feat_num[QED_ISCSI_CQ] = min_t(u32, RESC_NUM(p_hwfn, QED_SB),
+                                              RESC_NUM(p_hwfn,
+                                                       QED_CMDQS_CQS));
        DP_VERBOSE(p_hwfn,
                   NETIF_MSG_PROBE,
-                  "#PF_L2_QUEUES=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d #SBS=%d\n",
+                  "#PF_L2_QUEUES=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d ISCSI_CQ=%d #SBS=%d\n",
                   (int)FEAT_NUM(p_hwfn, QED_PF_L2_QUE),
                   (int)FEAT_NUM(p_hwfn, QED_VF_L2_QUE),
                   (int)FEAT_NUM(p_hwfn, QED_RDMA_CNQ),
+                  (int)FEAT_NUM(p_hwfn, QED_ISCSI_CQ),
                   RESC_NUM(p_hwfn, QED_SB));
 }
 
index 38273f41201d8fd9dd7a6a3115b47c2cd4ccb454..417691cf4fd6eee8988982517eaf940255211f72 100644 (file)
@@ -181,6 +181,15 @@ qed_sp_iscsi_func_start(struct qed_hwfn *p_hwfn,
        p_params = &p_hwfn->pf_params.iscsi_pf_params;
        p_queue = &p_init->q_params;
 
+       /* Sanity */
+       if (p_params->num_queues > p_hwfn->hw_info.feat_num[QED_ISCSI_CQ]) {
+               DP_ERR(p_hwfn,
+                      "Cannot satisfy CQ amount. Queues requested %d, CQs available %d. Aborting function start\n",
+                      p_params->num_queues,
+                      p_hwfn->hw_info.resc_num[QED_ISCSI_CQ]);
+               return -EINVAL;
+       }
+
        SET_FIELD(p_init->hdr.flags,
                  ISCSI_SLOW_PATH_HDR_LAYER_CODE, ISCSI_SLOW_PATH_LAYER_CODE);
        p_init->hdr.op_code = ISCSI_RAMROD_CMD_ID_INIT_FUNC;
@@ -1012,6 +1021,8 @@ static int qed_fill_iscsi_dev_info(struct qed_dev *cdev,
        info->secondary_bdq_rq_addr =
            qed_iscsi_get_secondary_bdq_prod(hwfn, BDQ_ID_RQ);
 
+       info->num_cqs = FEAT_NUM(hwfn, QED_ISCSI_CQ);
+
        return rc;
 }
 
index f70bb81b8b6acfda1701ffcd073163db05a82770..3414649133d2e44fe36b9c12e12f42ba6970ed9d 100644 (file)
@@ -67,6 +67,8 @@ struct qed_dev_iscsi_info {
 
        void __iomem *primary_dbq_rq_addr;
        void __iomem *secondary_bdq_rq_addr;
+
+       u8 num_cqs;
 };
 
 struct qed_iscsi_id_params {