get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131803,
    "url": "http://patches.dpdk.org/api/patches/131803/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230822010226.17783-9-yuying.zhang@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20230822010226.17783-9-yuying.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230822010226.17783-9-yuying.zhang@intel.com",
    "date": "2023-08-22T01:02:26",
    "name": "[v6,8/8] net/cpfl: add flow support for representor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "95b5e9afdfd1eb2ddd7c5fb0c336879159f22309",
    "submitter": {
        "id": 1844,
        "url": "http://patches.dpdk.org/api/people/1844/?format=api",
        "name": "Zhang, Yuying",
        "email": "yuying.zhang@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230822010226.17783-9-yuying.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 29591,
            "url": "http://patches.dpdk.org/api/series/29591/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=29591",
            "date": "2023-08-22T01:02:18",
            "name": "add rte flow support for cpfl",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/29591/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/131803/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/131803/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 5641D42608;\n\tThu, 21 Sep 2023 18:59:57 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9D47F40EE2;\n\tThu, 21 Sep 2023 18:59:19 +0200 (CEST)",
            "from mgamail.intel.com (mgamail.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 646D940EAB\n for <dev@dpdk.org>; Thu, 21 Sep 2023 18:59:14 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Sep 2023 09:59:11 -0700",
            "from dpdk-pengyuan-mev.sh.intel.com ([10.67.119.128])\n by fmsmga004.fm.intel.com with ESMTP; 21 Sep 2023 09:59:10 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1695315554; x=1726851554;\n h=from:to:subject:date:message-id:in-reply-to:references:\n mime-version:content-transfer-encoding;\n bh=15hheedv985+axDKwOwpSiiOBLKoCoJJLo5Z2CqwUko=;\n b=jlOjWQdw00HHTz8kboPlGDeeFW/GVS46eWc8A77L/6rfnfjqwqPKsfIQ\n HCaF1RfPbfyIFdhh8xaSZ3awbcc9quibRf3e0evNWIw+9IuObT7iff1GO\n /TZxRnXonBiUmHYTPGoxVvmT25GKIMyB1Xh4m61xW0mhsUNrFof5ZHIjS\n CDZr2esy1KBBXzSOb15dYtJmczH9hD9D8BnCefoCsEhwYh4BW3mJostUn\n lORzaR3kJpFy4Ha4YZkBhtiZvTCgg2pZQqDa1aGV1yKm2WZBVVo7zErwV\n 19NWfjLKyDSWDt8TRw23YcHBgPbOSgx2WkTJlOIqSnW1JmugIYvEKPmfI Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10840\"; a=\"379468336\"",
            "E=Sophos;i=\"6.03,165,1694761200\"; d=\"scan'208\";a=\"379468336\"",
            "E=McAfee;i=\"6600,9927,10840\"; a=\"817472313\"",
            "E=Sophos;i=\"6.03,165,1694761200\"; d=\"scan'208\";a=\"817472313\""
        ],
        "X-ExtLoop1": "1",
        "From": "\"Zhang, Yuying\" <yuying.zhang@intel.com>",
        "To": "yuying.zhang@intel.com, dev@dpdk.org, qi.z.zhang@intel.com,\n jingjing.wu@intel.com, beilei.xing@intel.com",
        "Subject": "[PATCH v6 8/8] net/cpfl: add flow support for representor",
        "Date": "Tue, 22 Aug 2023 01:02:26 +0000",
        "Message-Id": "<20230822010226.17783-9-yuying.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230822010226.17783-1-yuying.zhang@intel.com>",
        "References": "<20230915100047.90153-1-yuying.zhang@intel.com>\n <20230822010226.17783-1-yuying.zhang@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "From: Yuying Zhang <yuying.zhang@intel.com>\n\nAdd flow support for representor, so representor can\ncreate, destroy, validate and flush rules.\n\nSigned-off-by: Yuying Zhang <yuying.zhang@intel.com>\n---\n doc/guides/nics/cpfl.rst                | 13 ++++\n doc/guides/rel_notes/release_23_11.rst  |  1 +\n drivers/net/cpfl/cpfl_flow_engine_fxp.c | 90 ++++++++++++++++++++++++-\n drivers/net/cpfl/cpfl_representor.c     | 29 ++++++++\n 4 files changed, 130 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/cpfl.rst b/doc/guides/nics/cpfl.rst\nindex 15680a10a6..6bfcc7137a 100644\n--- a/doc/guides/nics/cpfl.rst\n+++ b/doc/guides/nics/cpfl.rst\n@@ -194,3 +194,16 @@ low level hardware resources.\n    .. code-block:: console\n \n    dpdk-testpmd -c 0x3 -n 4 -a 0000:af:00.6,vport=[0],flow_parser=\"refpkg.json\" -- -i\n+\n+#. Create one flow to forward ETH-IPV4-TCP from I/O port to a local(CPF's) vport::\n+\n+   .. code-block:: console\n+\n+   flow create 0 ingress group 1 pattern eth dst is 00:01:00:00:03:14 / ipv4 src is 192.168.0.1 \\\n+   dst is 192.168.0.2 / tcp / end actions port_representor port_id 0 / end\n+\n+#. Send the packet, and it should be displayed on PMD::\n+\n+   .. code-block:: console\n+\n+   sendp(Ether(dst='00:01:00:00:03:14')/IP(src='192.168.0.1',dst='192.168.0.2')/TCP(),iface=\"enp24s0f0\")\ndiff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst\nindex 3d9be208d0..bad71ad3fd 100644\n--- a/doc/guides/rel_notes/release_23_11.rst\n+++ b/doc/guides/rel_notes/release_23_11.rst\n@@ -81,6 +81,7 @@ New Features\n * **Updated Intel cpfl driver.**\n \n   * Added support for port representor.\n+  * Added support for rte_flow.\n \n Removed Items\n -------------\ndiff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c\nindex e0c08a77c3..fed18d8349 100644\n--- a/drivers/net/cpfl/cpfl_flow_engine_fxp.c\n+++ b/drivers/net/cpfl/cpfl_flow_engine_fxp.c\n@@ -73,6 +73,7 @@ cpfl_fxp_create(struct rte_eth_dev *dev,\n \tstruct cpfl_adapter_ext *ad = itf->adapter;\n \tstruct cpfl_rule_info_meta *rim = meta;\n \tstruct cpfl_vport *vport;\n+\tstruct cpfl_repr *repr;\n \n \tif (!rim)\n \t\treturn ret;\n@@ -83,6 +84,10 @@ cpfl_fxp_create(struct rte_eth_dev *dev,\n \t\t * Even index is tx queue and odd index is rx queue.\n \t\t */\n \t\tcpq_id = vport->base.devarg_id * 2;\n+\t} else if (itf->type == CPFL_ITF_TYPE_REPRESENTOR) {\n+\t\trepr = (struct cpfl_repr *)itf;\n+\t\tcpq_id = ((repr->repr_id.pf_id  + repr->repr_id.vf_id) &\n+\t\t\t  (CPFL_TX_CFGQ_NUM - 1)) * 2;\n \t} else {\n \t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n \t\t\t\t   \"fail to find correct control queue\");\n@@ -122,6 +127,7 @@ cpfl_fxp_destroy(struct rte_eth_dev *dev,\n \tstruct cpfl_rule_info_meta *rim;\n \tuint32_t i;\n \tstruct cpfl_vport *vport;\n+\tstruct cpfl_repr *repr;\n \n \trim = flow->rule;\n \tif (!rim) {\n@@ -135,6 +141,10 @@ cpfl_fxp_destroy(struct rte_eth_dev *dev,\n \tif (itf->type == CPFL_ITF_TYPE_VPORT) {\n \t\tvport = (struct cpfl_vport *)itf;\n \t\tcpq_id = vport->base.devarg_id * 2;\n+\t} else if (itf->type == CPFL_ITF_TYPE_REPRESENTOR) {\n+\t\trepr = (struct cpfl_repr *)itf;\n+\t\tcpq_id = ((repr->repr_id.pf_id  + repr->repr_id.vf_id) &\n+\t\t\t  (CPFL_TX_CFGQ_NUM - 1)) * 2;\n \t} else {\n \t\trte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n \t\t\t\t   \"fail to find correct control queue\");\n@@ -257,6 +267,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,\n \tint queue_id = -1;\n \tbool fwd_vsi = false;\n \tbool fwd_q = false;\n+\tbool is_vsi;\n \tuint32_t i;\n \tstruct cpfl_rule_info *rinfo = &rim->rules[index];\n \tunion cpfl_action_set *act_set = (void *)rinfo->act_bytes;\n@@ -267,6 +278,7 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,\n \t\taction_type = action->type;\n \t\tswitch (action_type) {\n \t\tcase RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:\n+\t\tcase RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:\n \t\t\tif (!fwd_vsi)\n \t\t\t\tfwd_vsi = true;\n \t\t\telse\n@@ -285,12 +297,20 @@ cpfl_fxp_parse_action(struct cpfl_itf *itf,\n \t\t\t\tqueue_id = CPFL_INVALID_QUEUE_ID;\n \t\t\t}\n \n-\t\t\tdev_id = cpfl_get_vsi_id(dst_itf);\n+\t\t\tis_vsi = (action_type == RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR ||\n+\t\t\t\t  dst_itf->type == CPFL_ITF_TYPE_REPRESENTOR);\n+\t\t\tif (is_vsi)\n+\t\t\t\tdev_id = cpfl_get_vsi_id(dst_itf);\n+\t\t\telse\n+\t\t\t\tdev_id = cpfl_get_port_id(dst_itf);\n \n \t\t\tif (dev_id == CPFL_INVALID_HW_ID)\n \t\t\t\tgoto err;\n \n-\t\t\t*act_set = cpfl_act_fwd_vsi(0, priority, 0, dev_id);\n+\t\t\tif (is_vsi)\n+\t\t\t\t*act_set = cpfl_act_fwd_vsi(0, priority, 0, dev_id);\n+\t\t\telse\n+\t\t\t\t*act_set = cpfl_act_fwd_port(0, priority, 0, dev_id);\n \t\t\tact_set++;\n \t\t\trinfo->act_byte_len += sizeof(union cpfl_action_set);\n \t\t\tbreak;\n@@ -414,6 +434,64 @@ cpfl_is_mod_action(const struct rte_flow_action actions[])\n \treturn false;\n }\n \n+static bool\n+cpfl_fxp_get_metadata_port(struct cpfl_itf *itf,\n+\t\t\t   const struct rte_flow_action actions[])\n+{\n+\tconst struct rte_flow_action *action;\n+\tenum rte_flow_action_type action_type;\n+\tconst struct rte_flow_action_ethdev *ethdev;\n+\tstruct cpfl_itf *target_itf;\n+\tbool ret;\n+\n+\tif (itf->type == CPFL_ITF_TYPE_VPORT) {\n+\t\tret = cpfl_metadata_write_port_id(itf);\n+\t\tif (!ret) {\n+\t\t\tPMD_DRV_LOG(ERR, \"fail to write port id\");\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\n+\tret = cpfl_metadata_write_sourcevsi(itf);\n+\tif (!ret) {\n+\t\tPMD_DRV_LOG(ERR, \"fail to write source vsi id\");\n+\t\treturn false;\n+\t}\n+\n+\tret = cpfl_metadata_write_vsi(itf);\n+\tif (!ret) {\n+\t\tPMD_DRV_LOG(ERR, \"fail to write vsi id\");\n+\t\treturn false;\n+\t}\n+\n+\tif (!actions || actions->type == RTE_FLOW_ACTION_TYPE_END)\n+\t\treturn false;\n+\n+\tfor (action = actions; action->type != RTE_FLOW_ACTION_TYPE_END; action++) {\n+\t\taction_type = action->type;\n+\t\tswitch (action_type) {\n+\t\tcase RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:\n+\t\tcase RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:\n+\t\t\tethdev = (const struct rte_flow_action_ethdev *)action->conf;\n+\t\t\ttarget_itf = cpfl_get_itf_by_port_id(ethdev->port_id);\n+\t\t\tif (!target_itf) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"fail to get target_itf by port id\");\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t\tret = cpfl_metadata_write_targetvsi(target_itf);\n+\t\t\tif (!ret) {\n+\t\t\t\tPMD_DRV_LOG(ERR, \"fail to write target vsi id\");\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tcontinue;\n+\t\t}\n+\t}\n+\n+\treturn true;\n+}\n+\n static int\n cpfl_fxp_parse_pattern_action(struct rte_eth_dev *dev,\n \t\t\t      const struct rte_flow_attr *attr,\n@@ -430,7 +508,13 @@ cpfl_fxp_parse_pattern_action(struct rte_eth_dev *dev,\n \tstruct cpfl_rule_info_meta *rim;\n \tint ret;\n \n-\tret = cpfl_flow_parse_items(adapter->flow_parser, pattern, attr, &pr_action);\n+\tret = cpfl_fxp_get_metadata_port(itf, actions);\n+\tif (!ret) {\n+\t\tPMD_DRV_LOG(ERR, \"Fail to save metadata.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tret = cpfl_flow_parse_items(itf, adapter->flow_parser, pattern, attr, &pr_action);\n \tif (ret) {\n \t\tPMD_DRV_LOG(ERR, \"No Match pattern support.\");\n \t\treturn -EINVAL;\ndiff --git a/drivers/net/cpfl/cpfl_representor.c b/drivers/net/cpfl/cpfl_representor.c\nindex 4d15a26c80..de3b426727 100644\n--- a/drivers/net/cpfl/cpfl_representor.c\n+++ b/drivers/net/cpfl/cpfl_representor.c\n@@ -4,6 +4,8 @@\n \n #include \"cpfl_representor.h\"\n #include \"cpfl_rxtx.h\"\n+#include \"cpfl_flow.h\"\n+#include \"cpfl_rules.h\"\n \n static int\n cpfl_repr_allowlist_update(struct cpfl_adapter_ext *adapter,\n@@ -374,6 +376,22 @@ cpfl_repr_link_update(struct rte_eth_dev *ethdev,\n \treturn 0;\n }\n \n+static int\n+cpfl_dev_repr_flow_ops_get(struct rte_eth_dev *dev,\n+\t\t\t   const struct rte_flow_ops **ops)\n+{\n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n+#ifdef RTE_HAS_JANSSON\n+\t*ops = &cpfl_flow_ops;\n+#else\n+\t*ops = NULL;\n+\tPMD_DRV_LOG(NOTICE, \"not support rte_flow, please install json-c library.\");\n+#endif\n+\treturn 0;\n+}\n+\n static const struct eth_dev_ops cpfl_repr_dev_ops = {\n \t.dev_start\t\t= cpfl_repr_dev_start,\n \t.dev_stop\t\t= cpfl_repr_dev_stop,\n@@ -385,6 +403,7 @@ static const struct eth_dev_ops cpfl_repr_dev_ops = {\n \t.tx_queue_setup\t\t= cpfl_repr_tx_queue_setup,\n \n \t.link_update\t\t= cpfl_repr_link_update,\n+\t.flow_ops_get\t\t= cpfl_dev_repr_flow_ops_get,\n };\n \n static int\n@@ -393,6 +412,7 @@ cpfl_repr_init(struct rte_eth_dev *eth_dev, void *init_param)\n \tstruct cpfl_repr *repr = CPFL_DEV_TO_REPR(eth_dev);\n \tstruct cpfl_repr_param *param = init_param;\n \tstruct cpfl_adapter_ext *adapter = param->adapter;\n+\tint ret;\n \n \trepr->repr_id = param->repr_id;\n \trepr->vport_info = param->vport_info;\n@@ -402,6 +422,15 @@ cpfl_repr_init(struct rte_eth_dev *eth_dev, void *init_param)\n \tif (repr->vport_info->vport.info.vport_status == CPCHNL2_VPORT_STATUS_ENABLED)\n \t\trepr->func_up = true;\n \n+\tTAILQ_INIT(&repr->itf.flow_list);\n+\tmemset(repr->itf.dma, 0, sizeof(repr->itf.dma));\n+\tmemset(repr->itf.msg, 0, sizeof(repr->itf.msg));\n+\tret = cpfl_alloc_dma_mem_batch(&repr->itf.flow_dma, repr->itf.dma,\n+\t\t\t\t       sizeof(union cpfl_rule_cfg_pkt_record),\n+\t\t\t\t       CPFL_FLOW_BATCH_SIZE);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n \teth_dev->dev_ops = &cpfl_repr_dev_ops;\n \n \teth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;\n",
    "prefixes": [
        "v6",
        "8/8"
    ]
}