Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/132025/?format=api
http://patchwork.dpdk.org/api/patches/132025/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230927125416.2308974-9-yuying.zhang@intel.com/", "project": { "id": 1, "url": "http://patchwork.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": "<20230927125416.2308974-9-yuying.zhang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230927125416.2308974-9-yuying.zhang@intel.com", "date": "2023-09-27T12:54:15", "name": "[v8,8/9] net/cpfl: add flow support for representor", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c4183d062fdb8b1a2c8fd186ba754219ebb0697f", "submitter": { "id": 1844, "url": "http://patchwork.dpdk.org/api/people/1844/?format=api", "name": "Zhang, Yuying", "email": "yuying.zhang@intel.com" }, "delegate": { "id": 1540, "url": "http://patchwork.dpdk.org/api/users/1540/?format=api", "username": "qzhan15", "first_name": "Qi", "last_name": "Zhang", "email": "qi.z.zhang@intel.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230927125416.2308974-9-yuying.zhang@intel.com/mbox/", "series": [ { "id": 29658, "url": "http://patchwork.dpdk.org/api/series/29658/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29658", "date": "2023-09-27T12:54:07", "name": "add rte flow support for cpfl", "version": 8, "mbox": "http://patchwork.dpdk.org/series/29658/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/132025/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/132025/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 3C72F42651;\n\tWed, 27 Sep 2023 14:55:42 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0A97F410D0;\n\tWed, 27 Sep 2023 14:55:04 +0200 (CEST)", "from mgamail.intel.com (mgamail.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 08B1640E2D\n for <dev@dpdk.org>; Wed, 27 Sep 2023 14:55:00 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Sep 2023 05:55:00 -0700", "from dpdk-wenjing-02.sh.intel.com ([10.67.119.3])\n by orsmga004.jf.intel.com with ESMTP; 27 Sep 2023 05:54:58 -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=1695819301; x=1727355301;\n h=from:to:subject:date:message-id:in-reply-to:references:\n mime-version:content-transfer-encoding;\n bh=ag994wpg6dKPlThjedFewCxdgaML4uKTNBDY2e/xvGQ=;\n b=W7njzsvKNwUI2TQLvVT04+YsucTZujCL05octDVszsawT6L5BSN63Xgv\n HCb7NccOK2crubOaWGKLzkpRNkhfpsO4lJBp2d7RIMIs545vFlOwkYBDb\n JbP02OAiUdDFZxu7jJXENF0PJIDIFJlz4ZZafHsXgrZaL7unbvzhsrQSD\n lMG3KE7C3KQDFy/bDQICZtASz+rcVTuGvuv+DIx8RmrjrswNKALLLrK+S\n QrmO5FTa8gz/nagNoaQOxoN/JtOkVr2sYrAxBTODSmkxmRHIQU5apBOvG\n GTPEAmmIxLgHYvN4ebwHCXeXFSxfPuZgblKVixHB70xcYzRnyHZ3QAcIM w==;", "X-IronPort-AV": [ "E=McAfee;i=\"6600,9927,10846\"; a=\"361204101\"", "E=Sophos;i=\"6.03,181,1694761200\"; d=\"scan'208\";a=\"361204101\"", "E=McAfee;i=\"6600,9927,10846\"; a=\"872873959\"", "E=Sophos;i=\"6.03,181,1694761200\"; d=\"scan'208\";a=\"872873959\"" ], "X-ExtLoop1": "1", "From": "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 v8 8/9] net/cpfl: add flow support for representor", "Date": "Wed, 27 Sep 2023 12:54:15 +0000", "Message-Id": "<20230927125416.2308974-9-yuying.zhang@intel.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230927125416.2308974-1-yuying.zhang@intel.com>", "References": "<20230926181703.2268199-1-yuying.zhang@intel.com>\n <20230927125416.2308974-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 drivers/net/cpfl/cpfl_flow_engine_fxp.c | 74 +++++++++++++++++++++++++\n drivers/net/cpfl/cpfl_representor.c | 29 ++++++++++\n 2 files changed, 103 insertions(+)", "diff": "diff --git a/drivers/net/cpfl/cpfl_flow_engine_fxp.c b/drivers/net/cpfl/cpfl_flow_engine_fxp.c\nindex 154af5bd35..c460e6b5c6 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@@ -414,6 +424,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,6 +498,12 @@ cpfl_fxp_parse_pattern_action(struct rte_eth_dev *dev,\n \tstruct cpfl_rule_info_meta *rim;\n \tint ret;\n \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.\");\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": [ "v8", "8/9" ] }{ "id": 132025, "url": "