get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 128303,
    "url": "http://patches.dpdk.org/api/patches/128303/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230607130245.8048-15-ivan.malov@arknetworks.am/",
    "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": "<20230607130245.8048-15-ivan.malov@arknetworks.am>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230607130245.8048-15-ivan.malov@arknetworks.am",
    "date": "2023-06-07T13:02:25",
    "name": "[v4,14/34] net/sfc: let driver-internal flows use VF representor action",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "e3707e19dcf0838ceb285ccfb2c7b8800f95fa3a",
    "submitter": {
        "id": 2962,
        "url": "http://patches.dpdk.org/api/people/2962/?format=api",
        "name": "Ivan Malov",
        "email": "ivan.malov@arknetworks.am"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230607130245.8048-15-ivan.malov@arknetworks.am/mbox/",
    "series": [
        {
            "id": 28390,
            "url": "http://patches.dpdk.org/api/series/28390/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28390",
            "date": "2023-06-07T13:02:11",
            "name": "net/sfc: support HW conntrack assistance",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/28390/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/128303/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/128303/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 CB32942C4D;\n\tWed,  7 Jun 2023 15:04:58 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7129B42D8D;\n\tWed,  7 Jun 2023 15:03:04 +0200 (CEST)",
            "from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80])\n by mails.dpdk.org (Postfix) with ESMTP id DBA0642D43\n for <dev@dpdk.org>; Wed,  7 Jun 2023 15:02:54 +0200 (CEST)",
            "from localhost.localdomain (unknown [78.109.69.83])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by agw.arknetworks.am (Postfix) with ESMTPSA id 67914E1253;\n Wed,  7 Jun 2023 17:02:54 +0400 (+04)"
        ],
        "From": "Ivan Malov <ivan.malov@arknetworks.am>",
        "To": "dev@dpdk.org",
        "Cc": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Ferruh Yigit <ferruh.yigit@amd.com>, Andy Moreton <amoreton@xilinx.com>",
        "Subject": "[PATCH v4 14/34] net/sfc: let driver-internal flows use VF\n representor action",
        "Date": "Wed,  7 Jun 2023 17:02:25 +0400",
        "Message-Id": "<20230607130245.8048-15-ivan.malov@arknetworks.am>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20230607130245.8048-1-ivan.malov@arknetworks.am>",
        "References": "<20230601195538.8265-1-ivan.malov@arknetworks.am>\n <20230607130245.8048-1-ivan.malov@arknetworks.am>",
        "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": "In the case of VF <--> VF representor pairs, these flows can\nonly collect VF traffic, so let them use generic flow action\nPORT_REPRESENTOR, as part of re-using generic flow mechanism.\n\nCurrently, it does not allow to access VF representors since\nthey have no unique HW logical ports (m-ports). They all sit\non the same (representor proxy) m-port, while demultiplexing\nof traffic uses ingress (VF) m-port value in packet metadata.\nTraffic from arbitrary sources cannot be identified this way.\nBut, for VF traffic, it should be right to make an exception.\n\nSigned-off-by: Ivan Malov <ivan.malov@arknetworks.am>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n drivers/net/sfc/sfc_mae.c            | 25 +++++++++++++++++++------\n drivers/net/sfc/sfc_repr.c           | 20 ++++++++++++++++----\n drivers/net/sfc/sfc_repr_proxy.c     | 15 +++++++++++++++\n drivers/net/sfc/sfc_repr_proxy_api.h |  3 +++\n drivers/net/sfc/sfc_switch.c         |  7 ++-----\n drivers/net/sfc/sfc_switch.h         | 10 ++++++++++\n 6 files changed, 65 insertions(+), 15 deletions(-)",
    "diff": "diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 1928d58779..89fa75281f 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -1525,6 +1525,7 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,\n \tconst struct rte_flow_item_port_id *spec = NULL;\n \tconst struct rte_flow_item_port_id *mask = NULL;\n \tefx_mport_sel_t mport_sel;\n+\tunsigned int type_mask;\n \tint rc;\n \n \tif (ctx_mae->match_mport_set) {\n@@ -1556,8 +1557,10 @@ sfc_mae_rule_parse_item_port_id(const struct rte_flow_item *item,\n \t\t\t\t\t  \"The port ID is too large\");\n \t}\n \n+\ttype_mask = 1U << SFC_MAE_SWITCH_PORT_INDEPENDENT;\n+\n \trc = sfc_mae_switch_get_ethdev_mport(ctx_mae->sa->mae.switch_domain_id,\n-\t\t\t\t\t     spec->id, &mport_sel);\n+\t\t\t\t\t     spec->id, type_mask, &mport_sel);\n \tif (rc != 0) {\n \t\treturn rte_flow_error_set(error, rc,\n \t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM, item,\n@@ -1590,6 +1593,7 @@ sfc_mae_rule_parse_item_ethdev_based(const struct rte_flow_item *item,\n \tconst struct rte_flow_item_ethdev *spec = NULL;\n \tconst struct rte_flow_item_ethdev *mask = NULL;\n \tefx_mport_sel_t mport_sel;\n+\tunsigned int type_mask;\n \tint rc;\n \n \tif (ctx_mae->match_mport_set) {\n@@ -1617,9 +1621,11 @@ sfc_mae_rule_parse_item_ethdev_based(const struct rte_flow_item *item,\n \n \tswitch (item->type) {\n \tcase RTE_FLOW_ITEM_TYPE_PORT_REPRESENTOR:\n+\t\ttype_mask = 1U << SFC_MAE_SWITCH_PORT_INDEPENDENT;\n+\n \t\trc = sfc_mae_switch_get_ethdev_mport(\n \t\t\t\tctx_mae->sa->mae.switch_domain_id,\n-\t\t\t\tspec->port_id, &mport_sel);\n+\t\t\t\tspec->port_id, type_mask, &mport_sel);\n \t\tif (rc != 0) {\n \t\t\treturn rte_flow_error_set(error, rc,\n \t\t\t\t\tRTE_FLOW_ERROR_TYPE_ITEM, item,\n@@ -3529,6 +3535,7 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,\n {\n \tstruct sfc_adapter_shared * const sas = sfc_sa2shared(sa);\n \tstruct sfc_mae *mae = &sa->mae;\n+\tunsigned int type_mask;\n \tefx_mport_sel_t mport;\n \tuint16_t port_id;\n \tint rc;\n@@ -3538,8 +3545,10 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,\n \n \tport_id = (conf->original != 0) ? sas->port_id : conf->id;\n \n+\ttype_mask = 1U << SFC_MAE_SWITCH_PORT_INDEPENDENT;\n+\n \trc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,\n-\t\t\t\t\t     port_id, &mport);\n+\t\t\t\t\t     port_id, type_mask, &mport);\n \tif (rc != 0) {\n \t\tsfc_err(sa, \"failed to get m-port for the given ethdev (port_id=%u): %s\",\n \t\t\tport_id, strerror(rc));\n@@ -3558,14 +3567,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,\n static int\n sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa,\n \t\tconst struct rte_flow_action_ethdev *conf,\n-\t\tefx_mae_actions_t *spec)\n+\t\tunsigned int type_mask, efx_mae_actions_t *spec)\n {\n \tstruct sfc_mae *mae = &sa->mae;\n \tefx_mport_sel_t mport;\n \tint rc;\n \n \trc = sfc_mae_switch_get_ethdev_mport(mae->switch_domain_id,\n-\t\t\t\t\t     conf->port_id, &mport);\n+\t\t\t\t\t     conf->port_id, type_mask, &mport);\n \tif (rc != 0) {\n \t\tsfc_err(sa, \"failed to get m-port for the given ethdev (port_id=%u): %s\",\n \t\t\tconf->port_id, strerror(rc));\n@@ -3641,6 +3650,7 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \tconst struct sfc_mae_outer_rule *outer_rule = spec_mae->outer_rule;\n \tconst uint64_t rx_metadata = sa->negotiated_rx_metadata;\n \tefx_mae_actions_t *spec = ctx->spec;\n+\tunsigned int switch_port_type_mask;\n \tbool custom_error = B_FALSE;\n \tint rc = 0;\n \n@@ -3757,8 +3767,11 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \tcase RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR:\n \t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR,\n \t\t\t\t       bundle->actions_mask);\n+\n+\t\tswitch_port_type_mask = 1U << SFC_MAE_SWITCH_PORT_INDEPENDENT;\n+\n \t\trc = sfc_mae_rule_parse_action_port_representor(sa,\n-\t\t\t\taction->conf, spec);\n+\t\t\t\taction->conf, switch_port_type_mask, spec);\n \t\tbreak;\n \tcase RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT:\n \t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT,\ndiff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c\nindex d4134ec91b..6c7727d569 100644\n--- a/drivers/net/sfc/sfc_repr.c\n+++ b/drivers/net/sfc/sfc_repr.c\n@@ -933,15 +933,26 @@ sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)\n \tstruct sfc_repr_shared *srs = sfc_repr_shared_by_eth_dev(dev);\n \tstruct sfc_mae_switch_port_request switch_port_request;\n \tefx_mport_sel_t ethdev_mport_sel;\n+\tefx_mport_id_t proxy_mport_id;\n \tstruct sfc_repr *sr;\n \tint ret;\n \n \t/*\n-\t * Currently there is no mport we can use for representor's\n-\t * ethdev. Use an invalid one for now. This way representors\n-\t * can be instantiated.\n+\t * For each representor, a driver-internal flow has to be installed\n+\t * in order to direct traffic coming from the represented entity to\n+\t * the \"representor proxy\". Such internal flows need to find ethdev\n+\t * mport by ethdev ID of the representors in question to specify in\n+\t * delivery action. So set the representor ethdev's mport to that\n+\t * of the \"representor proxy\" in below switch port request.\n \t */\n-\tefx_mae_mport_invalid(&ethdev_mport_sel);\n+\tsfc_repr_proxy_mport_alias_get(repr_data->pf_port_id, &proxy_mport_id);\n+\n+\tret = efx_mae_mport_by_id(&proxy_mport_id, &ethdev_mport_sel);\n+\tif (ret != 0) {\n+\t\tSFC_GENERIC_LOG(ERR,\n+\t\t\t\"%s() failed to get repr proxy mport by ID\", __func__);\n+\t\tgoto fail_get_selector;\n+\t}\n \n \tmemset(&switch_port_request, 0, sizeof(switch_port_request));\n \tswitch_port_request.type = SFC_MAE_SWITCH_PORT_REPRESENTOR;\n@@ -1033,6 +1044,7 @@ sfc_repr_eth_dev_init(struct rte_eth_dev *dev, void *init_params)\n \n fail_create_port:\n fail_mae_assign_switch_port:\n+fail_get_selector:\n \tSFC_GENERIC_LOG(ERR, \"%s() failed: %s\", __func__, rte_strerror(-ret));\n \treturn ret;\n }\ndiff --git a/drivers/net/sfc/sfc_repr_proxy.c b/drivers/net/sfc/sfc_repr_proxy.c\nindex 4ba7683370..74c3494c35 100644\n--- a/drivers/net/sfc/sfc_repr_proxy.c\n+++ b/drivers/net/sfc/sfc_repr_proxy.c\n@@ -1708,3 +1708,18 @@ sfc_repr_proxy_repr_entity_mac_addr_set(uint16_t pf_port_id, uint16_t repr_id,\n \n \treturn rc;\n }\n+\n+void\n+sfc_repr_proxy_mport_alias_get(uint16_t pf_port_id, efx_mport_id_t *mport_alias)\n+{\n+\tconst struct sfc_repr_proxy *rp;\n+\tstruct sfc_adapter *sa;\n+\n+\tsa = sfc_get_adapter_by_pf_port_id(pf_port_id);\n+\tsfc_adapter_lock(sa);\n+\trp = sfc_repr_proxy_by_adapter(sa);\n+\n+\tmemcpy(mport_alias, &rp->mport_alias, sizeof(*mport_alias));\n+\n+\tsfc_adapter_unlock(sa);\n+}\ndiff --git a/drivers/net/sfc/sfc_repr_proxy_api.h b/drivers/net/sfc/sfc_repr_proxy_api.h\nindex 1d38ab2451..07d79a50cb 100644\n--- a/drivers/net/sfc/sfc_repr_proxy_api.h\n+++ b/drivers/net/sfc/sfc_repr_proxy_api.h\n@@ -46,6 +46,9 @@ int sfc_repr_proxy_stop_repr(uint16_t pf_port_id, uint16_t repr_id);\n int sfc_repr_proxy_repr_entity_mac_addr_set(uint16_t pf_port_id,\n \t\tuint16_t repr_id, const struct rte_ether_addr *mac_addr);\n \n+void sfc_repr_proxy_mport_alias_get(uint16_t pf_port_id,\n+\t\t\t\t    efx_mport_id_t *mport_alias);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c\nindex 8f1ee97fa8..f80de4e889 100644\n--- a/drivers/net/sfc/sfc_switch.c\n+++ b/drivers/net/sfc/sfc_switch.c\n@@ -551,6 +551,7 @@ sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id,\n int\n sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,\n \t\t\t\tuint16_t ethdev_port_id,\n+\t\t\t\tunsigned int allowed_mae_switch_port_types,\n \t\t\t\tefx_mport_sel_t *mport_sel)\n {\n \tstruct sfc_mae_switch_port *port;\n@@ -562,11 +563,7 @@ sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,\n \tif (rc != 0)\n \t\tgoto unlock;\n \n-\tif (port->type != SFC_MAE_SWITCH_PORT_INDEPENDENT) {\n-\t\t/*\n-\t\t * The ethdev is a \"VF representor\". It does not own\n-\t\t * a dedicated m-port suitable for use in flow rules.\n-\t\t */\n+\tif (((1U << port->type) & allowed_mae_switch_port_types) == 0) {\n \t\trc = ENOTSUP;\n \t\tgoto unlock;\n \t}\ndiff --git a/drivers/net/sfc/sfc_switch.h b/drivers/net/sfc/sfc_switch.h\nindex 62aea9b785..6a85ce4dcf 100644\n--- a/drivers/net/sfc/sfc_switch.h\n+++ b/drivers/net/sfc/sfc_switch.h\n@@ -102,8 +102,18 @@ int sfc_mae_assign_switch_port(uint16_t switch_domain_id,\n int sfc_mae_clear_switch_port(uint16_t switch_domain_id,\n \t\t\t      uint16_t switch_port_id);\n \n+/*\n+ * For user flows, allowed_mae_switch_port_types can only contain bit\n+ * SFC_MAE_SWITCH_PORT_INDEPENDENT, meaning that only those ethdevs\n+ * that have their own MAE m-ports can be accessed by a port-based\n+ * action. For driver-internal flows, this mask can also contain\n+ * bit SFC_MAE_SWITCH_PORT_REPRESENTOR to allow VF traffic to be\n+ * sent to the common MAE m-port of all such REPRESENTOR ports\n+ * via a port-based action, for default switch interconnection.\n+ */\n int sfc_mae_switch_get_ethdev_mport(uint16_t switch_domain_id,\n \t\t\t\t    uint16_t ethdev_port_id,\n+\t\t\t\t    unsigned int allowed_mae_switch_port_types,\n \t\t\t\t    efx_mport_sel_t *mport_sel);\n \n int sfc_mae_switch_get_entity_mport(uint16_t switch_domain_id,\n",
    "prefixes": [
        "v4",
        "14/34"
    ]
}