get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97421,
    "url": "https://patches.dpdk.org/api/patches/97421/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210827065717.1838258-4-andrew.rybchenko@oktetlabs.ru/",
    "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": "<20210827065717.1838258-4-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210827065717.1838258-4-andrew.rybchenko@oktetlabs.ru",
    "date": "2021-08-27T06:56:42",
    "name": "[03/38] net/sfc: add switch mode device argument",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7eca68526728f7ead0d8042afc1690d42f2bc344",
    "submitter": {
        "id": 2013,
        "url": "https://patches.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "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/20210827065717.1838258-4-andrew.rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 18492,
            "url": "https://patches.dpdk.org/api/series/18492/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18492",
            "date": "2021-08-27T06:56:39",
            "name": "net/sfc: support port representors",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/18492/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/97421/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/97421/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 CC9F7A0C43;\n\tFri, 27 Aug 2021 08:58:01 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6365D4125D;\n\tFri, 27 Aug 2021 08:57:46 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id BDB3341251\n for <dev@dpdk.org>; Fri, 27 Aug 2021 08:57:44 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id 7C0147F6CB; Fri, 27 Aug 2021 09:57:44 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id 0C9617F6D0;\n Fri, 27 Aug 2021 09:57:33 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 0C9617F6D0",
        "Authentication-Results": "shelob.oktetlabs.ru/0C9617F6D0; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Igor Romanov <igor.romanov@oktetlabs.ru>,\n Andy Moreton <amoreton@xilinx.com>, Ivan Malov <ivan.malov@oktetlabs.ru>",
        "Date": "Fri, 27 Aug 2021 09:56:42 +0300",
        "Message-Id": "<20210827065717.1838258-4-andrew.rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>",
        "References": "<20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 03/38] net/sfc: add switch mode device argument",
        "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: Igor Romanov <igor.romanov@oktetlabs.ru>\n\nAdd the argument that allows user to choose either switchdev or legacy\nmode. Legacy mode enables switching by using Ethernet virtual bridging\n(EVB) API. In switchdev mode, VF traffic goes via port representor\n(if any) on PF, and software virtual switch (for example, Open vSwitch)\nsteers the traffic.\n\nSigned-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\nReviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>\n---\n doc/guides/nics/sfc_efx.rst  | 13 +++++++++\n drivers/net/sfc/sfc.h        |  2 ++\n drivers/net/sfc/sfc_ethdev.c | 54 ++++++++++++++++++++++++++++++++++++\n drivers/net/sfc/sfc_kvargs.c |  1 +\n drivers/net/sfc/sfc_kvargs.h |  8 ++++++\n drivers/net/sfc/sfc_sriov.c  |  9 ++++--\n 6 files changed, 85 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/doc/guides/nics/sfc_efx.rst b/doc/guides/nics/sfc_efx.rst\nindex 163bc2533f..d66cb76dab 100644\n--- a/doc/guides/nics/sfc_efx.rst\n+++ b/doc/guides/nics/sfc_efx.rst\n@@ -371,6 +371,19 @@ boolean parameters value.\n   If this parameter is not specified then ef100 device will operate as\n   network device.\n \n+- ``switch_mode`` [legacy|switchdev] (see below for default)\n+\n+  In legacy mode, NIC firmware provides Ethernet virtual bridging (EVB) API\n+  to configure switching inside NIC to deliver traffic to physical (PF) and\n+  virtual (VF) PCI functions. PF driver is responsible to build the\n+  infrastructure for VFs, and traffic goes to/from VF by default in accordance\n+  with MAC address assigned, permissions and filters installed by VF drivers.\n+  In switchdev mode VF traffic goes via port representor (if any) on PF, and\n+  software virtual switch (for example, Open vSwitch) makes the decision.\n+  Software virtual switch may install MAE rules to pass established traffic\n+  flows via hardware and offload software datapath as the result.\n+  Default is legacy.\n+\n - ``rx_datapath`` [auto|efx|ef10|ef10_essb] (default **auto**)\n \n   Choose receive datapath implementation.\ndiff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h\nindex 331e06bac6..b045baca9e 100644\n--- a/drivers/net/sfc/sfc.h\n+++ b/drivers/net/sfc/sfc.h\n@@ -313,6 +313,8 @@ struct sfc_adapter {\n \tboolean_t\t\t\ttso_encap;\n \n \tuint32_t\t\t\trxd_wait_timeout_ns;\n+\n+\tbool\t\t\t\tswitchdev;\n };\n \n static inline struct sfc_adapter_shared *\ndiff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c\nindex 2db0d000c3..41add341a0 100644\n--- a/drivers/net/sfc/sfc_ethdev.c\n+++ b/drivers/net/sfc/sfc_ethdev.c\n@@ -2188,6 +2188,44 @@ sfc_register_dp(void)\n \t}\n }\n \n+static int\n+sfc_parse_switch_mode(struct sfc_adapter *sa)\n+{\n+\tconst char *switch_mode = NULL;\n+\tint rc;\n+\n+\tsfc_log_init(sa, \"entry\");\n+\n+\trc = sfc_kvargs_process(sa, SFC_KVARG_SWITCH_MODE,\n+\t\t\t\tsfc_kvarg_string_handler, &switch_mode);\n+\tif (rc != 0)\n+\t\tgoto fail_kvargs;\n+\n+\t/* Check representors when supported */\n+\tif (switch_mode == NULL ||\n+\t    strcasecmp(switch_mode, SFC_KVARG_SWITCH_MODE_LEGACY) == 0) {\n+\t\tsa->switchdev = false;\n+\t} else if (strcasecmp(switch_mode,\n+\t\t\t      SFC_KVARG_SWITCH_MODE_SWITCHDEV) == 0) {\n+\t\tsa->switchdev = true;\n+\t} else {\n+\t\tsfc_err(sa, \"invalid switch mode device argument '%s'\",\n+\t\t\tswitch_mode);\n+\t\trc = EINVAL;\n+\t\tgoto fail_mode;\n+\t}\n+\n+\tsfc_log_init(sa, \"done\");\n+\n+\treturn 0;\n+\n+fail_mode:\n+fail_kvargs:\n+\tsfc_log_init(sa, \"failed: %s\", rte_strerror(rc));\n+\n+\treturn rc;\n+}\n+\n static int\n sfc_eth_dev_init(struct rte_eth_dev *dev)\n {\n@@ -2270,6 +2308,10 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)\n \tsfc_adapter_lock_init(sa);\n \tsfc_adapter_lock(sa);\n \n+\trc = sfc_parse_switch_mode(sa);\n+\tif (rc != 0)\n+\t\tgoto fail_switch_mode;\n+\n \tsfc_log_init(sa, \"probing\");\n \trc = sfc_probe(sa);\n \tif (rc != 0)\n@@ -2285,6 +2327,13 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)\n \tif (rc != 0)\n \t\tgoto fail_attach;\n \n+\tif (sa->switchdev && sa->mae.status != SFC_MAE_STATUS_SUPPORTED) {\n+\t\tsfc_err(sa,\n+\t\t\t\"failed to enable switchdev mode without MAE support\");\n+\t\trc = ENOTSUP;\n+\t\tgoto fail_switchdev_no_mae;\n+\t}\n+\n \tencp = efx_nic_cfg_get(sa->nic);\n \n \t/*\n@@ -2299,6 +2348,9 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)\n \tsfc_log_init(sa, \"done\");\n \treturn 0;\n \n+fail_switchdev_no_mae:\n+\tsfc_detach(sa);\n+\n fail_attach:\n \tsfc_eth_dev_clear_ops(dev);\n \n@@ -2306,6 +2358,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)\n \tsfc_unprobe(sa);\n \n fail_probe:\n+fail_switch_mode:\n \tsfc_adapter_unlock(sa);\n \tsfc_adapter_lock_fini(sa);\n \trte_free(dev->data->mac_addrs);\n@@ -2370,6 +2423,7 @@ RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd);\n RTE_PMD_REGISTER_PCI_TABLE(net_sfc_efx, pci_id_sfc_efx_map);\n RTE_PMD_REGISTER_KMOD_DEP(net_sfc_efx, \"* igb_uio | uio_pci_generic | vfio-pci\");\n RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx,\n+\tSFC_KVARG_SWITCH_MODE \"=\" SFC_KVARG_VALUES_SWITCH_MODE \" \"\n \tSFC_KVARG_RX_DATAPATH \"=\" SFC_KVARG_VALUES_RX_DATAPATH \" \"\n \tSFC_KVARG_TX_DATAPATH \"=\" SFC_KVARG_VALUES_TX_DATAPATH \" \"\n \tSFC_KVARG_PERF_PROFILE \"=\" SFC_KVARG_VALUES_PERF_PROFILE \" \"\ndiff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c\nindex 974c05e68e..cd16213637 100644\n--- a/drivers/net/sfc/sfc_kvargs.c\n+++ b/drivers/net/sfc/sfc_kvargs.c\n@@ -22,6 +22,7 @@ sfc_kvargs_parse(struct sfc_adapter *sa)\n \tstruct rte_eth_dev *eth_dev = (sa)->eth_dev;\n \tstruct rte_devargs *devargs = eth_dev->device->devargs;\n \tconst char **params = (const char *[]){\n+\t\tSFC_KVARG_SWITCH_MODE,\n \t\tSFC_KVARG_STATS_UPDATE_PERIOD_MS,\n \t\tSFC_KVARG_PERF_PROFILE,\n \t\tSFC_KVARG_RX_DATAPATH,\ndiff --git a/drivers/net/sfc/sfc_kvargs.h b/drivers/net/sfc/sfc_kvargs.h\nindex ff76e7d9fc..8e34ec92a2 100644\n--- a/drivers/net/sfc/sfc_kvargs.h\n+++ b/drivers/net/sfc/sfc_kvargs.h\n@@ -18,6 +18,14 @@ extern \"C\" {\n \n #define SFC_KVARG_VALUES_BOOL\t\t\"[1|y|yes|on|0|n|no|off]\"\n \n+#define SFC_KVARG_SWITCH_MODE_LEGACY\t\"legacy\"\n+#define SFC_KVARG_SWITCH_MODE_SWITCHDEV\t\"switchdev\"\n+\n+#define SFC_KVARG_SWITCH_MODE\t\t\"switch_mode\"\n+#define SFC_KVARG_VALUES_SWITCH_MODE \\\n+\t\"[\" SFC_KVARG_SWITCH_MODE_LEGACY \"|\" \\\n+\t    SFC_KVARG_SWITCH_MODE_SWITCHDEV \"]\"\n+\n #define SFC_KVARG_PERF_PROFILE\t\t\"perf_profile\"\n \n #define SFC_KVARG_PERF_PROFILE_AUTO\t\t\"auto\"\ndiff --git a/drivers/net/sfc/sfc_sriov.c b/drivers/net/sfc/sfc_sriov.c\nindex baa0242433..385b172e2e 100644\n--- a/drivers/net/sfc/sfc_sriov.c\n+++ b/drivers/net/sfc/sfc_sriov.c\n@@ -53,7 +53,7 @@ sfc_sriov_attach(struct sfc_adapter *sa)\n \tsfc_log_init(sa, \"entry\");\n \n \tsriov->num_vfs = pci_dev->max_vfs;\n-\tif (sriov->num_vfs == 0)\n+\tif (sa->switchdev || sriov->num_vfs == 0)\n \t\tgoto done;\n \n \tvport_config = calloc(sriov->num_vfs + 1, sizeof(*vport_config));\n@@ -110,6 +110,11 @@ sfc_sriov_vswitch_create(struct sfc_adapter *sa)\n \n \tsfc_log_init(sa, \"entry\");\n \n+\tif (sa->switchdev) {\n+\t\tsfc_log_init(sa, \"don't create vswitch in switchdev mode\");\n+\t\tgoto done;\n+\t}\n+\n \tif (sriov->num_vfs == 0) {\n \t\tsfc_log_init(sa, \"no VFs enabled\");\n \t\tgoto done;\n@@ -152,7 +157,7 @@ sfc_sriov_vswitch_destroy(struct sfc_adapter *sa)\n \n \tsfc_log_init(sa, \"entry\");\n \n-\tif (sriov->num_vfs == 0)\n+\tif (sa->switchdev || sriov->num_vfs == 0)\n \t\tgoto done;\n \n \trc = efx_evb_vswitch_destroy(sa->nic, sriov->vswitch);\n",
    "prefixes": [
        "03/38"
    ]
}