get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73880,
    "url": "http://patchwork.dpdk.org/api/patches/73880/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200713062828.19626-5-somnath.kotur@broadcom.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20200713062828.19626-5-somnath.kotur@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200713062828.19626-5-somnath.kotur@broadcom.com",
    "date": "2020-07-13T06:28:22",
    "name": "[04/10] net/bnxt: add changes to support 2 table scopes",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "43e27b597db26989de04d38dcf28d79331a00057",
    "submitter": {
        "id": 908,
        "url": "http://patchwork.dpdk.org/api/people/908/?format=api",
        "name": "Somnath Kotur",
        "email": "somnath.kotur@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patchwork.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200713062828.19626-5-somnath.kotur@broadcom.com/mbox/",
    "series": [
        {
            "id": 10978,
            "url": "http://patchwork.dpdk.org/api/series/10978/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10978",
            "date": "2020-07-13T06:28:18",
            "name": "bnxt patches",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/10978/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/73880/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/73880/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 8EAB2A0540;\n\tMon, 13 Jul 2020 08:34:12 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 081E31D419;\n\tMon, 13 Jul 2020 08:33:45 +0200 (CEST)",
            "from relay.smtp.broadcom.com (relay.smtp.broadcom.com\n [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id C894B1C205\n for <dev@dpdk.org>; Mon, 13 Jul 2020 08:33:38 +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 02F8829C661;\n Sun, 12 Jul 2020 23:33:37 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 02F8829C661",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1594622018;\n bh=qr8L6Iiq/3WxCiH2os6GPKEklM8Fuy+MmoloD8MA4Vo=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=tETcbiMYzQ+TGpyuFISj8q9yhQ64s63ehIsP5YJgrwBwPoDWoec9POKLpoCUuwldO\n qIFgJ9I0Q1vBCtjF2acV6OnO10ssN0y0bY8BXK52Z2hGMywEcNvHBylhgXE3JvxADp\n sFqh66RvXjmjEkul4rngXEkurZ7YKKxRzgwvP5DA=",
        "From": "Somnath Kotur <somnath.kotur@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "ferruh.yigit@intel.com",
        "Date": "Mon, 13 Jul 2020 11:58:22 +0530",
        "Message-Id": "<20200713062828.19626-5-somnath.kotur@broadcom.com>",
        "X-Mailer": "git-send-email 2.10.1.613.g2cc2e70",
        "In-Reply-To": "<20200713062828.19626-1-somnath.kotur@broadcom.com>",
        "References": "<20200713062828.19626-1-somnath.kotur@broadcom.com>",
        "Subject": "[dpdk-dev] [PATCH 04/10] net/bnxt: add changes to support 2 table\n\tscopes",
        "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: Farah Smith <farah.smith@broadcom.com>\n\nNeed to remap the table scope ids allocated from HCAPI RM from high\nto low value because for legacy devices a table scope is a set of base\naddresses.  The PCIe addresses must map to a PCIe PF which exists in\nthe hardware.\n\nSigned-off-by: Farah Smith <farah.smith@broadcom.com>\nReviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nReviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>\nSigned-off-by: Somnath Kotur <somnath.kotur@broadcom.com>\n---\n drivers/net/bnxt/tf_core/tf_em_common.c | 106 +++++++++++++++++++++++++++++++-\n drivers/net/bnxt/tf_core/tf_em_common.h |  27 +++++++-\n drivers/net/bnxt/tf_core/tf_em_host.c   |  23 ++-----\n drivers/net/bnxt/tf_core/tf_em_system.c |  19 +-----\n 4 files changed, 137 insertions(+), 38 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c\nindex 65b9abf..10c3f16 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_common.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_common.c\n@@ -44,6 +44,28 @@ static enum tf_mem_type mem_type;\n /** Table scope array */\n struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];\n \n+/** Table scope reversal table\n+ *\n+ * Table scope are allocated from 15 to 0 within HCAPI RM.  Because of the\n+ * association between PFs and legacy table scopes, reverse table scope ids.\n+ * 15 indicates 0, 14 indicates 1, etc... The application will only see the 0\n+ * based number.  The firmware will only use the 0 based number.  Only HCAPI RM\n+ * and Truflow RM believe the number is 15.  When HCAPI RM support allocation\n+ * from low to high is supported, this adjust function can be removed.\n+ */\n+const uint32_t tbl_scope_reverse[TF_NUM_TBL_SCOPE] = {\n+\t15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };\n+\n+static uint32_t\n+tf_tbl_scope_adjust(uint32_t tbl_scope_id)\n+{\n+\tif (tbl_scope_id < TF_NUM_TBL_SCOPE)\n+\t\treturn tbl_scope_reverse[tbl_scope_id];\n+\telse\n+\t\treturn TF_TBL_SCOPE_INVALID;\n+};\n+\n+\n /* API defined in tf_em.h */\n struct tf_tbl_scope_cb *\n tbl_scope_cb_find(uint32_t tbl_scope_id)\n@@ -51,11 +73,17 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)\n \tint i;\n \tstruct tf_rm_is_allocated_parms parms;\n \tint allocated;\n+\tuint32_t rm_tbl_scope_id;\n+\n+\trm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);\n+\n+\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID)\n+\t\treturn NULL;\n \n \t/* Check that id is valid */\n \tparms.rm_db = eem_db[TF_DIR_RX];\n \tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tparms.index = tbl_scope_id;\n+\tparms.index = rm_tbl_scope_id;\n \tparms.allocated = &allocated;\n \n \ti = tf_rm_is_allocated(&parms);\n@@ -71,6 +99,61 @@ tbl_scope_cb_find(uint32_t tbl_scope_id)\n \treturn NULL;\n }\n \n+int tf_tbl_scope_alloc(uint32_t *tbl_scope_id)\n+{\n+\tint rc;\n+\tstruct tf_rm_allocate_parms parms = { 0 };\n+\tuint32_t rm_tbl_scope_id;\n+\tuint32_t usr_tbl_scope_id = TF_TBL_SCOPE_INVALID;\n+\n+\t/* Get Table Scope control block from the session pool */\n+\tparms.rm_db = eem_db[TF_DIR_RX];\n+\tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n+\tparms.index = &rm_tbl_scope_id;\n+\n+\trc = tf_rm_allocate(&parms);\n+\tif (rc) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Failed to allocate table scope rc:%s\\n\",\n+\t\t\t    strerror(-rc));\n+\t\treturn rc;\n+\t}\n+\n+\tusr_tbl_scope_id = tf_tbl_scope_adjust(rm_tbl_scope_id);\n+\n+\tif (usr_tbl_scope_id == TF_TBL_SCOPE_INVALID) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Invalid table scope allocated id:%d\\n\",\n+\t\t\t    (int)rm_tbl_scope_id);\n+\t\treturn -EINVAL;\n+\t}\n+\t*tbl_scope_id = usr_tbl_scope_id;\n+\treturn 0;\n+};\n+\n+int tf_tbl_scope_free(uint32_t tbl_scope_id)\n+{\n+\tstruct tf_rm_free_parms parms = { 0 };\n+\tuint32_t rm_tbl_scope_id;\n+\tuint32_t rc;\n+\n+\trm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id);\n+\n+\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Invalid table scope allocated id:%d\\n\",\n+\t\t\t    (int)tbl_scope_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tparms.rm_db = eem_db[TF_DIR_RX];\n+\tparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n+\tparms.index = rm_tbl_scope_id;\n+\n+\trc = tf_rm_free(&parms);\n+\treturn rc;\n+};\n+\n int\n tf_create_tbl_pool_external(enum tf_dir dir,\n \t\t\t    struct tf_tbl_scope_cb *tbl_scope_cb,\n@@ -706,9 +789,17 @@ tf_insert_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb,\n \n \t\tif (rc) {\n \t\t\tstruct tf_rm_free_parms fparms = { 0 };\n+\t\t\tuint32_t rm_tbl_scope_id;\n \n \t\t\tTFP_DRV_LOG(ERR,\n \t\t\t\t    \"System alloc mmap failed\\n\");\n+\n+\t\t\trm_tbl_scope_id =\n+\t\t\t\ttf_tbl_scope_adjust(parms->tbl_scope_id);\n+\n+\t\t\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID)\n+\t\t\t\treturn -EINVAL;\n+\n \t\t\t/* Free Table control block */\n \t\t\tfparms.rm_db = eem_db[TF_DIR_RX];\n \t\t\tfparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n@@ -1043,13 +1134,24 @@ int tf_tbl_ext_common_set(struct tf *tfp,\n \n \t\tif (rc) {\n \t\t\tstruct tf_rm_free_parms fparms = { 0 };\n+\t\t\tuint32_t rm_tbl_scope_id;\n+\n+\t\t\t/* TODO: support allocation of table scope from\n+\t\t\t * min in HCAPI RM.  For now call adjust function\n+\t\t\t * on value obtained from RM.\n+\t\t\t */\n+\t\t\trm_tbl_scope_id =\n+\t\t\t\ttf_tbl_scope_adjust(parms->tbl_scope_id);\n+\n+\t\t\tif (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID)\n+\t\t\t\treturn -EINVAL;\n \n \t\t\tTFP_DRV_LOG(ERR,\n \t\t\t\t    \"System alloc mmap failed\\n\");\n \t\t\t/* Free Table control block */\n \t\t\tfparms.rm_db = eem_db[TF_DIR_RX];\n \t\t\tfparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\t\t\tfparms.index = parms->tbl_scope_id;\n+\t\t\tfparms.index = rm_tbl_scope_id;\n \t\t\ttf_rm_free(&fparms);\n \t\t\treturn -EINVAL;\n \t\t}\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_common.h b/drivers/net/bnxt/tf_core/tf_em_common.h\nindex fa313c4..f71a487 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_common.h\n+++ b/drivers/net/bnxt/tf_core/tf_em_common.h\n@@ -9,7 +9,6 @@\n #include \"tf_core.h\"\n #include \"tf_session.h\"\n \n-\n /**\n  * Function to search for table scope control block structure\n  * with specified table scope ID.\n@@ -24,6 +23,32 @@\n struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id);\n \n /**\n+ * Table Scope Allocate\n+ *\n+ * Allocate a table scope\n+ *\n+ * [in/out] pointer to tbl_scope_id\n+ *\n+ * Returns:\n+ *  0 - success\n+ *  -EINVAL - error\n+ */\n+int tf_tbl_scope_alloc(uint32_t *tbl_scope_id);\n+\n+/**\n+ * Table Scope Free\n+ *\n+ * Free a table scope\n+ *\n+ * [in] tbl_scope_id to free\n+ *\n+ * Returns:\n+ *  0 - success\n+ *  -EINVAL - error\n+ */\n+int tf_tbl_scope_free(uint32_t tbl_scope_id);\n+\n+/**\n  * Create and initialize a stack to use for action entries\n  *\n  * [in] dir\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c\nindex b5db94f..cfcb12f 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_host.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_host.c\n@@ -374,14 +374,8 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n \tstruct hcapi_cfa_em_table *em_tables;\n \tstruct tf_free_tbl_scope_parms free_parms;\n-\tstruct tf_rm_allocate_parms aparms = { 0 };\n-\tstruct tf_rm_free_parms fparms = { 0 };\n-\n-\t/* Get Table Scope control block from the session pool */\n-\taparms.rm_db = eem_db[TF_DIR_RX];\n-\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\taparms.index = (uint32_t *)&parms->tbl_scope_id;\n-\trc = tf_rm_allocate(&aparms);\n+\n+\trc = tf_tbl_scope_alloc(&parms->tbl_scope_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to allocate table scope\\n\");\n@@ -478,11 +472,7 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms)\n \treturn -EINVAL;\n \n cleanup:\n-\t/* Free Table control block */\n-\tfparms.rm_db = eem_db[TF_DIR_RX];\n-\tfparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tfparms.index = parms->tbl_scope_id;\n-\ttf_rm_free(&fparms);\n+\ttf_tbl_scope_free(parms->tbl_scope_id);\n \treturn -EINVAL;\n }\n \n@@ -493,7 +483,6 @@ tf_em_ext_free(struct tf *tfp,\n \tint rc = 0;\n \tenum tf_dir  dir;\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n-\tstruct tf_rm_free_parms aparms = { 0 };\n \n \ttbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id);\n \n@@ -502,11 +491,7 @@ tf_em_ext_free(struct tf *tfp,\n \t\treturn -EINVAL;\n \t}\n \n-\t/* Free Table control block */\n-\taparms.rm_db = eem_db[TF_DIR_RX];\n-\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\taparms.index = parms->tbl_scope_id;\n-\trc = tf_rm_free(&aparms);\n+\trc = tf_tbl_scope_free(parms->tbl_scope_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to free table scope\\n\");\ndiff --git a/drivers/net/bnxt/tf_core/tf_em_system.c b/drivers/net/bnxt/tf_core/tf_em_system.c\nindex 1c3c702..32ee1ee 100644\n--- a/drivers/net/bnxt/tf_core/tf_em_system.c\n+++ b/drivers/net/bnxt/tf_core/tf_em_system.c\n@@ -364,9 +364,7 @@ tf_em_ext_alloc(struct tf *tfp,\n \tint rc;\n \tstruct tf_session *tfs;\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n-\tstruct tf_rm_allocate_parms aparms = { 0 };\n \tstruct tf_free_tbl_scope_parms free_parms;\n-\tstruct tf_rm_free_parms fparms = { 0 };\n \tint dir;\n \tint i;\n \tstruct hcapi_cfa_em_table *em_tables;\n@@ -382,10 +380,7 @@ tf_em_ext_alloc(struct tf *tfp,\n \t\treturn rc;\n \t}\n \n-\taparms.rm_db = eem_db[TF_DIR_RX];\n-\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\taparms.index = (uint32_t *)&parms->tbl_scope_id;\n-\trc = tf_rm_allocate(&aparms);\n+\trc = tf_tbl_scope_alloc(&parms->tbl_scope_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to allocate table scope\\n\");\n@@ -473,10 +468,7 @@ tf_em_ext_alloc(struct tf *tfp,\n \n cleanup:\n \t/* Free Table control block */\n-\tfparms.rm_db = eem_db[TF_DIR_RX];\n-\tfparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\tfparms.index = parms->tbl_scope_id;\n-\ttf_rm_free(&fparms);\n+\ttf_tbl_scope_free(parms->tbl_scope_id);\n \treturn -EINVAL;\n }\n \n@@ -488,7 +480,6 @@ tf_em_ext_free(struct tf *tfp,\n \tstruct tf_session *tfs;\n \tstruct tf_tbl_scope_cb *tbl_scope_cb;\n \tint dir;\n-\tstruct tf_rm_free_parms aparms = { 0 };\n \n \tTF_CHECK_PARMS2(tfp, parms);\n \n@@ -503,11 +494,7 @@ tf_em_ext_free(struct tf *tfp,\n \n \ttbl_scope_cb = &tbl_scopes[parms->tbl_scope_id];\n \n-\t\t/* Free Table control block */\n-\taparms.rm_db = eem_db[TF_DIR_RX];\n-\taparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE;\n-\taparms.index = parms->tbl_scope_id;\n-\trc = tf_rm_free(&aparms);\n+\trc = tf_tbl_scope_free(parms->tbl_scope_id);\n \tif (rc) {\n \t\tTFP_DRV_LOG(ERR,\n \t\t\t    \"Failed to free table scope\\n\");\n",
    "prefixes": [
        "04/10"
    ]
}