DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: qi.z.zhang@intel.com
Cc: dev@dpdk.org, Kevin Traynor <ktraynor@redhat.com>, zhirun.yan@intel.com
Subject: [dpdk-dev] [RFC 2/2] net/i40e: update requested queue pair num check for rounding
Date: Tue,  5 Mar 2019 16:30:39 +0000	[thread overview]
Message-ID: <20190305163039.16790-2-ktraynor@redhat.com> (raw)
In-Reply-To: <20190305163039.16790-1-ktraynor@redhat.com>

Since rounding up the requested queue pairs to allow the vf to
request a non-aligned number was added, it may happen that the
requested number is less than the available num of queues but the
rounded up number is greater. In this case, it is not caught with
the usual checks but later when there is a reset and failed setup.

By rounding earlier the checks can be done before a failed reset
occurs, and a rounded max amount of available queues can be returned
to the vf.

Cc: zhirun.yan@intel.com
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 drivers/net/i40e/i40e_pf.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c
index 0c4bdbcd1..651c56bb2 100644
--- a/drivers/net/i40e/i40e_pf.c
+++ b/drivers/net/i40e/i40e_pf.c
@@ -1251,4 +1251,7 @@ i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg)
 	pf = vf->pf;
 
+	if (!rte_is_power_of_2(req_pairs))
+		req_pairs = i40e_align_floor(req_pairs) << 1;
+
 	if (req_pairs == 0) {
 		PMD_DRV_LOG(ERR, "VF %d tried to request 0 queues. Ignoring.\n",
@@ -1261,17 +1264,16 @@ i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg)
 		vfres->num_queue_pairs = I40E_MAX_QP_NUM_PER_VF;
 	} else if (req_pairs > cur_pairs + pf->qp_pool.num_free) {
-		PMD_DRV_LOG(ERR,
-			    "VF %d requested %d more queues, but only %d left\n",
+		PMD_DRV_LOG(ERR, "VF %d requested %d queues (rounded to %d) "
+			         "but only %d available\n",
 			    vf->vf_idx,
-			    req_pairs - cur_pairs,
-			    pf->qp_pool.num_free);
-		vfres->num_queue_pairs = pf->qp_pool.num_free + cur_pairs;
+			    vfres->num_queue_pairs,
+			    req_pairs,
+			    cur_pairs + pf->qp_pool.num_free);
+		vfres->num_queue_pairs = i40e_align_floor(pf->qp_pool.num_free +
+			                                  cur_pairs);
 	} else {
 		i40e_vc_notify_vf_reset(vf);
 		vf->vsi->nb_qps = req_pairs;
-		if (rte_is_power_of_2(req_pairs))
-			pf->vf_nb_qps = req_pairs;
-		else
-			pf->vf_nb_qps = i40e_align_floor(req_pairs) << 1;
+		pf->vf_nb_qps = req_pairs;
 		i40e_pf_host_process_cmd_reset_vf(vf);
 
-- 
2.20.1

  reply	other threads:[~2019-03-05 16:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 16:30 [dpdk-dev] [PATCH 1/2] net/i40e: fix negative check on unsigned queue pairs Kevin Traynor
2019-03-05 16:30 ` Kevin Traynor [this message]
2019-03-11  2:18   ` [dpdk-dev] [RFC 2/2] net/i40e: update requested queue pair num check for rounding Zhang, Qi Z
2019-03-11 12:35     ` Ferruh Yigit
2019-03-11 18:38       ` Kevin Traynor
2019-03-07 13:42 ` [dpdk-dev] [PATCH 1/2] net/i40e: fix negative check on unsigned queue pairs Zhang, Qi Z

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=20190305163039.16790-2-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=zhirun.yan@intel.com \
    /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).