get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81548,
    "url": "https://patches.dpdk.org/api/patches/81548/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1603185222-14831-45-git-send-email-arybchenko@solarflare.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": "<1603185222-14831-45-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1603185222-14831-45-git-send-email-arybchenko@solarflare.com",
    "date": "2020-10-20T09:13:24",
    "name": "[v2,44/62] net/sfc: support flow action PORT ID in transfer rules",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "baf3ee0893df65e9b588b9897a283f93fb157084",
    "submitter": {
        "id": 607,
        "url": "https://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.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@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1603185222-14831-45-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [
        {
            "id": 13137,
            "url": "https://patches.dpdk.org/api/series/13137/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13137",
            "date": "2020-10-20T09:12:44",
            "name": "net/sfc: support flow API transfer rules",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/13137/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/81548/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/81548/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 30F1DA04DD;\n\tTue, 20 Oct 2020 11:33:38 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D30B4E36D;\n\tTue, 20 Oct 2020 11:15:36 +0200 (CEST)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 0AB06C83C\n for <dev@dpdk.org>; Tue, 20 Oct 2020 11:14:15 +0200 (CEST)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.65.62])\n by dispatch1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id\n C60896007C for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:15 +0000 (UTC)",
            "from us4-mdac16-25.ut7.mdlocal (unknown [10.7.65.251])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id C54308009B\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:15 +0000 (UTC)",
            "from mx1-us1.ppe-hosted.com (unknown [10.7.66.34])\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n 4A46828005C\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:15 +0000 (UTC)",
            "from webmail.solarflare.com (uk.solarflare.com [193.34.186.16])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))\n (No client certificate requested)\n by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id\n F3A11600053\n for <dev@dpdk.org>; Tue, 20 Oct 2020 09:14:14 +0000 (UTC)",
            "from ukex01.SolarFlarecom.com (10.17.10.4) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id\n 15.0.1497.2; Tue, 20 Oct 2020 10:14:01 +0100",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server id\n 15.0.1497.2 via Frontend Transport; Tue, 20 Oct 2020 10:14:01 +0100",
            "from ukv-loginhost.uk.solarflarecom.com\n (ukv-loginhost.uk.solarflarecom.com [10.17.10.39])\n by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id 09K9E1Fj028492;\n Tue, 20 Oct 2020 10:14:01 +0100",
            "from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1])\n by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 386291613A9;\n Tue, 20 Oct 2020 10:14:01 +0100 (BST)"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Tue, 20 Oct 2020 10:13:24 +0100",
        "Message-ID": "<1603185222-14831-45-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1603185222-14831-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1603183709-23420-1-git-send-email-arybchenko@solarflare.com>\n <1603185222-14831-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-TM-AS-Product-Ver": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-TM-AS-Result": "No-1.065200-8.000000-10",
        "X-TMASE-MatchedRID": "3ksEd+Y0lhRu0gVhNXVDBHYZxYoZm58FK1PH96GPPGCZfDRE1uqSgu1+\n sfrt9AWI2XHJ0L4jOIRTvVffeIwvQ4SH/KD/7QRgnFVnNmvv47tLXPA26IG0hN9RlPzeVuQQbaa\n h63IrZyfR1p6w/8fEozoDS4rfut35X+8u+zQ7JmKqDSBu0tUhr4HLFWR93TgkHWtVZN0asTi1lc\n oibF/5wUxwpTUboUzT7uiIyPP00Otw1/wpADjDvGhCG8qMW+KyBnIRIVcCWN9s98Z8fG/6kS9+7\n r4Ve5ORzAGZU0rgjylsMyD1FAVfKvzEorjs/fJlD3uYMxd01bd9LQinZ4QefPcjNeVeWlqY+gtH\n j7OwNO2tdP9AzJTY3NtLmhUDutwNn7lxBBp+zgrK30zxQlCIv9vosV/0Q+z83J0NP0GJI4sA1B7\n YuKd0v85ZpbBQ5omwWXp4ELZuAse+BLCmO4JWR9pAu0sLxpSoQ8G+yYJYYdZRZDsGiXQioL4jxK\n nHJRLcVcr204P67pw=",
        "X-TM-AS-User-Approved-Sender": "Yes",
        "X-TM-AS-User-Blocked-Sender": "No",
        "X-TMASE-Result": "10-1.065200-8.000000",
        "X-TMASE-Version": "SMEX-12.5.0.1300-8.6.1012-25736.003",
        "X-MDID": "1603185255-v04lX8-W2PLR",
        "X-PPE-DISP": "1603185255;v04lX8-W2PLR",
        "Subject": "[dpdk-dev] [PATCH v2 44/62] net/sfc: support flow action PORT ID in\n\ttransfer rules",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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: Ivan Malov <ivan.malov@oktetlabs.ru>\n\nThe action handler will use MAE action DELIVER with MPORT\nof the PCIe function associated with a given DPDK port ID.\nThe DPDK port must not relate to a different physical device.\n\nSigned-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\n---\n doc/guides/nics/sfc_efx.rst  |  2 ++\n drivers/net/sfc/sfc_mae.c    | 33 ++++++++++++++++++++\n drivers/net/sfc/sfc_switch.c | 58 ++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_switch.h |  6 ++++\n 4 files changed, 99 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst\nindex ba73391d5f..7b8c1c8527 100644\n--- a/doc/guides/nics/sfc_efx.rst\n+++ b/doc/guides/nics/sfc_efx.rst\n@@ -218,6 +218,8 @@ Supported actions (***transfer*** rules):\n \n - VF\n \n+- PORT_ID\n+\n - DROP\n \n Validating flow rules depends on the firmware variant.\ndiff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c\nindex 64cd6b0e9b..f309efa2cf 100644\n--- a/drivers/net/sfc/sfc_mae.c\n+++ b/drivers/net/sfc/sfc_mae.c\n@@ -30,6 +30,7 @@ sfc_mae_assign_entity_mport(struct sfc_adapter *sa,\n int\n sfc_mae_attach(struct sfc_adapter *sa)\n {\n+\tstruct sfc_adapter_shared * const sas = sfc_sa2shared(sa);\n \tstruct sfc_mae_switch_port_request switch_port_request = {0};\n \tconst efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);\n \tefx_mport_sel_t entity_mport;\n@@ -67,6 +68,12 @@ sfc_mae_attach(struct sfc_adapter *sa)\n \tsfc_log_init(sa, \"assign RTE switch port\");\n \tswitch_port_request.type = SFC_MAE_SWITCH_PORT_INDEPENDENT;\n \tswitch_port_request.entity_mportp = &entity_mport;\n+\t/*\n+\t * As of now, the driver does not support representors, so\n+\t * RTE ethdev MPORT simply matches that of the entity.\n+\t */\n+\tswitch_port_request.ethdev_mportp = &entity_mport;\n+\tswitch_port_request.ethdev_port_id = sas->port_id;\n \trc = sfc_mae_assign_switch_port(mae->switch_domain_id,\n \t\t\t\t\t&switch_port_request,\n \t\t\t\t\t&mae->switch_port_id);\n@@ -793,6 +800,27 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa,\n \treturn efx_mae_action_set_populate_deliver(spec, &mport);\n }\n \n+static int\n+sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa,\n+\t\t\t\t  const struct rte_flow_action_port_id *conf,\n+\t\t\t\t  efx_mae_actions_t *spec)\n+{\n+\tstruct sfc_adapter_shared * const sas = sfc_sa2shared(sa);\n+\tstruct sfc_mae *mae = &sa->mae;\n+\tefx_mport_sel_t mport;\n+\tuint16_t port_id;\n+\tint rc;\n+\n+\tport_id = (conf->original != 0) ? sas->port_id : conf->id;\n+\n+\trc = sfc_mae_switch_port_by_ethdev(mae->switch_domain_id,\n+\t\t\t\t\t   port_id, &mport);\n+\tif (rc != 0)\n+\t\treturn rc;\n+\n+\treturn efx_mae_action_set_populate_deliver(spec, &mport);\n+}\n+\n static int\n sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \t\t\t  const struct rte_flow_action *action,\n@@ -848,6 +876,11 @@ sfc_mae_rule_parse_action(struct sfc_adapter *sa,\n \t\t\t\t       bundle->actions_mask);\n \t\trc = sfc_mae_rule_parse_action_pf_vf(sa, action->conf, spec);\n \t\tbreak;\n+\tcase RTE_FLOW_ACTION_TYPE_PORT_ID:\n+\t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_PORT_ID,\n+\t\t\t\t       bundle->actions_mask);\n+\t\trc = sfc_mae_rule_parse_action_port_id(sa, action->conf, spec);\n+\t\tbreak;\n \tcase RTE_FLOW_ACTION_TYPE_DROP:\n \t\tSFC_BUILD_SET_OVERFLOW(RTE_FLOW_ACTION_TYPE_DROP,\n \t\t\t\t       bundle->actions_mask);\ndiff --git a/drivers/net/sfc/sfc_switch.c b/drivers/net/sfc/sfc_switch.c\nindex 395fc40263..bdea2a2446 100644\n--- a/drivers/net/sfc/sfc_switch.c\n+++ b/drivers/net/sfc/sfc_switch.c\n@@ -41,10 +41,22 @@\n  * This mapping comprises a port type to ensure that RTE switch port ID\n  * of a represented entity and that of its representor are different in\n  * the case when the entity gets plugged into DPDK and not into a guest.\n+ *\n+ * Entry data also comprises RTE ethdev's own MPORT. This value\n+ * coincides with the entity MPORT in the case of independent ports.\n+ * In the case of representors, this ID is not a selector and refers\n+ * to an allocatable object (that is, it's likely to change on RTE\n+ * ethdev replug). Flow API backend must use this value rather\n+ * than entity_mport to support flow rule action PORT_ID.\n  */\n struct sfc_mae_switch_port {\n \tTAILQ_ENTRY(sfc_mae_switch_port)\tswitch_domain_ports;\n \n+\t/** RTE ethdev MPORT */\n+\tefx_mport_sel_t\t\t\t\tethdev_mport;\n+\t/** RTE ethdev port ID */\n+\tuint16_t\t\t\t\tethdev_port_id;\n+\n \t/** Entity (PCIe function) MPORT selector */\n \tefx_mport_sel_t\t\t\t\tentity_mport;\n \t/** Port type (independent/representor) */\n@@ -263,6 +275,9 @@ sfc_mae_assign_switch_port(uint16_t switch_domain_id,\n \tTAILQ_INSERT_TAIL(&domain->ports, port, switch_domain_ports);\n \n done:\n+\tport->ethdev_mport = *req->ethdev_mportp;\n+\tport->ethdev_port_id = req->ethdev_port_id;\n+\n \t*switch_port_id = port->id;\n \n \trte_spinlock_unlock(&sfc_mae_switch.lock);\n@@ -274,3 +289,46 @@ sfc_mae_assign_switch_port(uint16_t switch_domain_id,\n \trte_spinlock_unlock(&sfc_mae_switch.lock);\n \treturn rc;\n }\n+\n+/* This function expects to be called only when the lock is held */\n+static int\n+sfc_mae_find_switch_port_by_ethdev(uint16_t switch_domain_id,\n+\t\t\t\t   uint16_t ethdev_port_id,\n+\t\t\t\t   efx_mport_sel_t *mport_sel)\n+{\n+\tstruct sfc_mae_switch_domain *domain;\n+\tstruct sfc_mae_switch_port *port;\n+\n+\tSFC_ASSERT(rte_spinlock_is_locked(&sfc_mae_switch.lock));\n+\n+\tif (ethdev_port_id == RTE_MAX_ETHPORTS)\n+\t\treturn EINVAL;\n+\n+\tdomain = sfc_mae_find_switch_domain_by_id(switch_domain_id);\n+\tif (domain == NULL)\n+\t\treturn EINVAL;\n+\n+\tTAILQ_FOREACH(port, &domain->ports, switch_domain_ports) {\n+\t\tif (port->ethdev_port_id == ethdev_port_id) {\n+\t\t\t*mport_sel = port->ethdev_mport;\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn ENOENT;\n+}\n+\n+int\n+sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,\n+\t\t\t      uint16_t ethdev_port_id,\n+\t\t\t      efx_mport_sel_t *mport_sel)\n+{\n+\tint rc;\n+\n+\trte_spinlock_lock(&sfc_mae_switch.lock);\n+\trc = sfc_mae_find_switch_port_by_ethdev(switch_domain_id,\n+\t\t\t\t\t\tethdev_port_id, mport_sel);\n+\trte_spinlock_unlock(&sfc_mae_switch.lock);\n+\n+\treturn rc;\n+}\ndiff --git a/drivers/net/sfc/sfc_switch.h b/drivers/net/sfc/sfc_switch.h\nindex 9845ac8801..96ece95654 100644\n--- a/drivers/net/sfc/sfc_switch.h\n+++ b/drivers/net/sfc/sfc_switch.h\n@@ -32,6 +32,8 @@ enum sfc_mae_switch_port_type {\n struct sfc_mae_switch_port_request {\n \tenum sfc_mae_switch_port_type\t\ttype;\n \tconst efx_mport_sel_t\t\t\t*entity_mportp;\n+\tconst efx_mport_sel_t\t\t\t*ethdev_mportp;\n+\tuint16_t\t\t\t\tethdev_port_id;\n };\n \n int sfc_mae_assign_switch_domain(struct sfc_adapter *sa,\n@@ -41,6 +43,10 @@ int sfc_mae_assign_switch_port(uint16_t switch_domain_id,\n \t\t\t       const struct sfc_mae_switch_port_request *req,\n \t\t\t       uint16_t *switch_port_id);\n \n+int sfc_mae_switch_port_by_ethdev(uint16_t switch_domain_id,\n+\t\t\t\t  uint16_t ethdev_port_id,\n+\t\t\t\t  efx_mport_sel_t *mport_sel);\n+\n #ifdef __cplusplus\n }\n #endif\n",
    "prefixes": [
        "v2",
        "44/62"
    ]
}