Show a patch.

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

{
    "id": 74714,
    "url": "https://patches.dpdk.org/api/patches/74714/?format=api",
    "web_url": "https://patches.dpdk.org/patch/74714/",
    "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"
    },
    "msgid": "<20200724053235.71069-5-ajit.khaparde@broadcom.com>",
    "date": "2020-07-24T05:32:17",
    "name": "[v3,04/22] net/bnxt: modify ulp mapper to use tcam search",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d6ebf1b7bfa96253c2dea6931173be9d6a7ce909",
    "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/patch/74714/mbox/",
    "series": [
        {
            "id": 11269,
            "url": "https://patches.dpdk.org/api/series/11269/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11269",
            "date": "2020-07-24T05:32:13",
            "name": "bnxt patches",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/11269/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74714/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74714/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "References": "<20200723115639.22357-1-somnath.kotur@broadcom.com>\n <20200724053235.71069-1-ajit.khaparde@broadcom.com>",
        "X-Mailman-Version": "2.1.15",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "X-Relaying-Domain": "broadcom.com",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Message-Id": "<20200724053235.71069-5-ajit.khaparde@broadcom.com>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "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=Ezz5kyK+ncR9csKqWKX/YsazdKUrm9sMjW5tGg+ACbg=;\n b=ky1GX6U7oxEwGhe9UAjf6qr0pMSXXKadSpW1t9Akyso42GxBe//g/37f9ZcsTVYCnw\n 3qA0Oa6d4dKH/LLs/JU8u4ivTQnCwa3NRKT16fAyQyk+bAjfA3mlO6xof2t0PjMzE1Q3\n sOWTgc/mu4aVTjjAwLiW1KXv6phCOcFZvBfx79oCUiTysfWvTQP4PkscrAojY+9ZOBs/\n Fd95bnXFYdl5PFW3pOOiTQYl1KlJYwPBREN1loyDfxfjz5gJkQ6MSMQkxAG1+vJPNF+u\n PIw9yLD+YqNGz0lJjkKZI6h2OQFWFc4khQBgCbUKzvJqD6dysxfrgDursZ66ntz5bK6g\n mH8A==",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A77E9A0518;\n\tFri, 24 Jul 2020 07:33:31 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id DDA551C06D;\n\tFri, 24 Jul 2020 07:33:11 +0200 (CEST)",
            "from mail-vs1-f97.google.com (mail-vs1-f97.google.com\n [209.85.217.97]) by dpdk.org (Postfix) with ESMTP id 56EB91C067\n for <dev@dpdk.org>; Fri, 24 Jul 2020 07:33:01 +0200 (CEST)",
            "by mail-vs1-f97.google.com with SMTP id p25so4304968vsg.4\n for <dev@dpdk.org>; Thu, 23 Jul 2020 22:33:01 -0700 (PDT)",
            "from localhost.localdomain ([192.19.223.252])\n by smtp-relay.gmail.com with ESMTPS id h17sm592840vsk.0.2020.07.23.22.32.57\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 23 Jul 2020 22:33:00 -0700 (PDT)"
        ],
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "X-Received": "by 2002:a67:d599:: with SMTP id m25mr6768979vsj.149.1595568780499;\n Thu, 23 Jul 2020 22:33:00 -0700 (PDT)",
        "Subject": "[dpdk-dev] [PATCH v3 04/22] net/bnxt: modify ulp mapper to use tcam\n\tsearch",
        "Precedence": "list",
        "X-Gm-Message-State": "AOAM530UaOnxFn74vY0Z/3KpI+6aGo/0EKnZ1dUolRJIT9SH0EZB3+PL\n HJYmaAXN6Lvvlu2J/2D3rTLtxl2ZT08feHUjdW1vTG26OA2aThQ2xisJtnfWW9NQLYhUsQDDYGU\n SvpA8EH08mFzFLau3syr03MI6bkbebr/cWD6lRcbv/sINUzaFIUooARJ1sgQYY1ZQf+bmRvhLXO\n ehbA==",
        "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:content-transfer-encoding;\n bh=Ezz5kyK+ncR9csKqWKX/YsazdKUrm9sMjW5tGg+ACbg=;\n b=RErMwo77t48fB78G9e1/75aqctg6NrfG+/0gMCuWu8NZW2Vk3xps4X+2kJWWpa5GSD\n drzJt6gJtYBgkKXH9d4+ltIp9hhGivIm9kdPU36GBIVSs3gnOoHze1R9kef76zBDh2io\n 7QG9orCgrUSnAspOmTMQ2iZNAgPeSbg99VX0Q=",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Date": "Thu, 23 Jul 2020 22:32:17 -0700",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Google-Smtp-Source": "\n ABdhPJyOmZMujGevv/JQMkrNfUKb6L4gdgtHceZTLOeAqCi50CZNfQPzDysn5OWsx9w8YTZw7yvFIIzRm7Rv",
        "Cc": "ferruh.yigit@intel.com, Mike Baucom <michael.baucom@broadcom.com>,\n Kishore Padmanabha <kishore.padmanabha@broadcom.com>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "In-Reply-To": "<20200724053235.71069-1-ajit.khaparde@broadcom.com>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "To": "dev@dpdk.org"
    },
    "content": "From: Mike Baucom <michael.baucom@broadcom.com>\n\nmodified ulp mappper to use the new tf_search_tcam_entry API.\nWhen search before allocation is requested, mapper calls\ntc_search_tcam_entry with the alloc flag.\n\n- On HIT, the result and tcam index is returned.\n- On MISS, the tcam index is returned but the result is\ncreated and the tcam entry is set.\n- On REJECT, the flow request is rejected.\n\nSigned-off-by: Mike Baucom <michael.baucom@broadcom.com>\nReviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/ulp_mapper.c | 106 ++++++++++++++++++---------\n 1 file changed, 71 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\nindex 6a727ed34..2d3373df2 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c\n@@ -690,7 +690,7 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms,\n {\n \tstruct ulp_flow_db_res_params\tfid_parms;\n \tuint64_t id = 0;\n-\tuint32_t idx;\n+\tuint32_t idx = 0;\n \tstruct tf_search_identifier_parms sparms = { 0 };\n \tstruct tf_free_identifier_parms free_parms = { 0 };\n \tstruct tf *tfp;\n@@ -1292,12 +1292,13 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \tstruct tf *tfp;\n \tint32_t rc, trc;\n \tstruct tf_alloc_tcam_entry_parms aparms\t\t= { 0 };\n+\tstruct tf_search_tcam_entry_parms searchparms   = { 0 };\n \tstruct tf_set_tcam_entry_parms sparms\t\t= { 0 };\n \tstruct ulp_flow_db_res_params\tfid_parms\t= { 0 };\n \tstruct tf_free_tcam_entry_parms free_parms\t= { 0 };\n \tuint32_t hit = 0;\n \tuint16_t tmplen = 0;\n-\tstruct ulp_blob res_blob;\n+\tuint16_t idx;\n \n \t/* Skip this if was handled by the cache. */\n \tif (parms->tcam_tbl_opc == BNXT_ULP_MAPPER_TCAM_TBL_OPC_CACHE_SKIP) {\n@@ -1352,37 +1353,72 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \t\t}\n \t}\n \n-\taparms.dir\t\t= tbl->direction;\n-\taparms.tcam_tbl_type\t= tbl->resource_type;\n-\taparms.search_enable\t= tbl->srch_b4_alloc;\n-\taparms.key_sz_in_bits\t= tbl->key_bit_size;\n-\taparms.key\t\t= ulp_blob_data_get(&key, &tmplen);\n-\tif (tbl->key_bit_size != tmplen) {\n-\t\tBNXT_TF_DBG(ERR, \"Key len (%d) != Expected (%d)\\n\",\n-\t\t\t    tmplen, tbl->key_bit_size);\n-\t\treturn -EINVAL;\n-\t}\n+\tif (!tbl->srch_b4_alloc) {\n+\t\t/*\n+\t\t * No search for re-use is requested, so simply allocate the\n+\t\t * tcam index.\n+\t\t */\n+\t\taparms.dir\t\t= tbl->direction;\n+\t\taparms.tcam_tbl_type\t= tbl->resource_type;\n+\t\taparms.search_enable\t= tbl->srch_b4_alloc;\n+\t\taparms.key_sz_in_bits\t= tbl->key_bit_size;\n+\t\taparms.key\t\t= ulp_blob_data_get(&key, &tmplen);\n+\t\tif (tbl->key_bit_size != tmplen) {\n+\t\t\tBNXT_TF_DBG(ERR, \"Key len (%d) != Expected (%d)\\n\",\n+\t\t\t\t    tmplen, tbl->key_bit_size);\n+\t\t\treturn -EINVAL;\n+\t\t}\n \n-\taparms.mask\t\t= ulp_blob_data_get(&mask, &tmplen);\n-\tif (tbl->key_bit_size != tmplen) {\n-\t\tBNXT_TF_DBG(ERR, \"Mask len (%d) != Expected (%d)\\n\",\n-\t\t\t    tmplen, tbl->key_bit_size);\n-\t\treturn -EINVAL;\n-\t}\n+\t\taparms.mask\t\t= ulp_blob_data_get(&mask, &tmplen);\n+\t\tif (tbl->key_bit_size != tmplen) {\n+\t\t\tBNXT_TF_DBG(ERR, \"Mask len (%d) != Expected (%d)\\n\",\n+\t\t\t\t    tmplen, tbl->key_bit_size);\n+\t\t\treturn -EINVAL;\n+\t\t}\n \n-\taparms.priority\t\t= tbl->priority;\n+\t\taparms.priority\t\t= tbl->priority;\n \n-\t/*\n-\t * All failures after this succeeds require the entry to be freed.\n-\t * cannot return directly on failure, but needs to goto error\n-\t */\n-\trc = tf_alloc_tcam_entry(tfp, &aparms);\n-\tif (rc) {\n-\t\tBNXT_TF_DBG(ERR, \"tcam alloc failed rc=%d.\\n\", rc);\n-\t\treturn rc;\n-\t}\n+\t\t/*\n+\t\t * All failures after this succeeds require the entry to be\n+\t\t * freed. cannot return directly on failure, but needs to goto\n+\t\t * error.\n+\t\t */\n+\t\trc = tf_alloc_tcam_entry(tfp, &aparms);\n+\t\tif (rc) {\n+\t\t\tBNXT_TF_DBG(ERR, \"tcam alloc failed rc=%d.\\n\", rc);\n+\t\t\treturn rc;\n+\t\t}\n+\t\tidx = aparms.idx;\n+\t\thit = aparms.hit;\n+\t} else {\n+\t\t/*\n+\t\t * Searching before allocation to see if we already have an\n+\t\t * entry.  This allows re-use of a constrained resource.\n+\t\t */\n+\t\tsearchparms.dir = tbl->direction;\n+\t\tsearchparms.tcam_tbl_type = tbl->resource_type;\n+\t\tsearchparms.key = ulp_blob_data_get(&key, &tmplen);\n+\t\tsearchparms.key_sz_in_bits = tbl->key_bit_size;\n+\t\tsearchparms.mask = ulp_blob_data_get(&mask, &tmplen);\n+\t\tsearchparms.priority = tbl->priority;\n+\t\tsearchparms.alloc = 1;\n+\t\tsearchparms.result = ulp_blob_data_get(&data, &tmplen);\n+\t\tsearchparms.result_sz_in_bits = tbl->result_bit_size;\n+\n+\t\trc = tf_search_tcam_entry(tfp, &searchparms);\n+\t\tif (rc) {\n+\t\t\tBNXT_TF_DBG(ERR, \"tcam search failed rc=%d\\n\", rc);\n+\t\t\treturn rc;\n+\t\t}\n \n-\thit = aparms.hit;\n+\t\t/* Successful search, check the result */\n+\t\tif (searchparms.search_status == REJECT) {\n+\t\t\tBNXT_TF_DBG(ERR, \"tcam alloc rejected\\n\");\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\t\tidx = searchparms.idx;\n+\t\thit = searchparms.hit;\n+\t}\n \n \t/* Build the result */\n \tif (!tbl->srch_b4_alloc || !hit) {\n@@ -1430,9 +1466,9 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \t\t\t}\n \t\t}\n \n-\t\tsparms.dir\t\t= aparms.dir;\n-\t\tsparms.tcam_tbl_type\t= aparms.tcam_tbl_type;\n-\t\tsparms.idx\t\t= aparms.idx;\n+\t\tsparms.dir\t\t= tbl->direction;\n+\t\tsparms.tcam_tbl_type\t= tbl->resource_type;\n+\t\tsparms.idx\t\t= idx;\n \t\t/* Already verified the key/mask lengths */\n \t\tsparms.key\t\t= ulp_blob_data_get(&key, &tmplen);\n \t\tsparms.mask\t\t= ulp_blob_data_get(&mask, &tmplen);\n@@ -1464,7 +1500,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \t\t\t\trc = -EINVAL;\n \t\t\t\tgoto error;\n \t\t\t}\n-\t\t\tparms->cache_ptr->tcam_idx = aparms.idx;\n+\t\t\tparms->cache_ptr->tcam_idx = idx;\n \t\t}\n \n \t\t/* Mark action */\n@@ -1483,7 +1519,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \t\tidents = ulp_mapper_ident_fields_get(tbl, &num_idents);\n \t\tfor (i = 0; i < num_idents; i++) {\n \t\t\trc = ulp_mapper_ident_extract(parms, tbl,\n-\t\t\t\t\t\t      &idents[i], &res_blob);\n+\t\t\t\t\t\t      &idents[i], &data);\n \t\t\tif (rc) {\n \t\t\t\tBNXT_TF_DBG(ERR,\n \t\t\t\t\t    \"Error in ident extraction\\n\");\n@@ -1501,7 +1537,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,\n \t\tfid_parms.resource_func\t= tbl->resource_func;\n \t\tfid_parms.resource_type\t= tbl->resource_type;\n \t\tfid_parms.critical_resource = tbl->critical_resource;\n-\t\tfid_parms.resource_hndl\t= aparms.idx;\n+\t\tfid_parms.resource_hndl\t= idx;\n \t\trc = ulp_flow_db_resource_add(parms->ulp_ctx,\n \t\t\t\t\t      parms->tbl_idx,\n \t\t\t\t\t      parms->fid,\n",
    "prefixes": [
        "v3",
        "04/22"
    ]
}