DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: <dev@dpdk.org>
Cc: Rasesh Mody <rasesh.mody@cavium.com>, <Dept-EngDPDKDev@cavium.com>
Subject: [dpdk-dev] [PATCH 07/21] net/qede/base: fix numbering l2 VF queues
Date: Sun, 26 Feb 2017 23:51:49 -0800	[thread overview]
Message-ID: <1488181923-9649-7-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1488181923-9649-1-git-send-email-rasesh.mody@cavium.com>

There are some constellations where Due to lack of resource allocation
in MFW, There would be an insufficient number of L2 queues for all the
VFs.

This introduces a new feature ECORE_VF_L2_QUE which correctly numbers
the number of VF queues. Notice it might be larger than the actual
number of VFs in configuration space, in which case its the ecore
client responsibility not to try activating that many.

As part of the fix, also correct the nubmering of the VF queues. As
their numbering is dependent on the SBs of the PF, which might only be
partially used by L2 [as half would be assigned for RDMA which doesn't
require L2 queues], we make the numbering consecutive with that of the
L2 queues only.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
 drivers/net/qede/base/ecore.h     |    1 +
 drivers/net/qede/base/ecore_dev.c |   19 +++++++++++++++----
 drivers/net/qede/base/ecore_int.c |   35 +++++++++++++++++++++++++++++++++--
 3 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h
index b41ff4a..b2f4910 100644
--- a/drivers/net/qede/base/ecore.h
+++ b/drivers/net/qede/base/ecore.h
@@ -288,6 +288,7 @@ enum ecore_feature {
 	ECORE_RDMA_CNQ,
 	ECORE_ISCSI_CQ,
 	ECORE_FCOE_CQ,
+	ECORE_VF_L2_QUE,
 	ECORE_MAX_FEATURES,
 };
 
diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c
index e37b2b5..b518413 100644
--- a/drivers/net/qede/base/ecore_dev.c
+++ b/drivers/net/qede/base/ecore_dev.c
@@ -2065,6 +2065,7 @@ static void get_function_id(struct ecore_hwfn *p_hwfn)
 static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn)
 {
 	u32 *feat_num = p_hwfn->hw_info.feat_num;
+	struct ecore_sb_cnt_info sb_cnt_info;
 	int num_features = 1;
 
 	/* L2 Queues require each: 1 status block. 1 L2 queue */
@@ -2073,11 +2074,21 @@ static void ecore_hw_set_feat(struct ecore_hwfn *p_hwfn)
 		       RESC_NUM(p_hwfn, ECORE_SB) / num_features,
 		       RESC_NUM(p_hwfn, ECORE_L2_QUEUE));
 
+	OSAL_MEM_ZERO(&sb_cnt_info, sizeof(sb_cnt_info));
+	ecore_int_get_num_sbs(p_hwfn, &sb_cnt_info);
+	feat_num[ECORE_VF_L2_QUE] =
+		OSAL_MIN_T(u32,
+			   RESC_NUM(p_hwfn, ECORE_L2_QUEUE) -
+			   FEAT_NUM(p_hwfn, ECORE_PF_L2_QUE),
+			   sb_cnt_info.sb_iov_cnt);
+
 	DP_VERBOSE(p_hwfn, ECORE_MSG_PROBE,
-		   "#PF_L2_QUEUES=%d #ROCE_CNQ=%d #SBS=%d num_features=%d\n",
-		   feat_num[ECORE_PF_L2_QUE],
-		   feat_num[ECORE_RDMA_CNQ],
-		   RESC_NUM(p_hwfn, ECORE_SB), num_features);
+		   "#PF_L2_QUEUES=%d VF_L2_QUEUES=%d #ROCE_CNQ=%d #SBS=%d num_features=%d\n",
+		   (int)FEAT_NUM(p_hwfn, ECORE_PF_L2_QUE),
+		   (int)FEAT_NUM(p_hwfn, ECORE_VF_L2_QUE),
+		   (int)FEAT_NUM(p_hwfn, ECORE_RDMA_CNQ),
+		   RESC_NUM(p_hwfn, ECORE_SB),
+		   num_features);
 }
 
 static enum resource_id_enum
