From 3f11cf0623f23d9ad977bd81378a6a850717643f Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Sat, 8 Sep 2018 13:30:54 -0700 Subject: [PATCH] net/qede/base: limit number of non ethernet queues to 64 Limit the number of non ethernet queues to 64, allowing a max queues to status block ratio of 2:1 in case of storage target. Theoretically a non-target storage PF can have 128 queues and SBs. This change is to support 64 entries for a target iSCSI/FCoE PF and 128 for a non-target. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore.h | 3 +++ drivers/net/qede/base/ecore_dev.c | 32 ++++++++++++++++++++------- drivers/net/qede/base/ecore_dev_api.h | 3 +++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 5d79fdf010..cf66c4c165 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -870,6 +870,9 @@ struct ecore_dev { bool b_is_emul_full; #endif + /* Indicates whether this PF serves a storage target */ + bool b_is_target; + #ifdef CONFIG_ECORE_BINARY_FW /* @DPDK */ void *firmware; u64 fw_len; diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 6302abc1a9..fdb62f2329 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -3027,15 +3027,30 @@ static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn) FEAT_NUM(p_hwfn, ECORE_VF_L2_QUE)); } - if (ECORE_IS_FCOE_PERSONALITY(p_hwfn)) - feat_num[ECORE_FCOE_CQ] = - OSAL_MIN_T(u32, sb_cnt.cnt, RESC_NUM(p_hwfn, - ECORE_CMDQS_CQS)); + if (ECORE_IS_FCOE_PERSONALITY(p_hwfn) || + ECORE_IS_ISCSI_PERSONALITY(p_hwfn)) { + u32 *p_storage_feat = ECORE_IS_FCOE_PERSONALITY(p_hwfn) ? + &feat_num[ECORE_FCOE_CQ] : + &feat_num[ECORE_ISCSI_CQ]; + u32 limit = sb_cnt.cnt; + + /* The number of queues should not exceed the number of FP SBs. + * In storage target, the queues are divided into pairs of a CQ + * and a CmdQ, and each pair uses a single SB. The limit in + * this case should allow a max ratio of 2:1 instead of 1:1. + */ + if (p_hwfn->p_dev->b_is_target) + limit *= 2; + *p_storage_feat = OSAL_MIN_T(u32, limit, + RESC_NUM(p_hwfn, ECORE_CMDQS_CQS)); - if (ECORE_IS_ISCSI_PERSONALITY(p_hwfn)) - feat_num[ECORE_ISCSI_CQ] = - OSAL_MIN_T(u32, sb_cnt.cnt, RESC_NUM(p_hwfn, - ECORE_CMDQS_CQS)); + /* @DPDK */ + /* The size of "cq_cmdq_sb_num_arr" in the fcoe/iscsi init + * ramrod is limited to "NUM_OF_GLOBAL_QUEUES / 2". + */ + *p_storage_feat = OSAL_MIN_T(u32, *p_storage_feat, + (NUM_OF_GLOBAL_QUEUES / 2)); + } DP_VERBOSE(p_hwfn, ECORE_MSG_PROBE, "#PF_L2_QUEUE=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d #FCOE_CQ=%d #ISCSI_CQ=%d #SB=%d\n", @@ -4327,6 +4342,7 @@ enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev, p_dev->chk_reg_fifo = p_params->chk_reg_fifo; p_dev->allow_mdump = p_params->allow_mdump; p_hwfn->b_en_pacing = p_params->b_en_pacing; + p_dev->b_is_target = p_params->b_is_target; if (p_params->b_relaxed_probe) p_params->p_relaxed_res = ECORE_HW_PREPARE_SUCCESS; diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 02bacc228d..7cba54cac8 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -271,6 +271,9 @@ struct ecore_hw_prepare_params { /* Enable/disable request by ecore client for pacing */ bool b_en_pacing; + + /* Indicates whether this PF serves a storage target */ + bool b_is_target; }; /** -- 2.20.1