get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 73399,
    "url": "https://patches.dpdk.org/api/patches/73399/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200707092244.12791-20-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-20-hemant.agrawal@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200707092244.12791-20-hemant.agrawal@nxp.com",
    "date": "2020-07-07T09:22:34",
    "name": "[v2,19/29] net/dpaa2: support QoS or FS table entry indexing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ea925399fb738004667c2ce698ac409696aa2b87",
    "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-20-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/73399/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73399/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 33C0EA00BE;\n\tTue,  7 Jul 2020 11:31:04 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 5AA2A1DDE8;\n\tTue,  7 Jul 2020 11:27:29 +0200 (CEST)",
            "from inva020.nxp.com (inva020.nxp.com [92.121.34.13])\n by dpdk.org (Postfix) with ESMTP id 0DA151DD24\n for <dev@dpdk.org>; Tue,  7 Jul 2020 11:27:12 +0200 (CEST)",
            "from inva020.nxp.com (localhost [127.0.0.1])\n by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E46151A0A57;\n Tue,  7 Jul 2020 11:27:11 +0200 (CEST)",
            "from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com\n [165.114.16.14])\n by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0741A1A0A4E;\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 C0C99402FA;\n Tue,  7 Jul 2020 17:27:07 +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:34 +0530",
        "Message-Id": "<20200707092244.12791-20-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 19/29] net/dpaa2: support QoS or FS table\n\tentry indexing",
        "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\nCalculate QoS/FS entry index by group and priority of flow.\n\n1)The less index of entry, the higher priority of flow.\n2)Verify if the flow with same group and priority has been added before\n  creating flow.\n\nSigned-off-by: Jun Yang <jun.yang@nxp.com>\n---\n drivers/net/dpaa2/dpaa2_ethdev.c |   4 +\n drivers/net/dpaa2/dpaa2_ethdev.h |   5 +-\n drivers/net/dpaa2/dpaa2_flow.c   | 127 +++++++++++++------------------\n 3 files changed, 59 insertions(+), 77 deletions(-)",
    "diff": "diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c\nindex fd3097c7d..008e1c570 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.c\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.c\n@@ -2392,6 +2392,10 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)\n \t}\n \n \tpriv->num_rx_tc = attr.num_rx_tcs;\n+\tpriv->qos_entries = attr.qos_entries;\n+\tpriv->fs_entries = attr.fs_entries;\n+\tpriv->dist_queues = attr.num_queues;\n+\n \t/* only if the custom CG is enabled */\n \tif (attr.options & DPNI_OPT_CUSTOM_CG)\n \t\tpriv->max_cgs = attr.num_cgs;\ndiff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h\nindex 030c625e3..b49b88a2d 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.h\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.h\n@@ -145,6 +145,9 @@ struct dpaa2_dev_priv {\n \tuint8_t max_mac_filters;\n \tuint8_t max_vlan_filters;\n \tuint8_t num_rx_tc;\n+\tuint16_t qos_entries;\n+\tuint16_t fs_entries;\n+\tuint8_t dist_queues;\n \tuint8_t flags; /*dpaa2 config flags */\n \tuint8_t en_ordered;\n \tuint8_t en_loose_ordered;\n@@ -152,8 +155,6 @@ struct dpaa2_dev_priv {\n \tuint8_t cgid_in_use[MAX_RX_QUEUES];\n \n \tstruct extract_s extract;\n-\tuint8_t *qos_index;\n-\tuint8_t *fs_index;\n \n \tuint16_t ss_offset;\n \tuint64_t ss_iova;\ndiff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c\nindex 941d62b80..760a8a793 100644\n--- a/drivers/net/dpaa2/dpaa2_flow.c\n+++ b/drivers/net/dpaa2/dpaa2_flow.c\n@@ -47,11 +47,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-\tuint16_t qos_index;\n-\tuint16_t fs_index;\n \tuint8_t key_size;\n \tuint8_t tc_id; /** Traffic Class ID. */\n-\tuint8_t flow_type;\n \tuint8_t tc_index; /** index within this Traffic Class. */\n \tenum rte_flow_action_type action;\n \tuint16_t flow_id;\n@@ -2645,6 +2642,7 @@ dpaa2_flow_entry_update(\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+\tuint16_t qos_index;\n \n \twhile (curr) {\n \t\tif (curr->ipaddr_rule.ipaddr_type ==\n@@ -2676,6 +2674,9 @@ dpaa2_flow_entry_update(\n \t\t\tsize = NH_FLD_IPV6_ADDR_SIZE;\n \t\t}\n \n+\t\tqos_index = curr->tc_id * priv->fs_entries +\n+\t\t\tcurr->tc_index;\n+\n \t\tret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW,\n \t\t\t\tpriv->token, &curr->qos_rule);\n \t\tif (ret) {\n@@ -2769,7 +2770,7 @@ dpaa2_flow_entry_update(\n \n \t\tret = dpni_add_qos_entry(dpni, CMD_PRI_LOW,\n \t\t\t\tpriv->token, &curr->qos_rule,\n-\t\t\t\tcurr->tc_id, curr->qos_index,\n+\t\t\t\tcurr->tc_id, qos_index,\n \t\t\t\t0, 0);\n \t\tif (ret) {\n \t\t\tDPAA2_PMD_ERR(\"Qos entry update failed.\");\n@@ -2875,7 +2876,7 @@ dpaa2_flow_entry_update(\n \t\t\tcurr->fs_rule.key_size += extend;\n \n \t\tret = dpni_add_fs_entry(dpni, CMD_PRI_LOW,\n-\t\t\t\tpriv->token, curr->tc_id, curr->fs_index,\n+\t\t\t\tpriv->token, curr->tc_id, curr->tc_index,\n \t\t\t\t&curr->fs_rule, &curr->action_cfg);\n \t\tif (ret) {\n \t\t\tDPAA2_PMD_ERR(\"FS entry update failed.\");\n@@ -2888,6 +2889,28 @@ dpaa2_flow_entry_update(\n \treturn 0;\n }\n \n+static inline int\n+dpaa2_flow_verify_attr(\n+\tstruct dpaa2_dev_priv *priv,\n+\tconst struct rte_flow_attr *attr)\n+{\n+\tstruct rte_flow *curr = LIST_FIRST(&priv->flows);\n+\n+\twhile (curr) {\n+\t\tif (curr->tc_id == attr->group &&\n+\t\t\tcurr->tc_index == attr->priority) {\n+\t\t\tDPAA2_PMD_ERR(\n+\t\t\t\t\"Flow with group %d and priority %d already exists.\",\n+\t\t\t\tattr->group, attr->priority);\n+\n+\t\t\treturn -1;\n+\t\t}\n+\t\tcurr = LIST_NEXT(curr, next);\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int\n dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t       struct rte_eth_dev *dev,\n@@ -2898,10 +2921,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n {\n \tconst struct rte_flow_action_queue *dest_queue;\n \tconst struct rte_flow_action_rss *rss_conf;\n-\tuint16_t index;\n \tint is_keycfg_configured = 0, end_of_list = 0;\n \tint ret = 0, i = 0, j = 0;\n-\tstruct dpni_attr nic_attr;\n \tstruct dpni_rx_tc_dist_cfg tc_cfg;\n \tstruct dpni_qos_tbl_cfg qos_cfg;\n \tstruct dpni_fs_action_cfg action;\n@@ -2909,6 +2930,11 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \tstruct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw;\n \tsize_t param;\n \tstruct rte_flow *curr = LIST_FIRST(&priv->flows);\n+\tuint16_t qos_index;\n+\n+\tret = dpaa2_flow_verify_attr(priv, attr);\n+\tif (ret)\n+\t\treturn ret;\n \n \t/* Parse pattern list to get the matching parameters */\n \twhile (!end_of_list) {\n@@ -3056,31 +3082,15 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t}\n \t\t\t}\n \t\t\t/* Configure QoS table first */\n-\t\t\tmemset(&nic_attr, 0, sizeof(struct dpni_attr));\n-\t\t\tret = dpni_get_attributes(dpni, CMD_PRI_LOW,\n-\t\t\t\t\t\t priv->token, &nic_attr);\n-\t\t\tif (ret < 0) {\n-\t\t\t\tDPAA2_PMD_ERR(\n-\t\t\t\t\"Failure to get attribute. dpni@%p err code(%d)\\n\",\n-\t\t\t\tdpni, ret);\n-\t\t\t\treturn ret;\n-\t\t\t}\n \n-\t\t\taction.flow_id = action.flow_id % nic_attr.num_rx_tcs;\n+\t\t\taction.flow_id = action.flow_id % priv->num_rx_tc;\n \n-\t\t\tif (!priv->qos_index) {\n-\t\t\t\tpriv->qos_index = rte_zmalloc(0,\n-\t\t\t\t\t\tnic_attr.qos_entries, 64);\n-\t\t\t}\n-\t\t\tfor (index = 0; index < nic_attr.qos_entries; index++) {\n-\t\t\t\tif (!priv->qos_index[index]) {\n-\t\t\t\t\tpriv->qos_index[index] = 1;\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tif (index >= nic_attr.qos_entries) {\n+\t\t\tqos_index = flow->tc_id * priv->fs_entries +\n+\t\t\t\tflow->tc_index;\n+\n+\t\t\tif (qos_index >= priv->qos_entries) {\n \t\t\t\tDPAA2_PMD_ERR(\"QoS table with %d entries full\",\n-\t\t\t\t\tnic_attr.qos_entries);\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@@ -3110,30 +3120,18 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t}\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, index,\n+\t\t\t\t\t\tflow->tc_id, qos_index,\n \t\t\t\t\t\t0, 0);\n \t\t\tif (ret < 0) {\n \t\t\t\tDPAA2_PMD_ERR(\n \t\t\t\t\"Error in addnig entry to QoS table(%d)\", ret);\n-\t\t\t\tpriv->qos_index[index] = 0;\n \t\t\t\treturn ret;\n \t\t\t}\n-\t\t\tflow->qos_index = index;\n \n \t\t\t/* Then Configure FS table */\n-\t\t\tif (!priv->fs_index) {\n-\t\t\t\tpriv->fs_index = rte_zmalloc(0,\n-\t\t\t\t\t\t\t\tnic_attr.fs_entries, 64);\n-\t\t\t}\n-\t\t\tfor (index = 0; index < nic_attr.fs_entries; index++) {\n-\t\t\t\tif (!priv->fs_index[index]) {\n-\t\t\t\t\tpriv->fs_index[index] = 1;\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tif (index >= nic_attr.fs_entries) {\n+\t\t\tif (flow->tc_index >= priv->fs_entries) {\n \t\t\t\tDPAA2_PMD_ERR(\"FS table with %d entries full\",\n-\t\t\t\t\tnic_attr.fs_entries);\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@@ -3164,31 +3162,23 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t}\n \t\t\t}\n \t\t\tret = dpni_add_fs_entry(dpni, CMD_PRI_LOW, priv->token,\n-\t\t\t\t\t\tflow->tc_id, index,\n+\t\t\t\t\t\tflow->tc_id, flow->tc_index,\n \t\t\t\t\t\t&flow->fs_rule, &action);\n \t\t\tif (ret < 0) {\n \t\t\t\tDPAA2_PMD_ERR(\n \t\t\t\t\"Error in adding entry to FS table(%d)\", ret);\n-\t\t\t\tpriv->fs_index[index] = 0;\n \t\t\t\treturn ret;\n \t\t\t}\n-\t\t\tflow->fs_index = index;\n \t\t\tmemcpy(&flow->action_cfg, &action,\n \t\t\t\tsizeof(struct dpni_fs_action_cfg));\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n-\t\t\tret = dpni_get_attributes(dpni, CMD_PRI_LOW,\n-\t\t\t\t\t\t priv->token, &nic_attr);\n-\t\t\tif (ret < 0) {\n-\t\t\t\tDPAA2_PMD_ERR(\n-\t\t\t\t\"Failure to get attribute. dpni@%p err code(%d)\\n\",\n-\t\t\t\tdpni, ret);\n-\t\t\t\treturn ret;\n-\t\t\t}\n \t\t\trss_conf = (const struct rte_flow_action_rss *)(actions[j].conf);\n \t\t\tfor (i = 0; i < (int)rss_conf->queue_num; i++) {\n-\t\t\t\tif (rss_conf->queue[i] < (attr->group * nic_attr.num_queues) ||\n-\t\t\t\t    rss_conf->queue[i] >= ((attr->group + 1) * nic_attr.num_queues)) {\n+\t\t\t\tif (rss_conf->queue[i] <\n+\t\t\t\t\t(attr->group * priv->dist_queues) ||\n+\t\t\t\t\trss_conf->queue[i] >=\n+\t\t\t\t\t((attr->group + 1) * priv->dist_queues)) {\n \t\t\t\t\tDPAA2_PMD_ERR(\n \t\t\t\t\t\"Queue/Group combination are not supported\\n\");\n \t\t\t\t\treturn -ENOTSUP;\n@@ -3262,34 +3252,24 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t}\n \n \t\t\t/* Add Rule into QoS table */\n-\t\t\tif (!priv->qos_index) {\n-\t\t\t\tpriv->qos_index = rte_zmalloc(0,\n-\t\t\t\t\t\tnic_attr.qos_entries, 64);\n-\t\t\t}\n-\t\t\tfor (index = 0; index < nic_attr.qos_entries; index++) {\n-\t\t\t\tif (!priv->qos_index[index]) {\n-\t\t\t\t\tpriv->qos_index[index] = 1;\n-\t\t\t\t\tbreak;\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tif (index >= nic_attr.qos_entries) {\n+\t\t\tqos_index = flow->tc_id * priv->fs_entries +\n+\t\t\t\tflow->tc_index;\n+\t\t\tif (qos_index >= priv->qos_entries) {\n \t\t\t\tDPAA2_PMD_ERR(\"QoS table with %d entries full\",\n-\t\t\t\t\tnic_attr.qos_entries);\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 \t\t\t  priv->extract.qos_key_extract.key_info.key_total_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\tindex, 0, 0);\n+\t\t\t\t\t\tqos_index, 0, 0);\n \t\t\tif (ret < 0) {\n \t\t\t\tDPAA2_PMD_ERR(\n \t\t\t\t\"Error in entry addition in QoS table(%d)\",\n \t\t\t\tret);\n-\t\t\t\tpriv->qos_index[index] = 0;\n \t\t\t\treturn ret;\n \t\t\t}\n-\t\t\tflow->qos_index = index;\n \t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_END:\n \t\t\tend_of_list = 1;\n@@ -3574,7 +3554,6 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev,\n \t\t\t\t\"Error in adding entry to QoS table(%d)\", ret);\n \t\t\tgoto error;\n \t\t}\n-\t\tpriv->qos_index[flow->qos_index] = 0;\n \n \t\t/* Then remove entry from FS table */\n \t\tret = dpni_remove_fs_entry(dpni, CMD_PRI_LOW, priv->token,\n@@ -3584,7 +3563,6 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev,\n \t\t\t\t\"Error in entry addition in FS table(%d)\", ret);\n \t\t\tgoto error;\n \t\t}\n-\t\tpriv->fs_index[flow->fs_index] = 0;\n \t\tbreak;\n \tcase RTE_FLOW_ACTION_TYPE_RSS:\n \t\tret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token,\n@@ -3594,7 +3572,6 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev,\n \t\t\t\"Error in entry addition in QoS table(%d)\", ret);\n \t\t\tgoto error;\n \t\t}\n-\t\tpriv->qos_index[flow->qos_index] = 0;\n \t\tbreak;\n \tdefault:\n \t\tDPAA2_PMD_ERR(\n",
    "prefixes": [
        "v2",
        "19/29"
    ]
}