diff --git a/drivers/net/qede/base/ecore_int.c b/drivers/net/qede/base/ecore_int.c
index 96f283b..1a157a5 100644
--- a/drivers/net/qede/base/ecore_int.c
+++ b/drivers/net/qede/base/ecore_int.c
@@ -1964,6 +1964,31 @@ enum _ecore_status_t ecore_int_igu_read_cam(struct ecore_hwfn *p_hwfn,
 			}
 		}
 	}
+
+	/* There's a possibility the igu_sb_cnt_iov doesn't properly reflect
+	 * the number of VF SBs [especially for first VF on engine, as we can't
+	 * diffrentiate between empty entries and its entries].
+	 * Since we don't really support more SBs than VFs today, prevent any
+	 * such configuration by sanitizing the number of SBs to equal the
+	 * number of VFs.
+	 */
+	if (IS_PF_SRIOV(p_hwfn)) {
+		u16 total_vfs = p_hwfn->p_dev->p_iov_info->total_vfs;
+
+		if (total_vfs < p_igu_info->free_blks) {
+			DP_VERBOSE(p_hwfn, (ECORE_MSG_INTR | ECORE_MSG_IOV),
+				   "Limiting number of SBs for IOV - %04x --> %04x\n",
+				   p_igu_info->free_blks,
+				   p_hwfn->p_dev->p_iov_info->total_vfs);
+			p_igu_info->free_blks = total_vfs;
+		} else if (total_vfs > p_igu_info->free_blks) {
+			DP_NOTICE(p_hwfn, true,
+				  "IGU has only %04x SBs for VFs while the device has %04x VFs\n",
+				  p_igu_info->free_blks, total_vfs);
+			return ECORE_INVAL;
+		}
+	}
+
 	p_igu_info->igu_sb_cnt_iov = p_igu_info->free_blks;
 
 	DP_VERBOSE(p_hwfn, ECORE_MSG_INTR,
@@ -2101,8 +2126,14 @@ u16 ecore_int_queue_id_from_sb_id(struct ecore_hwfn *p_hwfn, u16 sb_id)
 	    (sb_id < p_info->igu_base_sb + p_info->igu_sb_cnt)) {
 		return sb_id - p_info->igu_base_sb;
 	} else if ((sb_id >= p_info->igu_base_sb_iov) &&
-		   (sb_id < p_info->igu_base_sb_iov + p_info->igu_sb_cnt_iov)) {
-		return sb_id - p_info->igu_base_sb_iov + p_info->igu_sb_cnt;
+		   (sb_id < p_info->igu_base_sb_iov +
+			    p_info->igu_sb_cnt_iov)) {
+		/* We want the first VF queue to be adjacent to the
+		 * last PF queue. Since L2 queues can be partial to
+		 * SBs, we'll use the feature instead.
+		 */
+		return sb_id - p_info->igu_base_sb_iov +
+		       FEAT_NUM(p_hwfn, ECORE_PF_L2_QUE);
 	} else {
 		DP_NOTICE(p_hwfn, true, "SB %d not in range for function\n",
 			  sb_id);
-- 
1.7.10.3

  parent reply	other threads:[~2017-02-27  7:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27  7:51 [dpdk-dev] [PATCH 01/21] net/qede/base: fix incorrect typecasting of flag Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 02/21] net/qede/base: fix to set pointers to NULL after freeing Rasesh Mody
2017-03-02 13:05   ` Ferruh Yigit
2017-03-18  7:02     ` Mody, Rasesh
2017-02-27  7:51 ` [dpdk-dev] [PATCH 03/21] net/qede/base: fix forcing driver default resc allocation Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 04/21] net/qede/base: fix TM block ILT initialization Rasesh Mody
2017-03-02 13:05   ` Ferruh Yigit
2017-02-27  7:51 ` [dpdk-dev] [PATCH 05/21] net/qede/base: fix printout Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 06/21] net/qede/base: fix VF init after malicious VF FLR Rasesh Mody
2017-02-27  7:51 ` Rasesh Mody [this message]
2017-02-27  7:51 ` [dpdk-dev] [PATCH 08/21] net/qede/base: fix printing incorrect index for multi-bit attentions Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 09/21] dev/qede/base: fix to prevent VF promisc Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 10/21] net/qede/base: add attention bits for CHIP_NUM_AH_xxx Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 11/21] net/qede/base: fix printout Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 12/21] net/qede/base: fix DORQ attention mask Rasesh Mody
2017-03-02 13:06   ` Ferruh Yigit
2017-02-27  7:51 ` [dpdk-dev] [PATCH 13/21] net/qede/base: fix out-of-bound memory access Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 14/21] net/qede/base: fix to remove redundant memset Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 15/21] net/qede/base: fix remove the unneeded convertion to LE Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 16/21] net/qede/base: fix first VF index calculation Rasesh Mody
2017-02-27  7:51 ` [dpdk-dev] [PATCH 17/21] net/qede/base: fix typo Rasesh Mody
2017-02-27  7:52 ` [dpdk-dev] [PATCH 18/21] net/qede/base: semantic fix Rasesh Mody
2017-03-02 13:06   ` Ferruh Yigit
2017-02-27  7:52 ` [dpdk-dev] [PATCH 19/21] net/qede/base: fix sriov typo Rasesh Mody
2017-02-27  7:52 ` [dpdk-dev] [PATCH 20/21] net/qede/base: fix the value of RESOURCE_DUMP to 0 Rasesh Mody
2017-03-02 13:07   ` Ferruh Yigit
2017-02-27  7:52 ` [dpdk-dev] [PATCH 21/21] net/qede/base: fix to use NULL pointer Rasesh Mody
2017-03-02 13:04 ` [dpdk-dev] [PATCH 01/21] net/qede/base: fix incorrect typecasting of flag Ferruh Yigit
2017-03-06 20:02   ` Mody, Rasesh
2017-03-18  6:48   ` [dpdk-dev] [PATCH v2 " Rasesh Mody
2017-03-20 17:15     ` Ferruh Yigit
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 02/21] net/qede/base: fix to set pointers to NULL after freeing Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 03/21] net/qede/base: fix forcing driver default resc allocation Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 04/21] net/qede/base: fix TM block ILT initialization Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 05/21] net/qede/base: fix printout Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 06/21] net/qede/base: fix VF init after malicious VF FLR Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 07/21] net/qede/base: fix numbering L2 VF queues Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 08/21] net/qede/base: fix index printing of multi-bit attentions Rasesh Mody
2017-03-18  6:50   ` [dpdk-dev] [PATCH v2 09/21] net/qede/base: fix to prevent VF promisc config Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 10/21] net/qede/base: add attention bits for AH chip Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 11/21] net/qede/base: fix printout Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 12/21] net/qede/base: fix DORQ attention mask Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 13/21] net/qede/base: fix out-of-bound memory access Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 14/21] net/qede/base: fix to remove redundant memset Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 15/21] net/qede/base: fix remove the unneeded conversion to LE Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 16/21] net/qede/base: fix first VF index calculation Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 17/21] net/qede/base: fix typo Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 18/21] net/qede/base: refactor return path Rasesh Mody
2017-03-18  6:53   ` [dpdk-dev] [PATCH v2 19/21] net/qede/base: fix sriov typo Rasesh Mody
2017-03-18  6:57   ` [dpdk-dev] [PATCH v2 20/21] net/qede/base: fix resource lock minimum value Rasesh Mody
2017-03-18  6:57   ` [dpdk-dev] [PATCH v2 21/21] net/qede/base: fix to use NULL pointer Rasesh Mody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488181923-9649-7-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).