get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 33519,
    "url": "https://patches.dpdk.org/api/patches/33519/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20180110174931.2163-4-remy.horton@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": "<20180110174931.2163-4-remy.horton@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180110174931.2163-4-remy.horton@intel.com",
    "date": "2018-01-10T17:49:29",
    "name": "[dpdk-dev,v5,3/5] drivers/net/i40e: add Port Representor functionality",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "31a60c8aae2cf350e05b6d6d4cbc5491ce51eaab",
    "submitter": {
        "id": 326,
        "url": "https://patches.dpdk.org/api/people/326/?format=api",
        "name": "Remy Horton",
        "email": "remy.horton@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20180110174931.2163-4-remy.horton@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/33519/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/33519/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 7A3F41B23B;\n\tWed, 10 Jan 2018 18:49:51 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id E6DB01B1F9\n\tfor <dev@dpdk.org>; Wed, 10 Jan 2018 18:49:39 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t10 Jan 2018 09:49:39 -0800",
            "from rhorton-mobl1.ger.corp.intel.com (HELO\n\tFC23.ger.corp.intel.com) ([10.252.19.205])\n\tby fmsmga001.fm.intel.com with ESMTP; 10 Jan 2018 09:49:38 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,341,1511856000\"; d=\"scan'208\";a=\"20544765\"",
        "From": "Remy Horton <remy.horton@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "John McNamara <john.mcnamara@intel.com>,\n\tBeilei Xing <beilei.xing@intel.com>,\n\tDeclan Doherty <declan.doherty@intel.com>,\n\tMohammad Abdul Awal <mohammad.abdul.awal@intel.com>",
        "Date": "Wed, 10 Jan 2018 17:49:29 +0000",
        "Message-Id": "<20180110174931.2163-4-remy.horton@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20180110174931.2163-1-remy.horton@intel.com>",
        "References": "<20180110174931.2163-1-remy.horton@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 3/5] drivers/net/i40e: add Port Representor\n\tfunctionality",
        "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://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": "<https://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": "Port Representors provide a logical presentation in DPDK of VF (virtual\nfunction) ports for the purposes of control and monitoring. Each port\nrepresentor device represents a single VF and is associated with it's\nparent physical function (PF) PMD which provides the back-end hooks for\nthe representor device ops and defines the control domain to which that\nport belongs. This allows to use existing DPDK APIs to monitor and control\nthe port without the need to create and maintain VF specific APIs.\n\nThis patch adds to the i40e PMD the functions required to enable port\nrepresentor functionality.\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\nSigned-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>\nSigned-off-by: Remy Horton <remy.horton@intel.com>\n---\n MAINTAINERS                                  |   2 +\n drivers/net/i40e/Makefile                    |   2 +\n drivers/net/i40e/i40e_ethdev.c               |  19 +\n drivers/net/i40e/i40e_ethdev.h               |   1 +\n drivers/net/i40e/i40e_port_representor_ops.c | 516 +++++++++++++++++++++++++++\n drivers/net/i40e/i40e_port_representor_ops.h |  19 +\n drivers/net/i40e/rte_pmd_i40e.c              |  43 +++\n drivers/net/i40e/rte_pmd_i40e.h              |  18 +\n drivers/net/i40e/rte_pmd_i40e_version.map    |   7 +\n 9 files changed, 627 insertions(+)\n create mode 100644 drivers/net/i40e/i40e_port_representor_ops.c\n create mode 100644 drivers/net/i40e/i40e_port_representor_ops.h",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex c48f1b5..b720566 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -787,6 +787,8 @@ M: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>\n M: Remy Horton <remy.horton@intel.com>\n F: lib/librte_representor\n F: doc/guides/prog_guide/representor_lib.rst\n+F: drivers/net/i40e/i40e_prep_ops.c\n+F: drivers/net/i40e/i40e_prep_ops.h\n \n \n Packet Framework\ndiff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile\nindex 4b9634d..521640b 100644\n--- a/drivers/net/i40e/Makefile\n+++ b/drivers/net/i40e/Makefile\n@@ -14,6 +14,7 @@ CFLAGS += -DX722_A0_SUPPORT\n LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring\n LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash\n LDLIBS += -lrte_bus_pci\n+LDLIBS += -lrte_representor\n \n EXPORT_MAP := rte_pmd_i40e_version.map\n \n@@ -85,6 +86,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_fdir.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_flow.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += rte_pmd_i40e.c\n SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_tm.c\n+SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_port_representor_ops.c\n \n # install this header file\n SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h\ndiff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 285d92b..7e1443c 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -36,6 +36,7 @@\n #include \"i40e_ethdev.h\"\n #include \"i40e_rxtx.h\"\n #include \"i40e_pf.h\"\n+#include \"i40e_port_representor_ops.h\"\n #include \"i40e_regs.h\"\n #include \"rte_pmd_i40e.h\"\n \n@@ -1093,6 +1094,17 @@ eth_i40e_dev_init(struct rte_eth_dev *dev)\n \thw->bus.func = pci_dev->addr.function;\n \thw->adapter_stopped = 0;\n \n+\t/* init representor broker */\n+\tif (rte_representor_enabled()) {\n+\t\tret = i40e_port_representor_broker_init(dev, &pf->broker,\n+\t\t\tpci_dev);\n+\t\tif (ret) {\n+\t\t\tPMD_INIT_LOG(ERR, \"Representor broker register failed \"\n+\t\t\t\t\"with ret=%d\\n\", ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n \t/* Make sure all is clean before doing PF reset */\n \ti40e_clear_hw(hw);\n \n@@ -1428,6 +1440,13 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)\n \tpci_dev = RTE_ETH_DEV_TO_PCI(dev);\n \tintr_handle = &pci_dev->intr_handle;\n \n+\t/* free port representor pmds */\n+\tif (rte_representor_enabled()) {\n+\t\tret = i40e_port_representor_broker_uninit(dev, pf->broker);\n+\t\tif (ret)\n+\t\t\tPMD_INIT_LOG(ERR, \"Representor broker unregister\"\n+\t\t\t\t\" failed with ret=%d\\n\", ret);\n+\t}\n \tif (hw->adapter_stopped == 0)\n \t\ti40e_dev_close(dev);\n \ndiff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h\nindex f2b4b70..cadecbf 100644\n--- a/drivers/net/i40e/i40e_ethdev.h\n+++ b/drivers/net/i40e/i40e_ethdev.h\n@@ -928,6 +928,7 @@ struct i40e_pf {\n \tbool gtp_replace_flag;   /* 1 - GTP-C/U filter replace is done */\n \tbool qinq_replace_flag;  /* QINQ filter replace is done */\n \tstruct i40e_tm_conf tm_conf;\n+\tstruct rte_representor_broker *broker;\n \n \t/* Dynamic Device Personalization */\n \tbool gtp_support; /* 1 - support GTP-C and GTP-U */\ndiff --git a/drivers/net/i40e/i40e_port_representor_ops.c b/drivers/net/i40e/i40e_port_representor_ops.c\nnew file mode 100644\nindex 0000000..ddd9e77\n--- /dev/null\n+++ b/drivers/net/i40e/i40e_port_representor_ops.c\n@@ -0,0 +1,516 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2017 Intel Corporation.\n+ */\n+\n+#include <rte_bus_pci.h>\n+#include <rte_ethdev.h>\n+#include <rte_pci.h>\n+\n+#include \"base/i40e_type.h\"\n+#include \"base/virtchnl.h\"\n+#include \"i40e_ethdev.h\"\n+#include \"i40e_port_representor_ops.h\"\n+#include \"i40e_rxtx.h\"\n+#include \"rte_pmd_i40e.h\"\n+\n+\n+struct i40e_representor_private_data {\n+\tstruct rte_eth_dev *pf_ethdev;\n+};\n+\n+static int\n+i40e_representor_link_update(struct rte_eth_dev *ethdev, int wait_to_complete)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\treturn i40e_dev_link_update(i40e_priv_data->pf_ethdev,\n+\t\twait_to_complete);\n+}\n+\n+static void\n+i40e_representor_dev_infos_get(struct rte_eth_dev *ethdev,\n+\tstruct rte_eth_dev_info *dev_info)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\tstruct i40e_pf_vf *vf;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_pf *pf;\n+\n+\tif (!is_i40e_supported(i40e_priv_data->pf_ethdev)) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid PF dev.\");\n+\t\treturn;\n+\t}\n+\n+\tpf = I40E_DEV_PRIVATE_TO_PF(\n+\t\ti40e_priv_data->pf_ethdev->data->dev_private);\n+\tif (representor->vport_id >= pf->vf_num || !pf->vfs) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VF ID.\");\n+\t\treturn;\n+\t}\n+\n+\tvf = &pf->vfs[representor->vport_id];\n+\tvsi = vf->vsi;\n+\tif (!vsi) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VSI.\");\n+\t\treturn;\n+\t}\n+\n+\t/* get dev info for the vdev */\n+\tdev_info->pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);\n+\tdev_info->max_rx_queues = vsi->nb_qps;\n+\tdev_info->max_tx_queues = vsi->nb_qps;\n+\tdev_info->min_rx_bufsize = I40E_BUF_SIZE_MIN;\n+\tdev_info->max_rx_pktlen = I40E_FRAME_SIZE_MAX;\n+\tdev_info->hash_key_size = (I40E_VFQF_HKEY_MAX_INDEX + 1) *\n+\t\tsizeof(uint32_t);\n+\tdev_info->reta_size = ETH_RSS_RETA_SIZE_64;\n+\tdev_info->flow_type_rss_offloads = I40E_RSS_OFFLOAD_ALL;\n+\tdev_info->max_mac_addrs = I40E_NUM_MACADDR_MAX;\n+\tdev_info->rx_offload_capa =\n+\t\tDEV_RX_OFFLOAD_VLAN_STRIP |\n+\t\tDEV_RX_OFFLOAD_QINQ_STRIP |\n+\t\tDEV_RX_OFFLOAD_IPV4_CKSUM |\n+\t\tDEV_RX_OFFLOAD_UDP_CKSUM |\n+\t\tDEV_RX_OFFLOAD_TCP_CKSUM;\n+\tdev_info->tx_offload_capa =\n+\t\tDEV_TX_OFFLOAD_VLAN_INSERT |\n+\t\tDEV_TX_OFFLOAD_QINQ_INSERT |\n+\t\tDEV_TX_OFFLOAD_IPV4_CKSUM |\n+\t\tDEV_TX_OFFLOAD_UDP_CKSUM |\n+\t\tDEV_TX_OFFLOAD_TCP_CKSUM |\n+\t\tDEV_TX_OFFLOAD_SCTP_CKSUM |\n+\t\tDEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |\n+\t\tDEV_TX_OFFLOAD_TCP_TSO |\n+\t\tDEV_TX_OFFLOAD_VXLAN_TNL_TSO |\n+\t\tDEV_TX_OFFLOAD_GRE_TNL_TSO |\n+\t\tDEV_TX_OFFLOAD_IPIP_TNL_TSO |\n+\t\tDEV_TX_OFFLOAD_GENEVE_TNL_TSO;\n+\n+\tdev_info->default_rxconf = (struct rte_eth_rxconf) {\n+\t\t.rx_thresh = {\n+\t\t\t.pthresh = I40E_DEFAULT_RX_PTHRESH,\n+\t\t\t.hthresh = I40E_DEFAULT_RX_HTHRESH,\n+\t\t\t.wthresh = I40E_DEFAULT_RX_WTHRESH,\n+\t\t},\n+\t\t.rx_free_thresh = I40E_DEFAULT_RX_FREE_THRESH,\n+\t\t.rx_drop_en = 0,\n+\t};\n+\n+\tdev_info->default_txconf = (struct rte_eth_txconf) {\n+\t\t.tx_thresh = {\n+\t\t\t.pthresh = I40E_DEFAULT_TX_PTHRESH,\n+\t\t\t.hthresh = I40E_DEFAULT_TX_HTHRESH,\n+\t\t\t.wthresh = I40E_DEFAULT_TX_WTHRESH,\n+\t\t},\n+\t\t.tx_free_thresh = I40E_DEFAULT_TX_FREE_THRESH,\n+\t\t.tx_rs_thresh = I40E_DEFAULT_TX_RSBIT_THRESH,\n+\t\t.txq_flags = ETH_TXQ_FLAGS_NOMULTSEGS |\n+\t\t\t\tETH_TXQ_FLAGS_NOOFFLOADS,\n+\t};\n+\n+\tdev_info->rx_desc_lim = (struct rte_eth_desc_lim) {\n+\t\t.nb_max = I40E_MAX_RING_DESC,\n+\t\t.nb_min = I40E_MIN_RING_DESC,\n+\t\t.nb_align = I40E_ALIGN_RING_DESC,\n+\t};\n+\n+\tdev_info->tx_desc_lim = (struct rte_eth_desc_lim) {\n+\t\t.nb_max = I40E_MAX_RING_DESC,\n+\t\t.nb_min = I40E_MIN_RING_DESC,\n+\t\t.nb_align = I40E_ALIGN_RING_DESC,\n+\t};\n+}\n+\n+static int i40e_representor_dev_configure(__rte_unused struct rte_eth_dev *dev)\n+{\n+\treturn 0;\n+}\n+\n+static int i40e_representor_rx_queue_setup(__rte_unused struct rte_eth_dev *dev,\n+\t__rte_unused uint16_t rx_queue_id,\n+\t__rte_unused uint16_t nb_rx_desc,\n+\t__rte_unused unsigned int socket_id,\n+\t__rte_unused const struct rte_eth_rxconf *rx_conf,\n+\t__rte_unused struct rte_mempool *mb_pool)\n+{\n+\treturn 0;\n+}\n+\n+static int i40e_representor_tx_queue_setup(__rte_unused struct rte_eth_dev *dev,\n+\t__rte_unused uint16_t rx_queue_id,\n+\t__rte_unused uint16_t nb_rx_desc,\n+\t__rte_unused unsigned int socket_id,\n+\t__rte_unused const struct rte_eth_txconf *tx_conf)\n+{\n+\treturn 0;\n+}\n+\n+static int i40e_representor_dev_start(__rte_unused struct rte_eth_dev *dev)\n+{\n+\treturn 0;\n+}\n+\n+static void i40e_representor_dev_stop(__rte_unused struct rte_eth_dev *dev)\n+{\n+}\n+\n+static int\n+i40e_representor_stats_get(struct rte_eth_dev *ethdev,\n+\t\tstruct rte_eth_stats *stats)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\treturn rte_pmd_i40e_get_vf_stats(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, stats);\n+}\n+\n+static void\n+i40e_representor_stats_reset(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_reset_vf_stats(i40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id);\n+}\n+\n+static void\n+i40e_representor_promiscuous_enable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_unicast_promisc(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, 1);\n+}\n+\n+static void\n+i40e_representor_promiscuous_disable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_unicast_promisc(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, 0);\n+}\n+\n+static void\n+i40e_representor_allmulticast_enable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_multicast_promisc(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, 1);\n+}\n+\n+static void\n+i40e_representor_allmulticast_disable(struct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_multicast_promisc(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, 0);\n+}\n+\n+static void\n+i40e_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_remove_vf_mac_addr(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, &ethdev->data->mac_addrs[index]);\n+}\n+\n+static void\n+i40e_representor_mac_addr_set(struct rte_eth_dev *ethdev,\n+\t\tstruct ether_addr *mac_addr)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_mac_addr(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, mac_addr);\n+}\n+\n+static int\n+i40e_representor_vlan_filter_set(struct rte_eth_dev *ethdev,\n+\t\tuint16_t vlan_id, int on)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\tuint32_t vfid;\n+\tuint64_t vf_mask;\n+\n+\tvfid = representor->vport_id;\n+\tvf_mask = 1ULL << vfid;\n+\n+\treturn rte_pmd_i40e_set_vf_vlan_filter(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\tvlan_id, vf_mask, on);\n+}\n+\n+static int\n+i40e_representor_vlan_offload_set(struct rte_eth_dev *ethdev, int mask)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\tstruct rte_eth_dev *pdev;\n+\tstruct i40e_pf_vf *vf;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_pf *pf;\n+\tuint32_t vfid;\n+\n+\tpdev = i40e_priv_data->pf_ethdev;\n+\tvfid = representor->vport_id;\n+\n+\tif (!is_i40e_supported(pdev)) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid PF dev.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tpf = I40E_DEV_PRIVATE_TO_PF(pdev->data->dev_private);\n+\n+\tif (vfid >= pf->vf_num || !pf->vfs) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VF ID.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvf = &pf->vfs[vfid];\n+\tvsi = vf->vsi;\n+\tif (!vsi) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VSI.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Fixme: even though there 3 kinds of hw offloads, hw_vlan_filter,\n+\t * hw_vlan_strip, and hw_vlan_extend.\n+\t * currently the hw_vlan_extend offload by vsi is not implemented.\n+\t */\n+\n+\tif (mask & ETH_VLAN_FILTER_MASK) {\n+\t\t/* Enable or disable VLAN filtering offload */\n+\t\tif (ethdev->data->dev_conf.rxmode.hw_vlan_filter)\n+\t\t\treturn i40e_vsi_config_vlan_filter(vsi, TRUE);\n+\t\telse\n+\t\t\treturn i40e_vsi_config_vlan_filter(vsi, FALSE);\n+\t}\n+\n+\tif (mask & ETH_VLAN_STRIP_MASK) {\n+\t\t/* Enable or disable VLAN stripping offload */\n+\t\tif (ethdev->data->dev_conf.rxmode.hw_vlan_strip)\n+\t\t\treturn i40e_vsi_config_vlan_stripping(vsi, TRUE);\n+\t\telse\n+\t\t\treturn i40e_vsi_config_vlan_stripping(vsi, FALSE);\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+\n+static void\n+i40e_representor_vlan_strip_queue_set(struct rte_eth_dev *ethdev,\n+\t__rte_unused uint16_t rx_queue_id, int on)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\trte_pmd_i40e_set_vf_vlan_stripq(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, on);\n+}\n+\n+static int\n+i40e_representor_vlan_pvid_set(struct rte_eth_dev *ethdev, uint16_t vlan_id,\n+\t__rte_unused int on)\n+{\n+\tstruct rte_representor_port *representor = ethdev->data->dev_private;\n+\tstruct i40e_representor_private_data *i40e_priv_data =\n+\t\trepresentor->priv_data;\n+\n+\treturn rte_pmd_i40e_set_vf_vlan_insert(\n+\t\ti40e_priv_data->pf_ethdev->data->port_id,\n+\t\trepresentor->vport_id, vlan_id);\n+}\n+\n+struct eth_dev_ops i40e_representor_dev_ops = {\n+\t.link_update          = i40e_representor_link_update,\n+\t.dev_infos_get        = i40e_representor_dev_infos_get,\n+\t.dev_configure        = i40e_representor_dev_configure,\n+\t.rx_queue_setup       = i40e_representor_rx_queue_setup,\n+\t.tx_queue_setup       = i40e_representor_tx_queue_setup,\n+\t.dev_start            = i40e_representor_dev_start,\n+\t.dev_stop             = i40e_representor_dev_stop,\n+\n+\t.stats_get            = i40e_representor_stats_get,\n+\t.stats_reset          = i40e_representor_stats_reset,\n+\n+\t.promiscuous_enable   = i40e_representor_promiscuous_enable,\n+\t.promiscuous_disable  = i40e_representor_promiscuous_disable,\n+\n+\t.allmulticast_enable  = i40e_representor_allmulticast_enable,\n+\t.allmulticast_disable = i40e_representor_allmulticast_disable,\n+\n+\t.mac_addr_remove      = i40e_representor_mac_addr_remove,\n+\t.mac_addr_set         = i40e_representor_mac_addr_set,\n+\n+\t.vlan_filter_set      = i40e_representor_vlan_filter_set,\n+\t.vlan_offload_set     = i40e_representor_vlan_offload_set,\n+\t.vlan_strip_queue_set = i40e_representor_vlan_strip_queue_set,\n+\t.vlan_pvid_set        = i40e_representor_vlan_pvid_set\n+};\n+\n+static uint16_t i40e_representor_rx_burst(__rte_unused void *rxq,\n+\t__rte_unused struct rte_mbuf **rx_pkts,\n+\t__rte_unused uint16_t nb_pkts)\n+{\n+\treturn 0;\n+}\n+\n+static uint16_t i40e_representor_tx_burst(__rte_unused void *txq,\n+\t__rte_unused struct rte_mbuf **tx_pkts,\n+\t__rte_unused uint16_t nb_pkts)\n+{\n+\treturn 0;\n+}\n+\n+static int\n+i40e_port_representor_init(struct rte_representor_broker *broker,\n+\t\tstruct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_eth_dev *pf_ethdev;\n+\tstruct rte_eth_link *link;\n+\tstruct rte_representor_port *port;\n+\tstruct i40e_pf *i40e_pf;\n+\tstruct i40e_pf_vf *i40e_vf;\n+\n+\tport = ethdev->data->dev_private;\n+\n+\t/**\n+\t * Allocate private data for i40e port representor and save the physical\n+\t * functions ethdev handle\n+\t */\n+\tport->priv_data = rte_zmalloc_socket(\"i40e_port_representor_priv_data\",\n+\t\t\tsizeof(struct i40e_representor_private_data),\n+\t\t\tRTE_CACHE_LINE_SIZE, ethdev->device->numa_node);\n+\tif (!port->priv_data)\n+\t\treturn -ENOMEM;\n+\n+\tpf_ethdev = (struct rte_eth_dev *)broker->private_data;\n+\n+\t((struct i40e_representor_private_data *)port->priv_data)->pf_ethdev =\n+\t\t\tpf_ethdev;\n+\n+\n+\ti40e_pf = I40E_DEV_PRIVATE_TO_PF(pf_ethdev->data->dev_private);\n+\ti40e_vf = &i40e_pf->vfs[port->vport_id];\n+\n+\tif (!i40e_vf->vsi) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VSI.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* Set representor device ops */\n+\tethdev->dev_ops = &i40e_representor_dev_ops;\n+\n+\t/* Setting the number queues allocated to the VF */\n+\tethdev->data->nb_rx_queues = i40e_vf->vsi->nb_qps;\n+\tethdev->data->nb_tx_queues = i40e_vf->vsi->nb_qps;\n+\n+\t/* Link state. Inherited from PF */\n+\tlink = &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+\t/* No data-path so no RX/TX functions */\n+\tethdev->rx_pkt_burst = i40e_representor_rx_burst;\n+\tethdev->tx_pkt_burst = i40e_representor_tx_burst;\n+\n+\treturn 0;\n+}\n+\n+static int\n+i40e_port_representor_uninit(struct rte_representor_broker *broker __rte_unused,\n+\t\tstruct rte_eth_dev *ethdev)\n+{\n+\tstruct rte_representor_port *port = ethdev->data->dev_private;\n+\n+\trte_free(port->priv_data);\n+\n+\treturn 0;\n+}\n+\n+struct rte_representor_broker_port_ops i40e_broker_port_ops = {\n+\t.port_init = i40e_port_representor_init,\n+\t.port_uninit = i40e_port_representor_uninit\n+};\n+\n+int\n+i40e_port_representor_broker_init(struct rte_eth_dev *dev,\n+\tstruct rte_representor_broker **broker,\n+\tconst struct rte_pci_device *pci_dev)\n+{\n+\tstruct rte_bus *bus;\n+\n+\t*broker = rte_zmalloc_socket(\"rte_port_representor_broker\",\n+\t\tsizeof(**broker), RTE_CACHE_LINE_SIZE,\n+\t\trte_socket_id());\n+\tif (!*broker) {\n+\t\tRTE_LOG(ERR, EAL, \"Not enough memory for representor \"\n+\t\t\t\"broker\\n\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tbus = rte_bus_find_by_device(&pci_dev->device);\n+\n+\t/* Set i40e broker parameters */\n+\t(*broker)->bus = bus->name;\n+\t(*broker)->device = pci_dev->name;\n+\t(*broker)->nb_virtual_ports = pci_dev->max_vfs;\n+\t(*broker)->ops = &i40e_broker_port_ops;\n+\t(*broker)->private_data = dev;\n+\n+\treturn rte_representor_broker_init(*broker);\n+}\n+\n+int\n+i40e_port_representor_broker_uninit(__rte_unused struct rte_eth_dev *dev,\n+\tstruct rte_representor_broker *broker)\n+{\n+\tint ret;\n+\n+\tret = rte_representor_broker_uninit(broker);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\trte_free(broker);\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/i40e/i40e_port_representor_ops.h b/drivers/net/i40e/i40e_port_representor_ops.h\nnew file mode 100644\nindex 0000000..b7187ee\n--- /dev/null\n+++ b/drivers/net/i40e/i40e_port_representor_ops.h\n@@ -0,0 +1,19 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2017 Intel Corporation.\n+ */\n+\n+#ifndef _I40E_PORT_REPRESENTOR_OPS_H_\n+#define _I40E_PORT_REPRESENTOR_OPS_H_\n+\n+#include <rte_port_representor_driver.h>\n+\n+int\n+i40e_port_representor_broker_init(struct rte_eth_dev *dev,\n+\tstruct rte_representor_broker **broker,\n+\tconst struct rte_pci_device *pci_dev);\n+\n+int\n+i40e_port_representor_broker_uninit(struct rte_eth_dev *dev,\n+\tstruct rte_representor_broker *broker);\n+\n+#endif /* _I40E_PORT_REPRESENTOR_OPS_H_ */\ndiff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c\nindex 947f13b..afe20a8 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.c\n+++ b/drivers/net/i40e/rte_pmd_i40e.c\n@@ -570,6 +570,49 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,\n \treturn 0;\n }\n \n+static const struct ether_addr null_mac_addr;\n+\n+int\n+rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,\n+\tstruct ether_addr *mac_addr)\n+{\n+\tstruct rte_eth_dev *dev;\n+\tstruct i40e_pf_vf *vf;\n+\tstruct i40e_vsi *vsi;\n+\tstruct i40e_pf *pf;\n+\n+\tif (i40e_validate_mac_addr((u8 *)mac_addr) != I40E_SUCCESS)\n+\t\treturn -EINVAL;\n+\n+\tRTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);\n+\n+\tdev = &rte_eth_devices[port];\n+\n+\tif (!is_i40e_supported(dev))\n+\t\treturn -ENOTSUP;\n+\n+\tpf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n+\n+\tif (vf_id >= pf->vf_num || !pf->vfs)\n+\t\treturn -EINVAL;\n+\n+\tvf = &pf->vfs[vf_id];\n+\tvsi = vf->vsi;\n+\tif (!vsi) {\n+\t\tPMD_DRV_LOG(ERR, \"Invalid VSI.\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (is_same_ether_addr(mac_addr, &vf->mac_addr))\n+\t\t/* Reset the mac with NULL address */\n+\t\tether_addr_copy(&null_mac_addr, &vf->mac_addr);\n+\n+\t/* Remove the mac */\n+\ti40e_vsi_delete_mac(vsi, mac_addr);\n+\n+\treturn 0;\n+}\n+\n /* Set vlan strip on/off for specific VF from host */\n int\n rte_pmd_i40e_set_vf_vlan_stripq(uint16_t port, uint16_t vf_id, uint8_t on)\ndiff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h\nindex 7ca37b1..89f4fea 100644\n--- a/drivers/net/i40e/rte_pmd_i40e.h\n+++ b/drivers/net/i40e/rte_pmd_i40e.h\n@@ -439,6 +439,24 @@ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id,\n \t\t\t\t struct ether_addr *mac_addr);\n \n /**\n+ * Remove the VF MAC address.\n+ *\n+ * @param port\n+ *   The port identifier of the Ethernet device.\n+ * @param vf_id\n+ *   VF id.\n+ * @param mac_addr\n+ *   VF MAC address.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENODEV) if *port* invalid.\n+ *   - (-EINVAL) if *vf* or *mac_addr* is invalid.\n+ */\n+int\n+rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id,\n+\tstruct ether_addr *mac_addr);\n+\n+/**\n  * Enable/Disable vf vlan strip for all queues in a pool\n  *\n  * @param port\ndiff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map\nindex ebbd24e..4faff5a 100644\n--- a/drivers/net/i40e/rte_pmd_i40e_version.map\n+++ b/drivers/net/i40e/rte_pmd_i40e_version.map\n@@ -58,3 +58,10 @@ DPDK_17.11 {\n \trte_pmd_i40e_rss_queue_region_conf;\n \n } DPDK_17.08;\n+\n+DPDK_18.02 {\n+\tglobal:\n+\n+\trte_pmd_i40e_remove_vf_mac_addr;\n+\n+}DPDK_17.11;\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "3/5"
    ]
}