From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id ED1651B1BE for ; Wed, 24 Jan 2018 16:39:46 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9FFC0226CA; Wed, 24 Jan 2018 10:39:46 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 24 Jan 2018 10:39:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=3BRVVde3iDw+OLrTB o+l6zQXfVgWtAi9I2SOhO6t5cE=; b=oMNl74vx4LcgBn4eP+7aZ1D11hck4H+8c EJfS9szBF7FhXKh7Jv/RFw5aLGiZGTU8akLSjSIRO8YDo05ALh9vZ4HwGwyHe0BF Fcc0IPS/qgfqPhHr1HJY/5o/b2whK9+M7hmdz6/2Pr0BVzh2e5ZgEHqWo0cl1NJ3 5V00H0UVzSR63zcCxlXcE7wvWSJ8CLTxzURsClLLhvWek0U7qVbgCOVI1GFqt0+s RKBX7uZOPWPfwTD+fr15pFKIOHepRp5Hz4ifnup6Re1Poa+0w0Le6TkRZzy+WqM/ E1d23gvXQEUsLX+NJ1SUK1AO6eGyNqB6GKAt86RMIeOX270EcZREQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=3BRVVde3iDw+OLrTBo+l6zQXfVgWtAi9I2SOhO6t5cE=; b=GR7fFK0R TvDNGe60/R5ZuL02RGELXlAQKBpxEP0aT+WpwWBgdl1pb4Y2gBS25fsB5Ro4zSg1 MdQnJnbkEm2XqXVfj7dilsVPe+MiTkfOn14Uqlkv6YXpcwzIEqWTfFdVQ5tuG1bo w4CUtihLlMeSPZZThM7a+VvLdjBe806SGLivBcA3o/V9kKfWiUvoj01M2oSv7Gek PI76gifJAjtFJVy6ejY9MMJ6/JCdWOsPYN4yx5HBEiCWayMM2p1A2JKupMbVj6z8 gGtyxzcvRw2JlT3FrAGzSCEP4OHGSvvFCpNboS9dhqDZsRBS3sp1Uy8ZuV422xy7 jbdBCkhVbRkHxA== X-ME-Sender: Received: from localhost.localdomain (unknown [115.150.27.206]) by mail.messagingengine.com (Postfix) with ESMTPA id DF6AF7E1BE; Wed, 24 Jan 2018 10:39:44 -0500 (EST) From: Yuanhan Liu To: Ajit Khaparde Cc: dpdk stable Date: Wed, 24 Jan 2018 23:32:35 +0800 Message-Id: <1516808026-25523-87-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> References: <1516808026-25523-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'net/bnxt: fix group info usage' has been queued to LTS release 17.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2018 15:39:47 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/26/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 36dd8aa0949e820fa93061907e826497383e71e5 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Mon, 8 Jan 2018 12:24:28 -0800 Subject: [PATCH] net/bnxt: fix group info usage [ upstream commit ee5d7bddab2751fe54bdee50ac3c9840bcc3be64 ] Ring groups is a Rx only attribute. Make sure there are sufficient ring groups available. Return an error if they are not available. Fixes: 37d6161a68ba ("net/bnxt: add ring group alloc/free") Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_cpr.c | 1 - drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++-- drivers/net/bnxt/bnxt_hwrm.c | 14 ++++---------- drivers/net/bnxt/bnxt_ring.c | 4 +++- drivers/net/bnxt/bnxt_ring.h | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index 19c684c..cde8adc 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -165,7 +165,6 @@ int bnxt_alloc_def_cp_ring(struct bnxt *bp) goto err_out; cpr->cp_doorbell = bp->pdev->mem_resource[2].addr; B_CP_DIS_DB(cpr, cpr->cp_raw_cons); - bp->grp_info[0].cp_fw_ring_id = cp_ring->fw_ring_id; if (BNXT_PF(bp)) rc = bnxt_hwrm_func_cfg_def_cp(bp); else diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3b6813c..7832e20 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -393,7 +393,10 @@ static int bnxt_init_nic(struct bnxt *bp) { int rc; - bnxt_init_ring_grps(bp); + rc = bnxt_init_ring_grps(bp); + if (rc) + return rc; + bnxt_init_vnics(bp); bnxt_init_filters(bp); @@ -2939,11 +2942,19 @@ skip_init: /* Copy the permanent MAC from the qcap response address now. */ memcpy(bp->mac_addr, bp->dflt_mac_addr, sizeof(bp->mac_addr)); memcpy(ð_dev->data->mac_addrs[0], bp->mac_addr, ETHER_ADDR_LEN); + + if (bp->max_ring_grps < bp->rx_cp_nr_rings) { + /* 1 ring is for default completion ring */ + RTE_LOG(ERR, PMD, "Insufficient resource: Ring Group\n"); + rc = -ENOSPC; + goto error_free; + } + bp->grp_info = rte_zmalloc("bnxt_grp_info", sizeof(*bp->grp_info) * bp->max_ring_grps, 0); if (!bp->grp_info) { RTE_LOG(ERR, PMD, - "Failed to alloc %zu bytes needed to store group info table\n", + "Failed to alloc %zu bytes to store group info table\n", sizeof(*bp->grp_info) * bp->max_ring_grps); rc = -ENOMEM; goto error_free; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index d2c800d..564e3f7 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1046,7 +1046,6 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, cpr->hw_stats_ctx_id = rte_le_to_cpu_16(resp->stat_ctx_id); HWRM_UNLOCK(); - bp->grp_info[idx].fw_stats_ctx = cpr->hw_stats_ctx_id; return rc; } @@ -1569,19 +1568,15 @@ int bnxt_free_all_hwrm_stat_ctxs(struct bnxt *bp) for (i = 0; i < bp->rx_cp_nr_rings + bp->tx_cp_nr_rings; i++) { - if (i >= bp->rx_cp_nr_rings) + if (i >= bp->rx_cp_nr_rings) { cpr = bp->tx_queues[i - bp->rx_cp_nr_rings]->cp_ring; - else + } else { cpr = bp->rx_queues[i]->cp_ring; + bp->grp_info[i].fw_stats_ctx = -1; + } if (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE) { rc = bnxt_hwrm_stat_ctx_free(bp, cpr, i); cpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE; - /* - * TODO. Need a better way to reset grp_info.stats_ctx - * for Rx rings only. stats_ctx is not saved for Tx - * in grp_info. - */ - bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id; if (rc) return rc; } @@ -1641,7 +1636,6 @@ static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, bnxt_hwrm_ring_free(bp, cp_ring, HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL); cp_ring->fw_ring_id = INVALID_HW_RING_ID; - bp->grp_info[idx].cp_fw_ring_id = INVALID_HW_RING_ID; memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size * sizeof(*cpr->cp_desc_ring)); cpr->cp_raw_cons = 0; diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index e0ca0e7..59d1035 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -63,13 +63,15 @@ void bnxt_free_ring(struct bnxt_ring *ring) * Ring groups */ -void bnxt_init_ring_grps(struct bnxt *bp) +int bnxt_init_ring_grps(struct bnxt *bp) { unsigned int i; for (i = 0; i < bp->max_ring_grps; i++) memset(&bp->grp_info[i], (uint8_t)HWRM_NA_SIGNATURE, sizeof(struct bnxt_ring_grp_info)); + + return 0; } /* diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index 164f482..a88ab55 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -94,7 +94,7 @@ struct bnxt_tx_ring_info; struct bnxt_rx_ring_info; struct bnxt_cp_ring_info; void bnxt_free_ring(struct bnxt_ring *ring); -void bnxt_init_ring_grps(struct bnxt *bp); +int bnxt_init_ring_grps(struct bnxt *bp); int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, struct bnxt_tx_ring_info *tx_ring_info, struct bnxt_rx_ring_info *rx_ring_info, -- 2.7.4