get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127832,
    "url": "https://patches.dpdk.org/api/patches/127832/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230601114220.17796-2-denis.pryazhennikov@arknetworks.am/",
    "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": "<20230601114220.17796-2-denis.pryazhennikov@arknetworks.am>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230601114220.17796-2-denis.pryazhennikov@arknetworks.am",
    "date": "2023-06-01T11:42:17",
    "name": "[1/4] common/sfc_efx/base: NIC Partitioning mode discovery using heuristic approach",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "eea949a302b4143d7754f7bcbc5b7e9d3654b80e",
    "submitter": {
        "id": 3057,
        "url": "https://patches.dpdk.org/api/people/3057/?format=api",
        "name": "Denis Pryazhennikov",
        "email": "denis.pryazhennikov@arknetworks.am"
    },
    "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/20230601114220.17796-2-denis.pryazhennikov@arknetworks.am/mbox/",
    "series": [
        {
            "id": 28300,
            "url": "https://patches.dpdk.org/api/series/28300/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=28300",
            "date": "2023-06-01T11:42:16",
            "name": "net/sfc: support KEEP_CRC offload",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/28300/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/127832/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/127832/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 5230B42C02;\n\tThu,  1 Jun 2023 13:42:30 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D52B742B8B;\n\tThu,  1 Jun 2023 13:42:25 +0200 (CEST)",
            "from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80])\n by mails.dpdk.org (Postfix) with ESMTP id 8AB6D40DDC\n for <dev@dpdk.org>; Thu,  1 Jun 2023 13:42:23 +0200 (CEST)",
            "from localhost.localdomain (unknown [37.252.90.53])\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 E3854E1241;\n Thu,  1 Jun 2023 15:42:22 +0400 (+04)"
        ],
        "From": "Denis Pryazhennikov <denis.pryazhennikov@arknetworks.am>",
        "To": "dev@dpdk.org",
        "Cc": "Viacheslav Galaktionov <viacheslav.galaktionov@arknetworks.am>,\n 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 1/4] common/sfc_efx/base: NIC Partitioning mode discovery\n using heuristic approach",
        "Date": "Thu,  1 Jun 2023 15:42:17 +0400",
        "Message-Id": "<20230601114220.17796-2-denis.pryazhennikov@arknetworks.am>",
        "X-Mailer": "git-send-email 2.37.0 (Apple Git-136)",
        "In-Reply-To": "<20230601114220.17796-1-denis.pryazhennikov@arknetworks.am>",
        "References": "<20230601114220.17796-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": "NIC Partitioning mode in SFN devices means multiple PFs per network port.\nWhen NIC Partitioning is configured, apart from the privileged adapter(s) the\nother unprivileged adapter(s) will share the same physical port.\nDetermining NIC Partitioning mode is required to take necessary action(s) for\nunprivileged adapter to work seamlessly.\nNIC Partitioning is determined using heuristic approach - If the physical ports\nare shared between PFs then either NIC Partitioning or SR-IOV is in use.\nWhen NIC Partitioning is in use MAX MTU workaround should be applied so that\nthe unprivileged functions can seamlessly configure any valid MTU.\n\nhg-changeset: 7f0abee725a8e9c6524e773e5e5d6286a3b027a4\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>\n---\n drivers/common/sfc_efx/base/ef10_nic.c | 109 +++++++++++++++++++++++++\n drivers/common/sfc_efx/base/efx.h      |   8 ++\n 2 files changed, 117 insertions(+)",
    "diff": "diff --git a/drivers/common/sfc_efx/base/ef10_nic.c b/drivers/common/sfc_efx/base/ef10_nic.c\nindex e1709d120093..db4834a65175 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,89 @@ ef10_mcdi_get_pf_count(\n \treturn (rc);\n }\n \n+static\t__checkReturn\tefx_rc_t\n+ef10_nic_get_physical_port_usage(\n+\t__in\t\tefx_nic_t *enp,\n+\t__in_ecount(pfs_to_ports_size)\tuint8_t *pfs_to_ports,\n+\t__in\t\tsize_t pfs_to_ports_size,\n+\t__out\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+\tsize_t pf;\n+\tuint8_t phy_port;\n+\tefx_rc_t rc;\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: Sharing of physical ports (using heuristic approach) can\n+\t * imply either NIC Partitioning or SR-IOV is in use. This info is\n+\t * sufficient to apply the max MTU workaround (WIN-628), but should\n+\t * not be used for other purposes.\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+\n+\t\tif ((encp->enc_pf != pf) &&\n+\t\t    (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 +1390,32 @@ 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\t\t\t\t\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+\t\tefx_byte_t *bytep;\n+\t\tint i;\n+\n+\t\tbytep = MCDI_OUT(req, efx_byte_t, CAP_PFS_TO_PORTS(OFST));\n+\t\tfor (i = 0; i < EFX_ARRAY_SIZE(pfs_to_ports); i++) {\n+\t\t\tpfs_to_ports[i] = EFX_BYTE_FIELD(*bytep, EFX_BYTE_0);\n+\t\t\tbytep += CAP_PFS_TO_PORTS(LEN);\n+\t\t}\n+\n+\t\tif (ef10_nic_get_physical_port_usage(enp,\n+\t\t    pfs_to_ports, EFX_ARRAY_SIZE(pfs_to_ports),\n+\t\t    &encp->enc_port_usage) != 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 49e29dcc1c69..93bb4916bfd6 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@@ -1680,6 +1686,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": [
        "1/4"
    ]
}