Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/84903/?format=api
http://patches.dpdk.org/api/patches/84903/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20201209235347.16180-10-ajit.khaparde@broadcom.com/", "project": { "id": 1, "url": "http://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": "<20201209235347.16180-10-ajit.khaparde@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20201209235347.16180-10-ajit.khaparde@broadcom.com", "date": "2020-12-09T23:53:39", "name": "[v3,09/17] net/bnxt: fix max rings computation", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "c9630af766f3d88344c42ff8c85e826b7ecd97f7", "submitter": { "id": 2064, "url": "http://patches.dpdk.org/api/people/2064/?format=api", "name": "Ajit Khaparde", "email": "ajitkhaparde@gmail.com" }, "delegate": { "id": 1766, "url": "http://patches.dpdk.org/api/users/1766/?format=api", "username": "ajitkhaparde", "first_name": "Ajit", "last_name": "Khaparde", "email": "ajit.khaparde@broadcom.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20201209235347.16180-10-ajit.khaparde@broadcom.com/mbox/", "series": [ { "id": 14226, "url": "http://patches.dpdk.org/api/series/14226/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=14226", "date": "2020-12-09T23:53:30", "name": "fixes and refactoring changes for bnxt", "version": 3, "mbox": "http://patches.dpdk.org/series/14226/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/84903/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/84903/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6BABEA04DB;\n\tThu, 10 Dec 2020 00:57:06 +0100 (CET)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 710C6CA0E;\n\tThu, 10 Dec 2020 00:54:12 +0100 (CET)", "from mail-pg1-f195.google.com (mail-pg1-f195.google.com\n [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 08B83C9DC;\n Thu, 10 Dec 2020 00:54:07 +0100 (CET)", "by mail-pg1-f195.google.com with SMTP id t3so2434393pgi.11;\n Wed, 09 Dec 2020 15:54:06 -0800 (PST)", "from localhost.localdomain ([192.19.228.250])\n by smtp.gmail.com with ESMTPSA id s7sm4047693pfh.207.2020.12.09.15.54.03\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Wed, 09 Dec 2020 15:54:04 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=6jJdV41BRw4l0qeC+e/ZTNbv2J3RerTm8XEnp9TjRAI=;\n b=J2lZun+XCotPLbmC5QVV5p5Cwzar97j2uj96g6/uNGWv5p+EPI4Ar1Hq4685bdP5Mw\n GzcvbitbXvlKh9h9zo84k2utAsbJZ6gzHM1mlRz7/AgCj4ZPYbrUGInKIuJ1REgUPzWr\n 3Y67y340lQZ1Q0W32mZQZrnhYEQOK1ORcN1D8s5L5bcfYwfyGNf0p+ceoQXSEZVxYfPv\n H+zBi7viIBUQKkVMtH4y7QkxJjg4eTdCyNwvUYcwhquJUdzOVr/1JKLDUaRrKTMEvtti\n seUaO0yeeN1qKQ0JLzkOYaMu4+gAACcC75klM+zP2lqVOqypfhcI9bHlGFzSAcaEAY8g\n gAEw==", "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:content-transfer-encoding;\n bh=6jJdV41BRw4l0qeC+e/ZTNbv2J3RerTm8XEnp9TjRAI=;\n b=bFk39KlhY3L/spulzXNym4tVQlQ0QkD0KAJ1VVSbeO44ZNfZlfbPWKtQKTc1uRUfr+\n 6ZDVpShsRm3VRVwn3XQhBRHv1rjM/mjpN72bTPSWo+GIm3VDCA94DfVJyuR6Y3LIbsIU\n owSGzgfmisxHGkatHlELQKHJOtSC3Xpr4PA5jlQQKV1D/A0rMQymbQiBiydojbHXcz4V\n gxAxymI1NaJXpHGLD9S3cQkdE1/Nn6w9xCD0/FZSBKNBLO4O3Yp9jkzMlAiiO0RokFXr\n Rw53j9pr+SX8HiOVNDaJsAdtjfq4sLGwtS/rxoTmQrw3UJcRA4MA3ldbmLcWrK/YqSVc\n keQA==", "X-Gm-Message-State": "AOAM530wjFOdT9J8kZs+ztNqwr3UT5pWZyngWjaD8egcPKqgcP8HlLyV\n Ir1H1bjuiQBryglIE27jxL38BPKQHW9Ddcp4", "X-Google-Smtp-Source": "\n ABdhPJxqNlzjD/U9dJbc5aYdHa6pDdEZGKqBgSZAH1FZEZl3ni0I2e0e+i3J0GEYjkHKFUGrPimxoQ==", "X-Received": "by 2002:aa7:8708:0:b029:19e:924:345a with SMTP id\n b8-20020aa787080000b029019e0924345amr4463757pfo.54.1607558044935;\n Wed, 09 Dec 2020 15:54:04 -0800 (PST)", "From": "Ajit Khaparde <ajitkhaparde@gmail.com>", "X-Google-Original-From": "Ajit Khaparde <ajit.khaparde@broadcom.com>", "To": "dev@dpdk.org", "Cc": "Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,\n stable@dpdk.org, Somnath Kotur <somnath.kotur@broadcom.com>", "Date": "Wed, 9 Dec 2020 15:53:39 -0800", "Message-Id": "<20201209235347.16180-10-ajit.khaparde@broadcom.com>", "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)", "In-Reply-To": "<20201209235347.16180-1-ajit.khaparde@broadcom.com>", "References": "<20201209192233.6518-1-ajit.khaparde@broadcom.com>\n <20201209235347.16180-1-ajit.khaparde@broadcom.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v3 09/17] net/bnxt: fix max rings computation", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "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": "From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>\n\nThe current max_rings computation does not take into account the case\nwhen max_nq_rings is <= num_async_cpr. This results in a wrong value\nlike 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr\nonly when max_cp_rings > num_async_cpr.\n\nApart from this, the entire logic is currently spread across a few\nmacros, making it hard to read and debug this code. Move this code\ninto an inline function.\n\nmax_msix is not used in the max_rings calculation.\nApparently the max_msix field returned in HWRM_RESC_QCAPS is only\nvalid for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.\nAlso, when a function reset is performed on an application quit, FW\nwill not reset the VF resource pool as per design.\nThis can lead to a strange condition wherein the max_msix field\non Wh+ keeps changing on each application re-load thereby throwing\nthrowing off the max_rings computation.\n\nFixes: f03e66cb64ce (\"net/bnxt: limit queue count for NS3/Stingray devices\")\nCc: stable@dpdk.org\n\nSigned-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>\nSigned-off-by: Somnath Kotur <somnath.kotur@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h | 41 +++++++++++++++++++++++-----------\n drivers/net/bnxt/bnxt_ethdev.c | 2 +-\n drivers/net/bnxt/bnxt_rxq.c | 7 +++---\n drivers/net/bnxt/bnxt_txq.c | 2 +-\n 4 files changed, 34 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex 9c1c87489..bc0935272 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -752,19 +752,6 @@ struct bnxt {\n \tuint16_t\t\tmax_tx_rings;\n \tuint16_t\t\tmax_rx_rings;\n #define MAX_STINGRAY_RINGS\t\t128U\n-/* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */\n-#define BNXT_MAX_RX_RINGS(bp) \\\n-\t(BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings / 2U, \\\n-\t\t\t\t\t MAX_STINGRAY_RINGS), \\\n-\t\t\t\t bp->max_stat_ctx / 2U) : \\\n-\t\t\t\tRTE_MIN(bp->max_rx_rings / 2U, \\\n-\t\t\t\t\tbp->max_stat_ctx / 2U))\n-#define BNXT_MAX_TX_RINGS(bp) \\\n-\t(RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp)))\n-\n-#define BNXT_MAX_RINGS(bp) \\\n-\t(RTE_MIN((((bp)->max_cp_rings - BNXT_NUM_ASYNC_CPR(bp)) / 2U), \\\n-\t\t BNXT_MAX_TX_RINGS(bp)))\n \n #define BNXT_MAX_VF_REP_RINGS\t8\n \n@@ -822,6 +809,34 @@ struct bnxt {\n \tuint16_t\t\ttx_cfa_action;\n };\n \n+static\n+inline uint16_t bnxt_max_rings(struct bnxt *bp)\n+{\n+\tuint16_t max_tx_rings = bp->max_tx_rings;\n+\tuint16_t max_rx_rings = bp->max_rx_rings;\n+\tuint16_t max_cp_rings = bp->max_cp_rings;\n+\tuint16_t max_rings;\n+\n+\t/* For the sake of symmetry:\n+\t * max Tx rings == max Rx rings, one stat ctx for each.\n+\t */\n+\tif (BNXT_STINGRAY(bp)) {\n+\t\tmax_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,\n+\t\t\t\t\t MAX_STINGRAY_RINGS),\n+\t\t\t\t bp->max_stat_ctx / 2U);\n+\t} else {\n+\t\tmax_rx_rings = RTE_MIN(max_rx_rings / 2U,\n+\t\t\t\t bp->max_stat_ctx / 2U);\n+\t}\n+\n+\tmax_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);\n+\tif (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))\n+\t\tmax_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);\n+\tmax_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);\n+\n+\treturn max_rings;\n+}\n+\n #define BNXT_FC_TIMER\t1 /* Timer freq in Sec Flow Counters */\n \n /**\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex 0b14ca234..bf8963577 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -920,7 +920,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,\n \tif (BNXT_PF(bp))\n \t\tdev_info->max_vfs = pdev->max_vfs;\n \n-\tmax_rx_rings = BNXT_MAX_RINGS(bp);\n+\tmax_rx_rings = bnxt_max_rings(bp);\n \t/* For the sake of symmetry, max_rx_queues = max_tx_queues */\n \tdev_info->max_rx_queues = max_rx_rings;\n \tdev_info->max_tx_queues = max_rx_rings;\ndiff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c\nindex 328cc994d..19e11e47b 100644\n--- a/drivers/net/bnxt/bnxt_rxq.c\n+++ b/drivers/net/bnxt/bnxt_rxq.c\n@@ -311,7 +311,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,\n \tif (rc)\n \t\treturn rc;\n \n-\tif (queue_idx >= BNXT_MAX_RINGS(bp)) {\n+\tif (queue_idx >= bnxt_max_rings(bp)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t\"Cannot create Rx ring %d. Only %d rings available\\n\",\n \t\t\tqueue_idx, bp->max_rx_rings);\n@@ -364,8 +364,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,\n \n \teth_dev->data->rx_queues[queue_idx] = rxq;\n \t/* Allocate RX ring hardware descriptors */\n-\tif (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,\n-\t\t\t \"rxr\")) {\n+\trc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,\n+\t\t\t \"rxr\");\n+\tif (rc) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t \"ring_dma_zone_reserve for rx_ring failed!\\n\");\n \t\tgoto err;\ndiff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c\nindex c9792a2af..99a31cef2 100644\n--- a/drivers/net/bnxt/bnxt_txq.c\n+++ b/drivers/net/bnxt/bnxt_txq.c\n@@ -98,7 +98,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,\n \tif (rc)\n \t\treturn rc;\n \n-\tif (queue_idx >= BNXT_MAX_RINGS(bp)) {\n+\tif (queue_idx >= bnxt_max_rings(bp)) {\n \t\tPMD_DRV_LOG(ERR,\n \t\t\t\"Cannot create Tx ring %d. Only %d rings available\\n\",\n \t\t\tqueue_idx, bp->max_tx_rings);\n", "prefixes": [ "v3", "09/17" ] }{ "id": 84903, "url": "