get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73400,
    "url": "https://patches.dpdk.org/api/patches/73400/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200707092244.12791-21-hemant.agrawal@nxp.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": "<20200707092244.12791-21-hemant.agrawal@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200707092244.12791-21-hemant.agrawal@nxp.com",
    "date": "2020-07-07T09:22:35",
    "name": "[v2,20/29] net/dpaa2: define the size of table entry",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "19c4042e60f8400ce8a7b03a4ff4445881c0f9bb",
    "submitter": {
        "id": 477,
        "url": "https://patches.dpdk.org/api/people/477/?format=api",
        "name": "Hemant Agrawal",
        "email": "hemant.agrawal@nxp.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200707092244.12791-21-hemant.agrawal@nxp.com/mbox/",
    "series": [
        {
            "id": 10842,
            "url": "https://patches.dpdk.org/api/series/10842/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10842",
            "date": "2020-07-07T09:22:15",
            "name": "NXP DPAAx enhancements",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/10842/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73400/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/73400/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 F228AA00BE;\n\tTue,  7 Jul 2020 11:31:16 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B68D81DDF4;\n\tTue,  7 Jul 2020 11:27:31 +0200 (CEST)",
            "from inva021.nxp.com (inva021.nxp.com [92.121.34.21])\n by dpdk.org (Postfix) with ESMTP id B2EC21DC93\n for <dev@dpdk.org>; Tue,  7 Jul 2020 11:27:12 +0200 (CEST)",
            "from inva021.nxp.com (localhost [127.0.0.1])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 956F42008E9;\n Tue,  7 Jul 2020 11:27:12 +0200 (CEST)",
            "from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com\n [165.114.16.14])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id AE2EF20060D;\n Tue,  7 Jul 2020 11:27:10 +0200 (CEST)",
            "from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net\n [10.232.133.63])\n by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 720B0402FC;\n Tue,  7 Jul 2020 17:27:08 +0800 (SGT)"
        ],
        "From": "Hemant Agrawal <hemant.agrawal@nxp.com>",
        "To": "dev@dpdk.org",
        "Cc": "ferruh.yigit@intel.com,\n\tJun Yang <jun.yang@nxp.com>",
        "Date": "Tue,  7 Jul 2020 14:52:35 +0530",
        "Message-Id": "<20200707092244.12791-21-hemant.agrawal@nxp.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20200707092244.12791-1-hemant.agrawal@nxp.com>",
        "References": "<20200527132326.1382-1-hemant.agrawal@nxp.com>\n <20200707092244.12791-1-hemant.agrawal@nxp.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Subject": "[dpdk-dev] [PATCH v2 20/29] net/dpaa2: define the size of table\n\tentry",
        "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: Jun Yang <jun.yang@nxp.com>\n\nIf entry size is not bigger than 27, MC alloc one TCAM entry,\notherwise, alloc 2 TCAM entries.\nExtracts size by HW must be not bigger than TCAM entry size(27 or 54).\nSo define the flow entry size as 54.\n\nSigned-off-by: Jun Yang <jun.yang@nxp.com>\n---\n drivers/net/dpaa2/dpaa2_flow.c | 90 ++++++++++++++++++++++------------\n 1 file changed, 60 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c\nindex 760a8a793..bcbd5977a 100644\n--- a/drivers/net/dpaa2/dpaa2_flow.c\n+++ b/drivers/net/dpaa2/dpaa2_flow.c\n@@ -29,6 +29,8 @@\n  */\n int mc_l4_port_identification;\n \n+#define FIXED_ENTRY_SIZE 54\n+\n enum flow_rule_ipaddr_type {\n \tFLOW_NONE_IPADDR,\n \tFLOW_IPV4_ADDR,\n@@ -47,7 +49,8 @@ struct rte_flow {\n \tLIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */\n \tstruct dpni_rule_cfg qos_rule;\n \tstruct dpni_rule_cfg fs_rule;\n-\tuint8_t key_size;\n+\tuint8_t qos_real_key_size;\n+\tuint8_t fs_real_key_size;\n \tuint8_t tc_id; /** Traffic Class ID. */\n \tuint8_t tc_index; /** index within this Traffic Class. */\n \tenum rte_flow_action_type action;\n@@ -478,6 +481,7 @@ dpaa2_flow_rule_data_set(\n \t\t\tprot, field);\n \t\treturn -1;\n \t}\n+\n \tmemcpy((void *)(size_t)(rule->key_iova + offset), key, size);\n \tmemcpy((void *)(size_t)(rule->mask_iova + offset), mask, size);\n \n@@ -523,9 +527,11 @@ _dpaa2_flow_rule_move_ipaddr_tail(\n \t\tlen = NH_FLD_IPV6_ADDR_SIZE;\n \n \tmemcpy(tmp, (char *)key_src, len);\n+\tmemset((char *)key_src, 0, len);\n \tmemcpy((char *)key_dst, tmp, len);\n \n \tmemcpy(tmp, (char *)mask_src, len);\n+\tmemset((char *)mask_src, 0, len);\n \tmemcpy((char *)mask_dst, tmp, len);\n \n \treturn 0;\n@@ -1251,8 +1257,7 @@ dpaa2_configure_flow_generic_ip(\n \n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tlocal_cfg |= (DPAA2_QOS_TABLE_RECONFIGURE |\n-\t\t\t\tDPAA2_QOS_TABLE_IPADDR_EXTRACT);\n+\t\t\tlocal_cfg |= DPAA2_QOS_TABLE_RECONFIGURE;\n \t\t}\n \n \t\tindex = dpaa2_flow_extract_search(\n@@ -1269,8 +1274,7 @@ dpaa2_configure_flow_generic_ip(\n \n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tlocal_cfg |= (DPAA2_FS_TABLE_RECONFIGURE |\n-\t\t\t\tDPAA2_FS_TABLE_IPADDR_EXTRACT);\n+\t\t\tlocal_cfg |= DPAA2_FS_TABLE_RECONFIGURE;\n \t\t}\n \n \t\tif (spec_ipv4)\n@@ -1339,8 +1343,7 @@ dpaa2_configure_flow_generic_ip(\n \n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tlocal_cfg |= (DPAA2_QOS_TABLE_RECONFIGURE |\n-\t\t\t\tDPAA2_QOS_TABLE_IPADDR_EXTRACT);\n+\t\t\tlocal_cfg |= DPAA2_QOS_TABLE_RECONFIGURE;\n \t\t}\n \n \t\tindex = dpaa2_flow_extract_search(\n@@ -1361,8 +1364,7 @@ dpaa2_configure_flow_generic_ip(\n \n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tlocal_cfg |= (DPAA2_FS_TABLE_RECONFIGURE |\n-\t\t\t\tDPAA2_FS_TABLE_IPADDR_EXTRACT);\n+\t\t\tlocal_cfg |= DPAA2_FS_TABLE_RECONFIGURE;\n \t\t}\n \n \t\tif (spec_ipv4)\n@@ -2641,7 +2643,7 @@ dpaa2_flow_entry_update(\n \tchar ipdst_key[NH_FLD_IPV6_ADDR_SIZE];\n \tchar ipsrc_mask[NH_FLD_IPV6_ADDR_SIZE];\n \tchar ipdst_mask[NH_FLD_IPV6_ADDR_SIZE];\n-\tint extend = -1, extend1, size;\n+\tint extend = -1, extend1, size = -1;\n \tuint16_t qos_index;\n \n \twhile (curr) {\n@@ -2696,6 +2698,9 @@ dpaa2_flow_entry_update(\n \t\t\telse\n \t\t\t\textend = extend1;\n \n+\t\t\tRTE_ASSERT((size == NH_FLD_IPV4_ADDR_SIZE) ||\n+\t\t\t\t(size == NH_FLD_IPV6_ADDR_SIZE));\n+\n \t\t\tmemcpy(ipsrc_key,\n \t\t\t\t(char *)(size_t)curr->qos_rule.key_iova +\n \t\t\t\tcurr->ipaddr_rule.qos_ipsrc_offset,\n@@ -2725,6 +2730,9 @@ dpaa2_flow_entry_update(\n \t\t\telse\n \t\t\t\textend = extend1;\n \n+\t\t\tRTE_ASSERT((size == NH_FLD_IPV4_ADDR_SIZE) ||\n+\t\t\t\t(size == NH_FLD_IPV6_ADDR_SIZE));\n+\n \t\t\tmemcpy(ipdst_key,\n \t\t\t\t(char *)(size_t)curr->qos_rule.key_iova +\n \t\t\t\tcurr->ipaddr_rule.qos_ipdst_offset,\n@@ -2745,6 +2753,8 @@ dpaa2_flow_entry_update(\n \t\t}\n \n \t\tif (curr->ipaddr_rule.qos_ipsrc_offset >= 0) {\n+\t\t\tRTE_ASSERT((size == NH_FLD_IPV4_ADDR_SIZE) ||\n+\t\t\t\t(size == NH_FLD_IPV6_ADDR_SIZE));\n \t\t\tmemcpy((char *)(size_t)curr->qos_rule.key_iova +\n \t\t\t\tcurr->ipaddr_rule.qos_ipsrc_offset,\n \t\t\t\tipsrc_key,\n@@ -2755,6 +2765,8 @@ dpaa2_flow_entry_update(\n \t\t\t\tsize);\n \t\t}\n \t\tif (curr->ipaddr_rule.qos_ipdst_offset >= 0) {\n+\t\t\tRTE_ASSERT((size == NH_FLD_IPV4_ADDR_SIZE) ||\n+\t\t\t\t(size == NH_FLD_IPV6_ADDR_SIZE));\n \t\t\tmemcpy((char *)(size_t)curr->qos_rule.key_iova +\n \t\t\t\tcurr->ipaddr_rule.qos_ipdst_offset,\n \t\t\t\tipdst_key,\n@@ -2766,7 +2778,9 @@ dpaa2_flow_entry_update(\n \t\t}\n \n \t\tif (extend >= 0)\n-\t\t\tcurr->qos_rule.key_size += extend;\n+\t\t\tcurr->qos_real_key_size += extend;\n+\n+\t\tcurr->qos_rule.key_size = FIXED_ENTRY_SIZE;\n \n \t\tret = dpni_add_qos_entry(dpni, CMD_PRI_LOW,\n \t\t\t\tpriv->token, &curr->qos_rule,\n@@ -2873,7 +2887,8 @@ dpaa2_flow_entry_update(\n \t\t}\n \n \t\tif (extend >= 0)\n-\t\t\tcurr->fs_rule.key_size += extend;\n+\t\t\tcurr->fs_real_key_size += extend;\n+\t\tcurr->fs_rule.key_size = FIXED_ENTRY_SIZE;\n \n \t\tret = dpni_add_fs_entry(dpni, CMD_PRI_LOW,\n \t\t\t\tpriv->token, curr->tc_id, curr->tc_index,\n@@ -3093,31 +3108,34 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t\tpriv->qos_entries);\n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tflow->qos_rule.key_size = priv->extract\n-\t\t\t\t.qos_key_extract.key_info.key_total_size;\n+\t\t\tflow->qos_rule.key_size = FIXED_ENTRY_SIZE;\n \t\t\tif (flow->ipaddr_rule.ipaddr_type == FLOW_IPV4_ADDR) {\n \t\t\t\tif (flow->ipaddr_rule.qos_ipdst_offset >=\n \t\t\t\t\tflow->ipaddr_rule.qos_ipsrc_offset) {\n-\t\t\t\t\tflow->qos_rule.key_size =\n+\t\t\t\t\tflow->qos_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.qos_ipdst_offset +\n \t\t\t\t\t\tNH_FLD_IPV4_ADDR_SIZE;\n \t\t\t\t} else {\n-\t\t\t\t\tflow->qos_rule.key_size =\n+\t\t\t\t\tflow->qos_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.qos_ipsrc_offset +\n \t\t\t\t\t\tNH_FLD_IPV4_ADDR_SIZE;\n \t\t\t\t}\n-\t\t\t} else if (flow->ipaddr_rule.ipaddr_type == FLOW_IPV6_ADDR) {\n+\t\t\t} else if (flow->ipaddr_rule.ipaddr_type ==\n+\t\t\t\tFLOW_IPV6_ADDR) {\n \t\t\t\tif (flow->ipaddr_rule.qos_ipdst_offset >=\n \t\t\t\t\tflow->ipaddr_rule.qos_ipsrc_offset) {\n-\t\t\t\t\tflow->qos_rule.key_size =\n+\t\t\t\t\tflow->qos_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.qos_ipdst_offset +\n \t\t\t\t\t\tNH_FLD_IPV6_ADDR_SIZE;\n \t\t\t\t} else {\n-\t\t\t\t\tflow->qos_rule.key_size =\n+\t\t\t\t\tflow->qos_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.qos_ipsrc_offset +\n \t\t\t\t\t\tNH_FLD_IPV6_ADDR_SIZE;\n \t\t\t\t}\n \t\t\t}\n+\n+\t\t\tflow->qos_rule.key_size = FIXED_ENTRY_SIZE;\n+\n \t\t\tret = dpni_add_qos_entry(dpni, CMD_PRI_LOW,\n \t\t\t\t\t\tpriv->token, &flow->qos_rule,\n \t\t\t\t\t\tflow->tc_id, qos_index,\n@@ -3134,17 +3152,20 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t\tpriv->fs_entries);\n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tflow->fs_rule.key_size = priv->extract\n-\t\t\t\t\t.tc_key_extract[attr->group].key_info.key_total_size;\n+\n+\t\t\tflow->fs_real_key_size =\n+\t\t\t\tpriv->extract.tc_key_extract[flow->tc_id]\n+\t\t\t\t.key_info.key_total_size;\n+\n \t\t\tif (flow->ipaddr_rule.ipaddr_type ==\n \t\t\t\tFLOW_IPV4_ADDR) {\n \t\t\t\tif (flow->ipaddr_rule.fs_ipdst_offset >=\n \t\t\t\t\tflow->ipaddr_rule.fs_ipsrc_offset) {\n-\t\t\t\t\tflow->fs_rule.key_size =\n+\t\t\t\t\tflow->fs_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.fs_ipdst_offset +\n \t\t\t\t\t\tNH_FLD_IPV4_ADDR_SIZE;\n \t\t\t\t} else {\n-\t\t\t\t\tflow->fs_rule.key_size =\n+\t\t\t\t\tflow->fs_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.fs_ipsrc_offset +\n \t\t\t\t\t\tNH_FLD_IPV4_ADDR_SIZE;\n \t\t\t\t}\n@@ -3152,15 +3173,18 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\tFLOW_IPV6_ADDR) {\n \t\t\t\tif (flow->ipaddr_rule.fs_ipdst_offset >=\n \t\t\t\t\tflow->ipaddr_rule.fs_ipsrc_offset) {\n-\t\t\t\t\tflow->fs_rule.key_size =\n+\t\t\t\t\tflow->fs_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.fs_ipdst_offset +\n \t\t\t\t\t\tNH_FLD_IPV6_ADDR_SIZE;\n \t\t\t\t} else {\n-\t\t\t\t\tflow->fs_rule.key_size =\n+\t\t\t\t\tflow->fs_real_key_size =\n \t\t\t\t\t\tflow->ipaddr_rule.fs_ipsrc_offset +\n \t\t\t\t\t\tNH_FLD_IPV6_ADDR_SIZE;\n \t\t\t\t}\n \t\t\t}\n+\n+\t\t\tflow->fs_rule.key_size = FIXED_ENTRY_SIZE;\n+\n \t\t\tret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token,\n \t\t\t\t\t\tflow->tc_id, flow->tc_index,\n \t\t\t\t\t\t&flow->fs_rule, &action);\n@@ -3259,8 +3283,10 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t\tpriv->qos_entries);\n \t\t\t\treturn -1;\n \t\t\t}\n-\t\t\tflow->qos_rule.key_size =\n+\n+\t\t\tflow->qos_real_key_size =\n \t\t\t  priv->extract.qos_key_extract.key_info.key_total_size;\n+\t\t\tflow->qos_rule.key_size = FIXED_ENTRY_SIZE;\n \t\t\tret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token,\n \t\t\t\t\t\t&flow->qos_rule, flow->tc_id,\n \t\t\t\t\t\tqos_index, 0, 0);\n@@ -3283,11 +3309,15 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t}\n \n \tif (!ret) {\n-\t\tret = dpaa2_flow_entry_update(priv, flow->tc_id);\n-\t\tif (ret) {\n-\t\t\tDPAA2_PMD_ERR(\"Flow entry update failed.\");\n+\t\tif (is_keycfg_configured &\n+\t\t\t(DPAA2_QOS_TABLE_RECONFIGURE |\n+\t\t\tDPAA2_FS_TABLE_RECONFIGURE)) {\n+\t\t\tret = dpaa2_flow_entry_update(priv, flow->tc_id);\n+\t\t\tif (ret) {\n+\t\t\t\tDPAA2_PMD_ERR(\"Flow entry update failed.\");\n \n-\t\t\treturn -1;\n+\t\t\t\treturn -1;\n+\t\t\t}\n \t\t}\n \t\t/* New rules are inserted. */\n \t\tif (!curr) {\n",
    "prefixes": [
        "v2",
        "20/29"
    ]
}