qed: Share additional information with qedf
authorMintz, Yuval <Yuval.Mintz@cavium.com>
Fri, 2 Jun 2017 05:58:31 +0000 (08:58 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Jun 2017 14:33:03 +0000 (10:33 -0400)
Share several new tidbits with qedf:
 - wwpn & wwnn
 - Absolute pf-id [this one is actually meant for qedi as well]
 - Number of available CQs

While we're at it, now that qedf will be aware of the available CQs
we can add some validation on the inputs it provides.

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

index 7649f35000db919a9d4376910a85de1c10810885..2d88d4883483c22d502bb67134561914844495f5 100644 (file)
@@ -2071,16 +2071,22 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
                                                         QED_VF_L2_QUE));
        }
 
+       if (p_hwfn->hw_info.personality == QED_PCI_FCOE)
+               feat_num[QED_FCOE_CQ] =  min_t(u32, sb_cnt.cnt,
+                                              RESC_NUM(p_hwfn,
+                                                       QED_CMDQS_CQS));
+
        if (p_hwfn->hw_info.personality == QED_PCI_ISCSI)
                feat_num[QED_ISCSI_CQ] = min_t(u32, sb_cnt.cnt,
                                               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 ISCSI_CQ=%d #SBS=%d\n",
+                  "#PF_L2_QUEUES=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d FCOE_CQ=%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_FCOE_CQ),
                   (int)FEAT_NUM(p_hwfn, QED_ISCSI_CQ),
                   (int)sb_cnt.cnt);
 }
index 3fc4ff22960ed10cd027923e8ab5c4217277e08b..df195c02b7111d0e899f118391290bb1857731a6 100644 (file)
@@ -141,6 +141,15 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn,
        p_data = &p_ramrod->init_ramrod_data;
        fcoe_pf_params = &p_hwfn->pf_params.fcoe_pf_params;
 
+       /* Sanity */
+       if (fcoe_pf_params->num_cqs > p_hwfn->hw_info.feat_num[QED_FCOE_CQ]) {
+               DP_ERR(p_hwfn,
+                      "Cannot satisfy CQ amount. CQs requested %d, CQs available %d. Aborting function start\n",
+                      fcoe_pf_params->num_cqs,
+                      p_hwfn->hw_info.feat_num[QED_FCOE_CQ]);
+               return -EINVAL;
+       }
+
        p_data->mtu = cpu_to_le16(fcoe_pf_params->mtu);
        tmp = cpu_to_le16(fcoe_pf_params->sq_num_pbl_pages);
        p_data->sq_num_pages_in_pbl = tmp;
@@ -739,6 +748,11 @@ static int qed_fill_fcoe_dev_info(struct qed_dev *cdev,
        info->secondary_bdq_rq_addr =
            qed_fcoe_get_secondary_bdq_prod(hwfn, BDQ_ID_RQ);
 
+       info->wwpn = hwfn->mcp_info->func_info.wwn_port;
+       info->wwnn = hwfn->mcp_info->func_info.wwn_node;
+
+       info->num_cqs = FEAT_NUM(hwfn, QED_FCOE_CQ);
+
        return rc;
 }
 
index ac3bdcd9f0b6d8eca8a38a1b4b76ec991bdf58ce..baebd5926895a9ef933a0935b87cebec90d3ff9c 100644 (file)
@@ -269,6 +269,8 @@ int qed_fill_dev_info(struct qed_dev *cdev,
                if (QED_LEADING_HWFN(cdev)->hw_info.b_wol_support ==
                    QED_WOL_SUPPORT_PME)
                        dev_info->wol_support = true;
+
+               dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id;
        } else {
                qed_vf_get_fw_version(&cdev->hwfns[0], &dev_info->fw_major,
                                      &dev_info->fw_minor, &dev_info->fw_rev,
index bd6bcb8094151fca0e40b377a0eb81334300a695..1e015c50e6b8869eb208be9e5ee48b9eaf00b268 100644 (file)
@@ -24,6 +24,11 @@ struct qed_dev_fcoe_info {
 
        void __iomem *primary_dbq_rq_addr;
        void __iomem *secondary_bdq_rq_addr;
+
+       u64 wwpn;
+       u64 wwnn;
+
+       u8 num_cqs;
 };
 
 struct qed_fcoe_params_offload {
index 607e1c5e185a3d1dda995f1828cd71aecb61c774..e29c6f74a4d4cbb4b2879b5e66890ff9c0d21a07 100644 (file)
@@ -360,6 +360,8 @@ struct qed_dev_info {
        bool            vxlan_enable;
        bool            gre_enable;
        bool            geneve_enable;
+
+       u8              abs_pf_id;
 };
 
 enum qed_sb_type {