get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 77050,
    "url": "http://patches.dpdk.org/api/patches/77050/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200909135656.18892-2-hyonkim@cisco.com/",
    "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": "<20200909135656.18892-2-hyonkim@cisco.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200909135656.18892-2-hyonkim@cisco.com",
    "date": "2020-09-09T13:56:52",
    "name": "[1/5] net/enic: extend vnic dev API for VF representors",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2d959ab2619cecf5393aee8e7b2ae4777eddbbb9",
    "submitter": {
        "id": 948,
        "url": "http://patches.dpdk.org/api/people/948/?format=api",
        "name": "Hyong Youb Kim (hyonkim)",
        "email": "hyonkim@cisco.com"
    },
    "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/20200909135656.18892-2-hyonkim@cisco.com/mbox/",
    "series": [
        {
            "id": 12057,
            "url": "http://patches.dpdk.org/api/series/12057/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=12057",
            "date": "2020-09-09T13:56:51",
            "name": "net/enic: add SR-IOV VF representor",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/12057/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/77050/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/77050/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 6D416A04B1;\n\tWed,  9 Sep 2020 15:57:19 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1038E1C0C9;\n\tWed,  9 Sep 2020 15:57:19 +0200 (CEST)",
            "from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77])\n by dpdk.org (Postfix) with ESMTP id 5D4CA1C0BE\n for <dev@dpdk.org>; Wed,  9 Sep 2020 15:57:17 +0200 (CEST)",
            "from rcdn-core-3.cisco.com ([173.37.93.154])\n by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 09 Sep 2020 13:57:16 +0000",
            "from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])\n by rcdn-core-3.cisco.com (8.15.2/8.15.2) with ESMTP id 089DvG9Z022478;\n Wed, 9 Sep 2020 13:57:16 GMT",
            "by cisco.com (Postfix, from userid 508933)\n id 04A5D20F2005; Wed,  9 Sep 2020 06:57:16 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=7086; q=dns/txt; s=iport;\n t=1599659837; x=1600869437;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=09Mr2dckLXEkY+ohW/b5hQOvk4+U8yqSyoQ21WFuvR4=;\n b=S9kxQ+Ql2zUIyaBl4VpXuoUNkpSIZiMfADE+cnQ8sQRZ1P7PgpEtjRSc\n 5y5NzmH3XW+fgItBfglM5Gi8HHARzBxnhAJ/PcJbuf3nB/HRaMpN2MxYf\n 9MolNT+rMXz4vkCya4yizmZNQaeCn+F871p2/5fdXV8G/ZwDuxNxrAG23 8=;",
        "X-IronPort-AV": "E=Sophos;i=\"5.76,409,1592870400\"; d=\"scan'208\";a=\"825411486\"",
        "From": "Hyong Youb Kim <hyonkim@cisco.com>",
        "To": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "Cc": "dev@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>,\n John Daley <johndale@cisco.com>",
        "Date": "Wed,  9 Sep 2020 06:56:52 -0700",
        "Message-Id": "<20200909135656.18892-2-hyonkim@cisco.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "In-Reply-To": "<20200909135656.18892-1-hyonkim@cisco.com>",
        "References": "<20200909135656.18892-1-hyonkim@cisco.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Outbound-SMTP-Client": "10.193.184.48, savbu-usnic-a.cisco.com",
        "X-Outbound-Node": "rcdn-core-3.cisco.com",
        "Subject": "[dpdk-dev] [PATCH 1/5] net/enic: extend vnic dev API for VF\n\trepresentors",
        "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": "VF representors need to proxy devcmd through the PF vnic_dev\ninstance. Extend vnic_dev to accommodate them as follows.\n\n1. Add vnic_vf_rep_register()\nA VF representor creates its own vnic_dev instance via this function\nand saves VF ID. When performing devcmd, vnic_dev uses the saved VF ID\nto proxy devcmd through the PF vnic_dev instance.\n\n2. Add vnic_register_lock()\nAs PF and VF representors appear as independent ports to the\napplication, its threads may invoke APIs on them simultaneously,\nleading to race conditions on the PF vnic_dev. For example, thread A\ncan query stats on PF port, while thread B queries stats on a VF\nrepresentor.\n\nThe PF port invokes this function to provide a lock to vnic_dev. This\nlock is used to serialize devcmd calls from PF and VF representors.\n\n3. Add utility functions to assist VF representor settings\nvnic_dev_mtu() and vnic_dev_uif() retrieve vnic MTU and UIF number\n(uplink index), respectively.\n\nSigned-off-by: Hyong Youb Kim <hyonkim@cisco.com>\nReviewed-by: John Daley <johndale@cisco.com>\n---\n drivers/net/enic/base/vnic_dev.c | 112 ++++++++++++++++++++++++++++++-\n drivers/net/enic/base/vnic_dev.h |   4 ++\n 2 files changed, 113 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/drivers/net/enic/base/vnic_dev.c b/drivers/net/enic/base/vnic_dev.c\nindex ac03817f4..aaca07ca6 100644\n--- a/drivers/net/enic/base/vnic_dev.c\n+++ b/drivers/net/enic/base/vnic_dev.c\n@@ -61,6 +61,16 @@ struct vnic_dev {\n \tvoid (*free_consistent)(void *priv,\n \t\tsize_t size, void *vaddr,\n \t\tdma_addr_t dma_handle);\n+\t/*\n+\t * Used to serialize devcmd access, currently from PF and its\n+\t * VF representors. When there are no representors, lock is\n+\t * not used.\n+\t */\n+\tint locked;\n+\tvoid (*lock)(void *priv);\n+\tvoid (*unlock)(void *priv);\n+\tstruct vnic_dev *pf_vdev;\n+\tint vf_id;\n };\n \n #define VNIC_MAX_RES_HDR_SIZE \\\n@@ -84,6 +94,14 @@ void vnic_register_cbacks(struct vnic_dev *vdev,\n \tvdev->free_consistent = free_consistent;\n }\n \n+void vnic_register_lock(struct vnic_dev *vdev, void (*lock)(void *priv),\n+\tvoid (*unlock)(void *priv))\n+{\n+\tvdev->lock = lock;\n+\tvdev->unlock = unlock;\n+\tvdev->locked = 0;\n+}\n+\n static int vnic_dev_discover_res(struct vnic_dev *vdev,\n \tstruct vnic_dev_bar *bar, unsigned int num_bars)\n {\n@@ -410,12 +428,39 @@ static int vnic_dev_cmd_no_proxy(struct vnic_dev *vdev,\n \treturn err;\n }\n \n+void vnic_dev_cmd_proxy_by_index_start(struct vnic_dev *vdev, uint16_t index)\n+{\n+\tvdev->proxy = PROXY_BY_INDEX;\n+\tvdev->proxy_index = index;\n+}\n+\n+void vnic_dev_cmd_proxy_end(struct vnic_dev *vdev)\n+{\n+\tvdev->proxy = PROXY_NONE;\n+\tvdev->proxy_index = 0;\n+}\n+\n int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \tuint64_t *a0, uint64_t *a1, int wait)\n {\n \tuint64_t args[2];\n+\tbool vf_rep;\n+\tint vf_idx;\n \tint err;\n \n+\tvf_rep = false;\n+\tif (vdev->pf_vdev) {\n+\t\tvf_rep = true;\n+\t\tvf_idx = vdev->vf_id;\n+\t\t/* Everything below assumes PF vdev */\n+\t\tvdev = vdev->pf_vdev;\n+\t}\n+\tif (vdev->lock)\n+\t\tvdev->lock(vdev->priv);\n+\t/* For VF representor, proxy devcmd to VF index */\n+\tif (vf_rep)\n+\t\tvnic_dev_cmd_proxy_by_index_start(vdev, vf_idx);\n+\n \targs[0] = *a0;\n \targs[1] = *a1;\n \tmemset(vdev->args, 0, sizeof(vdev->args));\n@@ -435,6 +480,10 @@ int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \t\tbreak;\n \t}\n \n+\tif (vf_rep)\n+\t\tvnic_dev_cmd_proxy_end(vdev);\n+\tif (vdev->unlock)\n+\t\tvdev->unlock(vdev->priv);\n \tif (err == 0) {\n \t\t*a0 = args[0];\n \t\t*a1 = args[1];\n@@ -446,17 +495,41 @@ int vnic_dev_cmd(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n int vnic_dev_cmd_args(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,\n \t\t      uint64_t *args, int nargs, int wait)\n {\n+\tbool vf_rep;\n+\tint vf_idx;\n+\tint err;\n+\n+\tvf_rep = false;\n+\tif (vdev->pf_vdev) {\n+\t\tvf_rep = true;\n+\t\tvf_idx = vdev->vf_id;\n+\t\tvdev = vdev->pf_vdev;\n+\t}\n+\tif (vdev->lock)\n+\t\tvdev->lock(vdev->priv);\n+\tif (vf_rep)\n+\t\tvnic_dev_cmd_proxy_by_index_start(vdev, vf_idx);\n+\n \tswitch (vdev->proxy) {\n \tcase PROXY_BY_INDEX:\n-\t\treturn vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_INDEX, cmd,\n+\t\terr = vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_INDEX, cmd,\n \t\t\t\targs, nargs, wait);\n+\t\tbreak;\n \tcase PROXY_BY_BDF:\n-\t\treturn vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_BDF, cmd,\n+\t\terr = vnic_dev_cmd_proxy(vdev, CMD_PROXY_BY_BDF, cmd,\n \t\t\t\targs, nargs, wait);\n+\t\tbreak;\n \tcase PROXY_NONE:\n \tdefault:\n-\t\treturn vnic_dev_cmd_no_proxy(vdev, cmd, args, nargs, wait);\n+\t\terr = vnic_dev_cmd_no_proxy(vdev, cmd, args, nargs, wait);\n+\t\tbreak;\n \t}\n+\n+\tif (vf_rep)\n+\t\tvnic_dev_cmd_proxy_end(vdev);\n+\tif (vdev->unlock)\n+\t\tvdev->unlock(vdev->priv);\n+\treturn err;\n }\n \n int vnic_dev_fw_info(struct vnic_dev *vdev,\n@@ -1012,6 +1085,22 @@ uint32_t vnic_dev_port_speed(struct vnic_dev *vdev)\n \treturn vdev->notify_copy.port_speed;\n }\n \n+uint32_t vnic_dev_mtu(struct vnic_dev *vdev)\n+{\n+\tif (!vnic_dev_notify_ready(vdev))\n+\t\treturn 0;\n+\n+\treturn vdev->notify_copy.mtu;\n+}\n+\n+uint32_t vnic_dev_uif(struct vnic_dev *vdev)\n+{\n+\tif (!vnic_dev_notify_ready(vdev))\n+\t\treturn 0;\n+\n+\treturn vdev->notify_copy.uif;\n+}\n+\n uint32_t vnic_dev_intr_coal_timer_usec_to_hw(struct vnic_dev *vdev,\n \t\t\t\t\t     uint32_t usec)\n {\n@@ -1100,6 +1189,23 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,\n \treturn NULL;\n }\n \n+struct vnic_dev *vnic_vf_rep_register(void *priv, struct vnic_dev *pf_vdev,\n+\tint vf_id)\n+{\n+\tstruct vnic_dev *vdev;\n+\n+\tvdev = (struct vnic_dev *)rte_zmalloc(\"enic-vf-rep-vdev\",\n+\t\t\t\tsizeof(struct vnic_dev), RTE_CACHE_LINE_SIZE);\n+\tif (!vdev)\n+\t\treturn NULL;\n+\tvdev->priv = priv;\n+\tvdev->pf_vdev = pf_vdev;\n+\tvdev->vf_id = vf_id;\n+\tvdev->alloc_consistent = pf_vdev->alloc_consistent;\n+\tvdev->free_consistent = pf_vdev->free_consistent;\n+\treturn vdev;\n+}\n+\n /*\n  *  vnic_dev_classifier: Add/Delete classifier entries\n  *  @vdev: vdev of the device\ndiff --git a/drivers/net/enic/base/vnic_dev.h b/drivers/net/enic/base/vnic_dev.h\nindex 02e19c0b8..30ba57bfc 100644\n--- a/drivers/net/enic/base/vnic_dev.h\n+++ b/drivers/net/enic/base/vnic_dev.h\n@@ -80,6 +80,8 @@ void vnic_register_cbacks(struct vnic_dev *vdev,\n \tvoid (*free_consistent)(void *priv,\n \t\tsize_t size, void *vaddr,\n \t\tdma_addr_t dma_handle));\n+void vnic_register_lock(struct vnic_dev *vdev, void (*lock)(void *priv),\n+\tvoid (*unlock)(void *priv));\n void __iomem *vnic_dev_get_res(struct vnic_dev *vdev, enum vnic_res_type type,\n \tunsigned int index);\n dma_addr_t vnic_dev_get_res_bus_addr(struct vnic_dev *vdev,\n@@ -172,6 +174,8 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,\n \tvoid *priv, struct rte_pci_device *pdev, struct vnic_dev_bar *bar,\n \tunsigned int num_bars);\n struct rte_pci_device *vnic_dev_get_pdev(struct vnic_dev *vdev);\n+struct vnic_dev *vnic_vf_rep_register(void *priv, struct vnic_dev *pf_vdev,\n+\tint vf_id);\n int vnic_dev_alloc_stats_mem(struct vnic_dev *vdev);\n int vnic_dev_cmd_init(struct vnic_dev *vdev, int fallback);\n int vnic_dev_get_size(void);\n",
    "prefixes": [
        "1/5"
    ]
}