get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 128917,
    "url": "http://patchwork.dpdk.org/api/patches/128917/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230622114755.1754-2-denis.pryazhennikov@arknetworks.am/",
    "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": "<20230622114755.1754-2-denis.pryazhennikov@arknetworks.am>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230622114755.1754-2-denis.pryazhennikov@arknetworks.am",
    "date": "2023-06-22T11:47:52",
    "name": "[v4,1/4] common/sfc_efx/base: discover NIC partitioning mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "33dc51e08fb2b2af133df6e3193b2b38554f0289",
    "submitter": {
        "id": 3057,
        "url": "http://patchwork.dpdk.org/api/people/3057/?format=api",
        "name": "Denis Pryazhennikov",
        "email": "denis.pryazhennikov@arknetworks.am"
    },
    "delegate": {
        "id": 319,
        "url": "http://patchwork.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230622114755.1754-2-denis.pryazhennikov@arknetworks.am/mbox/",
    "series": [
        {
            "id": 28615,
            "url": "http://patchwork.dpdk.org/api/series/28615/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=28615",
            "date": "2023-06-22T11:47:51",
            "name": "net/sfc: support KEEP_CRC offload",
            "version": 4,
            "mbox": "http://patchwork.dpdk.org/series/28615/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/128917/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/128917/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 2789342D23;\n\tThu, 22 Jun 2023 13:49:31 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id BF47C42B71;\n\tThu, 22 Jun 2023 13:49:27 +0200 (CEST)",
            "from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80])\n by mails.dpdk.org (Postfix) with ESMTP id EADF4406A2\n for <dev@dpdk.org>; Thu, 22 Jun 2023 13:49:25 +0200 (CEST)",
            "from localhost.localdomain (unknown [37.252.90.118])\n (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA512)\n (No client certificate requested)\n by agw.arknetworks.am (Postfix) with ESMTPSA id 65A11E123E;\n Thu, 22 Jun 2023 15:49:25 +0400 (+04)"
        ],
        "From": "Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>",
        "To": "dev@dpdk.org",
        "Cc": "Ferruh Yigit <ferruh.yigit@amd.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Sandilya Bhagi <sbhagi@solarflare.com>, Andy Moreton <amoreton@xilinx.com>",
        "Subject": "[PATCH v4 1/4] common/sfc_efx/base: discover NIC partitioning mode",
        "Date": "Thu, 22 Jun 2023 15:47:52 +0400",
        "Message-Id": "<20230622114755.1754-2-denis.pryazhennikov@arknetworks.am>",
        "X-Mailer": "git-send-email 2.39.2 (Apple Git-143)",
        "In-Reply-To": "<20230622114755.1754-1-denis.pryazhennikov@arknetworks.am>",
        "References": "<20230601114220.17796-1-denis.pryazhennikov@arknetworks.am>\n <20230622114755.1754-1-denis.pryazhennikov@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": "From: Sandilya Bhagi <sbhagi@solarflare.com>\n\nNIC Partitioning mode in SFC devices means multiple PFs\nper network port. When NIC Partitioning is configured,\napart from the privileged adapter(s) the other\nunprivileged adapter(s) will share the same physical port.\nDetermining NIC Partitioning mode is required to take\nnecessary action(s) for unprivileged adapter to work seamlessly.\nNIC Partitioning is determined using heuristic approach.\nIf the physical ports are shared between PFs then either\nNIC Partitioning or SR-IOV is in use.\n\nSigned-off-by: Sandilya Bhagi <sbhagi@solarflare.com>\nSigned-off-by: Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>\nReviewed-by: Andy Moreton <amoreton@xilinx.com>\nAcked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n---\n drivers/common/sfc_efx/base/ef10_nic.c | 101 +++++++++++++++++++++++++\n drivers/common/sfc_efx/base/efx.h      |   8 ++\n 2 files changed, 109 insertions(+)",
    "diff": "diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c\nindex e1709d120093..0c6a2eee4453 100644\n--- a/drivers/common/sfc_efx/base/ef10_nic.c\n+++ b/drivers/common/sfc_efx/base/ef10_nic.c\n@@ -1044,6 +1044,83 @@ ef10_mcdi_get_pf_count(\n \treturn (rc);\n }\n \n+static\t__checkReturn\t\t\tefx_rc_t\n+ef10_nic_get_physical_port_usage(\n+\t__in\t\t\t\tefx_nic_t *enp,\n+\t__in_ecount(pfs_to_ports_size)\tuint8_t *pfs_to_ports,\n+\t__in\t\t\t\tsize_t pfs_to_ports_size,\n+\t__out\t\t\t\tefx_port_usage_t *port_usagep)\n+{\n+\tefx_nic_cfg_t *encp = &(enp->en_nic_cfg);\n+\tefx_port_usage_t port_usage;\n+\tuint8_t phy_port;\n+\tefx_rc_t rc;\n+\tsize_t pf;\n+\n+\t/*\n+\t * The sharing of physical ports between functions are determined\n+\t * in the following way.\n+\t * 1. If VFs are enabled then the physical port is shared.\n+\t * 2. Retrieve PFs to ports assignment.\n+\t * 3. If PF 0 assignment cannot be retrieved(ACCESS_DENIED), it\n+\t *    implies this is an unprivileged function. An unprivileged\n+\t *    function indicates the physical port must be shared with\n+\t *    another privileged function.\n+\t * 4. If PF 0 assignment can be retrieved, it indicates this\n+\t *    function is privileged. Now, read all other PF's physical\n+\t *    port number assignment and check if the current PF's physical\n+\t *    port is shared with any other PF's physical port.\n+\t * NOTE: PF 0 is always privileged function.\n+\t */\n+\n+\tif (EFX_PCI_FUNCTION_IS_VF(encp)) {\n+\t\tport_usage = EFX_PORT_USAGE_SHARED;\n+\t\tgoto out;\n+\t}\n+\n+\tif (pfs_to_ports[0] ==\n+\t    MC_CMD_GET_CAPABILITIES_V2_OUT_ACCESS_NOT_PERMITTED) {\n+\t\t/*\n+\t\t * This is unprivileged function as it do not have sufficient\n+\t\t * privileges to read the value, this implies the physical port\n+\t\t * is shared between this function and another privileged\n+\t\t * function\n+\t\t */\n+\t\tport_usage = EFX_PORT_USAGE_SHARED;\n+\t\tgoto out;\n+\t}\n+\n+\tif (encp->enc_pf >= pfs_to_ports_size) {\n+\t\trc = EINVAL;\n+\t\tgoto fail1;\n+\t}\n+\tphy_port = pfs_to_ports[encp->enc_pf];\n+\n+\t/*\n+\t * This is privileged function as it is able read the value of\n+\t * PF 0. Now, check if any other function share the same physical\n+\t * port number as this function.\n+\t */\n+\tfor (pf = 0; pf < pfs_to_ports_size; pf++) {\n+\t\tif ((encp->enc_pf != pf) && (phy_port == pfs_to_ports[pf])) {\n+\t\t\t/* Found match, PFs share the same physical port */\n+\t\t\tport_usage = EFX_PORT_USAGE_SHARED;\n+\t\t\tgoto out;\n+\t\t}\n+\t}\n+\n+\tport_usage = EFX_PORT_USAGE_EXCLUSIVE;\n+\n+out:\n+\t*port_usagep = port_usage;\n+\treturn (0);\n+\n+fail1:\n+\tEFSYS_PROBE1(fail1, efx_rc_t, rc);\n+\n+\treturn (rc);\n+}\n+\n static\t__checkReturn\tefx_rc_t\n ef10_get_datapath_caps(\n \t__in\t\tefx_nic_t *enp)\n@@ -1307,6 +1384,30 @@ ef10_get_datapath_caps(\n \t\tencp->enc_tunnel_config_udp_entries_max = 0;\n \t}\n \n+#define CAP_PFS_TO_PORTS(_n)\t\\\n+\t(MC_CMD_GET_CAPABILITIES_V2_OUT_PFS_TO_PORTS_ASSIGNMENT_ ## _n)\n+\n+\tencp->enc_port_usage = EFX_PORT_USAGE_UNKNOWN;\n+\n+\tif (req.emr_out_length_used >= MC_CMD_GET_CAPABILITIES_V2_OUT_LEN) {\n+\t\t/* PFs to ports assignment */\n+\t\tuint8_t pfs_to_ports[CAP_PFS_TO_PORTS(NUM)];\n+\n+\t\tEFX_STATIC_ASSERT((CAP_PFS_TO_PORTS(NUM) * CAP_PFS_TO_PORTS(LEN)) ==\n+\t\t    EFX_ARRAY_SIZE(pfs_to_ports));\n+\n+\t\tmemcpy(pfs_to_ports, MCDI_OUT(req, efx_byte_t, CAP_PFS_TO_PORTS(OFST)),\n+\t\t    EFX_ARRAY_SIZE(pfs_to_ports));\n+\n+\t\trc = ef10_nic_get_physical_port_usage(enp, pfs_to_ports,\n+\t\t    EFX_ARRAY_SIZE(pfs_to_ports), &encp->enc_port_usage);\n+\t\tif (rc != 0) {\n+\t\t\t/* PF to port mapping lookup failed */\n+\t\t\tencp->enc_port_usage = EFX_PORT_USAGE_UNKNOWN;\n+\t\t}\n+\t}\n+#undef  CAP_PFS_TO_PORTS\n+\n \t/*\n \t * Check if firmware reports the VI window mode.\n \t * Medford2 has a variable VI window size (8K, 16K or 64K).\ndiff --git a/drivers/common/sfc_efx/base/efx.h b/drivers/common/sfc_efx/base/efx.h\nindex f156f8b5b31a..a63211612249 100644\n--- a/drivers/common/sfc_efx/base/efx.h\n+++ b/drivers/common/sfc_efx/base/efx.h\n@@ -311,6 +311,12 @@ efx_nic_check_pcie_link_speed(\n \t__in\t\tuint32_t pcie_link_gen,\n \t__out\t\tefx_pcie_link_performance_t *resultp);\n \n+typedef enum efx_port_usage_e {\n+\tEFX_PORT_USAGE_UNKNOWN = 0,\n+\tEFX_PORT_USAGE_EXCLUSIVE,\t/* Port only used by this PF */\n+\tEFX_PORT_USAGE_SHARED,\t\t/* Port shared with other PFs */\n+} efx_port_usage_t;\n+\n #define\tEFX_MAC_ADDR_LEN 6\n \n #if EFSYS_OPT_MCDI\n@@ -1682,6 +1688,8 @@ typedef struct efx_nic_cfg_s {\n \tuint32_t\t\tenc_assigned_port;\n \t/* NIC DMA mapping type */\n \tefx_nic_dma_mapping_t\tenc_dma_mapping;\n+\t/* Physical ports shared by PFs */\n+\tefx_port_usage_t\tenc_port_usage;\n } efx_nic_cfg_t;\n \n #define\tEFX_PCI_VF_INVALID 0xffff\n",
    "prefixes": [
        "v4",
        "1/4"
    ]
}