From patchwork Sun Jul 10 21:15:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "John Daley (johndale)" X-Patchwork-Id: 14726 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 819322904; Sun, 10 Jul 2016 23:15:36 +0200 (CEST) Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) by dpdk.org (Postfix) with ESMTP id B7DB828FD for ; Sun, 10 Jul 2016 23:15:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1439; q=dns/txt; s=iport; t=1468185335; x=1469394935; h=from:to:cc:subject:date:message-id; bh=7jk0bTZ89J2h8ZS1FZ/mUnVPpW8UlaR6Wb9+d8VVli8=; b=haGSAE6quYtC/4xYDLJbCsY9/lfupSfa6POPYnjWVIUwSX/KoqlN94QA s1c1kiK1C2T91QEJyowCMAIAzl45X5pFrMwoUsKE3rxltCmFWb1Fe9uie xQ3KJr3GjFN61E7SC2pNp5U51UFsPbx1VtRDqxLZWeLr3jEjUdtuYQxi+ k=; X-IronPort-AV: E=Sophos;i="5.28,343,1464652800"; d="scan'208";a="122610345" Received: from alln-core-6.cisco.com ([173.36.13.139]) by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Jul 2016 21:15:34 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id u6ALFYSi004006; Sun, 10 Jul 2016 21:15:34 GMT Received: by cisco.com (Postfix, from userid 392789) id 7E3313FAADB0; Sun, 10 Jul 2016 14:15:34 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: bruce.richardson@intel.com, John Daley Date: Sun, 10 Jul 2016 14:15:30 -0700 Message-Id: <1468185330-19713-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] net/enic: fix crash when changing number of Rx or Tx queues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The check that all Tx and Rx queues were set up was not adequate when reconfiguring with a different number of queues. Only the number of completion queues (CQs) was being used to make the determination, but the CQ array is shared between the underlying Rx and Tx queues. Check that the internal Rx, Tx and CQs are all set up before completing port configuration. Fixes: fefed3d1e62c ("enic: new driver") Signed-off-by: John Daley Reviewed-by: Nelson Escobar --- drivers/net/enic/enic_ethdev.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 633e431..9ab6dc2 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -146,9 +146,21 @@ static int enicpmd_dev_setup_intr(struct enic *enic) if (!enic->cq[index].ctrl) break; } - if (enic->cq_count != index) return 0; + for (index = 0; index < enic->wq_count; index++) { + if (!enic->wq[index].ctrl) + break; + } + if (enic->wq_count != index) + return 0; + /* check start of packet (SOP) RQs only in case scatter is disabled. */ + for (index = 0; index < enic->rq_count; index++) { + if (!enic->rq[enic_sop_rq(index)].ctrl) + break; + } + if (enic->rq_count != index) + return 0; ret = enic_alloc_intr_resources(enic); if (ret) {