get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 87075,
    "url": "https://patches.dpdk.org/api/patches/87075/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210122094800.197748-18-jiawenwu@trustnetic.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": "<20210122094800.197748-18-jiawenwu@trustnetic.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210122094800.197748-18-jiawenwu@trustnetic.com",
    "date": "2021-01-22T09:47:57",
    "name": "[v1,17/20] net/txgbe: support VF representor",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "293ec12433695d497a8a262da8c99d23912efa14",
    "submitter": {
        "id": 1932,
        "url": "https://patches.dpdk.org/api/people/1932/?format=api",
        "name": "Jiawen Wu",
        "email": "jiawenwu@trustnetic.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/20210122094800.197748-18-jiawenwu@trustnetic.com/mbox/",
    "series": [
        {
            "id": 14902,
            "url": "https://patches.dpdk.org/api/series/14902/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14902",
            "date": "2021-01-22T09:47:41",
            "name": "net/txgbe: add VF driver support",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/14902/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/87075/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/87075/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 9EF7FA0A0A;\n\tFri, 22 Jan 2021 10:50:33 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id EA4AB140ED8;\n\tFri, 22 Jan 2021 10:48:24 +0100 (CET)",
            "from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56])\n by mails.dpdk.org (Postfix) with ESMTP id 7A255140EBA\n for <dev@dpdk.org>; Fri, 22 Jan 2021 10:48:21 +0100 (CET)",
            "from wxdbg.localdomain.com (unknown [183.129.236.74])\n by esmtp6.qq.com (ESMTP) with\n id ; Fri, 22 Jan 2021 17:48:16 +0800 (CST)"
        ],
        "X-QQ-mid": "bizesmtp9t1611308896trdw1269y",
        "X-QQ-SSF": "01400000002000C0D000B00A0000000",
        "X-QQ-FEAT": "VP6n2TeHyWWRCJS6Q3SDvo/W2KOVhObZrgH2ah+wav222wEAOcV1WJKWraMCJ\n 2GoKz9cMRg6EwMw5i130YlB63LoSBA3q9DcJXVDGj4asbzHAu0YPUbHdjguawOINZTH2H0X\n V7q6Y9n5owDGyPS3ReLDsFwwfJfSatZfezxmxoDk0lDMxt7fZq8sTbnDDCwY9zH6tBqtauq\n B4wiuQu8jr0DmkwUfgJ1h/CohtmRl4dzVo2mDPCA6w27eyaHCkDRuU39MZJe1g+fd+01MS2\n Y6yDgMpvj/JtxwIaVf9gVsR9PYU+8iHGAyf3JnCdsidTwpVnWWeAPTS0QpuzviqbBr3w9Ti\n UT6XWaZgy8d9uMHr7hjH0glHUuMu2KnfqnG/qRy",
        "X-QQ-GoodBg": "2",
        "From": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jiawen Wu <jiawenwu@trustnetic.com>",
        "Date": "Fri, 22 Jan 2021 17:47:57 +0800",
        "Message-Id": "<20210122094800.197748-18-jiawenwu@trustnetic.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20210122094800.197748-1-jiawenwu@trustnetic.com>",
        "References": "<20210122094800.197748-1-jiawenwu@trustnetic.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-QQ-SENDSIZE": "520",
        "Feedback-ID": "bizesmtp:trustnetic.com:qybgforeign:qybgforeign6",
        "X-QQ-Bgrelay": "1",
        "Subject": "[dpdk-dev] [PATCH v1 17/20] net/txgbe: support VF representor",
        "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": "Create and init VF representor ports in PF probe process, and uninit the\nports when PF device removed. In addition, support to get device\ninformation for VF representor.\n\nSigned-off-by: Jiawen Wu <jiawenwu@trustnetic.com>\n---\n drivers/net/txgbe/meson.build            |   1 +\n drivers/net/txgbe/txgbe_ethdev.c         |  38 +++++-\n drivers/net/txgbe/txgbe_ethdev.h         |  12 ++\n drivers/net/txgbe/txgbe_vf_representor.c | 144 +++++++++++++++++++++++\n 4 files changed, 193 insertions(+), 2 deletions(-)\n create mode 100644 drivers/net/txgbe/txgbe_vf_representor.c",
    "diff": "diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build\nindex 3b9994aa9..f5391076e 100644\n--- a/drivers/net/txgbe/meson.build\n+++ b/drivers/net/txgbe/meson.build\n@@ -20,6 +20,7 @@ sources = files(\n \t'txgbe_pf.c',\n \t'txgbe_rxtx.c',\n \t'txgbe_tm.c',\n+\t'txgbe_vf_representor.c',\n )\n \n deps += ['hash', 'security']\ndiff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c\nindex 0f473d49a..fb2ffb0e1 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.c\n+++ b/drivers/net/txgbe/txgbe_ethdev.c\n@@ -862,9 +862,10 @@ static int\n eth_txgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tstruct rte_pci_device *pci_dev)\n {\n+\tchar name[RTE_ETH_NAME_MAX_LEN];\n \tstruct rte_eth_dev *pf_ethdev;\n \tstruct rte_eth_devargs eth_da;\n-\tint retval;\n+\tint i, retval;\n \n \tif (pci_dev->device.devargs) {\n \t\tretval = rte_eth_devargs_parse(pci_dev->device.devargs->args,\n@@ -887,6 +888,36 @@ eth_txgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \tif (pf_ethdev == NULL)\n \t\treturn -ENODEV;\n \n+\t/* probe VF representor ports */\n+\tfor (i = 0; i < eth_da.nb_representor_ports; i++) {\n+\t\tstruct txgbe_vf_info *vfinfo;\n+\t\tstruct txgbe_vf_representor representor;\n+\n+\t\tvfinfo = *TXGBE_DEV_VFDATA(pf_ethdev);\n+\t\tif (vfinfo == NULL) {\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t\"no virtual functions supported by PF\");\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\trepresentor.vf_id = eth_da.representor_ports[i];\n+\t\trepresentor.switch_domain_id = vfinfo->switch_domain_id;\n+\t\trepresentor.pf_ethdev = pf_ethdev;\n+\n+\t\t/* representor port net_bdf_port */\n+\t\tsnprintf(name, sizeof(name), \"net_%s_representor_%d\",\n+\t\t\tpci_dev->device.name,\n+\t\t\teth_da.representor_ports[i]);\n+\n+\t\tretval = rte_eth_dev_create(&pci_dev->device, name,\n+\t\t\tsizeof(struct txgbe_vf_representor), NULL, NULL,\n+\t\t\ttxgbe_vf_representor_init, &representor);\n+\n+\t\tif (retval)\n+\t\t\tPMD_DRV_LOG(ERR, \"failed to create txgbe vf \"\n+\t\t\t\t\"representor %s.\", name);\n+\t}\n+\n \treturn 0;\n }\n \n@@ -898,7 +929,10 @@ static int eth_txgbe_pci_remove(struct rte_pci_device *pci_dev)\n \tif (!ethdev)\n \t\treturn -ENODEV;\n \n-\treturn rte_eth_dev_destroy(ethdev, eth_txgbe_dev_uninit);\n+\tif (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)\n+\t\treturn rte_eth_dev_destroy(ethdev, txgbe_vf_representor_uninit);\n+\telse\n+\t\treturn rte_eth_dev_destroy(ethdev, eth_txgbe_dev_uninit);\n }\n \n static struct rte_pci_driver rte_txgbe_pmd = {\ndiff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h\nindex 5d4d9434a..a6fd39b7b 100644\n--- a/drivers/net/txgbe/txgbe_ethdev.h\n+++ b/drivers/net/txgbe/txgbe_ethdev.h\n@@ -373,6 +373,18 @@ struct txgbe_adapter {\n \tuint8_t rss_reta_updated;\n };\n \n+struct txgbe_vf_representor {\n+\tuint16_t vf_id;\n+\tuint16_t switch_domain_id;\n+\tstruct rte_eth_dev *pf_ethdev;\n+};\n+\n+int txgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params);\n+int txgbe_vf_representor_uninit(struct rte_eth_dev *ethdev);\n+\n+#define TXGBE_DEV_REPRESENTOR(dev) \\\n+\t((struct txgbe_vf_representor *)(dev)->data->dev_private)\n+\n #define TXGBE_DEV_ADAPTER(dev) \\\n \t((struct txgbe_adapter *)(dev)->data->dev_private)\n \ndiff --git a/drivers/net/txgbe/txgbe_vf_representor.c b/drivers/net/txgbe/txgbe_vf_representor.c\nnew file mode 100644\nindex 000000000..bee4957c4\n--- /dev/null\n+++ b/drivers/net/txgbe/txgbe_vf_representor.c\n@@ -0,0 +1,144 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2015-2020\n+ */\n+\n+#include <rte_ethdev.h>\n+#include <rte_pci.h>\n+#include <rte_malloc.h>\n+\n+#include \"base/txgbe_type.h\"\n+#include \"base/txgbe_vf.h\"\n+#include \"txgbe_ethdev.h\"\n+#include \"txgbe_rxtx.h\"\n+\n+static int\n+txgbe_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev,\n+\tstruct rte_eth_dev_info *dev_info)\n+{\n+\tstruct txgbe_vf_representor *representor =\n+\t\t\tTXGBE_DEV_REPRESENTOR(ethdev);\n+\n+\tstruct txgbe_hw *hw = TXGBE_DEV_HW(representor->pf_ethdev);\n+\n+\tdev_info->device = representor->pf_ethdev->device;\n+\n+\tdev_info->min_rx_bufsize = 1024;\n+\t/**< Minimum size of RX buffer. */\n+\tdev_info->max_rx_pktlen = 9728;\n+\t/**< Maximum configurable length of RX pkt. */\n+\tdev_info->max_rx_queues = TXGBE_VF_MAX_RX_QUEUES;\n+\t/**< Maximum number of RX queues. */\n+\tdev_info->max_tx_queues = TXGBE_VF_MAX_TX_QUEUES;\n+\t/**< Maximum number of TX queues. */\n+\n+\tdev_info->max_mac_addrs = hw->mac.num_rar_entries;\n+\t/**< Maximum number of MAC addresses. */\n+\n+\tdev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\tDEV_RX_OFFLOAD_UDP_CKSUM  |\n+\t\tDEV_RX_OFFLOAD_TCP_CKSUM;\n+\t/**< Device RX offload capabilities. */\n+\n+\tdev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT |\n+\t\tDEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |\n+\t\tDEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM |\n+\t\tDEV_TX_OFFLOAD_TCP_TSO | DEV_TX_OFFLOAD_MULTI_SEGS;\n+\t/**< Device TX offload capabilities. */\n+\n+\tdev_info->speed_capa =\n+\t\trepresentor->pf_ethdev->data->dev_link.link_speed;\n+\t/**< Supported speeds bitmap (ETH_LINK_SPEED_). */\n+\n+\tdev_info->switch_info.name =\n+\t\trepresentor->pf_ethdev->device->name;\n+\tdev_info->switch_info.domain_id = representor->switch_domain_id;\n+\tdev_info->switch_info.port_id = representor->vf_id;\n+\n+\treturn 0;\n+}\n+\n+static const struct eth_dev_ops txgbe_vf_representor_dev_ops = {\n+\t.dev_infos_get\t\t= txgbe_vf_representor_dev_infos_get,\n+};\n+\n+static uint16_t\n+txgbe_vf_representor_rx_burst(__rte_unused void *rx_queue,\n+\t__rte_unused struct rte_mbuf **rx_pkts, __rte_unused uint16_t nb_pkts)\n+{\n+\treturn 0;\n+}\n+\n+static uint16_t\n+txgbe_vf_representor_tx_burst(__rte_unused void *tx_queue,\n+\t__rte_unused struct rte_mbuf **tx_pkts, __rte_unused uint16_t nb_pkts)\n+{\n+\treturn 0;\n+}\n+\n+int\n+txgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)\n+{\n+\tstruct txgbe_vf_representor *representor =\n+\t\t\tTXGBE_DEV_REPRESENTOR(ethdev);\n+\n+\tstruct txgbe_vf_info *vf_data;\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct rte_eth_link *link;\n+\n+\tif (!representor)\n+\t\treturn -ENOMEM;\n+\n+\trepresentor->vf_id =\n+\t\t((struct txgbe_vf_representor *)init_params)->vf_id;\n+\trepresentor->switch_domain_id =\n+\t\t((struct txgbe_vf_representor *)init_params)->switch_domain_id;\n+\trepresentor->pf_ethdev =\n+\t\t((struct txgbe_vf_representor *)init_params)->pf_ethdev;\n+\n+\tpci_dev = RTE_ETH_DEV_TO_PCI(representor->pf_ethdev);\n+\n+\tif (representor->vf_id >= pci_dev->max_vfs)\n+\t\treturn -ENODEV;\n+\n+\tethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;\n+\tethdev->data->representor_id = representor->vf_id;\n+\n+\t/* Set representor device ops */\n+\tethdev->dev_ops = &txgbe_vf_representor_dev_ops;\n+\n+\t/* No data-path, but need stub Rx/Tx functions to avoid crash\n+\t * when testing with the likes of testpmd.\n+\t */\n+\tethdev->rx_pkt_burst = txgbe_vf_representor_rx_burst;\n+\tethdev->tx_pkt_burst = txgbe_vf_representor_tx_burst;\n+\n+\t/* Setting the number queues allocated to the VF */\n+\tethdev->data->nb_rx_queues = TXGBE_VF_MAX_RX_QUEUES;\n+\tethdev->data->nb_tx_queues = TXGBE_VF_MAX_RX_QUEUES;\n+\n+\t/* Reference VF mac address from PF data structure */\n+\tvf_data = *TXGBE_DEV_VFDATA(representor->pf_ethdev);\n+\n+\tethdev->data->mac_addrs = (struct rte_ether_addr *)\n+\t\tvf_data[representor->vf_id].vf_mac_addresses;\n+\n+\t/* Link state. Inherited from PF */\n+\tlink = &representor->pf_ethdev->data->dev_link;\n+\n+\tethdev->data->dev_link.link_speed = link->link_speed;\n+\tethdev->data->dev_link.link_duplex = link->link_duplex;\n+\tethdev->data->dev_link.link_status = link->link_status;\n+\tethdev->data->dev_link.link_autoneg = link->link_autoneg;\n+\n+\treturn 0;\n+}\n+\n+int\n+txgbe_vf_representor_uninit(struct rte_eth_dev *ethdev)\n+{\n+\t/* mac_addrs must not be freed because part of txgbe_vf_info */\n+\tethdev->data->mac_addrs = NULL;\n+\n+\treturn 0;\n+}\n+\n",
    "prefixes": [
        "v1",
        "17/20"
    ]
}