Show a patch.

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

{
    "id": 74644,
    "url": "https://patches.dpdk.org/api/patches/74644/",
    "web_url": "https://patches.dpdk.org/patch/74644/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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": "<20200723111329.21855-5-somnath.kotur@broadcom.com>",
    "date": "2020-07-23T11:13:13",
    "name": "[04/20] net/bnxt: ulp mapper changes to use tcam search",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d6ebf1b7bfa96253c2dea6931173be9d6a7ce909",
    "submitter": {
        "id": 908,
        "url": "https://patches.dpdk.org/api/people/908/",
        "name": "Somnath Kotur",
        "email": "somnath.kotur@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "https://patches.dpdk.org/api/users/1766/",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "https://patches.dpdk.org/patch/74644/mbox/",
    "series": [
        {
            "id": 11252,
            "url": "https://patches.dpdk.org/api/series/11252/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11252",
            "date": "2020-07-23T11:13:09",
            "name": "bnxt patches",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/11252/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74644/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/74644/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "References": "<20200723111329.21855-1-somnath.kotur@broadcom.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com E63051BDA04",
        "Subject": "[dpdk-dev] [PATCH 04/20] net/bnxt: ulp mapper changes to use tcam\n\tsearch",
        "Sender": "\"dev\" <dev-bounces@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 D1784A0521;\n\tThu, 23 Jul 2020 13:19:35 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1C00F1C010;\n\tThu, 23 Jul 2020 13:19:13 +0200 (CEST)",
            "from relay.smtp.broadcom.com (relay.smtp.broadcom.com\n [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 95B5A1BFD7\n for <dev@dpdk.org>; Thu, 23 Jul 2020 13:18:59 +0200 (CEST)",
            "from dhcp-10-123-153-55.dhcp.broadcom.net\n (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55])\n by relay.smtp.broadcom.com (Postfix) with ESMTP id E63051BDA04;\n Thu, 23 Jul 2020 04:18:58 -0700 (PDT)"
        ],
        "To": "dev@dpdk.org",
        "X-Mailer": "git-send-email 2.10.1.613.g2cc2e70",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1595503139;\n bh=QOrH/iPAa7/lhlAVxZSIrdBsSMl3FiRrWBeT4pk3l+o=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=RqhgDDsFEHQ+MIp/+YqaR3cZ4+V2me4REXNujMnYqU5B1AvnltGZTLJSGw0R+WyOD\n eTCY5pSV1bBonDYY3hiYLBMMirZJC9wnSPwxncCD/RJb3oUaWCv6/4tf27qi0ps4n5\n 853+TLIjRHRIiZZ/VTimYMb9TOCUiL3+07zI4rew=",
        "Date": "Thu, 23 Jul 2020 16:43:13 +0530",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "From": "Somnath Kotur <somnath.kotur@broadcom.com>",
        "In-Reply-To": "<20200723111329.21855-1-somnath.kotur@broadcom.com>",
        "Cc": "ferruh.yigit@intel.com",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200723111329.21855-5-somnath.kotur@broadcom.com>",
        "Return-Path": "<dev-bounces@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>\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 6a727ed..2d3373d 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": [
        "04/20"
    ]
}