get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/94877/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 94877,
    "url": "https://patches.dpdk.org/api/patches/94877/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210625223401.45505-3-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20210625223401.45505-3-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210625223401.45505-3-ajit.khaparde@broadcom.com",
    "date": "2021-06-25T22:34:01",
    "name": "[2/2] net/bnxt: fix ring alloc and free logic",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7d05dc77bb6c43479a175744359a118be51d2fce",
    "submitter": {
        "id": 501,
        "url": "https://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "https://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210625223401.45505-3-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 17493,
            "url": "https://patches.dpdk.org/api/series/17493/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17493",
            "date": "2021-06-25T22:33:59",
            "name": "bet/bnxt: add runtime queue setup support",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/17493/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94877/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/94877/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 7A783A034F;\n\tSat, 26 Jun 2021 00:34:28 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6FB09410E4;\n\tSat, 26 Jun 2021 00:34:19 +0200 (CEST)",
            "from mail-pf1-f169.google.com (mail-pf1-f169.google.com\n [209.85.210.169])\n by mails.dpdk.org (Postfix) with ESMTP id C1DB9410E2\n for <dev@dpdk.org>; Sat, 26 Jun 2021 00:34:18 +0200 (CEST)",
            "by mail-pf1-f169.google.com with SMTP id d12so879514pfj.2\n for <dev@dpdk.org>; Fri, 25 Jun 2021 15:34:18 -0700 (PDT)",
            "from localhost.localdomain ([192.19.223.252])\n by smtp.gmail.com with ESMTPSA id u8sm10111943pjg.1.2021.06.25.15.34.15\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Fri, 25 Jun 2021 15:34:16 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com;\n s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version; bh=hIyIuPqlxlm1J7f9Y44bvbTkWhJeVuhpUlnt65tlx1Y=;\n b=cHrcHs74stfiaCQpmCnUTkcUuNkMK3fwLA+pLMViN1VB5HKTBFeizwD/izjqW6dh7q\n Xn+TKFC4EPaPlz6SgfFtbWzSIGSlgerbQdHLDvkxLxN9CwO3RzVd8TWHzkfVcgnyKBVu\n dCfkrJzhEwaUUsPhFjA/yNfIRrVRsSDYAq558=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version;\n bh=hIyIuPqlxlm1J7f9Y44bvbTkWhJeVuhpUlnt65tlx1Y=;\n b=APFfRMFLtruL1elwCgS+Z4hycEwQSJ6ibPaehbqDgmRK2vWOZgfxjP4/bggBAyux6R\n fBpnSsy73J41TSCRI+Xjbd1SvkNpFHbMLMrcT99s2SdJGddkFOs4RutDiHb5JRhpklYe\n rn7x5R+sqti/hLGvWNp2nYwYWZlzrDsRRZFBl1owUc4/4OVw7WDlLsAb9M7Kfk1JBUdV\n brxHxrT0LzXR64vyux54mGYo6xBVKy9AkjjLXabzEl5nrXKcgU9MOsNsu4LF7GejpbW3\n Qa+B4zztInh9e9B4PCKYmv5CvJLF1kYiX7X8azSEx7ZVzePCbzaVOHa5Vt2e67k+8qYW\n U3Fg==",
        "X-Gm-Message-State": "AOAM531V+kiv+sZniVti0q8M3ymxPYpGNVyVU2SWX20rt0/hZfEVV30V\n L1WSHd60AdkMY0DI5AECXVtQW1ncaSsTpURI61ZPSsfOdMRf0W0taUVJclMfe1N7QuhvxCOU/Wf\n v8We/RmqtnjT4Iudmf0JhKH7CGrIAsU0cdZq771ofUiRy+F/a40xve38trYEepeI=",
        "X-Google-Smtp-Source": "\n ABdhPJy5K6kR2l5s6I4H3fzWqe4REI3ZwEDARcblsP4p9r5pMUj+w5y6Vcau9j6tr3E9S6jY6d1V5w==",
        "X-Received": "by 2002:a65:6642:: with SMTP id z2mr11522044pgv.388.1624660457526;\n Fri, 25 Jun 2021 15:34:17 -0700 (PDT)",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Somnath Kotur <somnath.kotur@broadcom.com>",
        "Date": "Fri, 25 Jun 2021 15:34:01 -0700",
        "Message-Id": "<20210625223401.45505-3-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20210625223401.45505-1-ajit.khaparde@broadcom.com>",
        "References": "<20210625223401.45505-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Type": "multipart/signed; protocol=\"application/pkcs7-signature\";\n micalg=sha-256; boundary=\"0000000000007b108905c59ebda1\"",
        "X-Content-Filtered-By": "Mailman/MimeDel 2.1.29",
        "Subject": "[dpdk-dev] [PATCH 2/2] net/bnxt: fix ring alloc and free logic",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Fix handling of ring alloc and free logic to fix check for invalid ring and\ncontext IDs. This also avoids code duplication.\n\nFixes: 6133f207970c (\"net/bnxt: add Rx queue create/destroy\")\nFixes: 51c87ebafc7d (\"net/bnxt: add Tx queue create/destroy\")\n\nSigned-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\nReviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>\n---\n drivers/net/bnxt/bnxt_hwrm.c | 173 +++++++++++++++--------------------\n drivers/net/bnxt/bnxt_ring.c |  30 +-----\n 2 files changed, 78 insertions(+), 125 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c\nindex 1a4968abe6..4593991af8 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.c\n+++ b/drivers/net/bnxt/bnxt_hwrm.c\n@@ -1810,6 +1810,9 @@ int bnxt_hwrm_ring_free(struct bnxt *bp,\n \tstruct hwrm_ring_free_input req = {.req_type = 0 };\n \tstruct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;\n \n+\tif (ring->fw_ring_id == INVALID_HW_RING_ID)\n+\t\treturn -EINVAL;\n+\n \tHWRM_PREP(&req, HWRM_RING_FREE, BNXT_USE_CHIMP_MB);\n \n \treq.ring_type = ring_type;\n@@ -1817,6 +1820,7 @@ int bnxt_hwrm_ring_free(struct bnxt *bp,\n \treq.cmpl_ring = rte_cpu_to_le_16(cp_ring_id);\n \n \trc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);\n+\tring->fw_ring_id = INVALID_HW_RING_ID;\n \n \tif (rc || resp->error_code) {\n \t\tif (rc == 0 && resp->error_code)\n@@ -1902,7 +1906,7 @@ int bnxt_hwrm_stat_clear(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)\n \tstruct hwrm_stat_ctx_clr_stats_input req = {.req_type = 0 };\n \tstruct hwrm_stat_ctx_clr_stats_output *resp = bp->hwrm_cmd_resp_addr;\n \n-\tif (cpr->hw_stats_ctx_id == (uint32_t)HWRM_NA_SIGNATURE)\n+\tif (cpr->hw_stats_ctx_id == HWRM_NA_SIGNATURE)\n \t\treturn rc;\n \n \tHWRM_PREP(&req, HWRM_STAT_CTX_CLR_STATS, BNXT_USE_CHIMP_MB);\n@@ -1923,6 +1927,9 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)\n \tstruct hwrm_stat_ctx_alloc_input req = {.req_type = 0 };\n \tstruct hwrm_stat_ctx_alloc_output *resp = bp->hwrm_cmd_resp_addr;\n \n+\tif (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE)\n+\t\treturn 0;\n+\n \tHWRM_PREP(&req, HWRM_STAT_CTX_ALLOC, BNXT_USE_CHIMP_MB);\n \n \treq.update_period_ms = rte_cpu_to_le_32(0);\n@@ -1946,6 +1953,9 @@ static int bnxt_hwrm_stat_ctx_free(struct bnxt *bp, struct bnxt_cp_ring_info *cp\n \tstruct hwrm_stat_ctx_free_input req = {.req_type = 0 };\n \tstruct hwrm_stat_ctx_free_output *resp = bp->hwrm_cmd_resp_addr;\n \n+\tif (cpr->hw_stats_ctx_id == HWRM_NA_SIGNATURE)\n+\t\treturn 0;\n+\n \tHWRM_PREP(&req, HWRM_STAT_CTX_FREE, BNXT_USE_CHIMP_MB);\n \n \treq.stat_ctx_id = rte_cpu_to_le_32(cpr->hw_stats_ctx_id);\n@@ -1955,6 +1965,8 @@ static int bnxt_hwrm_stat_ctx_free(struct bnxt *bp, struct bnxt_cp_ring_info *cp\n \tHWRM_CHECK_RESULT();\n \tHWRM_UNLOCK();\n \n+\tcpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE;\n+\n \treturn rc;\n }\n \n@@ -2600,49 +2612,54 @@ bnxt_free_all_hwrm_stat_ctxs(struct bnxt *bp)\n \tunsigned int i;\n \tstruct bnxt_cp_ring_info *cpr;\n \n-\tfor (i = 0; i < bp->rx_cp_nr_rings + bp->tx_cp_nr_rings; i++) {\n+\tfor (i = 0; i < bp->rx_cp_nr_rings; i++) {\n \n-\t\tif (i >= bp->rx_cp_nr_rings) {\n-\t\t\tcpr = bp->tx_queues[i - bp->rx_cp_nr_rings]->cp_ring;\n-\t\t} else {\n-\t\t\tcpr = bp->rx_queues[i]->cp_ring;\n-\t\t\tif (BNXT_HAS_RING_GRPS(bp))\n-\t\t\t\tbp->grp_info[i].fw_stats_ctx = -1;\n-\t\t}\n-\t\tif (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE) {\n-\t\t\trc = bnxt_hwrm_stat_ctx_free(bp, cpr);\n-\t\t\tcpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE;\n-\t\t\tif (rc)\n-\t\t\t\treturn rc;\n-\t\t}\n+\t\tcpr = bp->rx_queues[i]->cp_ring;\n+\t\tif (BNXT_HAS_RING_GRPS(bp))\n+\t\t\tbp->grp_info[i].fw_stats_ctx = -1;\n+\t\trc = bnxt_hwrm_stat_ctx_free(bp, cpr);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t}\n+\n+\tfor (i = 0; i < bp->tx_cp_nr_rings; i++) {\n+\t\tcpr = bp->tx_queues[i]->cp_ring;\n+\t\trc = bnxt_hwrm_stat_ctx_free(bp, cpr);\n+\t\tif (rc)\n+\t\t\treturn rc;\n \t}\n+\n \treturn 0;\n }\n \n int bnxt_alloc_all_hwrm_stat_ctxs(struct bnxt *bp)\n {\n+\tstruct bnxt_cp_ring_info *cpr;\n \tunsigned int i;\n \tint rc = 0;\n \n-\tfor (i = 0; i < bp->rx_cp_nr_rings + bp->tx_cp_nr_rings; i++) {\n-\t\tstruct bnxt_tx_queue *txq;\n-\t\tstruct bnxt_rx_queue *rxq;\n-\t\tstruct bnxt_cp_ring_info *cpr;\n+\tfor (i = 0; i < bp->rx_cp_nr_rings; i++) {\n+\t\tstruct bnxt_rx_queue *rxq = bp->rx_queues[i];\n \n-\t\tif (i >= bp->rx_cp_nr_rings) {\n-\t\t\ttxq = bp->tx_queues[i - bp->rx_cp_nr_rings];\n-\t\t\tcpr = txq->cp_ring;\n-\t\t} else {\n-\t\t\trxq = bp->rx_queues[i];\n-\t\t\tcpr = rxq->cp_ring;\n+\t\tcpr = rxq->cp_ring;\n+\t\tif (cpr->hw_stats_ctx_id == HWRM_NA_SIGNATURE) {\n+\t\t\trc = bnxt_hwrm_stat_ctx_alloc(bp, cpr);\n+\t\t\tif (rc)\n+\t\t\t\treturn rc;\n \t\t}\n+\t}\n+\n+\tfor (i = 0; i < bp->tx_cp_nr_rings; i++) {\n+\t\tstruct bnxt_tx_queue *txq = bp->tx_queues[i];\n \n+\t\tcpr = txq->cp_ring;\n \t\tif (cpr->hw_stats_ctx_id == HWRM_NA_SIGNATURE) {\n \t\t\trc = bnxt_hwrm_stat_ctx_alloc(bp, cpr);\n \t\t\tif (rc)\n \t\t\t\treturn rc;\n \t\t}\n \t}\n+\n \treturn rc;\n }\n \n@@ -2675,9 +2692,8 @@ void bnxt_free_nq_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)\n \tbnxt_hwrm_ring_free(bp, cp_ring,\n \t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_NQ,\n \t\t\t    INVALID_HW_RING_ID);\n-\tcp_ring->fw_ring_id = INVALID_HW_RING_ID;\n-\tmemset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *\n-\t\t\t\t     sizeof(*cpr->cp_desc_ring));\n+\tmemset(cpr->cp_desc_ring, 0,\n+\t       cpr->cp_ring_struct->ring_size * sizeof(*cpr->cp_desc_ring));\n \tcpr->cp_raw_cons = 0;\n }\n \n@@ -2686,11 +2702,10 @@ void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)\n \tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n \n \tbnxt_hwrm_ring_free(bp, cp_ring,\n-\t\t\tHWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL,\n-\t\t\tINVALID_HW_RING_ID);\n-\tcp_ring->fw_ring_id = INVALID_HW_RING_ID;\n-\tmemset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *\n-\t\t\tsizeof(*cpr->cp_desc_ring));\n+\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL,\n+\t\t\t    INVALID_HW_RING_ID);\n+\tmemset(cpr->cp_desc_ring, 0,\n+\t       cpr->cp_ring_struct->ring_size * sizeof(*cpr->cp_desc_ring));\n \tcpr->cp_raw_cons = 0;\n }\n \n@@ -2701,34 +2716,24 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)\n \tstruct bnxt_ring *ring = rxr->rx_ring_struct;\n \tstruct bnxt_cp_ring_info *cpr = rxq->cp_ring;\n \n-\tif (ring->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\tbnxt_hwrm_ring_free(bp, ring,\n-\t\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX,\n-\t\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n-\t\tring->fw_ring_id = INVALID_HW_RING_ID;\n-\t\tif (BNXT_HAS_RING_GRPS(bp))\n-\t\t\tbp->grp_info[queue_index].rx_fw_ring_id =\n-\t\t\t\t\t\t\tINVALID_HW_RING_ID;\n-\t}\n+\tbnxt_hwrm_ring_free(bp, ring,\n+\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX,\n+\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n+\tif (BNXT_HAS_RING_GRPS(bp))\n+\t\tbp->grp_info[queue_index].rx_fw_ring_id = INVALID_HW_RING_ID;\n+\n \tring = rxr->ag_ring_struct;\n-\tif (ring->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\tbnxt_hwrm_ring_free(bp, ring,\n-\t\t\t\t    BNXT_CHIP_P5(bp) ?\n-\t\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG :\n-\t\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX,\n-\t\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n-\t\tif (BNXT_HAS_RING_GRPS(bp))\n-\t\t\tbp->grp_info[queue_index].ag_fw_ring_id =\n-\t\t\t\t\t\t\tINVALID_HW_RING_ID;\n-\t}\n+\tbnxt_hwrm_ring_free(bp, ring,\n+\t\t\t    BNXT_CHIP_P5(bp) ?\n+\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX_AGG :\n+\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_RX,\n+\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n+\tif (BNXT_HAS_RING_GRPS(bp))\n+\t\tbp->grp_info[queue_index].ag_fw_ring_id = INVALID_HW_RING_ID;\n \n-\tif (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE) {\n-\t\tbnxt_hwrm_stat_ctx_free(bp, cpr);\n-\t\tcpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE;\n-\t}\n+\tbnxt_hwrm_stat_ctx_free(bp, cpr);\n \n-\tif (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID)\n-\t\tbnxt_free_cp_ring(bp, cpr);\n+\tbnxt_free_cp_ring(bp, cpr);\n \n \tif (BNXT_HAS_RING_GRPS(bp))\n \t\tbp->grp_info[queue_index].cp_fw_ring_id = INVALID_HW_RING_ID;\n@@ -2758,31 +2763,8 @@ bnxt_free_all_hwrm_rings(struct bnxt *bp)\n {\n \tunsigned int i;\n \n-\tfor (i = 0; i < bp->tx_cp_nr_rings; i++) {\n-\t\tstruct bnxt_tx_queue *txq = bp->tx_queues[i];\n-\t\tstruct bnxt_tx_ring_info *txr = txq->tx_ring;\n-\t\tstruct bnxt_ring *ring = txr->tx_ring_struct;\n-\t\tstruct bnxt_cp_ring_info *cpr = txq->cp_ring;\n-\n-\t\tif (ring->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\t\tbnxt_hwrm_ring_free(bp, ring,\n-\t\t\t\t\tHWRM_RING_FREE_INPUT_RING_TYPE_TX,\n-\t\t\t\t\tcpr->cp_ring_struct->fw_ring_id);\n-\t\t\tring->fw_ring_id = INVALID_HW_RING_ID;\n-\t\t\tmemset(txr->tx_desc_ring, 0,\n-\t\t\t\t\ttxr->tx_ring_struct->ring_size *\n-\t\t\t\t\tsizeof(*txr->tx_desc_ring));\n-\t\t\tmemset(txr->tx_buf_ring, 0,\n-\t\t\t\t\ttxr->tx_ring_struct->ring_size *\n-\t\t\t\t\tsizeof(*txr->tx_buf_ring));\n-\t\t\ttxr->tx_raw_prod = 0;\n-\t\t\ttxr->tx_raw_cons = 0;\n-\t\t}\n-\t\tif (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\t\tbnxt_free_cp_ring(bp, cpr);\n-\t\t\tcpr->cp_ring_struct->fw_ring_id = INVALID_HW_RING_ID;\n-\t\t}\n-\t}\n+\tfor (i = 0; i < bp->tx_cp_nr_rings; i++)\n+\t\tbnxt_free_hwrm_tx_ring(bp, i);\n \n \tfor (i = 0; i < bp->rx_cp_nr_rings; i++)\n \t\tbnxt_free_hwrm_rx_ring(bp, i);\n@@ -6207,20 +6189,17 @@ void bnxt_free_hwrm_tx_ring(struct bnxt *bp, int queue_index)\n \tstruct bnxt_ring *ring = txr->tx_ring_struct;\n \tstruct bnxt_cp_ring_info *cpr = txq->cp_ring;\n \n-\tif (ring->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\tbnxt_hwrm_ring_free(bp, ring,\n-\t\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_TX,\n-\t\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n-\t\tring->fw_ring_id = INVALID_HW_RING_ID;\n-\t}\n+\tbnxt_hwrm_ring_free(bp, ring,\n+\t\t\t    HWRM_RING_FREE_INPUT_RING_TYPE_TX,\n+\t\t\t    cpr->cp_ring_struct->fw_ring_id);\n+\ttxr->tx_raw_prod = 0;\n+\ttxr->tx_raw_cons = 0;\n+\tmemset(txr->tx_desc_ring, 0,\n+\t\ttxr->tx_ring_struct->ring_size * sizeof(*txr->tx_desc_ring));\n+\tmemset(txr->tx_buf_ring, 0,\n+\t\ttxr->tx_ring_struct->ring_size * sizeof(*txr->tx_buf_ring));\n \n-\tif (cpr->hw_stats_ctx_id != HWRM_NA_SIGNATURE) {\n-\t\tbnxt_hwrm_stat_ctx_free(bp, cpr);\n-\t\tcpr->hw_stats_ctx_id = HWRM_NA_SIGNATURE;\n-\t}\n+\tbnxt_hwrm_stat_ctx_free(bp, cpr);\n \n-\tif (cpr->cp_ring_struct->fw_ring_id != INVALID_HW_RING_ID) {\n-\t\tbnxt_free_cp_ring(bp, cpr);\n-\t\tcpr->cp_ring_struct->fw_ring_id = INVALID_HW_RING_ID;\n-\t}\n+\tbnxt_free_cp_ring(bp, cpr);\n }\ndiff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c\nindex 9ec0c10911..b05c470766 100644\n--- a/drivers/net/bnxt/bnxt_ring.c\n+++ b/drivers/net/bnxt/bnxt_ring.c\n@@ -700,7 +700,6 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)\n {\n \tstruct bnxt_coal coal;\n \tunsigned int i;\n-\tuint8_t ring_type;\n \tint rc = 0;\n \n \tbnxt_init_dflt_coal(&coal);\n@@ -712,36 +711,11 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)\n \t\t\tgoto err_out;\n \t}\n \n+\t/* If something is wrong with Rx ring alloc, skip Tx ring alloc */\n \tfor (i = 0; i < bp->tx_cp_nr_rings; i++) {\n-\t\tstruct bnxt_tx_queue *txq = bp->tx_queues[i];\n-\t\tstruct bnxt_cp_ring_info *cpr = txq->cp_ring;\n-\t\tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n-\t\tstruct bnxt_tx_ring_info *txr = txq->tx_ring;\n-\t\tstruct bnxt_ring *ring = txr->tx_ring_struct;\n-\t\tunsigned int idx = i + bp->rx_cp_nr_rings;\n-\t\tuint16_t tx_cosq_id = 0;\n-\n-\t\tif (bnxt_alloc_cmpl_ring(bp, idx, cpr))\n-\t\t\tgoto err_out;\n-\n-\t\tif (bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY)\n-\t\t\ttx_cosq_id = bp->tx_cosq_id[i < bp->max_lltc ? i : 0];\n-\t\telse\n-\t\t\ttx_cosq_id = bp->tx_cosq_id[0];\n-\t\t/* Tx ring */\n-\t\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_TX;\n-\t\trc = bnxt_hwrm_ring_alloc(bp, ring,\n-\t\t\t\t\t  ring_type,\n-\t\t\t\t\t  i, cpr->hw_stats_ctx_id,\n-\t\t\t\t\t  cp_ring->fw_ring_id,\n-\t\t\t\t\t  tx_cosq_id);\n+\t\trc = bnxt_alloc_hwrm_tx_ring(bp, i);\n \t\tif (rc)\n \t\t\tgoto err_out;\n-\n-\t\tbnxt_set_db(bp, &txr->tx_db, ring_type, i, ring->fw_ring_id,\n-\t\t\t    ring->ring_mask);\n-\t\ttxq->index = idx;\n-\t\tbnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);\n \t}\n \n err_out:\n",
    "prefixes": [
        "2/2"
    ]
}