From patchwork Tue Mar 5 16:30:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Traynor X-Patchwork-Id: 50824 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FA844C96; Tue, 5 Mar 2019 17:31:16 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 6D7342B87; Tue, 5 Mar 2019 17:31:14 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7DF5308338F; Tue, 5 Mar 2019 16:31:13 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-96.ams2.redhat.com [10.36.117.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C8871001DD7; Tue, 5 Mar 2019 16:31:12 +0000 (UTC) From: Kevin Traynor To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Kevin Traynor , stable@dpdk.org, zhirun.yan@intel.com Date: Tue, 5 Mar 2019 16:30:38 +0000 Message-Id: <20190305163039.16790-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 05 Mar 2019 16:31:13 +0000 (UTC) Subject: [dpdk-dev] [PATCH 1/2] net/i40e: fix negative check on unsigned queue pairs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix the check and associated log. Also, fix a typo in other log. Fixes: 03d478e9609d ("net/i40e: support PF respond VF request more queues") Cc: stable@dpdk.org Cc: zhirun.yan@intel.com Signed-off-by: Kevin Traynor Acked-by: Qi Zhang --- drivers/net/i40e/i40e_pf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 585b21cbc..0c4bdbcd1 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -1251,9 +1251,7 @@ i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg) pf = vf->pf; - if (req_pairs <= 0) { - PMD_DRV_LOG(ERR, - "VF %d tried to request %d queues. Ignoring.\n", - vf->vf_idx, - I40E_MAX_QP_NUM_PER_VF); + if (req_pairs == 0) { + PMD_DRV_LOG(ERR, "VF %d tried to request 0 queues. Ignoring.\n", + vf->vf_idx); } else if (req_pairs > I40E_MAX_QP_NUM_PER_VF) { PMD_DRV_LOG(ERR, @@ -1264,5 +1262,5 @@ i40e_pf_host_process_cmd_request_queues(struct i40e_pf_vf *vf, uint8_t *msg) } else if (req_pairs > cur_pairs + pf->qp_pool.num_free) { PMD_DRV_LOG(ERR, - "VF %d requested %d more queues, but noly %d left\n", + "VF %d requested %d more queues, but only %d left\n", vf->vf_idx, req_pairs - cur_pairs, From patchwork Tue Mar 5 16:30:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Traynor X-Patchwork-Id: 50825 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 996224CA0; Tue, 5 Mar 2019 17:31:17 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 375E92B87 for ; Tue, 5 Mar 2019 17:31:16 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B7563082E72; Tue, 5 Mar 2019 16:31:15 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-96.ams2.redhat.com [10.36.117.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id 229A01001E77; Tue, 5 Mar 2019 16:31:13 +0000 (UTC) From: Kevin Traynor To: qi.z.zhang@intel.com Cc: dev@dpdk.org, Kevin Traynor , zhirun.yan@intel.com Date: Tue, 5 Mar 2019 16:30:39 +0000 Message-Id: <20190305163039.16790-2-ktraynor@redhat.com> In-Reply-To: <20190305163039.16790-1-ktraynor@redhat.com> References: <20190305163039.16790-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 05 Mar 2019 16:31:15 +0000 (UTC) Subject: [dpdk-dev] [RFC 2/2] net/i40e: update requested queue pair num check for rounding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Qi Zhang --- 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);