get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 28430,
    "url": "https://patches.dpdk.org/api/patches/28430/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1504773339-21022-2-git-send-email-mohammad.abdul.awal@intel.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": "<1504773339-21022-2-git-send-email-mohammad.abdul.awal@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1504773339-21022-2-git-send-email-mohammad.abdul.awal@intel.com",
    "date": "2017-09-07T08:35:35",
    "name": "[dpdk-dev,RFC,1/5] Implemented port representor broker infrastructure, created BDF to port function.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8ab6c8c0fe218a7ec178400c57404e629d7c6c21",
    "submitter": {
        "id": 482,
        "url": "https://patches.dpdk.org/api/people/482/?format=api",
        "name": "Mohammad Abdul Awal",
        "email": "mohammad.abdul.awal@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1504773339-21022-2-git-send-email-mohammad.abdul.awal@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/28430/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/28430/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 260B7199AB;\n\tThu,  7 Sep 2017 10:36:42 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 5AD857D4E\n\tfor <dev@dpdk.org>; Thu,  7 Sep 2017 10:36:40 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Sep 2017 01:36:39 -0700",
            "from awal-z170x.ir.intel.com ([163.33.210.59])\n\tby orsmga003.jf.intel.com with ESMTP; 07 Sep 2017 01:36:36 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.42,357,1500966000\"; d=\"scan'208\";\n\ta=\"1011909843\"",
        "From": "Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>,\n\tRemy Horton <remy.horton@intel.com>,\n\tDeclan Doherty <declan.doherty@intel.com>",
        "Date": "Thu,  7 Sep 2017 09:35:35 +0100",
        "Message-Id": "<1504773339-21022-2-git-send-email-mohammad.abdul.awal@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1504773339-21022-1-git-send-email-mohammad.abdul.awal@intel.com>",
        "References": "<1504773339-21022-1-git-send-email-mohammad.abdul.awal@intel.com>",
        "Subject": "[dpdk-dev] [RFC 1/5] Implemented port representor broker\n\tinfrastructure, created BDF to port function.",
        "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": "Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>\nSigned-off-by: Remy Horton <remy.horton@intel.com>\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\n---\n lib/librte_ether/Makefile               |   2 +\n lib/librte_ether/rte_ethdev.c           |  93 ++++++++++\n lib/librte_ether/rte_ethdev.h           |  26 +++\n lib/librte_ether/rte_ether_version.map  |   9 +\n lib/librte_ether/rte_port_representor.c | 160 ++++++++++++++++++\n lib/librte_ether/rte_port_representor.h | 289 ++++++++++++++++++++++++++++++++\n 6 files changed, 579 insertions(+)\n create mode 100644 lib/librte_ether/rte_port_representor.c\n create mode 100644 lib/librte_ether/rte_port_representor.h",
    "diff": "diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile\nindex db692ae..b61a84b 100644\n--- a/lib/librte_ether/Makefile\n+++ b/lib/librte_ether/Makefile\n@@ -46,6 +46,7 @@ LIBABIVER := 6\n SRCS-y += rte_ethdev.c\n SRCS-y += rte_flow.c\n SRCS-y += rte_tm.c\n+SRCS-y += rte_port_representor.c\n \n #\n # Export include files\n@@ -59,5 +60,6 @@ SYMLINK-y-include += rte_flow.h\n SYMLINK-y-include += rte_flow_driver.h\n SYMLINK-y-include += rte_tm.h\n SYMLINK-y-include += rte_tm_driver.h\n+SYMLINK-y-include += rte_port_representor.h\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex 0597641..3bca00f 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -67,6 +67,7 @@\n \n #include \"rte_ether.h\"\n #include \"rte_ethdev.h\"\n+#include \"rte_port_representor.h\"\n \n static const char *MZ_RTE_ETH_DEV_DATA = \"rte_eth_dev_data\";\n struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];\n@@ -360,6 +361,98 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)\n \treturn -ENODEV;\n }\n \n+#define RTE_ETH_EBDF_MAX_COLONS 2\n+#define RTE_ETH_EBDF_MAX_PERIODS 1\n+\n+static inline int\n+char_to_value(char value)\n+{\n+\tif (value >= '0' && value <= '9')\n+\t\treturn value - '0';\n+\tif (value >= 'A' && value <= 'F')\n+\t\treturn value - 'A' + 10;\n+\tif (value >= 'a' && value <= 'f')\n+\t\treturn value - 'a' + 10;\n+\treturn -1;\n+}\n+\n+static int\n+parse_ebdf_addr(const char * const addr_str, struct rte_pci_addr *pci_addr)\n+{\n+\tconst char *str_pos;\n+\n+\tint cnt_colons = 0;\n+\tint cnt_periods = 0;\n+\tint nibbles[RTE_ETH_EBDF_MAX_COLONS + RTE_ETH_EBDF_MAX_PERIODS + 1];\n+\tint param_value;\n+\tint digit_value;\n+\n+\tstr_pos = addr_str;\n+\tparam_value = 0;\n+\twhile (*str_pos) {\n+\t\tif (isxdigit(*str_pos)) {\n+\t\t\tdigit_value = char_to_value(*str_pos);\n+\t\t\tif (digit_value == -1)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tparam_value = (param_value << 4) | digit_value;\n+\t\t} else if (*str_pos == ':') {\n+\t\t\tif (cnt_periods != 0 ||\n+\t\t\t\t\tcnt_colons >= RTE_ETH_EBDF_MAX_COLONS)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tnibbles[cnt_colons++] = param_value;\n+\t\t\tparam_value = 0;\n+\t\t} else if (*str_pos == '.') {\n+\t\t\tif (cnt_periods >= RTE_ETH_EBDF_MAX_PERIODS)\n+\t\t\t\treturn -EINVAL;\n+\t\t\tnibbles[cnt_colons + cnt_periods] = param_value;\n+\t\t\tparam_value = 0;\n+\t\t\tcnt_periods++;\n+\t\t} else\n+\t\t\treturn -EINVAL;\n+\t\tstr_pos++;\n+\t}\n+\tnibbles[cnt_colons + cnt_periods] = param_value;\n+\n+\tif (cnt_colons == 2 && cnt_periods == 1) {\n+\t\tpci_addr->domain = nibbles[0];\n+\t\tpci_addr->bus = nibbles[1];\n+\t\tpci_addr->devid = nibbles[2];\n+\t\tpci_addr->function = nibbles[3];\n+\t} else if (cnt_colons == 1 && cnt_periods == 1) {\n+\t\tpci_addr->domain = 0;\n+\t\tpci_addr->bus = nibbles[0];\n+\t\tpci_addr->devid = nibbles[1];\n+\t\tpci_addr->function = nibbles[2];\n+\t} else\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_eth_dev_get_port_by_pci_addr_str(const char *pci_str, uint8_t *port_id)\n+{\n+\tstruct rte_pci_device *pci_dev;\n+\tstruct rte_pci_addr pci_addr;\n+\n+\tif (parse_ebdf_addr(pci_str, &pci_addr) != 0)\n+\t\treturn -EINVAL;\n+\n+\tFOREACH_DEVICE_ON_PCIBUS(pci_dev) {\n+\t\tif (pci_dev->driver == NULL) {\n+\t\t\t/* No loaded driver - skip */\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (rte_eal_compare_pci_addr(&pci_addr, &pci_dev->addr) == 0) {\n+\t\t\t/* (E)BDF resolved to device name. Now get port_id..\n+\t\t\t */\n+\t\t\treturn rte_eth_dev_get_port_by_name(\n+\t\t\t\tpci_dev->device.name, port_id);\n+\t\t}\n+\t}\n+\treturn -ENODEV;\n+}\n+\n static int\n rte_eth_dev_is_detachable(uint8_t port_id)\n {\ndiff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h\nindex 0adf327..9342e45 100644\n--- a/lib/librte_ether/rte_ethdev.h\n+++ b/lib/librte_ether/rte_ethdev.h\n@@ -967,6 +967,7 @@ struct rte_eth_dev_info {\n \t/** Configured number of rx/tx queues */\n \tuint16_t nb_rx_queues; /**< Number of RX queues. */\n \tuint16_t nb_tx_queues; /**< Number of TX queues. */\n+\tuint16_t switch_domain; /**< Switch domain which port belongs to. */\n };\n \n /**\n@@ -1618,6 +1619,8 @@ enum rte_eth_dev_state {\n \tRTE_ETH_DEV_DEFERRED,\n };\n \n+struct rte_representor_broker;\n+\n /**\n  * @internal\n  * The generic data structure associated with each ethernet device.\n@@ -1633,6 +1636,8 @@ struct rte_eth_dev {\n \teth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function. */\n \teth_tx_prep_t tx_pkt_prepare; /**< Pointer to PMD transmit prepare function. */\n \tstruct rte_eth_dev_data *data;  /**< Pointer to device data */\n+\tstruct rte_port_representor_broker *rep_broker;\n+\t/**< Pointer to representor broker */\n \tconst struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */\n \tstruct rte_device *device; /**< Backing device */\n \tstruct rte_intr_handle *intr_handle; /**< Device interrupt handle */\n@@ -1711,6 +1716,7 @@ struct rte_eth_dev_data {\n \tint numa_node;  /**< NUMA node connection */\n \tstruct rte_vlan_filter_conf vlan_filter_conf;\n \t/**< VLAN filter configuration. */\n+\tuint16_t switch_domain; /**< Switch domain which port belongs to. */\n };\n \n /** Device supports hotplug detach */\n@@ -1730,6 +1736,12 @@ struct rte_eth_dev_data {\n extern struct rte_eth_dev rte_eth_devices[];\n \n /**\n+ * The pci device list needed to map the PF BDF to port id mapping for\n+ * port representor pmd argument parsing.\n+ */\n+extern struct rte_pci_bus rte_pci_bus;\n+\n+/**\n  * Iterates over valid ethdev ports.\n  *\n  * @param port_id\n@@ -4436,6 +4448,20 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,\n \t\t\t\t     uint16_t *nb_rx_desc,\n \t\t\t\t     uint16_t *nb_tx_desc);\n \n+/**\n+* Get the port id from (E)BDF PCI address.\n+*\n+* @param pci_str\n+*  Address as string\n+* @param port_id\n+*   pointer to port identifier of the device\n+* @return\n+*   - (0) if successful and port_id is filled.\n+*   - (-ENODEV or -EINVAL) on failure.\n+*/\n+int rte_eth_dev_get_port_by_pci_addr_str(const char *pci_str, uint8_t *port_id);\n+\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map\nindex 4283728..c08d469 100644\n--- a/lib/librte_ether/rte_ether_version.map\n+++ b/lib/librte_ether/rte_ether_version.map\n@@ -187,3 +187,12 @@ DPDK_17.08 {\n \trte_tm_wred_profile_delete;\n \n } DPDK_17.05;\n+\n+DPDK_17.11 {\n+\tglobal:\n+\n+\trte_representor_broker_init;\n+\trte_representor_add;\n+\trte_representor_broker_fini;\n+\n+} DPDK_17.08;\ndiff --git a/lib/librte_ether/rte_port_representor.c b/lib/librte_ether/rte_port_representor.c\nnew file mode 100644\nindex 0000000..ed5faa5\n--- /dev/null\n+++ b/lib/librte_ether/rte_port_representor.c\n@@ -0,0 +1,160 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   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+ *\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+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\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 FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include \"rte_ethdev.h\"\n+\n+#include \"rte_port_representor.h\"\n+\n+/*\n+ * Helper functions.\n+ */\n+static inline struct rte_port_representor *\n+get_representor(struct rte_port_representor_list *list)\n+{\n+\tstruct rte_port_representor *rep;\n+\n+\trep = NULL;\n+\tif (list->num == 0)\n+\t\treturn rep;\n+\n+\trep = STAILQ_FIRST(&list->head);\n+\tSTAILQ_REMOVE_HEAD(&list->head, next);\n+\tlist->num--;\n+\n+\treturn rep;\n+}\n+\n+static inline void\n+put_representor(struct rte_port_representor_list *list,\n+\tstruct rte_port_representor *rep)\n+{\n+\tSTAILQ_INSERT_TAIL(&list->head, rep, next);\n+\tlist->num++;\n+}\n+\n+static inline void\n+rem_representor(struct rte_port_representor_list *list,\n+\tstruct rte_port_representor *rep)\n+{\n+\tSTAILQ_REMOVE(&list->head, rep, rte_port_representor, next);\n+\tlist->num--;\n+}\n+\n+struct rte_port_representor_broker *\n+rte_representor_broker_init(struct rte_eth_dev *dev, uint16_t max_vfs,\n+\tstruct representor_ops *ops)\n+{\n+\tstruct rte_port_representor_broker *rb;\n+\tuint32_t port_id;\n+\n+\tif (!dev && !dev->data && !ops) {\n+\t\terrno = -EINVAL;\n+\t\treturn NULL;\n+\t}\n+\tport_id = dev->data->port_id;\n+\n+\trb = rte_zmalloc_socket(NULL, sizeof(*rb), RTE_CACHE_LINE_SIZE,\n+\t\trte_socket_id());\n+\tif (rb == NULL) {\n+\t\terrno = -ENOMEM;\n+\t\treturn NULL;\n+\t}\n+\t/* update broker */\n+\trb->pfid = port_id;\n+\tSTAILQ_INIT(&rb->rep_list.head);\n+\trb->max_vf = max_vfs;\n+\trb->rep_ops = ops;\n+\n+\tdev->rep_broker = rb;\n+\n+\t/* update switch domain */\n+\tdev->data->switch_domain = port_id;\n+\n+\treturn rb;\n+}\n+\n+void\n+rte_representor_broker_free(uint32_t port_id)\n+{\n+\tstruct rte_port_representor *rep;\n+\tstruct rte_eth_dev *eth_dev;\n+\tstruct rte_port_representor_broker *rb;\n+\n+\teth_dev = &rte_eth_devices[port_id];\n+\trb = eth_dev->rep_broker;\n+\twhile (!STAILQ_EMPTY(&rb->rep_list.head)) {\n+\t\trep = get_representor(&rb->rep_list);\n+\t\trte_free(rep);\n+\t}\n+\tSTAILQ_INIT(&rb->rep_list.head);\n+\trte_free(rb);\n+}\n+\n+struct rte_port_representor *\n+rte_representor_initialize(uint32_t port_id, uint32_t vf_index,\n+\tstruct rte_eth_dev *vdev)\n+{\n+\tstruct rte_port_representor *rep;\n+\tstruct rte_eth_dev *eth_dev;\n+\tstruct rte_port_representor_broker *rb;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, NULL);\n+\teth_dev = &rte_eth_devices[port_id];\n+\trb = eth_dev->rep_broker;\n+\n+\tif (vf_index >= rb->max_vf) {\n+\t\tRTE_LOG(ERR, EAL, \"Invalid vf_index=%u. Max allowed=%u\\n\",\n+\t\t\tvf_index, rb->max_vf - 1);\n+\t\terrno = -EINVAL;\n+\t\treturn NULL;\n+\t}\n+\n+\trep = rte_zmalloc_socket(NULL, sizeof(*rep), RTE_CACHE_LINE_SIZE,\n+\t\trte_socket_id());\n+\tif (rep == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"Not enough memory for representor.\\n\");\n+\t\terrno = -ENOMEM;\n+\t\treturn NULL;\n+\t}\n+\n+\trep->pfid = rb->pfid;\n+\trep->vf_index = vf_index;\n+\trep->pdev = eth_dev;\n+\trep->vdev = vdev;\n+\tvdev->data->switch_domain = eth_dev->data->switch_domain;\n+\tput_representor(&rb->rep_list, rep);\n+\tRTE_LOG(INFO, EAL, \"%s: Added representor <pfid=%u, vf_index=%u>\\n\",\n+\t\t__func__, rb->pfid, vf_index);\n+\n+\treturn rep;\n+}\ndiff --git a/lib/librte_ether/rte_port_representor.h b/lib/librte_ether/rte_port_representor.h\nnew file mode 100644\nindex 0000000..b132ead\n--- /dev/null\n+++ b/lib/librte_ether/rte_port_representor.h\n@@ -0,0 +1,289 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   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+ *\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+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\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 FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_PORT_REPRESENTOR_H_\n+#define _RTE_PORT_REPRESENTOR_H_\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <rte_malloc.h>\n+#include <rte_flow.h>\n+\n+struct rte_port_representor;\n+\n+/*\n+ * Definitions of all functions exported by an Ethernet representor driver\n+ * through the structure of type *representor_ops*.\n+ */\n+\n+typedef int (*representor_link_update_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tint wait_to_complete);\n+/**< @internal Get link speed, duplex mode and state (up/down) of a device. */\n+\n+typedef void (*representor_promiscuous_enable_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep);\n+/**< @internal Function used to enable the RX promiscuous mode of a device. */\n+\n+typedef void (*representor_promiscuous_disable_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep);\n+/**< @internal Function used to disable the RX promiscuous mode of a device. */\n+\n+typedef void (*representor_allmulticast_enable_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep);\n+/**< @internal Enable the receipt of all multicast packets by a device. */\n+\n+typedef void (*representor_allmulticast_disable_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep);\n+/**< @internal Disable the receipt of all multicast packets by a device. */\n+\n+typedef void (*representor_mac_addr_remove_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tuint32_t index);\n+/**< @internal Remove MAC address from a device. */\n+\n+typedef int (*representor_mac_addr_add_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tstruct ether_addr *mac_addr, uint32_t index, uint32_t vmdq);\n+/**< @internal Add a MAC address into a device */\n+\n+typedef void (*representor_mac_addr_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tstruct ether_addr *mac_addr);\n+/**< @internal Set a MAC address of a device. */\n+\n+typedef int (*representor_stats_get_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tstruct rte_eth_stats *stats);\n+/**< @internal Get I/O statistics of a device. */\n+\n+typedef void (*representor_stats_reset_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep);\n+/**< @internal Reset global I/O statistics of an Ethernet device to 0. */\n+\n+typedef void (*representor_dev_infos_get_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tstruct rte_eth_dev_info *dev_info);\n+/**< @internal Get specific information of an Ethernet device. */\n+\n+typedef int (*representor_vlan_filter_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep, uint16_t vlan_id, int on);\n+/**< @internal filtering of a VLAN Tag Identifier by an Ethernet device. */\n+\n+typedef int (*representor_vlan_tpid_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep,\n+\tenum rte_vlan_type type, uint16_t tpid);\n+/**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */\n+\n+typedef void (*representor_vlan_offload_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep, int mask);\n+/**< @internal set VLAN offload function by an Ethernet device. */\n+\n+typedef void (*representor_vlan_strip_queue_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep, int on);\n+/**< @internal VLAN stripping enable/disable by an queue of Ethernet device. */\n+\n+typedef int (*representor_vlan_pvid_set_t)(\n+\tstruct rte_port_representor_broker *rb,\n+\tstruct rte_port_representor *prep, uint16_t vlan_id);\n+/**< @internal set port based TX VLAN insertion by an Ethernet device. */\n+\n+typedef int (*representor_flow_validate_t)(\n+\t\tstruct rte_port_representor_broker *rb,\n+\t\tstruct rte_port_representor *prep,\n+\t\tconst struct rte_flow_attr *attr,\n+\t\tconst struct rte_flow_item pattern[],\n+\t\tconst struct rte_flow_action actions[],\n+\t\tstruct rte_flow_error *error);\n+/**< @internal Check whether a flow rule can be created on a given port. */\n+\n+typedef struct rte_flow * (*representor_flow_create_t)(\n+\t\tstruct rte_port_representor_broker *rb,\n+\t\tstruct rte_port_representor *prep,\n+\t\tconst struct rte_flow_attr *attr,\n+\t\tconst struct rte_flow_item pattern[],\n+\t\tconst struct rte_flow_action actions[],\n+\t\tstruct rte_flow_error *error);\n+/**< @internal Create a flow rule on a given port. */\n+\n+typedef int (*representor_flow_destroy_t)(\n+\t\tstruct rte_port_representor_broker *rb,\n+\t\tstruct rte_port_representor *prep,\n+\t\tstruct rte_flow *flow,\n+\t\tstruct rte_flow_error *error);\n+/**< @internal Destroy a flow rule on a given port. */\n+\n+typedef int (*representor_flow_flush_t)(\n+\t\tstruct rte_port_representor_broker *rb,\n+\t\tstruct rte_port_representor *prep,\n+\t\tstruct rte_flow_error *error);\n+/**< @internal Destroy all flow rules associated with a port. */\n+\n+/**\n+ * @internal A structure containing the functions exported by a\n+ * representor PMD.\n+ */\n+struct representor_ops {\n+\trepresentor_link_update_t link_update; /**< Get device link state. */\n+\n+\trepresentor_promiscuous_enable_t promiscuous_enable;\n+\t/**< Promiscuous ON. */\n+\n+\trepresentor_promiscuous_disable_t promiscuous_disable;\n+\t/**< Promiscuous OFF. */\n+\n+\trepresentor_allmulticast_enable_t allmulticast_enable;\n+\t/**< RX multicast ON. */\n+\n+\trepresentor_allmulticast_disable_t allmulticast_disable;\n+\t/**< RX multicast OFF. */\n+\n+\trepresentor_mac_addr_remove_t mac_addr_remove;\n+\t/**< Remove MAC address. */\n+\trepresentor_mac_addr_add_t mac_addr_add; /**< Add a MAC address. */\n+\trepresentor_mac_addr_set_t mac_addr_set; /**< Set a MAC address. */\n+\n+\trepresentor_stats_get_t stats_get;\n+\t/**< Get generic device statistics. */\n+\trepresentor_stats_reset_t stats_reset;\n+\t/**< Reset generic device statistics. */\n+\n+\trepresentor_dev_infos_get_t dev_infos_get;\n+\t/**< Get device info. */\n+\n+\trepresentor_vlan_filter_set_t vlan_filter_set;\n+\t/**< Filter VLAN Setup. */\n+\trepresentor_vlan_tpid_set_t vlan_tpid_set;\n+\t/**< Outer/Inner VLAN TPID Setup. */\n+\trepresentor_vlan_offload_set_t vlan_offload_set;\n+\t/**< Set VLAN Offload. */\n+\trepresentor_vlan_strip_queue_set_t vlan_strip_queue_set;\n+\t/**< VLAN Stripping on queue. */\n+\trepresentor_vlan_pvid_set_t vlan_pvid_set;\n+\t/**< Set port based TX VLAN insertion. */\n+\n+\trepresentor_flow_validate_t flow_validate;\n+\t/** Check whether a flow rule can be created on a given port. */\n+\trepresentor_flow_create_t flow_create;\n+\t/** Create a flow rule on a given port. */\n+\trepresentor_flow_destroy_t flow_destroy;\n+\t/** Destroy a flow rule on a given port. */\n+\trepresentor_flow_flush_t flow_flush;\n+\t/** Destroy all flow rules associated with a port. */\n+};\n+\n+struct rte_port_representor {\n+\tuint32_t pfid; /**< parent physical function id */\n+\tuint32_t vf_index; /**< virtual function index */\n+\tstruct rte_eth_dev *pdev; /**< parent PF PMD */\n+\tstruct rte_eth_dev *vdev; /**< representor PMD */\n+\tSTAILQ_ENTRY(rte_port_representor) next; /**< list pointer */\n+};\n+\n+struct rte_port_representor_list {\n+\tuint32_t num; /**< number of representors in the list */\n+\tSTAILQ_HEAD(, rte_port_representor) head; /**< list head */\n+};\n+\n+struct rte_port_representor_broker {\n+\tuint32_t pfid; /**< physical function id that broker belongs to. */\n+\tuint32_t max_vf; /**< maximum number of VF to support. */\n+\tconst struct representor_ops *rep_ops;\n+\t/**< supported ops by representor */\n+\tstruct rte_port_representor_list rep_list; /**< list of representors */\n+};\n+\n+/**\n+ * Port representor broker initialization function\n+ *\n+ * This function is called in HW driver initialization routine if the port\n+ * representor is enabled by EAL command line argument.\n+ *\n+ * @param dev\n+ *   The eth_dev structure for physical function.\n+ * @param max_vfs\n+ *   The maximum number of VFs can be represented by this broker.\n+ * @param ops\n+ *   Supported representor ops.\n+ * @return\n+ *   Return the pointer to allocated memory for representor broker.\n+ */\n+struct rte_port_representor_broker *\n+rte_representor_broker_init(struct rte_eth_dev *dev, uint16_t max_vfs,\n+\tstruct representor_ops *ops);\n+\n+/**\n+ * This function adds creates a representor PMD and add to the broker\n+ * @param port_id\n+ *    The physical function identifier\n+ * @param vf_index\n+ *    The virtual function index\n+ * @param vdev\n+ *    Pointer to the allocated rte_eth_dev structure for the representor PMD\n+ * @return\n+ *    Returns the pointer in broker for the representor PMD\n+ */\n+struct rte_port_representor *\n+rte_representor_initialize(uint32_t port_id, uint32_t vf_index,\n+\tstruct rte_eth_dev *vdev);\n+\n+/**\n+ * This functions deallocates all the allocated memory for representor PMDs\n+ * @param port_id\n+ *    The physical function identifier\n+ */\n+void\n+rte_representor_broker_free(uint32_t port_id);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_PORT_REPRESENTOR_H_ */\n",
    "prefixes": [
        "dpdk-dev",
        "RFC",
        "1/5"
    ]
}