get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 21032,
    "url": "https://patches.dpdk.org/api/patches/21032/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1488414008-162839-8-git-send-email-allain.legacy@windriver.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": "<1488414008-162839-8-git-send-email-allain.legacy@windriver.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1488414008-162839-8-git-send-email-allain.legacy@windriver.com",
    "date": "2017-03-02T00:19:59",
    "name": "[dpdk-dev,v3,07/16] net/avp: driver registration",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5461b97116120859664482252aa6197a2950da98",
    "submitter": {
        "id": 679,
        "url": "https://patches.dpdk.org/api/people/679/?format=api",
        "name": "Allain Legacy",
        "email": "allain.legacy@windriver.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/1488414008-162839-8-git-send-email-allain.legacy@windriver.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/21032/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/21032/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 6B31FF94E;\n\tThu,  2 Mar 2017 01:21:41 +0100 (CET)",
            "from mail1.windriver.com (mail1.windriver.com [147.11.146.13])\n\tby dpdk.org (Postfix) with ESMTP id DE63D2B9D\n\tfor <dev@dpdk.org>; Thu,  2 Mar 2017 01:20:36 +0100 (CET)",
            "from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com\n\t[147.11.189.40])\n\tby mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id v220KU7P014976\n\t(version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL);\n\tWed, 1 Mar 2017 16:20:30 -0800 (PST)",
            "from yow-cgts4-lx.wrs.com (128.224.145.137) by\n\tALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server\n\t(TLS) id 14.3.294.0; Wed, 1 Mar 2017 16:20:29 -0800"
        ],
        "From": "Allain Legacy <allain.legacy@windriver.com>",
        "To": "<ferruh.yigit@intel.com>",
        "CC": "<ian.jolliffe@windriver.com>, <jerin.jacob@caviumnetworks.com>,\n\t<stephen@networkplumber.org>, <thomas.monjalon@6wind.com>, <dev@dpdk.org>",
        "Date": "Wed, 1 Mar 2017 19:19:59 -0500",
        "Message-ID": "<1488414008-162839-8-git-send-email-allain.legacy@windriver.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1488414008-162839-1-git-send-email-allain.legacy@windriver.com>",
        "References": "<1488136143-116389-1-git-send-email-allain.legacy@windriver.com>\n\t<1488414008-162839-1-git-send-email-allain.legacy@windriver.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[128.224.145.137]",
        "Subject": "[dpdk-dev] [PATCH v3 07/16] net/avp: driver registration",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Adds the initial framework for registering the driver against the support\nPCI device identifiers.\n\nSigned-off-by: Allain Legacy <allain.legacy@windriver.com>\nSigned-off-by: Matt Peters <matt.peters@windriver.com>\n---\n config/common_linuxapp                       |   1 +\n config/defconfig_i686-native-linuxapp-gcc    |   5 +\n config/defconfig_i686-native-linuxapp-icc    |   5 +\n config/defconfig_x86_x32-native-linuxapp-gcc |   5 +\n drivers/net/avp/Makefile                     |   8 +\n drivers/net/avp/avp_ethdev.c                 | 230 +++++++++++++++++++++++++++\n mk/rte.app.mk                                |   1 +\n 7 files changed, 255 insertions(+)\n create mode 100644 drivers/net/avp/avp_ethdev.c",
    "diff": "diff --git a/config/common_linuxapp b/config/common_linuxapp\nindex 00ebaac..8690a00 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -43,6 +43,7 @@ CONFIG_RTE_LIBRTE_VHOST=y\n CONFIG_RTE_LIBRTE_PMD_VHOST=y\n CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y\n CONFIG_RTE_LIBRTE_PMD_TAP=y\n+CONFIG_RTE_LIBRTE_AVP_PMD=y\n CONFIG_RTE_LIBRTE_NFP_PMD=y\n CONFIG_RTE_LIBRTE_POWER=y\n CONFIG_RTE_VIRTIO_USER=y\ndiff --git a/config/defconfig_i686-native-linuxapp-gcc b/config/defconfig_i686-native-linuxapp-gcc\nindex 745c401..9847bdb 100644\n--- a/config/defconfig_i686-native-linuxapp-gcc\n+++ b/config/defconfig_i686-native-linuxapp-gcc\n@@ -75,3 +75,8 @@ CONFIG_RTE_LIBRTE_PMD_KASUMI=n\n # ZUC PMD is not supported on 32-bit\n #\n CONFIG_RTE_LIBRTE_PMD_ZUC=n\n+\n+#\n+# AVP PMD is not supported on 32-bit\n+#\n+CONFIG_RTE_LIBRTE_AVP_PMD=n\ndiff --git a/config/defconfig_i686-native-linuxapp-icc b/config/defconfig_i686-native-linuxapp-icc\nindex 50a3008..269e88e 100644\n--- a/config/defconfig_i686-native-linuxapp-icc\n+++ b/config/defconfig_i686-native-linuxapp-icc\n@@ -75,3 +75,8 @@ CONFIG_RTE_LIBRTE_PMD_KASUMI=n\n # ZUC PMD is not supported on 32-bit\n #\n CONFIG_RTE_LIBRTE_PMD_ZUC=n\n+\n+#\n+# AVP PMD is not supported on 32-bit\n+#\n+CONFIG_RTE_LIBRTE_AVP_PMD=n\ndiff --git a/config/defconfig_x86_x32-native-linuxapp-gcc b/config/defconfig_x86_x32-native-linuxapp-gcc\nindex 3e55c5c..19573cb 100644\n--- a/config/defconfig_x86_x32-native-linuxapp-gcc\n+++ b/config/defconfig_x86_x32-native-linuxapp-gcc\n@@ -50,3 +50,8 @@ CONFIG_RTE_LIBRTE_KNI=n\n # Solarflare PMD is not supported on 32-bit\n #\n CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n\n+\n+#\n+# AVP PMD is not supported on 32-bit\n+#\n+CONFIG_RTE_LIBRTE_AVP_PMD=n\ndiff --git a/drivers/net/avp/Makefile b/drivers/net/avp/Makefile\nindex 68a0fa5..9cf0449 100644\n--- a/drivers/net/avp/Makefile\n+++ b/drivers/net/avp/Makefile\n@@ -49,4 +49,12 @@ LIBABIVER := 1\n SYMLINK-$(CONFIG_RTE_LIBRTE_AVP_PMD)-include += rte_avp_common.h\n SYMLINK-$(CONFIG_RTE_LIBRTE_AVP_PMD)-include += rte_avp_fifo.h\n \n+#\n+# all source files are stored in SRCS-y\n+#\n+SRCS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += avp_ethdev.c\n+\n+# this lib depends upon:\n+DEPDIRS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += lib/librte_eal lib/librte_ether\n+\n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c\nnew file mode 100644\nindex 0000000..f0bf862\n--- /dev/null\n+++ b/drivers/net/avp/avp_ethdev.c\n@@ -0,0 +1,230 @@\n+/*\n+ *   BSD LICENSE\n+ *\n+ * Copyright (c) 2013-2016, Wind River Systems, Inc.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are met:\n+ *\n+ * 1) Redistributions of source code must retain the above copyright notice,\n+ * this list of conditions and the following disclaimer.\n+ *\n+ * 2) Redistributions in binary form must reproduce the above copyright notice,\n+ * this list of conditions and the following disclaimer in the documentation\n+ * and/or other materials provided with the distribution.\n+ *\n+ * 3) Neither the name of Wind River Systems nor the names of its contributors\n+ * may be used to endorse or promote products derived from this software\n+ * without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ * POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdint.h>\n+#include <string.h>\n+#include <stdio.h>\n+#include <errno.h>\n+#include <unistd.h>\n+#include <sys/io.h>\n+\n+#include <rte_ethdev.h>\n+#include <rte_memcpy.h>\n+#include <rte_string_fns.h>\n+#include <rte_memzone.h>\n+#include <rte_malloc.h>\n+#include <rte_atomic.h>\n+#include <rte_branch_prediction.h>\n+#include <rte_pci.h>\n+#include <rte_ether.h>\n+#include <rte_common.h>\n+#include <rte_cycles.h>\n+#include <rte_spinlock.h>\n+#include <rte_byteorder.h>\n+#include <rte_dev.h>\n+#include <rte_memory.h>\n+#include <rte_eal.h>\n+\n+#include \"rte_avp_common.h\"\n+#include \"rte_avp_fifo.h\"\n+\n+#include \"avp_logs.h\"\n+\n+\n+\n+static int eth_avp_dev_init(struct rte_eth_dev *eth_dev);\n+static int eth_avp_dev_uninit(struct rte_eth_dev *eth_dev);\n+\n+\n+#define AVP_DEV_TO_PCI(eth_dev) RTE_DEV_TO_PCI((eth_dev)->device)\n+\n+\n+#define AVP_MAX_MAC_ADDRS 1\n+#define AVP_MIN_RX_BUFSIZE ETHER_MIN_LEN\n+\n+\n+/*\n+ * Defines the number of microseconds to wait before checking the response\n+ * queue for completion.\n+ */\n+#define AVP_REQUEST_DELAY_USECS (5000)\n+\n+/*\n+ * Defines the number times to check the response queue for completion before\n+ * declaring a timeout.\n+ */\n+#define AVP_MAX_REQUEST_RETRY (100)\n+\n+/* Defines the current PCI driver version number */\n+#define AVP_DPDK_DRIVER_VERSION RTE_AVP_CURRENT_GUEST_VERSION\n+\n+/*\n+ * The set of PCI devices this driver supports\n+ */\n+static const struct rte_pci_id pci_id_avp_map[] = {\n+\t{ .vendor_id = RTE_AVP_PCI_VENDOR_ID,\n+\t  .device_id = RTE_AVP_PCI_DEVICE_ID,\n+\t  .subsystem_vendor_id = RTE_AVP_PCI_SUB_VENDOR_ID,\n+\t  .subsystem_device_id = RTE_AVP_PCI_SUB_DEVICE_ID,\n+\t  .class_id = RTE_CLASS_ANY_ID,\n+\t},\n+\n+\t{ .vendor_id = 0, /* sentinel */\n+\t},\n+};\n+\n+\n+/*\n+ * Defines the AVP device attributes which are attached to an RTE ethernet\n+ * device\n+ */\n+struct avp_dev {\n+\tuint32_t magic; /**< Memory validation marker */\n+\tuint64_t device_id; /**< Unique system identifier */\n+\tstruct ether_addr ethaddr; /**< Host specified MAC address */\n+\tstruct rte_eth_dev_data *dev_data;\n+\t/**< Back pointer to ethernet device data */\n+\tvolatile uint32_t flags; /**< Device operational flags */\n+\tuint8_t port_id; /**< Ethernet port identifier */\n+\tstruct rte_mempool *pool; /**< pkt mbuf mempool */\n+\tunsigned int guest_mbuf_size; /**< local pool mbuf size */\n+\tunsigned int host_mbuf_size; /**< host mbuf size */\n+\tunsigned int max_rx_pkt_len; /**< maximum receive unit */\n+\tuint32_t host_features; /**< Supported feature bitmap */\n+\tuint32_t features; /**< Enabled feature bitmap */\n+\tunsigned int num_tx_queues; /**< Negotiated number of transmit queues */\n+\tunsigned int max_tx_queues; /**< Maximum number of transmit queues */\n+\tunsigned int num_rx_queues; /**< Negotiated number of receive queues */\n+\tunsigned int max_rx_queues; /**< Maximum number of receive queues */\n+\n+\tstruct rte_avp_fifo *tx_q[RTE_AVP_MAX_QUEUES]; /**< TX queue */\n+\tstruct rte_avp_fifo *rx_q[RTE_AVP_MAX_QUEUES]; /**< RX queue */\n+\tstruct rte_avp_fifo *alloc_q[RTE_AVP_MAX_QUEUES];\n+\t/**< Allocated mbufs queue */\n+\tstruct rte_avp_fifo *free_q[RTE_AVP_MAX_QUEUES];\n+\t/**< To be freed mbufs queue */\n+\n+\t/* mutual exclusion over the 'flag' and 'resp_q/req_q' fields */\n+\trte_spinlock_t lock;\n+\n+\t/* For request & response */\n+\tstruct rte_avp_fifo *req_q; /**< Request queue */\n+\tstruct rte_avp_fifo *resp_q; /**< Response queue */\n+\tvoid *host_sync_addr; /**< (host) Req/Resp Mem address */\n+\tvoid *sync_addr; /**< Req/Resp Mem address */\n+\tvoid *host_mbuf_addr; /**< (host) MBUF pool start address */\n+\tvoid *mbuf_addr; /**< MBUF pool start address */\n+} __rte_cache_aligned;\n+\n+/* RTE ethernet private data */\n+struct avp_adapter {\n+\tstruct avp_dev avp;\n+} __rte_cache_aligned;\n+\n+/* Macro to cast the ethernet device private data to a AVP object */\n+#define AVP_DEV_PRIVATE_TO_HW(adapter) \\\n+\t(&((struct avp_adapter *)adapter)->avp)\n+\n+/*\n+ * This function is based on probe() function in avp_pci.c\n+ * It returns 0 on success.\n+ */\n+static int\n+eth_avp_dev_init(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct avp_dev *avp =\n+\t\tAVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);\n+\tstruct rte_pci_device *pci_dev;\n+\n+\tpci_dev = AVP_DEV_TO_PCI(eth_dev);\n+\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY) {\n+\t\t/*\n+\t\t * no setup required on secondary processes.  All data is saved\n+\t\t * in dev_private by the primary process. All resource should\n+\t\t * be mapped to the same virtual address so all pointers should\n+\t\t * be valid.\n+\t\t */\n+\t\treturn 0;\n+\t}\n+\n+\trte_eth_copy_pci_info(eth_dev, pci_dev);\n+\n+\teth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;\n+\n+\t/* Allocate memory for storing MAC addresses */\n+\teth_dev->data->mac_addrs = rte_zmalloc(\"avp_ethdev\", ETHER_ADDR_LEN, 0);\n+\tif (eth_dev->data->mac_addrs == NULL) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to allocate %d bytes needed to store MAC addresses\\n\",\n+\t\t\t    ETHER_ADDR_LEN);\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tether_addr_copy(&avp->ethaddr, &eth_dev->data->mac_addrs[0]);\n+\n+\treturn 0;\n+}\n+\n+static int\n+eth_avp_dev_uninit(struct rte_eth_dev *eth_dev)\n+{\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn -EPERM;\n+\n+\tif (eth_dev->data == NULL)\n+\t\treturn 0;\n+\n+\tif (eth_dev->data->mac_addrs != NULL) {\n+\t\trte_free(eth_dev->data->mac_addrs);\n+\t\teth_dev->data->mac_addrs = NULL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+\n+static struct eth_driver rte_avp_pmd = {\n+\t{\n+\t\t.id_table = pci_id_avp_map,\n+\t\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING,\n+\t\t.probe = rte_eth_dev_pci_probe,\n+\t\t.remove = rte_eth_dev_pci_remove,\n+\t},\n+\t.eth_dev_init = eth_avp_dev_init,\n+\t.eth_dev_uninit = eth_avp_dev_uninit,\n+\t.dev_private_size = sizeof(struct avp_adapter),\n+};\n+\n+\n+\n+RTE_PMD_REGISTER_PCI(rte_avp, rte_avp_pmd.pci_drv);\n+RTE_PMD_REGISTER_PCI_TABLE(rte_avp, pci_id_avp_map);\ndiff --git a/mk/rte.app.mk b/mk/rte.app.mk\nindex d46a33e..9d66257 100644\n--- a/mk/rte.app.mk\n+++ b/mk/rte.app.mk\n@@ -104,6 +104,7 @@ ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)\n # plugins (link only if static libraries)\n \n _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)  += -lrte_pmd_af_packet\n+_LDLIBS-$(CONFIG_RTE_LIBRTE_AVP_PMD)        += -lrte_pmd_avp\n _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD)      += -lrte_pmd_bnx2x -lz\n _LDLIBS-$(CONFIG_RTE_LIBRTE_BNXT_PMD)       += -lrte_pmd_bnxt\n _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)       += -lrte_pmd_bond\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "07/16"
    ]
}