get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1193,
    "url": "https://patches.dpdk.org/api/patches/1193/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1415390747-9532-7-git-send-email-ssujith@cisco.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": "<1415390747-9532-7-git-send-email-ssujith@cisco.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1415390747-9532-7-git-send-email-ssujith@cisco.com",
    "date": "2014-11-07T20:05:46",
    "name": "[dpdk-dev,6/7] DPDK-ENIC PMD interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "586a63ceb5c923e0a1195234aa94e81add42ee06",
    "submitter": {
        "id": 110,
        "url": "https://patches.dpdk.org/api/people/110/?format=api",
        "name": "Sujith Sankar",
        "email": "ssujith@cisco.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1415390747-9532-7-git-send-email-ssujith@cisco.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/1193/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/1193/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 7A06B7F69;\n\tFri,  7 Nov 2014 11:28:00 +0100 (CET)",
            "from bgl-iport-1.cisco.com (bgl-iport-1.cisco.com [72.163.197.25])\n\tby dpdk.org (Postfix) with ESMTP id EF0F37F25\n\tfor <dev@dpdk.org>; Fri,  7 Nov 2014 11:27:42 +0100 (CET)",
            "from vla196-nat.cisco.com (HELO bgl-core-4.cisco.com)\n\t([72.163.197.24])\n\tby bgl-iport-1.cisco.com with ESMTP; 07 Nov 2014 10:37:13 +0000",
            "from localhost ([10.106.186.117]) (authenticated bits=0)\n\tby bgl-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id sA7AbBc6002965\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);\n\tFri, 7 Nov 2014 10:37:13 GMT"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n\td=cisco.com; i=@cisco.com; l=17507; q=dns/txt;\n\ts=iport; t=1415356634; x=1416566234;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=eaPYAn5AxrclbkNk1/cocZkgye1KIwvHcudlvOX2PUE=;\n\tb=gBDPrX7yu8SbQA4Gwtv+gCqZ5EOlrr4tCM6yWYgdcusvqs6/Bj8H6gzN\n\tDgA/Mu7ksCO7bk40NYNg+ZzZC4ORb/l8rX1n1Kq9aOOnrN3AIsrZuWVXV\n\tU1pJB6KaBcHq1kyX/xO3v8YPewyEhw0/lEw5/XUoiO4ga/XLa4rgOn+xt o=;",
        "X-IronPort-AV": "E=Sophos;i=\"5.07,331,1413244800\"; d=\"scan'208\";a=\"47242411\"",
        "From": "Sujith Sankar <ssujith@cisco.com>",
        "To": "dev@dpdk.org",
        "Date": "Sat,  8 Nov 2014 01:35:46 +0530",
        "Message-Id": "<1415390747-9532-7-git-send-email-ssujith@cisco.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1415390747-9532-1-git-send-email-ssujith@cisco.com>",
        "References": "<1415390747-9532-1-git-send-email-ssujith@cisco.com>",
        "X-Authenticated-User": "ssujith@cisco.com",
        "Subject": "[dpdk-dev] [PATCH 6/7] DPDK-ENIC PMD interface",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "Signed-off-by: Sujith Sankar <ssujith@cisco.com>\n---\n lib/librte_pmd_enic/src/enic_etherdev.c | 616 ++++++++++++++++++++++++++++++++\n 1 file changed, 616 insertions(+)\n create mode 100644 lib/librte_pmd_enic/src/enic_etherdev.c",
    "diff": "diff --git a/lib/librte_pmd_enic/src/enic_etherdev.c b/lib/librte_pmd_enic/src/enic_etherdev.c\nnew file mode 100644\nindex 0000000..e9a64f5\n--- /dev/null\n+++ b/lib/librte_pmd_enic/src/enic_etherdev.c\n@@ -0,0 +1,616 @@\n+/*\n+ * Copyright 2008-2014 Cisco Systems, Inc.  All rights reserved.\n+ * Copyright 2007 Nuova Systems, Inc.  All rights reserved.\n+ *\n+ * Copyright (c) 2014, Cisco Systems, Inc. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions\n+ * are met:\n+ * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in\n+ * the documentation and/or other materials provided with the\n+ * distribution.\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n+ * POSSIBILITY OF SUCH DAMAGE.\n+ *\n+ */\n+#ident \"$Id$\"\n+\n+#include <stdio.h>\n+#include <stdint.h>\n+\n+#include <rte_dev.h>\n+#include <rte_pci.h>\n+#include <rte_ethdev.h>\n+#include <rte_string_fns.h>\n+\n+#include \"vnic_intr.h\"\n+#include \"vnic_cq.h\"\n+#include \"vnic_wq.h\"\n+#include \"vnic_rq.h\"\n+#include \"vnic_enet.h\"\n+#include \"enic.h\"\n+\n+#ifdef RTE_LIBRTE_ENIC_PMD_DEBUG_TRACE\n+#define ENICPMD_FUNC_TRACE()            \\\n+\tdo {                                 \\\n+\t\tdev_trace(enic, \"Entering %s\\n\", __func__);   \\\n+\t} while (0)\n+#else\n+#define ENICPMD_FUNC_TRACE()\n+#endif\n+\n+\n+/*\n+ * The set of PCI devices this driver supports\n+ */\n+static struct rte_pci_id pci_id_enic_map[] = {\n+#define RTE_PCI_DEV_ID_DECL_ENIC(vend, dev) {RTE_PCI_DEVICE(vend, dev)},\n+#ifndef PCI_VENDOR_ID_CISCO\n+#define PCI_VENDOR_ID_CISCO\t0x1137\n+#endif\n+#include \"rte_pci_dev_ids.h\"\n+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET)\n+RTE_PCI_DEV_ID_DECL_ENIC(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_VIC_ENET_VF)\n+{.vendor_id = 0, /* Sentinal */},\n+};\n+\n+int enicpmd_fdir_remove_perfect_filter(struct rte_eth_dev *eth_dev,\n+\t\tstruct rte_fdir_filter *fdir_filter,\n+\t\tuint16_t soft_id)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\treturn enic_fdir_del_fltr(enic, fdir_filter);\n+}\n+\n+int enicpmd_fdir_add_perfect_filter(struct rte_eth_dev *eth_dev,\n+\tstruct rte_fdir_filter *fdir_filter, uint16_t soft_id,\n+\tuint8_t queue, uint8_t drop)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\treturn enic_fdir_add_fltr(enic, fdir_filter, (uint16_t)queue, drop);\n+}\n+\n+void enicpmd_fdir_info_get(struct rte_eth_dev *eth_dev,\n+\tstruct rte_eth_fdir *fdir)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\t*fdir = enic->fdir.stats;\n+}\n+\n+void enicpmd_dev_tx_queue_release(void *txq)\n+{\n+\tENICPMD_FUNC_TRACE();\n+\tenic_free_wq(txq);\n+}\n+\n+static int enicpmd_dev_setup_intr(struct enic *enic)\n+{\n+\tint ret;\n+\tint index;\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\t/* Are we done with the init of all the queues? */\n+\tfor (index = 0; index < enic->cq_count; index++) {\n+\t\tif (!enic->cq[index].ctrl)\n+\t\t\tbreak;\n+\t}\n+\n+\tif (enic->cq_count != index)\n+\t\treturn 0;\n+\n+\tret = enic_alloc_intr_resources(enic);\n+\tif (ret) {\n+\t\tdev_err(enic, \"alloc intr failed\\n\");\n+\t\treturn ret;\n+\t}\n+\tenic_init_vnic_resources(enic);\n+\n+\tret = enic_setup_finish(enic);\n+\tif (ret)\n+\t\tdev_err(enic, \"setup could not be finished\\n\");\n+\n+\treturn ret;\n+}\n+\n+int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,\n+\tuint16_t queue_idx,\n+\tuint16_t nb_desc,\n+\tunsigned int socket_id,\n+\tconst struct rte_eth_txconf *tx_conf)\n+{\n+\tint ret;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\teth_dev->data->tx_queues[queue_idx] = (void *)&enic->wq[queue_idx];\n+\n+\tret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);\n+\tif (ret) {\n+\t\tdev_err(enic, \"error in allocating wq\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn enicpmd_dev_setup_intr(enic);\n+}\n+\n+int enicpmd_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t queue_idx)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tenic_start_wq(enic, queue_idx);\n+\n+\treturn 0;\n+}\n+\n+int enicpmd_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t queue_idx)\n+{\n+\tint ret;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tret = enic_stop_wq(enic, queue_idx);\n+\tif (ret)\n+\t\tdev_err(enic, \"error in stopping wq %d\\n\", queue_idx);\n+\n+\treturn ret;\n+}\n+\n+int enicpmd_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t queue_idx)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tenic_start_rq(enic, queue_idx);\n+\n+\treturn 0;\n+}\n+\n+int enicpmd_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t queue_idx)\n+{\n+\tint ret;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tret = enic_stop_rq(enic, queue_idx);\n+\tif (ret)\n+\t\tdev_err(enic, \"error in stopping rq %d\\n\", queue_idx);\n+\n+\treturn ret;\n+}\n+\n+void enicpmd_dev_rx_queue_release(void *rxq)\n+{\n+\tENICPMD_FUNC_TRACE();\n+\tenic_free_rq(rxq);\n+}\n+\n+int enicpmd_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,\n+\tuint16_t queue_idx,\n+\tuint16_t nb_desc,\n+\tunsigned int socket_id,\n+\tconst struct rte_eth_rxconf *rx_conf,\n+\tstruct rte_mempool *mp)\n+{\n+\tint ret;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\teth_dev->data->rx_queues[queue_idx] = (void *)&enic->rq[queue_idx];\n+\n+\tret = enic_alloc_rq(enic, queue_idx, socket_id, mp, nb_desc);\n+\tif (ret) {\n+\t\tdev_err(enic, \"error in allocating rq\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\treturn enicpmd_dev_setup_intr(enic);\n+}\n+\n+static int enicpmd_vlan_filter_set(struct rte_eth_dev *eth_dev,\n+\tuint16_t vlan_id, int on)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tif (on)\n+\t\tenic_add_vlan(enic, vlan_id);\n+\telse\n+\t\tenic_del_vlan(enic, vlan_id);\n+\treturn 0;\n+}\n+\n+static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tif (mask & ETH_VLAN_STRIP_MASK) {\n+\t\tif (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)\n+\t\t\tenic->ig_vlan_strip_en = 1;\n+\t\telse\n+\t\t\tenic->ig_vlan_strip_en = 0;\n+\t}\n+\tenic_set_rss_nic_cfg(enic);\n+\n+\n+\tif (mask & ETH_VLAN_FILTER_MASK) {\n+\t\tdev_warning(enic,\n+\t\t\t\"Configuration of VLAN filter is not supported\\n\");\n+\t}\n+\n+\tif (mask & ETH_VLAN_EXTEND_MASK) {\n+\t\tdev_warning(enic,\n+\t\t\t\"Configuration of extended VLAN is not supported\\n\");\n+\t}\n+}\n+\n+static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev)\n+{\n+\tint ret;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tret = enic_set_vnic_res(enic);\n+\tif (ret) {\n+\t\tdev_err(enic, \"Set vNIC resource num  failed, aborting\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\tif (eth_dev->data->dev_conf.rxmode.split_hdr_size &&\n+\t\teth_dev->data->dev_conf.rxmode.header_split) {\n+\t\t/* Enable header-data-split */\n+\t\tenic_set_hdr_split_size(enic,\n+\t\t\teth_dev->data->dev_conf.rxmode.split_hdr_size);\n+\t}\n+\n+\tenic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum;\n+\treturn 0;\n+}\n+\n+/* Start the device.\n+ * It returns 0 on success.\n+ */\n+static int enicpmd_dev_start(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\treturn enic_enable(enic);\n+}\n+\n+/*\n+ * Stop device: disable rx and tx functions to allow for reconfiguring.\n+ */\n+static void enicpmd_dev_stop(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct rte_eth_link link;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_disable(enic);\n+\tmemset(&link, 0, sizeof(link));\n+\trte_atomic64_cmpset((uint64_t *)&eth_dev->data->dev_link,\n+\t\t*(uint64_t *)&eth_dev->data->dev_link,\n+\t\t*(uint64_t *)&link);\n+}\n+\n+/*\n+ * Stop device.\n+ */\n+static void enicpmd_dev_close(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_remove(enic);\n+}\n+\n+static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,\n+\tint wait_to_complete)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\tint ret;\n+\tint link_status = 0;\n+\n+\tENICPMD_FUNC_TRACE();\n+\tlink_status = enic_get_link_status(enic);\n+\tret = (link_status == enic->link_status);\n+\tenic->link_status = link_status;\n+\teth_dev->data->dev_link.link_status = link_status;\n+\teth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;\n+\teth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev);\n+\treturn ret;\n+}\n+\n+static void enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,\n+\tstruct rte_eth_stats *stats)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_dev_stats_get(enic, stats);\n+}\n+\n+static void enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_dev_stats_clear(enic);\n+}\n+\n+static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,\n+\tstruct rte_eth_dev_info *device_info)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tdevice_info->max_rx_queues = enic->rq_count;\n+\tdevice_info->max_tx_queues = enic->wq_count;\n+\tdevice_info->min_rx_bufsize = ENIC_MIN_MTU;\n+\tdevice_info->max_rx_pktlen = enic->config.mtu;\n+\tdevice_info->max_mac_addrs = 1;\n+\tdevice_info->rx_offload_capa =\n+\t\tDEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\n+\t\tDEV_RX_OFFLOAD_UDP_CKSUM  |\n+\t\tDEV_RX_OFFLOAD_TCP_CKSUM;\n+\tdevice_info->tx_offload_capa =\n+\t\tDEV_TX_OFFLOAD_VLAN_INSERT |\n+\t\tDEV_TX_OFFLOAD_IPV4_CKSUM  |\n+\t\tDEV_TX_OFFLOAD_UDP_CKSUM   |\n+\t\tDEV_TX_OFFLOAD_TCP_CKSUM;\n+}\n+\n+static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic->promisc = 1;\n+\tenic_add_packet_filter(enic);\n+}\n+\n+static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic->promisc = 0;\n+\tenic_add_packet_filter(enic);\n+}\n+\n+static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic->allmulti = 1;\n+\tenic_add_packet_filter(enic);\n+}\n+\n+static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic->allmulti = 0;\n+\tenic_add_packet_filter(enic);\n+}\n+\n+static void enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev,\n+\tstruct ether_addr *mac_addr,\n+\tuint32_t index, uint32_t pool)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_set_mac_address(enic, mac_addr->addr_bytes);\n+}\n+\n+static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index)\n+{\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\tenic_del_mac_address(enic);\n+}\n+\n+\n+uint16_t enicpmd_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\tuint16_t nb_pkts)\n+{\n+\tunsigned int index;\n+\tunsigned int frags;\n+\tunsigned int pkt_len;\n+\tunsigned int seg_len;\n+\tunsigned int inc_len;\n+\tunsigned int nb_segs;\n+\tstruct rte_mbuf *tx_pkt;\n+\tstruct vnic_wq *wq = (struct vnic_wq *)tx_queue;\n+\tstruct enic *enic = vnic_dev_priv(wq->vdev);\n+\tunsigned char *buf;\n+\tunsigned short vlan_id;\n+\tunsigned short ol_flags;\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tfor (index = 0; index < nb_pkts; index++) {\n+\t\ttx_pkt = *tx_pkts++;\n+\t\tinc_len = 0;\n+\t\tnb_segs = tx_pkt->pkt.nb_segs;\n+\t\tif (nb_segs > vnic_wq_desc_avail(wq)) {\n+\t\t\t/* wq cleanup and try again */\n+\t\t\tif (!enic_cleanup_wq(enic, wq) ||\n+\t\t\t\t(nb_segs > vnic_wq_desc_avail(wq)))\n+\t\t\t\treturn index;\n+\t\t}\n+\t\tpkt_len = tx_pkt->pkt.pkt_len;\n+\t\tvlan_id = tx_pkt->pkt.vlan_macip.f.vlan_tci;\n+\t\tol_flags = tx_pkt->ol_flags;\n+\t\tfor (frags = 0; inc_len < pkt_len; frags++) {\n+\t\t\tif (!tx_pkt)\n+\t\t\t\tbreak;\n+\t\t\tseg_len = tx_pkt->pkt.data_len;\n+\t\t\tinc_len += seg_len;\n+\t\t\tif (enic_send_pkt(enic, wq, tx_pkt,\n+\t\t\t\t    (unsigned short)seg_len, !frags,\n+\t\t\t\t    (pkt_len == inc_len), ol_flags, vlan_id)) {\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\ttx_pkt = tx_pkt->pkt.next;\n+\t\t}\n+\t}\n+\n+\tenic_cleanup_wq(enic, wq);\n+\treturn index;\n+}\n+\n+uint16_t enicpmd_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,\n+\tuint16_t nb_pkts)\n+{\n+\tstruct vnic_rq *rq = (struct vnic_rq *)rx_queue;\n+\tunsigned int work_done;\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tif (enic_poll(rq, rx_pkts, (unsigned int)nb_pkts, &work_done))\n+\t\tdev_err(enic, \"error in enicpmd poll\\n\");\n+\n+\treturn work_done;\n+}\n+\n+static struct eth_dev_ops enicpmd_eth_dev_ops = {\n+\t.dev_configure        = enicpmd_dev_configure,\n+\t.dev_start            = enicpmd_dev_start,\n+\t.dev_stop             = enicpmd_dev_stop,\n+\t.dev_set_link_up      = NULL,\n+\t.dev_set_link_down    = NULL,\n+\t.dev_close            = enicpmd_dev_close,\n+\t.promiscuous_enable   = enicpmd_dev_promiscuous_enable,\n+\t.promiscuous_disable  = enicpmd_dev_promiscuous_disable,\n+\t.allmulticast_enable  = enicpmd_dev_allmulticast_enable,\n+\t.allmulticast_disable = enicpmd_dev_allmulticast_disable,\n+\t.link_update          = enicpmd_dev_link_update,\n+\t.stats_get            = enicpmd_dev_stats_get,\n+\t.stats_reset          = enicpmd_dev_stats_reset,\n+\t.queue_stats_mapping_set = NULL,\n+\t.dev_infos_get        = enicpmd_dev_info_get,\n+\t.mtu_set              = NULL,\n+\t.vlan_filter_set      = enicpmd_vlan_filter_set,\n+\t.vlan_tpid_set        = NULL,\n+\t.vlan_offload_set     = enicpmd_vlan_offload_set,\n+\t.vlan_strip_queue_set = NULL,\n+\t.rx_queue_start       = enicpmd_dev_rx_queue_start,\n+\t.rx_queue_stop        = enicpmd_dev_rx_queue_stop,\n+\t.tx_queue_start       = enicpmd_dev_tx_queue_start,\n+\t.tx_queue_stop        = enicpmd_dev_tx_queue_stop,\n+\t.rx_queue_setup       = enicpmd_dev_rx_queue_setup,\n+\t.rx_queue_release     = enicpmd_dev_rx_queue_release,\n+\t.rx_queue_count       = NULL,\n+\t.rx_descriptor_done   = NULL,\n+\t.tx_queue_setup       = enicpmd_dev_tx_queue_setup,\n+\t.tx_queue_release     = enicpmd_dev_tx_queue_release,\n+\t.dev_led_on           = NULL,\n+\t.dev_led_off          = NULL,\n+\t.flow_ctrl_get        = NULL,\n+\t.flow_ctrl_set        = NULL,\n+\t.priority_flow_ctrl_set = NULL,\n+\t.mac_addr_add         = enicpmd_add_mac_addr,\n+\t.mac_addr_remove      = enicpmd_remove_mac_addr,\n+\t.fdir_add_signature_filter    = NULL,\n+\t.fdir_update_signature_filter = NULL,\n+\t.fdir_remove_signature_filter = NULL,\n+\t.fdir_infos_get               = enicpmd_fdir_info_get,\n+\t.fdir_add_perfect_filter      = enicpmd_fdir_add_perfect_filter,\n+\t.fdir_update_perfect_filter   = enicpmd_fdir_add_perfect_filter,\n+\t.fdir_remove_perfect_filter   = enicpmd_fdir_remove_perfect_filter,\n+\t.fdir_set_masks               = NULL,\n+};\n+\n+struct enic *enicpmd_list_head = NULL;\n+/* Initialize the driver\n+ * It returns 0 on success.\n+ */\n+static int eth_enicpmd_dev_init(\n+\t__attribute__((unused))struct eth_driver *eth_drv,\n+\tstruct rte_eth_dev *eth_dev)\n+{\n+\tstruct rte_pci_device *pdev;\n+\tstruct rte_pci_addr *addr;\n+\tstruct enic *enic = pmd_priv(eth_dev);\n+\n+\tENICPMD_FUNC_TRACE();\n+\n+\tenic->rte_dev = eth_dev;\n+\teth_dev->dev_ops = &enicpmd_eth_dev_ops;\n+\teth_dev->rx_pkt_burst = &enicpmd_recv_pkts;\n+\teth_dev->tx_pkt_burst = &enicpmd_xmit_pkts;\n+\n+\tpdev = eth_dev->pci_dev;\n+\tenic->pdev = pdev;\n+\taddr = &pdev->addr;\n+\n+\tsnprintf(enic->bdf_name, ENICPMD_BDF_LENGTH, \"%04x:%02x:%02x.%x\",\n+\t\taddr->domain, addr->bus, addr->devid, addr->function);\n+\n+\treturn enic_probe(enic);\n+}\n+\n+static struct eth_driver rte_enic_pmd = {\n+\t{\n+\t\t.name = \"rte_enic_pmd\",\n+\t\t.id_table = pci_id_enic_map,\n+\t\t.drv_flags = RTE_PCI_DRV_NEED_MAPPING,\n+\t},\n+\t.eth_dev_init = eth_enicpmd_dev_init,\n+\t.dev_private_size = sizeof(struct enic),\n+};\n+\n+/* Driver initialization routine.\n+ * Invoked once at EAL init time.\n+ * Register as the [Poll Mode] Driver of Cisco ENIC device.\n+ */\n+int rte_enic_pmd_init(const char *name __rte_unused,\n+\tconst char *params __rte_unused)\n+{\n+\tENICPMD_FUNC_TRACE();\n+\n+\trte_eth_driver_register(&rte_enic_pmd);\n+\treturn 0;\n+}\n+\n+static struct rte_driver rte_enic_driver = {\n+\t.type = PMD_PDEV,\n+\t.init = rte_enic_pmd_init,\n+};\n+\n+PMD_REGISTER_DRIVER(rte_enic_driver);\n+\n",
    "prefixes": [
        "dpdk-dev",
        "6/7"
    ]
}