Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/54124/?format=api
http://patches.dpdk.org/api/patches/54124/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190602174247.32368-9-lance.richardson@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": "<20190602174247.32368-9-lance.richardson@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190602174247.32368-9-lance.richardson@broadcom.com", "date": "2019-06-02T17:42:43", "name": "[08/11] net/bnxt: refactor ring allocation code", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "934daaa4159685aaefc1ab02b629ea1375a6a8cb", "submitter": { "id": 1323, "url": "http://patches.dpdk.org/api/people/1323/?format=api", "name": "Lance Richardson", "email": "lance.richardson@broadcom.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190602174247.32368-9-lance.richardson@broadcom.com/mbox/", "series": [ { "id": 4850, "url": "http://patches.dpdk.org/api/series/4850/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4850", "date": "2019-06-02T17:42:35", "name": "add support for BCM57508 controller", "version": 1, "mbox": "http://patches.dpdk.org/series/4850/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/54124/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/54124/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4D3EA1B9A7;\n\tSun, 2 Jun 2019 19:43:23 +0200 (CEST)", "from mail-yw1-f52.google.com (mail-yw1-f52.google.com\n\t[209.85.161.52]) by dpdk.org (Postfix) with ESMTP id 4512A1B950\n\tfor <dev@dpdk.org>; Sun, 2 Jun 2019 19:43:11 +0200 (CEST)", "by mail-yw1-f52.google.com with SMTP id k70so6464084ywe.7\n\tfor <dev@dpdk.org>; Sun, 02 Jun 2019 10:43:11 -0700 (PDT)", "from lrichardson-VirtualBox.attlocal.net\n\t(69-218-223-106.lightspeed.rlghnc.sbcglobal.net. [69.218.223.106])\n\tby smtp.gmail.com with ESMTPSA id\n\tn78sm1000819ywd.2.2019.06.02.10.43.09\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 02 Jun 2019 10:43:10 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=AUTIa+EuRQI2aqLyu+0+jHF6stzfA53EPNharv6eaC8=;\n\tb=K8PaPJJph5NeYS/Wx68ZKxn2mWEqkz5kZ2sCgVy+reLy7OaA2F34pXsVCHiWYyO5Ue\n\tI+q2eXJUZkvgtfxzGBg+PgO9IBDr6SbMW0FRMVbWdinAoDelnupoQUpqUd5Z9E7aPUoF\n\tLAtI3pEp9e7EV/74JaGHHYH8EZ+2ODFmkMkVE=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=AUTIa+EuRQI2aqLyu+0+jHF6stzfA53EPNharv6eaC8=;\n\tb=SMEVmfX35gwzwXdD3T59qIx/tBTlPXSI0eXxBV0VIHzY4q7+fTBJT7shiau5fDzHxp\n\tCucuz6x6bZx0askVBIzinjX253u6Cugf5YR27T7PGwDsA/wQFZRUh1xHVNgFety4VUxF\n\tEqNHZ4yLb/XrCMmobgkGo8niF2ItUMC+wvruhTrPomRU9UUzXxeFTp3HZcP+LSI+MPIK\n\trVAC6TIz/yxEg69v09LGQOieJkDFxT4sh4mo1JstPsP46nJFx+UC1V5kAP1mnFZ1V/U1\n\tYUo3sBlKLEkaQv355lE9ZI1SoL8FOtLzW3ZpnwtlJDHIBCiYaqiSkWe/OLfhT4rOY9xm\n\tI5pQ==", "X-Gm-Message-State": "APjAAAWrGof/uMdW255jYiuCCnLdPnxigN6yIOHsgzooHF73jiT43SmC\n\tv7wnMDnnBV0QzFFzx0zJWLhJ5/REoOpqgSjczArny4wdc6ojiwIGcLvTYsv2zEJ5uwwnZP+pR7F\n\tnlHf5ppa3+mR+O+EEJtPi6HY/CUdP7sacLHUVWQegX9RMlT7eKKgtUxGTcGA4hbyJ", "X-Google-Smtp-Source": "APXvYqymm9yEH8ZQ2J9pZZQoH9yqWr6SDgxWtkbh6/7I0W6+TE0hKClHXaRUBM/4r5+vb1Y70BkNSQ==", "X-Received": "by 2002:a81:3d07:: with SMTP id\n\tk7mr11610271ywa.376.1559497390452; \n\tSun, 02 Jun 2019 10:43:10 -0700 (PDT)", "From": "Lance Richardson <lance.richardson@broadcom.com>", "To": "dev@dpdk.org", "Cc": "ajit.khaparde@broadcom.com, ferruh.yigit@intel.com,\n\tLance Richardson <lance.richardson@broadcom.com>", "Date": "Sun, 2 Jun 2019 13:42:43 -0400", "Message-Id": "<20190602174247.32368-9-lance.richardson@broadcom.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190602174247.32368-1-lance.richardson@broadcom.com>", "References": "<20190602174247.32368-1-lance.richardson@broadcom.com>", "Subject": "[dpdk-dev] [PATCH 08/11] net/bnxt: refactor ring allocation code", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Reduce code duplication and prepare for supporting hardware with\ndifferent ring allocation requirements by refactoring ring\nallocation code.\n\nSigned-off-by: Lance Richardson <lance.richardson@broadcom.com>\nReviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/bnxt_ring.c | 167 ++++++++++++++++++-----------------\n 1 file changed, 85 insertions(+), 82 deletions(-)", "diff": "diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c\nindex 15d418977..8473e4abe 100644\n--- a/drivers/net/bnxt/bnxt_ring.c\n+++ b/drivers/net/bnxt/bnxt_ring.c\n@@ -295,29 +295,94 @@ static void bnxt_set_db(struct bnxt *bp,\n \t}\n }\n \n-int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)\n+static int bnxt_alloc_cmpl_ring(struct bnxt *bp, int queue_index,\n+\t\t\t\tstruct bnxt_cp_ring_info *cpr)\n+{\n+\tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n+\tuint8_t ring_type;\n+\tint rc = 0;\n+\n+\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;\n+\n+\trc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, queue_index,\n+\t\t\t\t HWRM_NA_SIGNATURE, HWRM_NA_SIGNATURE);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\tcpr->cp_cons = 0;\n+\tbnxt_set_db(bp, &cpr->cp_db, ring_type, queue_index);\n+\tbnxt_db_cq(cpr);\n+\n+\treturn 0;\n+}\n+\n+static int bnxt_alloc_rx_ring(struct bnxt *bp, int queue_index)\n {\n \tstruct bnxt_rx_queue *rxq = bp->rx_queues[queue_index];\n \tstruct bnxt_cp_ring_info *cpr = rxq->cp_ring;\n \tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n \tstruct bnxt_rx_ring_info *rxr = rxq->rx_ring;\n \tstruct bnxt_ring *ring = rxr->rx_ring_struct;\n+\tuint8_t ring_type;\n+\tint rc = 0;\n+\n+\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n+\n+\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type,\n+\t\t\t\t queue_index, cpr->hw_stats_ctx_id,\n+\t\t\t\t cp_ring->fw_ring_id);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\trxr->rx_prod = 0;\n+\tbp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id;\n+\tbnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index);\n+\tbnxt_db_write(&rxr->rx_db, rxr->rx_prod);\n+\n+\treturn 0;\n+}\n+\n+static int bnxt_alloc_rx_agg_ring(struct bnxt *bp, int queue_index)\n+{\n \tunsigned int map_idx = queue_index + bp->rx_cp_nr_rings;\n+\tstruct bnxt_rx_queue *rxq = bp->rx_queues[queue_index];\n+\tstruct bnxt_cp_ring_info *cpr = rxq->cp_ring;\n+\tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n+\tstruct bnxt_rx_ring_info *rxr = rxq->rx_ring;\n+\tstruct bnxt_ring *ring = rxr->ag_ring_struct;\n+\tuint32_t hw_stats_ctx_id = HWRM_NA_SIGNATURE;\n \tuint8_t ring_type;\n \tint rc = 0;\n \n-\tbp->grp_info[queue_index].fw_stats_ctx = cpr->hw_stats_ctx_id;\n+\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n+\n+\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, map_idx,\n+\t\t\t\t hw_stats_ctx_id, cp_ring->fw_ring_id);\n \n-\t/* Rx cmpl */\n-\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;\n-\trc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, queue_index,\n-\t\t\t\t HWRM_NA_SIGNATURE, HWRM_NA_SIGNATURE);\n \tif (rc)\n+\t\treturn rc;\n+\n+\trxr->ag_prod = 0;\n+\tbp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;\n+\tbnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx);\n+\tbnxt_db_write(&rxr->ag_db, rxr->ag_prod);\n+\n+\treturn 0;\n+}\n+\n+int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)\n+{\n+\tstruct bnxt_rx_queue *rxq = bp->rx_queues[queue_index];\n+\tstruct bnxt_cp_ring_info *cpr = rxq->cp_ring;\n+\tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n+\tstruct bnxt_rx_ring_info *rxr = rxq->rx_ring;\n+\tint rc = 0;\n+\n+\tif (bnxt_alloc_cmpl_ring(bp, queue_index, cpr))\n \t\tgoto err_out;\n \n+\tbp->grp_info[queue_index].fw_stats_ctx = cpr->hw_stats_ctx_id;\n \tbp->grp_info[queue_index].cp_fw_ring_id = cp_ring->fw_ring_id;\n-\tbnxt_set_db(bp, &cpr->cp_db, ring_type, queue_index);\n-\tbnxt_db_cq(cpr);\n \n \tif (!queue_index) {\n \t\t/*\n@@ -330,34 +395,12 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)\n \t\tif (rc)\n \t\t\tgoto err_out;\n \t}\n-\t/* Rx ring */\n-\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n-\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, queue_index,\n-\t\t\t\t cpr->hw_stats_ctx_id, cp_ring->fw_ring_id);\n-\tif (rc)\n-\t\tgoto err_out;\n-\n-\trxr->rx_prod = 0;\n-\tbp->grp_info[queue_index].rx_fw_ring_id = ring->fw_ring_id;\n-\tbnxt_set_db(bp, &rxr->rx_db, ring_type, queue_index);\n-\tbnxt_db_write(&rxr->rx_db, rxr->rx_prod);\n-\n-\t/* Agg ring */\n-\tring = rxr->ag_ring_struct;\n-\tif (!ring)\n-\t\tPMD_DRV_LOG(ERR, \"Alloc AGG Ring is NULL!\\n\");\n \n-\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n-\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, map_idx,\n-\t\t\t\t HWRM_NA_SIGNATURE, cp_ring->fw_ring_id);\n-\tif (rc)\n+\tif (bnxt_alloc_rx_ring(bp, queue_index))\n \t\tgoto err_out;\n \n-\tPMD_DRV_LOG(DEBUG, \"Alloc AGG Done!\\n\");\n-\trxr->ag_prod = 0;\n-\tbp->grp_info[queue_index].ag_fw_ring_id = ring->fw_ring_id;\n-\tbnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx);\n-\tbnxt_db_write(&rxr->ag_db, rxr->ag_prod);\n+\tif (bnxt_alloc_rx_agg_ring(bp, queue_index))\n+\t\tgoto err_out;\n \n \trxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\n \t\tRTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);\n@@ -403,21 +446,14 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)\n \t\tstruct bnxt_cp_ring_info *cpr = rxq->cp_ring;\n \t\tstruct bnxt_ring *cp_ring = cpr->cp_ring_struct;\n \t\tstruct bnxt_rx_ring_info *rxr = rxq->rx_ring;\n-\t\tstruct bnxt_ring *ring = rxr->rx_ring_struct;\n-\t\tunsigned int map_idx = i + bp->rx_cp_nr_rings;\n \n \t\tbp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id;\n \n-\t\t/* Rx cmpl */\n-\t\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;\n-\t\trc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, i,\n-\t\t\t\t\t HWRM_NA_SIGNATURE,\n-\t\t\t\t\t HWRM_NA_SIGNATURE);\n-\t\tif (rc)\n+\t\tif (bnxt_alloc_cmpl_ring(bp, i, cpr))\n \t\t\tgoto err_out;\n+\n+\t\tbp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id;\n \t\tbp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id;\n-\t\tbnxt_set_db(bp, &cpr->cp_db, ring_type, i);\n-\t\tbnxt_db_cq(cpr);\n \n \t\tbnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id);\n \n@@ -434,38 +470,12 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)\n \t\t\t\tgoto err_out;\n \t\t}\n \n-\t\t/* Rx ring */\n-\t\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n-\t\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, i,\n-\t\t\t\t\t cpr->hw_stats_ctx_id,\n-\t\t\t\t\t cp_ring->fw_ring_id);\n-\t\tif (rc)\n-\t\t\tgoto err_out;\n-\t\trxr->rx_prod = 0;\n-\t\tbp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id;\n-\t\tbnxt_set_db(bp, &rxr->rx_db, ring_type, i);\n-\t\tbnxt_db_write(&rxr->rx_db, rxr->rx_prod);\n-\n-\t\t/* Agg ring */\n-\t\tring = rxr->ag_ring_struct;\n-\n-\t\tif (ring == NULL) {\n-\t\t\tPMD_DRV_LOG(ERR, \"Alloc AGG Ring is NULL!\\n\");\n+\t\tif (bnxt_alloc_rx_ring(bp, i))\n \t\t\tgoto err_out;\n-\t\t}\n \n-\t\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_RX;\n-\t\trc = bnxt_hwrm_ring_alloc(bp, ring, ring_type, map_idx,\n-\t\t\t\t\t HWRM_NA_SIGNATURE,\n-\t\t\t\t\t cp_ring->fw_ring_id);\n-\t\tif (rc)\n+\t\tif (bnxt_alloc_rx_agg_ring(bp, i))\n \t\t\tgoto err_out;\n \n-\t\trxr->ag_prod = 0;\n-\t\tbp->grp_info[i].ag_fw_ring_id = ring->fw_ring_id;\n-\t\tbnxt_set_db(bp, &rxr->ag_db, ring_type, map_idx);\n-\t\tbnxt_db_write(&rxr->ag_db, rxr->ag_prod);\n-\n \t\trxq->rx_buf_use_size = BNXT_MAX_MTU + RTE_ETHER_HDR_LEN +\n \t\t\t\t\tRTE_ETHER_CRC_LEN + (2 * VLAN_TAG_SIZE);\n \t\tif (bnxt_init_one_rx_ring(rxq)) {\n@@ -486,21 +496,14 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp)\n \t\tstruct bnxt_ring *ring = txr->tx_ring_struct;\n \t\tunsigned int idx = i + bp->rx_cp_nr_rings;\n \n-\t\t/* Tx cmpl */\n-\t\tring_type = HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL;\n-\t\trc = bnxt_hwrm_ring_alloc(bp, cp_ring, ring_type, idx,\n-\t\t\t\t\t HWRM_NA_SIGNATURE,\n-\t\t\t\t\t HWRM_NA_SIGNATURE);\n-\t\tif (rc)\n+\t\tif (bnxt_alloc_cmpl_ring(bp, idx, cpr))\n \t\t\tgoto err_out;\n \n-\t\tbnxt_set_db(bp, &cpr->cp_db, ring_type, idx);\n-\t\tbnxt_db_cq(cpr);\n-\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, ring_type, idx,\n-\t\t\t\t\t cpr->hw_stats_ctx_id,\n+\t\trc = bnxt_hwrm_ring_alloc(bp, ring,\n+\t\t\t\t\t ring_type,\n+\t\t\t\t\t idx, cpr->hw_stats_ctx_id,\n \t\t\t\t\t cp_ring->fw_ring_id);\n \t\tif (rc)\n \t\t\tgoto err_out;\n", "prefixes": [ "08/11" ] }{ "id": 54124, "url": "