get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 99775,
    "url": "https://patches.dpdk.org/api/patches/99775/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210927122650.30881-3-nipun.gupta@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": "<20210927122650.30881-3-nipun.gupta@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210927122650.30881-3-nipun.gupta@nxp.com",
    "date": "2021-09-27T12:26:41",
    "name": "[02/11] net/dpaa2: support Tx flow redirection action",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "161499ab43a90a19c4301667e356e37e38989598",
    "submitter": {
        "id": 471,
        "url": "https://patches.dpdk.org/api/people/471/?format=api",
        "name": "Nipun Gupta",
        "email": "nipun.gupta@nxp.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210927122650.30881-3-nipun.gupta@nxp.com/mbox/",
    "series": [
        {
            "id": 19191,
            "url": "https://patches.dpdk.org/api/series/19191/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19191",
            "date": "2021-09-27T12:26:39",
            "name": "NXP DPAAx Bus and PMD changes",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/19191/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/99775/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/99775/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A6A40A0548;\n\tMon, 27 Sep 2021 14:27:05 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 55FB9410F0;\n\tMon, 27 Sep 2021 14:26:58 +0200 (CEST)",
            "from inva021.nxp.com (inva021.nxp.com [92.121.34.21])\n by mails.dpdk.org (Postfix) with ESMTP id 2D3D140E3C\n for <dev@dpdk.org>; Mon, 27 Sep 2021 14:26:54 +0200 (CEST)",
            "from inva021.nxp.com (localhost [127.0.0.1])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F2B3C20001A;\n Mon, 27 Sep 2021 14:26:53 +0200 (CEST)",
            "from aprdc01srsp001v.ap-rdc01.nxp.com\n (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16])\n by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 767032013A6;\n Mon, 27 Sep 2021 14:26:53 +0200 (CEST)",
            "from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com\n [92.120.147.114])\n by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 5218D183AD26;\n Mon, 27 Sep 2021 20:26:52 +0800 (+08)"
        ],
        "From": "nipun.gupta@nxp.com",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com,\n sachin.saxena@nxp.com, Jun Yang <jun.yang@nxp.com>",
        "Date": "Mon, 27 Sep 2021 17:56:41 +0530",
        "Message-Id": "<20210927122650.30881-3-nipun.gupta@nxp.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210927122650.30881-1-nipun.gupta@nxp.com>",
        "References": "<20210927122650.30881-1-nipun.gupta@nxp.com>",
        "X-Virus-Scanned": "ClamAV using ClamSMTP",
        "Subject": "[dpdk-dev] [PATCH 02/11] net/dpaa2: support Tx flow redirection\n action",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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\nTX redirection support by flow action RTE_FLOW_ACTION_TYPE_PHY_PORT\nand RTE_FLOW_ACTION_TYPE_PORT_ID\n\nThis action is executed by HW to forward packets between ports.\nIf the ingress packets match the rule, the packets are switched\nwithout software involved and perf is improved as well.\n\nSigned-off-by: Jun Yang <jun.yang@nxp.com>\n---\n drivers/net/dpaa2/dpaa2_ethdev.c |   5 ++\n drivers/net/dpaa2/dpaa2_ethdev.h |   1 +\n drivers/net/dpaa2/dpaa2_flow.c   | 116 +++++++++++++++++++++++++++----\n drivers/net/dpaa2/mc/fsl_dpni.h  |  23 ++++++\n 4 files changed, 132 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c\nindex 560b79151b..9cf55c0f0b 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.c\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.c\n@@ -2822,6 +2822,11 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)\n \treturn ret;\n }\n \n+int dpaa2_dev_is_dpaa2(struct rte_eth_dev *dev)\n+{\n+\treturn dev->device->driver == &rte_dpaa2_pmd.driver;\n+}\n+\n static int\n rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,\n \t\tstruct rte_dpaa2_device *dpaa2_dev)\ndiff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h\nindex b9c729f6cd..3f34d7ecff 100644\n--- a/drivers/net/dpaa2/dpaa2_ethdev.h\n+++ b/drivers/net/dpaa2/dpaa2_ethdev.h\n@@ -240,6 +240,7 @@ uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);\n void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);\n void dpaa2_flow_clean(struct rte_eth_dev *dev);\n uint16_t dpaa2_dev_tx_conf(void *queue)  __rte_unused;\n+int dpaa2_dev_is_dpaa2(struct rte_eth_dev *dev);\n \n int dpaa2_timesync_enable(struct rte_eth_dev *dev);\n int dpaa2_timesync_disable(struct rte_eth_dev *dev);\ndiff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c\nindex bfe17c350a..5de886ec5e 100644\n--- a/drivers/net/dpaa2/dpaa2_flow.c\n+++ b/drivers/net/dpaa2/dpaa2_flow.c\n@@ -1,5 +1,5 @@\n /* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright 2018-2020 NXP\n+ * Copyright 2018-2021 NXP\n  */\n \n #include <sys/queue.h>\n@@ -30,10 +30,10 @@\n int mc_l4_port_identification;\n \n static char *dpaa2_flow_control_log;\n-static int dpaa2_flow_miss_flow_id =\n+static uint16_t dpaa2_flow_miss_flow_id =\n \tDPNI_FS_MISS_DROP;\n \n-#define FIXED_ENTRY_SIZE 54\n+#define FIXED_ENTRY_SIZE DPNI_MAX_KEY_SIZE\n \n enum flow_rule_ipaddr_type {\n \tFLOW_NONE_IPADDR,\n@@ -83,9 +83,18 @@ static const\n enum rte_flow_action_type dpaa2_supported_action_type[] = {\n \tRTE_FLOW_ACTION_TYPE_END,\n \tRTE_FLOW_ACTION_TYPE_QUEUE,\n+\tRTE_FLOW_ACTION_TYPE_PHY_PORT,\n+\tRTE_FLOW_ACTION_TYPE_PORT_ID,\n \tRTE_FLOW_ACTION_TYPE_RSS\n };\n \n+static const\n+enum rte_flow_action_type dpaa2_supported_fs_action_type[] = {\n+\tRTE_FLOW_ACTION_TYPE_QUEUE,\n+\tRTE_FLOW_ACTION_TYPE_PHY_PORT,\n+\tRTE_FLOW_ACTION_TYPE_PORT_ID\n+};\n+\n /* Max of enum rte_flow_item_type + 1, for both IPv4 and IPv6*/\n #define DPAA2_FLOW_ITEM_TYPE_GENERIC_IP (RTE_FLOW_ITEM_TYPE_META + 1)\n \n@@ -2937,6 +2946,19 @@ dpaa2_configure_flow_raw(struct rte_flow *flow,\n \treturn 0;\n }\n \n+static inline int dpaa2_fs_action_supported(\n+\t\tenum rte_flow_action_type action)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < (int)(sizeof(dpaa2_supported_fs_action_type) /\n+\t\t\t\t\tsizeof(enum rte_flow_action_type)); i++) {\n+\t\tif (action == dpaa2_supported_fs_action_type[i])\n+\t\t\treturn 1;\n+\t}\n+\n+\treturn 0;\n+}\n /* The existing QoS/FS entry with IP address(es)\n  * needs update after\n  * new extract(s) are inserted before IP\n@@ -3115,7 +3137,7 @@ dpaa2_flow_entry_update(\n \t\t\t}\n \t\t}\n \n-\t\tif (curr->action != RTE_FLOW_ACTION_TYPE_QUEUE) {\n+\t\tif (!dpaa2_fs_action_supported(curr->action)) {\n \t\t\tcurr = LIST_NEXT(curr, next);\n \t\t\tcontinue;\n \t\t}\n@@ -3253,6 +3275,43 @@ dpaa2_flow_verify_attr(\n \treturn 0;\n }\n \n+static inline struct rte_eth_dev *\n+dpaa2_flow_redirect_dev(struct dpaa2_dev_priv *priv,\n+\tconst struct rte_flow_action *action)\n+{\n+\tconst struct rte_flow_action_phy_port *phy_port;\n+\tconst struct rte_flow_action_port_id *port_id;\n+\tint idx = -1;\n+\tstruct rte_eth_dev *dest_dev;\n+\n+\tif (action->type == RTE_FLOW_ACTION_TYPE_PHY_PORT) {\n+\t\tphy_port = (const struct rte_flow_action_phy_port *)\n+\t\t\t\t\taction->conf;\n+\t\tif (!phy_port->original)\n+\t\t\tidx = phy_port->index;\n+\t} else if (action->type == RTE_FLOW_ACTION_TYPE_PORT_ID) {\n+\t\tport_id = (const struct rte_flow_action_port_id *)\n+\t\t\t\t\taction->conf;\n+\t\tif (!port_id->original)\n+\t\t\tidx = port_id->id;\n+\t} else {\n+\t\treturn NULL;\n+\t}\n+\n+\tif (idx >= 0) {\n+\t\tif (!rte_eth_dev_is_valid_port(idx))\n+\t\t\treturn NULL;\n+\t\tdest_dev = &rte_eth_devices[idx];\n+\t} else {\n+\t\tdest_dev = priv->eth_dev;\n+\t}\n+\n+\tif (!dpaa2_dev_is_dpaa2(dest_dev))\n+\t\treturn NULL;\n+\n+\treturn dest_dev;\n+}\n+\n static inline int\n dpaa2_flow_verify_action(\n \tstruct dpaa2_dev_priv *priv,\n@@ -3278,6 +3337,14 @@ dpaa2_flow_verify_action(\n \t\t\t\treturn -1;\n \t\t\t}\n \t\t\tbreak;\n+\t\tcase RTE_FLOW_ACTION_TYPE_PHY_PORT:\n+\t\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n+\t\t\tif (!dpaa2_flow_redirect_dev(priv, &actions[j])) {\n+\t\t\t\tDPAA2_PMD_ERR(\n+\t\t\t\t\t\"Invalid port id of action\");\n+\t\t\t\treturn -ENOTSUP;\n+\t\t\t}\n+\t\t\tbreak;\n \t\tcase RTE_FLOW_ACTION_TYPE_RSS:\n \t\t\trss_conf = (const struct rte_flow_action_rss *)\n \t\t\t\t\t(actions[j].conf);\n@@ -3330,11 +3397,13 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \tstruct dpni_qos_tbl_cfg qos_cfg;\n \tstruct dpni_fs_action_cfg action;\n \tstruct dpaa2_dev_priv *priv = dev->data->dev_private;\n-\tstruct dpaa2_queue *rxq;\n+\tstruct dpaa2_queue *dest_q;\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+\tstruct rte_eth_dev *dest_dev;\n+\tstruct dpaa2_dev_priv *dest_priv;\n \n \tret = dpaa2_flow_verify_attr(priv, attr);\n \tif (ret)\n@@ -3446,12 +3515,32 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \twhile (!end_of_list) {\n \t\tswitch (actions[j].type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_QUEUE:\n-\t\t\tdest_queue =\n-\t\t\t\t(const struct rte_flow_action_queue *)(actions[j].conf);\n-\t\t\trxq = priv->rx_vq[dest_queue->index];\n-\t\t\tflow->action = RTE_FLOW_ACTION_TYPE_QUEUE;\n+\t\tcase RTE_FLOW_ACTION_TYPE_PHY_PORT:\n+\t\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n \t\t\tmemset(&action, 0, sizeof(struct dpni_fs_action_cfg));\n-\t\t\taction.flow_id = rxq->flow_id;\n+\t\t\tflow->action = actions[j].type;\n+\n+\t\t\tif (actions[j].type == RTE_FLOW_ACTION_TYPE_QUEUE) {\n+\t\t\t\tdest_queue = (const struct rte_flow_action_queue *)\n+\t\t\t\t\t\t\t\t(actions[j].conf);\n+\t\t\t\tdest_q = priv->rx_vq[dest_queue->index];\n+\t\t\t\taction.flow_id = dest_q->flow_id;\n+\t\t\t} else {\n+\t\t\t\tdest_dev = dpaa2_flow_redirect_dev(priv,\n+\t\t\t\t\t\t\t\t   &actions[j]);\n+\t\t\t\tif (!dest_dev) {\n+\t\t\t\t\tDPAA2_PMD_ERR(\n+\t\t\t\t\t\t\"Invalid destination device to redirect!\");\n+\t\t\t\t\treturn -1;\n+\t\t\t\t}\n+\n+\t\t\t\tdest_priv = dest_dev->data->dev_private;\n+\t\t\t\tdest_q = dest_priv->tx_vq[0];\n+\t\t\t\taction.options =\n+\t\t\t\t\t\tDPNI_FS_OPT_REDIRECT_TO_DPNI_TX;\n+\t\t\t\taction.redirect_obj_token = dest_priv->token;\n+\t\t\t\taction.flow_id = dest_q->flow_id;\n+\t\t\t}\n \n \t\t\t/* Configure FS table first*/\n \t\t\tif (is_keycfg_configured & DPAA2_FS_TABLE_RECONFIGURE) {\n@@ -3481,8 +3570,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow,\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n \t\t\t\ttc_cfg.enable = true;\n-\t\t\t\ttc_cfg.fs_miss_flow_id =\n-\t\t\t\t\tdpaa2_flow_miss_flow_id;\n+\t\t\t\ttc_cfg.fs_miss_flow_id = dpaa2_flow_miss_flow_id;\n \t\t\t\tret = dpni_set_rx_fs_dist(dpni, CMD_PRI_LOW,\n \t\t\t\t\t\t\t priv->token, &tc_cfg);\n \t\t\t\tif (ret < 0) {\n@@ -3970,7 +4058,7 @@ struct rte_flow *dpaa2_flow_create(struct rte_eth_dev *dev,\n \tret = dpaa2_generic_flow_set(flow, dev, attr, pattern,\n \t\t\tactions, error);\n \tif (ret < 0) {\n-\t\tif (error->type > RTE_FLOW_ERROR_TYPE_ACTION)\n+\t\tif (error && error->type > RTE_FLOW_ERROR_TYPE_ACTION)\n \t\t\trte_flow_error_set(error, EPERM,\n \t\t\t\t\tRTE_FLOW_ERROR_TYPE_UNSPECIFIED,\n \t\t\t\t\tattr, \"unknown\");\n@@ -4002,6 +4090,8 @@ int dpaa2_flow_destroy(struct rte_eth_dev *dev,\n \n \tswitch (flow->action) {\n \tcase RTE_FLOW_ACTION_TYPE_QUEUE:\n+\tcase RTE_FLOW_ACTION_TYPE_PHY_PORT:\n+\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n \t\tif (priv->num_rx_tc > 1) {\n \t\t\t/* Remove entry from QoS table first */\n \t\t\tret = dpni_remove_qos_entry(dpni, CMD_PRI_LOW, priv->token,\ndiff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h\nindex 34c6b20033..bf14765e2b 100644\n--- a/drivers/net/dpaa2/mc/fsl_dpni.h\n+++ b/drivers/net/dpaa2/mc/fsl_dpni.h\n@@ -1496,12 +1496,35 @@ int dpni_clear_qos_table(struct fsl_mc_io *mc_io,\n  */\n #define DPNI_FS_OPT_SET_STASH_CONTROL  0x4\n \n+/**\n+ * Redirect matching traffic to Rx part of another dpni object. The frame\n+ * will be classified according to new qos and flow steering rules from\n+ * target dpni object.\n+ */\n+#define DPNI_FS_OPT_REDIRECT_TO_DPNI_RX\t\t0x08\n+\n+/**\n+ * Redirect matching traffic into Tx queue of another dpni object. The\n+ * frame will be transmitted directly\n+ */\n+#define DPNI_FS_OPT_REDIRECT_TO_DPNI_TX\t\t0x10\n+\n /**\n  * struct dpni_fs_action_cfg - Action configuration for table look-up\n  * @flc: FLC value for traffic matching this rule.  Please check the Frame\n  * Descriptor section in the hardware documentation for more information.\n  * @flow_id: Identifies the Rx queue used for matching traffic.  Supported\n  *     values are in range 0 to num_queue-1.\n+ * @redirect_obj_token: token that identifies the object where frame is\n+ * redirected when this rule is hit. This paraneter is used only when one of the\n+ * flags DPNI_FS_OPT_REDIRECT_TO_DPNI_RX or DPNI_FS_OPT_REDIRECT_TO_DPNI_TX is\n+ * set.\n+ * The token is obtained using dpni_open() API call. The object must stay\n+ * open during the operation to ensure the fact that application has access\n+ * on it. If the object is destroyed of closed next actions will take place:\n+ * - if DPNI_FS_OPT_DISCARD is set the frame will be discarded by current dpni\n+ * - if DPNI_FS_OPT_DISCARD is cleared the frame will be enqueued in queue with\n+ * \tindex provided in flow_id parameter.\n  * @options: Any combination of DPNI_FS_OPT_ values.\n  */\n struct dpni_fs_action_cfg {\n",
    "prefixes": [
        "02/11"
    ]
}