Show a patch.

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

{
    "id": 73409,
    "url": "https://patches.dpdk.org/api/patches/73409/?format=api",
    "web_url": "https://patches.dpdk.org/patch/73409/",
    "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"
    },
    "msgid": "<20200707092244.12791-30-hemant.agrawal@nxp.com>",
    "date": "2020-07-07T09:22:44",
    "name": "[v2,29/29] net/dpaa2: support raw flow classification",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0440f4c18b563e11c6733e412ae326eaef8ba14c",
    "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@intel.com"
    },
    "mbox": "https://patches.dpdk.org/patch/73409/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/73409/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73409/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": "<20200527132326.1382-1-hemant.agrawal@nxp.com>\n <20200707092244.12791-1-hemant.agrawal@nxp.com>",
        "X-BeenThere": "dev@dpdk.org",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v2 29/29] net/dpaa2: support raw flow\n\tclassification",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "From": "Hemant Agrawal <hemant.agrawal@nxp.com>",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9F1EBA00BE;\n\tTue,  7 Jul 2020 11:33:21 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9B8B11DE33;\n\tTue,  7 Jul 2020 11:27:42 +0200 (CEST)",
            "from inva020.nxp.com (inva020.nxp.com [92.121.34.13])\n by dpdk.org (Postfix) with ESMTP id D9F3F1DD7C\n for <dev@dpdk.org>; Tue,  7 Jul 2020 11:27:18 +0200 (CEST)",
            "from inva020.nxp.com (localhost [127.0.0.1])\n by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C076B1A0A30;\n Tue,  7 Jul 2020 11:27:18 +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 D96D71A0A46;\n Tue,  7 Jul 2020 11:27:16 +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 8DC8B402FC;\n Tue,  7 Jul 2020 17:27:14 +0800 (SGT)"
        ],
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "To": "dev@dpdk.org",
        "X-Mailer": "git-send-email 2.17.1",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Date": "Tue,  7 Jul 2020 14:52:44 +0530",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "In-Reply-To": "<20200707092244.12791-1-hemant.agrawal@nxp.com>",
        "Cc": "ferruh.yigit@intel.com,\n\tNipun Gupta <nipun.gupta@nxp.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200707092244.12791-30-hemant.agrawal@nxp.com>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "From: Nipun Gupta <nipun.gupta@nxp.com>\n\nAdd support for raw flow, which can be used for any\nprotocol rules.\n\nSigned-off-by: Nipun Gupta <nipun.gupta@nxp.com>\n---\n drivers/net/dpaa2/dpaa2_ethdev.h |   3 +-\n drivers/net/dpaa2/dpaa2_flow.c   | 135 +++++++++++++++++++++++++++++++\n 2 files changed, 137 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h\nindex 52faeeefe..2bc0f3f5a 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.h\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.h\n@@ -1,7 +1,7 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n  *\n  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.\n- *   Copyright 2016-2019 NXP\n+ *   Copyright 2016-2020 NXP\n  *\n  */\n \n@@ -99,6 +99,7 @@ extern enum pmd_dpaa2_ts dpaa2_enable_ts;\n #define DPAA2_QOS_TABLE_IPADDR_EXTRACT 4\n #define DPAA2_FS_TABLE_IPADDR_EXTRACT 8\n \n+#define DPAA2_FLOW_MAX_KEY_SIZE\t\t16\n \n /*Externaly defined*/\n extern const struct rte_flow_ops dpaa2_flow_ops;\ndiff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c\nindex cc789346a..136bdd5fa 100644\n--- a/drivers/net/dpaa2/dpaa2_flow.c\n+++ b/drivers/net/dpaa2/dpaa2_flow.c\n@@ -493,6 +493,42 @@ static int dpaa2_flow_extract_add(\n \treturn 0;\n }\n \n+static int dpaa2_flow_extract_add_raw(struct dpaa2_key_extract *key_extract,\n+\t\t\t\t      int size)\n+{\n+\tstruct dpkg_profile_cfg *dpkg = &key_extract->dpkg;\n+\tstruct dpaa2_key_info *key_info = &key_extract->key_info;\n+\tint last_extract_size, index;\n+\n+\tif (dpkg->num_extracts != 0 && dpkg->extracts[0].type !=\n+\t    DPKG_EXTRACT_FROM_DATA) {\n+\t\tDPAA2_PMD_WARN(\"RAW extract cannot be combined with others\");\n+\t\treturn -1;\n+\t}\n+\n+\tlast_extract_size = (size % DPAA2_FLOW_MAX_KEY_SIZE);\n+\tdpkg->num_extracts = (size / DPAA2_FLOW_MAX_KEY_SIZE);\n+\tif (last_extract_size)\n+\t\tdpkg->num_extracts++;\n+\telse\n+\t\tlast_extract_size = DPAA2_FLOW_MAX_KEY_SIZE;\n+\n+\tfor (index = 0; index < dpkg->num_extracts; index++) {\n+\t\tdpkg->extracts[index].type = DPKG_EXTRACT_FROM_DATA;\n+\t\tif (index == dpkg->num_extracts - 1)\n+\t\t\tdpkg->extracts[index].extract.from_data.size =\n+\t\t\t\tlast_extract_size;\n+\t\telse\n+\t\t\tdpkg->extracts[index].extract.from_data.size =\n+\t\t\t\tDPAA2_FLOW_MAX_KEY_SIZE;\n+\t\tdpkg->extracts[index].extract.from_data.offset =\n+\t\t\tDPAA2_FLOW_MAX_KEY_SIZE * index;\n+\t}\n+\n+\tkey_info->key_total_size = size;\n+\treturn 0;\n+}\n+\n /* Protocol discrimination.\n  * Discriminate IPv4/IPv6/vLan by Eth type.\n  * Discriminate UDP/TCP/ICMP by next proto of IP.\n@@ -674,6 +710,18 @@ dpaa2_flow_rule_data_set(\n \treturn 0;\n }\n \n+static inline int\n+dpaa2_flow_rule_data_set_raw(struct dpni_rule_cfg *rule,\n+\t\t\t     const void *key, const void *mask, int size)\n+{\n+\tint offset = 0;\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+\treturn 0;\n+}\n+\n static inline int\n _dpaa2_flow_rule_move_ipaddr_tail(\n \tstruct dpaa2_key_extract *key_extract,\n@@ -2814,6 +2862,83 @@ dpaa2_configure_flow_gre(struct rte_flow *flow,\n \treturn 0;\n }\n \n+static int\n+dpaa2_configure_flow_raw(struct rte_flow *flow,\n+\t\t\t struct rte_eth_dev *dev,\n+\t\t\t const struct rte_flow_attr *attr,\n+\t\t\t const struct rte_flow_item *pattern,\n+\t\t\t const struct rte_flow_action actions[] __rte_unused,\n+\t\t\t struct rte_flow_error *error __rte_unused,\n+\t\t\t int *device_configured)\n+{\n+\tstruct dpaa2_dev_priv *priv = dev->data->dev_private;\n+\tconst struct rte_flow_item_raw *spec = pattern->spec;\n+\tconst struct rte_flow_item_raw *mask = pattern->mask;\n+\tint prev_key_size =\n+\t\tpriv->extract.qos_key_extract.key_info.key_total_size;\n+\tint local_cfg = 0, ret;\n+\tuint32_t group;\n+\n+\t/* Need both spec and mask */\n+\tif (!spec || !mask) {\n+\t\tDPAA2_PMD_ERR(\"spec or mask not present.\");\n+\t\treturn -EINVAL;\n+\t}\n+\t/* Only supports non-relative with offset 0 */\n+\tif (spec->relative || spec->offset != 0 ||\n+\t    spec->search || spec->limit) {\n+\t\tDPAA2_PMD_ERR(\"relative and non zero offset not supported.\");\n+\t\treturn -EINVAL;\n+\t}\n+\t/* Spec len and mask len should be same */\n+\tif (spec->length != mask->length) {\n+\t\tDPAA2_PMD_ERR(\"Spec len and mask len mismatch.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Get traffic class index and flow id to be configured */\n+\tgroup = attr->group;\n+\tflow->tc_id = group;\n+\tflow->tc_index = attr->priority;\n+\n+\tif (prev_key_size < spec->length) {\n+\t\tret = dpaa2_flow_extract_add_raw(&priv->extract.qos_key_extract,\n+\t\t\t\t\t\t spec->length);\n+\t\tif (ret) {\n+\t\t\tDPAA2_PMD_ERR(\"QoS Extract RAW add failed.\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tlocal_cfg |= DPAA2_QOS_TABLE_RECONFIGURE;\n+\n+\t\tret = dpaa2_flow_extract_add_raw(\n+\t\t\t\t\t&priv->extract.tc_key_extract[group],\n+\t\t\t\t\tspec->length);\n+\t\tif (ret) {\n+\t\t\tDPAA2_PMD_ERR(\"FS Extract RAW add failed.\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\tlocal_cfg |= DPAA2_FS_TABLE_RECONFIGURE;\n+\t}\n+\n+\tret = dpaa2_flow_rule_data_set_raw(&flow->qos_rule, spec->pattern,\n+\t\t\t\t\t   mask->pattern, spec->length);\n+\tif (ret) {\n+\t\tDPAA2_PMD_ERR(\"QoS RAW rule data set failed\");\n+\t\treturn -1;\n+\t}\n+\n+\tret = dpaa2_flow_rule_data_set_raw(&flow->fs_rule, spec->pattern,\n+\t\t\t\t\t   mask->pattern, spec->length);\n+\tif (ret) {\n+\t\tDPAA2_PMD_ERR(\"FS RAW rule data set failed\");\n+\t\treturn -1;\n+\t}\n+\n+\t(*device_configured) |= local_cfg;\n+\n+\treturn 0;\n+}\n+\n /* The existing QoS/FS entry with IP address(es)\n  * needs update after\n  * new extract(s) are inserted before IP\n@@ -3297,6 +3422,16 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\treturn ret;\n \t\t\t}\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ITEM_TYPE_RAW:\n+\t\t\tret = dpaa2_configure_flow_raw(flow,\n+\t\t\t\t\t\t       dev, attr, &pattern[i],\n+\t\t\t\t\t\t       actions, error,\n+\t\t\t\t\t\t       &is_keycfg_configured);\n+\t\t\tif (ret) {\n+\t\t\t\tDPAA2_PMD_ERR(\"RAW flow configuration failed!\");\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ITEM_TYPE_END:\n \t\t\tend_of_list = 1;\n \t\t\tbreak; /*End of List*/\n",
    "prefixes": [
        "v2",
        "29/29"
    ]
}