get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 72333,
    "url": "https://patches.dpdk.org/api/patches/72333/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200627100050.19688-17-ajit.khaparde@broadcom.com/",
    "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",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200627100050.19688-17-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200627100050.19688-17-ajit.khaparde@broadcom.com",
    "date": "2020-06-27T10:00:41",
    "name": "[v4,16/25] net/bnxt: flow db API to get VF rep action record",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8ead4dc942fa3eede4cc7e15c2c2ecfc44ea1bd3",
    "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/project/dpdk/patch/20200627100050.19688-17-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10645,
            "url": "https://patches.dpdk.org/api/series/10645/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10645",
            "date": "2020-06-27T10:00:25",
            "name": "bnxt patches",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/10645/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/72333/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/72333/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 EE3D3A0522;\n\tSat, 27 Jun 2020 12:03:50 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1A1701C0B4;\n\tSat, 27 Jun 2020 12:01:36 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com\n [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 147941BF9C\n for <dev@dpdk.org>; Sat, 27 Jun 2020 12:01:02 +0200 (CEST)",
            "from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net\n [10.75.242.48])\n by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 1654A30C103;\n Sat, 27 Jun 2020 03:01:01 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id 62D4A140092;\n Sat, 27 Jun 2020 03:01:00 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 1654A30C103",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1593252061;\n bh=YX7LFqlCiOum9EwVQMLc3ZcAcwKvPArYxfmau6LTVIU=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=KLCOFk+cj6o1Fp5bJLJjaIeUqqZkd1aGFBcOlRrt7xtVs0/qwBCfXdqrg6YqidKYu\n yVqflOYzBmCUgryTM7gSE0MMzebV+8AmtlJrNKat1jAy6Z/UlZ9/oY6IoDM9uqAtIY\n BbJD1XKDgsB/OMPvLCP3kr9aa45ovwO8Yv5t02PY=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Kishore Padmanabha <kishore.padmanabha@broadcom.com>,\n Somnath Kotur <somnath.kotur@broadcom.com>,\n Mike Baucom <michael.baucom@broadcom.com>",
        "Date": "Sat, 27 Jun 2020 03:00:41 -0700",
        "Message-Id": "<20200627100050.19688-17-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20200627100050.19688-1-ajit.khaparde@broadcom.com>",
        "References": "<20200612125024.15989-1-somnath.kotur@broadcom.com>\n <20200627100050.19688-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 16/25] net/bnxt: flow db API to get VF rep\n\taction record",
        "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: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\n\nAdded flow db api to get the vf representor action\nrecord for a given flow.\n\nSigned-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nSigned-off-by: Somnath Kotur <somnath.kotur@broadcom.com>\nReviewed-by: Mike Baucom <michael.baucom@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 200 ++++++++++++++++++++++++--\n drivers/net/bnxt/tf_ulp/ulp_flow_db.h |  25 ++++\n 2 files changed, 212 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\nindex 30a809a8d..fc4c4da9c 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c\n@@ -53,7 +53,7 @@ ulp_flow_db_active_flow_set(struct bnxt_ulp_flow_tbl\t*flow_tbl,\n \n /*\n  * Helper function to allocate the flow table and initialize\n- *  is set.No validation being done in this function.\n+ * is set.No validation being done in this function.\n  *\n  * flow_tbl [in] Ptr to flow table\n  * idx [in] The index to bit to be set or reset.\n@@ -71,6 +71,19 @@ ulp_flow_db_active_flow_is_set(struct bnxt_ulp_flow_tbl\t*flow_tbl,\n \t\t\t\t    idx);\n }\n \n+static uint8_t\n+ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info)\n+{\n+\tuint8_t func;\n+\n+\tfunc = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >>\n+\t\t ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER);\n+\t/* The reource func is split into upper and lower */\n+\tif (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)\n+\t\treturn (func | res_info->resource_func_lower);\n+\treturn func;\n+}\n+\n /*\n  * Helper function to copy the resource params to resource info\n  *  No validation being done in this function.\n@@ -124,23 +137,13 @@ static void\n ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,\n \t\t\t       struct ulp_flow_db_res_params *params)\n {\n-\tuint8_t resource_func_upper;\n-\n \tmemset(params, 0, sizeof(struct ulp_flow_db_res_params));\n \tparams->direction = ((resource_info->nxt_resource_idx &\n \t\t\t\t ULP_FLOW_DB_RES_DIR_MASK) >>\n \t\t\t\t ULP_FLOW_DB_RES_DIR_BIT);\n-\tresource_func_upper = (((resource_info->nxt_resource_idx &\n-\t\t\t\tULP_FLOW_DB_RES_FUNC_MASK) >>\n-\t\t\t       ULP_FLOW_DB_RES_FUNC_BITS) <<\n-\t\t\t       ULP_FLOW_DB_RES_FUNC_UPPER);\n \n-\t/* The reource func is split into upper and lower */\n-\tif (resource_func_upper & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)\n-\t\tparams->resource_func = (resource_func_upper |\n-\t\t\t\t\t resource_info->resource_func_lower);\n-\telse\n-\t\tparams->resource_func = resource_func_upper;\n+\t/* use the helper function to get the resource func */\n+\tparams->resource_func = ulp_flow_db_resource_func_get(resource_info);\n \n \tif (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {\n \t\tparams->resource_hndl = resource_info->resource_em_handle;\n@@ -852,3 +855,174 @@ ulp_flow_db_validate_flow_func(struct bnxt_ulp_context *ulp_ctx,\n \n \treturn false;\n }\n+\n+/*\n+ * Internal api to traverse the resource list within a flow\n+ * and match a resource based on resource func and resource\n+ * sub type. This api should be used only for resources that\n+ * are unique and do not have multiple instances of resource\n+ * func and sub type combination since it will return only\n+ * the first match.\n+ */\n+static int32_t\n+ulp_flow_db_resource_hndl_get(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t      enum bnxt_ulp_flow_db_tables tbl_idx,\n+\t\t\t      uint32_t flow_id,\n+\t\t\t      uint32_t resource_func,\n+\t\t\t      uint32_t res_subtype,\n+\t\t\t      uint64_t *res_hndl)\n+{\n+\tstruct bnxt_ulp_flow_db *flow_db;\n+\tstruct bnxt_ulp_flow_tbl *flow_tbl;\n+\tstruct ulp_fdb_resource_info *fid_res;\n+\tuint32_t res_id;\n+\n+\tflow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctx);\n+\tif (!flow_db) {\n+\t\tBNXT_TF_DBG(ERR, \"Flow database not found\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tflow_tbl = &flow_db->flow_tbl[tbl_idx];\n+\n+\t/* check for limits of fid */\n+\tif (flow_id >= flow_tbl->num_flows || !flow_id) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid flow index\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* check if the flow is active or not */\n+\tif (!ulp_flow_db_active_flow_is_set(flow_tbl, flow_id)) {\n+\t\tBNXT_TF_DBG(ERR, \"flow does not exist\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\t/* Iterate the resource to get the resource handle */\n+\tres_id =  flow_id;\n+\twhile (res_id) {\n+\t\tfid_res = &flow_tbl->flow_resources[res_id];\n+\t\tif (ulp_flow_db_resource_func_get(fid_res) == resource_func) {\n+\t\t\tif (resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {\n+\t\t\t\tif (res_subtype == fid_res->resource_sub_type) {\n+\t\t\t\t\t*res_hndl = fid_res->resource_hndl;\n+\t\t\t\t\treturn 0;\n+\t\t\t\t}\n+\n+\t\t\t} else if (resource_func ==\n+\t\t\t\t   BNXT_ULP_RESOURCE_FUNC_EM_TABLE){\n+\t\t\t\t*res_hndl = fid_res->resource_em_handle;\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\t\t}\n+\t\tres_id = 0;\n+\t\tULP_FLOW_DB_RES_NXT_SET(res_id, fid_res->nxt_resource_idx);\n+\t}\n+\treturn -ENOENT;\n+}\n+\n+/*\n+ * Api to get the cfa action pointer from a flow.\n+ *\n+ * ulp_ctxt [in] Ptr to ulp context\n+ * flow_id [in] flow id\n+ * cfa_action [out] The resource handle stored in the flow database\n+ *\n+ * returns 0 on success\n+ */\n+int32_t\n+ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t\t   uint32_t flow_id,\n+\t\t\t\t   uint32_t *cfa_action)\n+{\n+\tuint8_t sub_type = BNXT_ULP_RESOURCE_SUB_TYPE_INDEX_TYPE_VFR_ACT_IDX;\n+\tuint64_t hndl;\n+\tint32_t rc;\n+\n+\trc = ulp_flow_db_resource_hndl_get(ulp_ctx,\n+\t\t\t\t\t   BNXT_ULP_DEFAULT_FLOW_TABLE,\n+\t\t\t\t\t   flow_id,\n+\t\t\t\t\t   BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE,\n+\t\t\t\t\t   sub_type, &hndl);\n+\tif (rc) {\n+\t\tBNXT_TF_DBG(ERR, \"CFA Action ptr not found for flow id %u\\n\",\n+\t\t\t    flow_id);\n+\t\treturn -ENOENT;\n+\t}\n+\t*cfa_action = hndl;\n+\treturn 0;\n+}\n+\n+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG\n+/*\n+ * Dump the entry details\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ *\n+ * returns none\n+ */\n+static void ulp_flow_db_res_dump(struct ulp_fdb_resource_info\t*r,\n+\t\t\t\t uint32_t\t*nxt_res)\n+{\n+\tuint8_t res_func = ulp_flow_db_resource_func_get(r);\n+\n+\tBNXT_TF_DBG(DEBUG, \"Resource func = %x, nxt_resource_idx = %x\\n\",\n+\t\t    res_func, (ULP_FLOW_DB_RES_NXT_MASK & r->nxt_resource_idx));\n+\tif (res_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE)\n+\t\tBNXT_TF_DBG(DEBUG, \"EM Handle = 0x%016\" PRIX64 \"\\n\",\n+\t\t\t    r->resource_em_handle);\n+\telse\n+\t\tBNXT_TF_DBG(DEBUG, \"Handle = 0x%08x\\n\", r->resource_hndl);\n+\n+\t*nxt_res = 0;\n+\tULP_FLOW_DB_RES_NXT_SET(*nxt_res,\n+\t\t\t\tr->nxt_resource_idx);\n+}\n+\n+/*\n+ * Dump the flow database entry details\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ *\n+ * returns none\n+ */\n+int32_t\tulp_flow_db_debug_dump(struct bnxt_ulp_context\t*ulp_ctxt)\n+{\n+\tstruct bnxt_ulp_flow_db\t\t*flow_db;\n+\tstruct bnxt_ulp_flow_tbl\t*flow_tbl;\n+\tstruct ulp_fdb_resource_info\t*r;\n+\tuint32_t\t\t\tnxt_res = 0;\n+\tenum bnxt_ulp_flow_db_tables\ttbl_idx;\n+\tuint32_t\t\t\tfid;\n+\n+\tif (!ulp_ctxt || !ulp_ctxt->cfg_data) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tflow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);\n+\tif (!flow_db) {\n+\t\tBNXT_TF_DBG(ERR, \"Invalid Arguments\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tfor (tbl_idx = 0; tbl_idx < BNXT_ULP_FLOW_TABLE_MAX; tbl_idx++) {\n+\t\tflow_tbl = &flow_db->flow_tbl[tbl_idx];\n+\t\tBNXT_TF_DBG(DEBUG, \"Dump Tbl index = %u, flows = %u:%u\\n\",\n+\t\t\t    tbl_idx, flow_tbl->num_flows,\n+\t\t\t    flow_tbl->num_resources);\n+\t\tBNXT_TF_DBG(DEBUG, \"Head_index = %u, Tail_index = %u\\n\",\n+\t\t\t    flow_tbl->head_index, flow_tbl->tail_index);\n+\t\tfor (fid = 0; fid < flow_tbl->num_flows; fid++) {\n+\t\t\tif (ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {\n+\t\t\t\tBNXT_TF_DBG(DEBUG, \"fid = %u\\n\", fid);\n+\t\t\t\t/* iterate the resource */\n+\t\t\t\tnxt_res = fid;\n+\t\t\t\tdo {\n+\t\t\t\t\tr = &flow_tbl->flow_resources[nxt_res];\n+\t\t\t\t\tulp_flow_db_res_dump(r, &nxt_res);\n+\t\t\t\t} while (nxt_res);\n+\t\t\t}\n+\t\t}\n+\t\tBNXT_TF_DBG(DEBUG, \"Done.\\n\");\n+\t}\n+\treturn 0;\n+}\n+#endif\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\nindex 9037dc5f5..357a589a9 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h\n@@ -222,4 +222,29 @@ ulp_flow_db_validate_flow_func(struct bnxt_ulp_context *ulp_ctx,\n \t\t\t       uint32_t flow_id,\n \t\t\t       uint32_t func_id);\n \n+/*\n+ * Api to get the cfa action pointer from a flow.\n+ *\n+ * ulp_ctxt [in] Ptr to ulp context\n+ * flow_id [in] flow id\n+ * cfa_action [out] The resource handle stored in the flow database\n+ *\n+ * returns 0 on success\n+ */\n+int32_t\n+ulp_default_flow_db_cfa_action_get(struct bnxt_ulp_context *ulp_ctx,\n+\t\t\t\t   uint32_t flow_id,\n+\t\t\t\t   uint32_t *cfa_action);\n+\n+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG\n+/*\n+ * Dump the flow database entry details\n+ *\n+ * ulp_ctxt [in] Ptr to ulp_context\n+ *\n+ * returns none\n+ */\n+int32_t\tulp_flow_db_debug_dump(struct bnxt_ulp_context\t*ulp_ctxt);\n+#endif\n+\n #endif /* _ULP_FLOW_DB_H_ */\n",
    "prefixes": [
        "v4",
        "16/25"
    ]
}