get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 63683,
    "url": "http://patches.dpdk.org/api/patches/63683/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191209214656.27347-7-cardigliano@ntop.org/",
    "project": {
        "id": 1,
        "url": "http://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": "<20191209214656.27347-7-cardigliano@ntop.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191209214656.27347-7-cardigliano@ntop.org",
    "date": "2019-12-09T21:46:45",
    "name": "[v3,06/17] net/ionic: add basic lif support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c0c3145b9abc25cbb8ad661081d46b505fc6d2a8",
    "submitter": {
        "id": 1465,
        "url": "http://patches.dpdk.org/api/people/1465/?format=api",
        "name": "Alfredo Cardigliano",
        "email": "cardigliano@ntop.org"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191209214656.27347-7-cardigliano@ntop.org/mbox/",
    "series": [
        {
            "id": 7760,
            "url": "http://patches.dpdk.org/api/series/7760/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=7760",
            "date": "2019-12-09T21:46:39",
            "name": "Introduces net/ionic PMD",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/7760/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/63683/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/63683/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 3CF4DA04B3;\n\tMon,  9 Dec 2019 22:49:41 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B2FFD1BF89;\n\tMon,  9 Dec 2019 22:48:46 +0100 (CET)",
            "from mail.ntop.org (mail-digitalocean.ntop.org [167.99.215.164])\n by dpdk.org (Postfix) with ESMTP id A23555B3C\n for <dev@dpdk.org>; Mon,  9 Dec 2019 22:48:31 +0100 (CET)",
            "from devele.ntop.org (net-93-145-196-230.cust.vodafonedsl.it\n [93.145.196.230])\n by mail.ntop.org (Postfix) with ESMTPSA id 51D9441B68;\n Mon,  9 Dec 2019 22:48:31 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ntop.org; s=mail;\n t=1575928111; bh=RgohIWYV+BM4o/wUecemjvNsGNGFTvnOIJwu0Wn6cOM=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=XQI/MC7PyaMpntjVQHlalHVDxGY5DaSuH1Hyqaf5+5wZRSnpOgXb2p2ROKQ/9Nxqo\n UKRW/h/8eNQnPC0af+azrTek1rOPD7qavKJ/jb7xt7sgQdSW3c1myjbWs3j7XZ2xfO\n lYQxsm9Tjd0MGya9C43SwKkmIhWzTwRLnWKZUQIY=",
        "From": "Alfredo Cardigliano <cardigliano@ntop.org>",
        "To": "Alfredo Cardigliano <cardigliano@ntop.org>,\n Anatoly Burakov <anatoly.burakov@intel.com>",
        "Cc": "dev@dpdk.org",
        "Date": "Mon,  9 Dec 2019 22:46:45 +0100",
        "Message-Id": "<20191209214656.27347-7-cardigliano@ntop.org>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20191209214656.27347-1-cardigliano@ntop.org>",
        "References": "<20191209214656.27347-1-cardigliano@ntop.org>",
        "Subject": "[dpdk-dev] [PATCH v3 06/17] net/ionic: add basic lif support",
        "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://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Initialize LIFs (Logical Interfaces) which represents\nexternal connections. The NIC can multiplex many LIFs\nto a single port, but in most setups, LIF0 is the\nprimary control for the port.\nCreate a device for each LIF.\n\nSigned-off-by: Alfredo Cardigliano <cardigliano@ntop.org>\nReviewed-by: Shannon Nelson <snelson@pensando.io>\n---\n drivers/net/ionic/Makefile       |   4 +\n drivers/net/ionic/ionic.h        |   5 ++\n drivers/net/ionic/ionic_dev.c    |  38 ++++++++\n drivers/net/ionic/ionic_dev.h    |   8 ++\n drivers/net/ionic/ionic_ethdev.c | 122 +++++++++++++++++++++++++-\n drivers/net/ionic/ionic_ethdev.h |  14 +++\n drivers/net/ionic/ionic_lif.c    | 144 +++++++++++++++++++++++++++++++\n drivers/net/ionic/ionic_lif.h    |  48 +++++++++++\n drivers/net/ionic/meson.build    |   4 +-\n 9 files changed, 384 insertions(+), 3 deletions(-)\n create mode 100644 drivers/net/ionic/ionic_ethdev.h\n create mode 100644 drivers/net/ionic/ionic_lif.c\n create mode 100644 drivers/net/ionic/ionic_lif.h",
    "diff": "diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile\nindex a3ad25897..79ec1f922 100644\n--- a/drivers/net/ionic/Makefile\n+++ b/drivers/net/ionic/Makefile\n@@ -8,6 +8,9 @@ include $(RTE_SDK)/mk/rte.vars.mk\n #\n LIB = librte_pmd_ionic.a\n \n+# Required to use rte_eth_dev_create and rte_eth_dev_destroy\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n+\n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS)\n \n@@ -36,6 +39,7 @@ endif\n SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_mac_api.c\n SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_dev.c\n SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c\n+SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_lif.c\n SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_main.c\n \n include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h\nindex a29f0bb89..b6ef63161 100644\n--- a/drivers/net/ionic/ionic.h\n+++ b/drivers/net/ionic/ionic.h\n@@ -49,7 +49,12 @@ struct ionic_adapter {\n \tstruct ionic_dev idev;\n \tstruct ionic_dev_bar bars[IONIC_BARS_MAX];\n \tstruct ionic_identity\tident;\n+\tstruct ionic_lif *lifs[IONIC_LIFS_MAX];\n \tuint32_t num_bars;\n+\tuint32_t nlifs;\n+\tuint32_t max_ntxqs_per_lif;\n+\tuint32_t max_nrxqs_per_lif;\n+\tuint32_t nintrs;\n \tbool is_mgmt_nic;\n \tstruct rte_pci_device *pci_dev;\n \tLIST_ENTRY(ionic_adapter) pci_adapters;\ndiff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c\nindex 0da5a43a3..841e0837f 100644\n--- a/drivers/net/ionic/ionic_dev.c\n+++ b/drivers/net/ionic/ionic_dev.c\n@@ -259,3 +259,41 @@ ionic_dev_cmd_port_loopback(struct ionic_dev *idev, uint8_t loopback_mode)\n \n \tionic_dev_cmd_go(idev, &cmd);\n }\n+\n+/* LIF commands */\n+\n+void\n+ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type, uint8_t ver)\n+{\n+\tunion ionic_dev_cmd cmd = {\n+\t\t.lif_identify.opcode = IONIC_CMD_LIF_IDENTIFY,\n+\t\t.lif_identify.type = type,\n+\t\t.lif_identify.ver = ver,\n+\t};\n+\n+\tionic_dev_cmd_go(idev, &cmd);\n+}\n+\n+void\n+ionic_dev_cmd_lif_init(struct ionic_dev *idev, uint16_t lif_index,\n+\t\t       rte_iova_t info_pa)\n+{\n+\tunion ionic_dev_cmd cmd = {\n+\t\t.lif_init.opcode = IONIC_CMD_LIF_INIT,\n+\t\t.lif_init.index = lif_index,\n+\t\t.lif_init.info_pa = info_pa,\n+\t};\n+\n+\tionic_dev_cmd_go(idev, &cmd);\n+}\n+\n+void\n+ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index)\n+{\n+\tunion ionic_dev_cmd cmd = {\n+\t\t.lif_init.opcode = IONIC_CMD_LIF_RESET,\n+\t\t.lif_init.index = lif_index,\n+\t};\n+\n+\tionic_dev_cmd_go(idev, &cmd);\n+}\ndiff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h\nindex 75c50d4cb..afcfcbf56 100644\n--- a/drivers/net/ionic/ionic_dev.h\n+++ b/drivers/net/ionic/ionic_dev.h\n@@ -9,6 +9,8 @@\n #include \"ionic_if.h\"\n #include \"ionic_regs.h\"\n \n+#define IONIC_LIFS_MAX\t\t\t1024\n+\n #define IONIC_DEVCMD_TIMEOUT\t30 /* devcmd_timeout */\n #define\tIONIC_ALIGN             4096\n \n@@ -142,4 +144,10 @@ void ionic_dev_cmd_port_pause(struct ionic_dev *idev, uint8_t pause_type);\n void ionic_dev_cmd_port_loopback(struct ionic_dev *idev,\n \tuint8_t loopback_mode);\n \n+void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type,\n+\tuint8_t ver);\n+void ionic_dev_cmd_lif_init(struct ionic_dev *idev, uint16_t lif_index,\n+\trte_iova_t addr);\n+void ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index);\n+\n #endif /* _IONIC_DEV_H_ */\ndiff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c\nindex a182beef8..a24f6f1d9 100644\n--- a/drivers/net/ionic/ionic_ethdev.c\n+++ b/drivers/net/ionic/ionic_ethdev.c\n@@ -7,11 +7,17 @@\n #include <rte_ethdev.h>\n #include <rte_ethdev_driver.h>\n #include <rte_malloc.h>\n+#include <rte_ethdev_pci.h>\n \n #include \"ionic_logs.h\"\n #include \"ionic.h\"\n #include \"ionic_dev.h\"\n #include \"ionic_mac_api.h\"\n+#include \"ionic_lif.h\"\n+#include \"ionic_ethdev.h\"\n+\n+static int  eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params);\n+static int  eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev);\n \n int ionic_logtype_driver;\n \n@@ -22,6 +28,9 @@ static const struct rte_pci_id pci_id_ionic_map[] = {\n \t{ .vendor_id = 0, /* sentinel */ },\n };\n \n+static const struct eth_dev_ops ionic_eth_dev_ops = {\n+};\n+\n /*\n  * There is no room in struct rte_pci_driver to keep a reference\n  * to the adapter, using a static list for the time being.\n@@ -30,10 +39,78 @@ static LIST_HEAD(ionic_pci_adapters_list, ionic_adapter) ionic_pci_adapters =\n \t\tLIST_HEAD_INITIALIZER(ionic_pci_adapters);\n static rte_spinlock_t ionic_pci_adapters_lock = RTE_SPINLOCK_INITIALIZER;\n \n+static int\n+eth_ionic_dev_init(struct rte_eth_dev *eth_dev, void *init_params)\n+{\n+\tstruct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n+\tstruct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);\n+\tstruct ionic_adapter *adapter = (struct ionic_adapter *)init_params;\n+\tint err;\n+\n+\tIONIC_PRINT_CALL();\n+\n+\teth_dev->dev_ops = &ionic_eth_dev_ops;\n+\n+\t/* Multi-process not supported, primary does initialization anyway */\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn 0;\n+\n+\trte_eth_copy_pci_info(eth_dev, pci_dev);\n+\n+\tlif->index = adapter->nlifs;\n+\tlif->eth_dev = eth_dev;\n+\tlif->adapter = adapter;\n+\tadapter->lifs[adapter->nlifs] = lif;\n+\n+\terr = ionic_lif_alloc(lif);\n+\n+\tif (err) {\n+\t\tIONIC_PRINT(ERR, \"Cannot allocate LIFs: %d, aborting\",\n+\t\t\terr);\n+\t\tgoto err;\n+\t}\n+\n+\terr = ionic_lif_init(lif);\n+\n+\tif (err) {\n+\t\tIONIC_PRINT(ERR, \"Cannot init LIFs: %d, aborting\", err);\n+\t\tgoto err_free_lif;\n+\t}\n+\n+\tIONIC_PRINT(DEBUG, \"Port %u initialized\", eth_dev->data->port_id);\n+\n+err_free_lif:\n+\tionic_lif_free(lif);\n+err:\n+\treturn 0;\n+}\n+\n+static int\n+eth_ionic_dev_uninit(struct rte_eth_dev *eth_dev)\n+{\n+\tstruct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);\n+\tstruct ionic_adapter *adapter = lif->adapter;\n+\n+\tIONIC_PRINT_CALL();\n+\n+\tif (rte_eal_process_type() != RTE_PROC_PRIMARY)\n+\t\treturn 0;\n+\n+\tadapter->lifs[lif->index] = NULL;\n+\n+\tionic_lif_deinit(lif);\n+\tionic_lif_free(lif);\n+\n+\teth_dev->dev_ops = NULL;\n+\n+\treturn 0;\n+}\n+\n static int\n eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tstruct rte_pci_device *pci_dev)\n {\n+\tchar name[RTE_ETH_NAME_MAX_LEN];\n \tstruct rte_mem_resource *resource;\n \tstruct ionic_adapter *adapter;\n \tstruct ionic_hw *hw;\n@@ -123,6 +200,41 @@ eth_ionic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,\n \t\tgoto err_free_adapter;\n \t}\n \n+\t/* Configure LIFs */\n+\terr = ionic_lif_identify(adapter);\n+\n+\tif (err) {\n+\t\tIONIC_PRINT(ERR, \"Cannot identify lif: %d, aborting\", err);\n+\t\tgoto err_free_adapter;\n+\t}\n+\n+\t/* Allocate and init LIFs */\n+\terr = ionic_lifs_size(adapter);\n+\n+\tif (err) {\n+\t\tIONIC_PRINT(ERR, \"Cannot size LIFs: %d, aborting\", err);\n+\t\tgoto err_free_adapter;\n+\t}\n+\n+\tadapter->nlifs = 0;\n+\tfor (i = 0; i < adapter->ident.dev.nlifs; i++) {\n+\t\tsnprintf(name, sizeof(name), \"net_%s_lif_%lu\",\n+\t\t\tpci_dev->device.name, i);\n+\n+\t\terr = rte_eth_dev_create(&pci_dev->device, name,\n+\t\t\tsizeof(struct ionic_lif),\n+\t\t\tNULL, NULL,\n+\t\t\teth_ionic_dev_init, adapter);\n+\n+\t\tif (err) {\n+\t\t\tIONIC_PRINT(ERR, \"Cannot create eth device for \"\n+\t\t\t\t\"ionic lif %s\", name);\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tadapter->nlifs++;\n+\t}\n+\n \trte_spinlock_lock(&ionic_pci_adapters_lock);\n \tLIST_INSERT_HEAD(&ionic_pci_adapters, adapter, pci_adapters);\n \trte_spinlock_unlock(&ionic_pci_adapters_lock);\n@@ -139,6 +251,8 @@ static int\n eth_ionic_pci_remove(struct rte_pci_device *pci_dev)\n {\n \tstruct ionic_adapter *adapter = NULL;\n+\tstruct ionic_lif *lif;\n+\tuint32_t i;\n \n \trte_spinlock_lock(&ionic_pci_adapters_lock);\n \tLIST_FOREACH(adapter, &ionic_pci_adapters, pci_adapters) {\n@@ -151,8 +265,14 @@ eth_ionic_pci_remove(struct rte_pci_device *pci_dev)\n \t\tLIST_REMOVE(adapter, pci_adapters);\n \trte_spinlock_unlock(&ionic_pci_adapters_lock);\n \n-\tif (adapter)\n+\tif (adapter) {\n+\t\tfor (i = 0; i < adapter->nlifs; i++) {\n+\t\t\tlif = adapter->lifs[i];\n+\t\t\trte_eth_dev_destroy(lif->eth_dev, eth_ionic_dev_uninit);\n+\t\t}\n+\n \t\trte_free(adapter);\n+\t}\n \n \treturn 0;\n }\ndiff --git a/drivers/net/ionic/ionic_ethdev.h b/drivers/net/ionic/ionic_ethdev.h\nnew file mode 100644\nindex 000000000..7228d8969\n--- /dev/null\n+++ b/drivers/net/ionic/ionic_ethdev.h\n@@ -0,0 +1,14 @@\n+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)\n+ * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.\n+ */\n+\n+#ifndef _IONIC_ETHDEV_H_\n+#define _IONIC_ETHDEV_H_\n+\n+#define IONIC_ETH_DEV_TO_LIF(eth_dev) ((struct ionic_lif *) \\\n+\t(eth_dev)->data->dev_private)\n+#define IONIC_ETH_DEV_TO_ADAPTER(eth_dev) \\\n+\t(IONIC_ETH_DEV_TO_LIF(eth_dev)->adapter)\n+\n+#endif /* _IONIC_ETHDEV_H_ */\n+\ndiff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c\nnew file mode 100644\nindex 000000000..d02dc05c9\n--- /dev/null\n+++ b/drivers/net/ionic/ionic_lif.c\n@@ -0,0 +1,144 @@\n+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)\n+ * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.\n+ */\n+\n+#include <rte_malloc.h>\n+#include <rte_ethdev_driver.h>\n+\n+#include \"ionic.h\"\n+#include \"ionic_logs.h\"\n+#include \"ionic_lif.h\"\n+#include \"ionic_ethdev.h\"\n+\n+int\n+ionic_lif_alloc(struct ionic_lif *lif)\n+{\n+\tuint32_t socket_id = rte_socket_id();\n+\n+\tsnprintf(lif->name, sizeof(lif->name), \"lif%u\", lif->index);\n+\n+\tIONIC_PRINT(DEBUG, \"Allocating Lif Info\");\n+\n+\tlif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);\n+\n+\tlif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,\n+\t\t\"lif_info\", 0 /* queue_idx*/,\n+\t\tlif->info_sz, IONIC_ALIGN, socket_id);\n+\n+\tif (!lif->info_z) {\n+\t\tIONIC_PRINT(ERR, \"Cannot allocate lif info memory\");\n+\t\treturn -ENOMEM;\n+\t}\n+\n+\tlif->info = lif->info_z->addr;\n+\tlif->info_pa = lif->info_z->iova;\n+\n+\treturn 0;\n+}\n+\n+void\n+ionic_lif_free(struct ionic_lif *lif)\n+{\n+\tif (lif->info) {\n+\t\trte_memzone_free(lif->info_z);\n+\t\tlif->info = NULL;\n+\t}\n+}\n+\n+int\n+ionic_lif_init(struct ionic_lif *lif)\n+{\n+\tstruct ionic_dev *idev = &lif->adapter->idev;\n+\tstruct ionic_q_init_comp comp;\n+\tint err;\n+\n+\tionic_dev_cmd_lif_init(idev, lif->index, lif->info_pa);\n+\terr = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);\n+\tionic_dev_cmd_comp(idev, &comp);\n+\tif (err)\n+\t\treturn err;\n+\n+\tlif->hw_index = comp.hw_index;\n+\n+\tlif->state |= IONIC_LIF_F_INITED;\n+\n+\treturn 0;\n+}\n+\n+void\n+ionic_lif_deinit(struct ionic_lif *lif)\n+{\n+\tif (!(lif->state & IONIC_LIF_F_INITED))\n+\t\treturn;\n+\n+\tlif->state &= ~IONIC_LIF_F_INITED;\n+}\n+\n+int\n+ionic_lif_identify(struct ionic_adapter *adapter)\n+{\n+\tstruct ionic_dev *idev = &adapter->idev;\n+\tstruct ionic_identity *ident = &adapter->ident;\n+\tint err;\n+\tunsigned int i;\n+\tunsigned int lif_words = sizeof(ident->lif.words) /\n+\t\tsizeof(ident->lif.words[0]);\n+\tunsigned int cmd_words = sizeof(idev->dev_cmd->data) /\n+\t\tsizeof(idev->dev_cmd->data[0]);\n+\tunsigned int nwords;\n+\n+\tionic_dev_cmd_lif_identify(idev, IONIC_LIF_TYPE_CLASSIC,\n+\t\tIONIC_IDENTITY_VERSION_1);\n+\terr = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT);\n+\tif (err)\n+\t\treturn (err);\n+\n+\tnwords = RTE_MIN(lif_words, cmd_words);\n+\tfor (i = 0; i < nwords; i++)\n+\t\tident->lif.words[i] = ioread32(&idev->dev_cmd->data[i]);\n+\n+\tIONIC_PRINT(INFO, \"capabilities 0x%lx \", ident->lif.capabilities);\n+\n+\tIONIC_PRINT(INFO, \"eth.max_ucast_filters 0x%x \",\n+\t\tident->lif.eth.max_ucast_filters);\n+\tIONIC_PRINT(INFO, \"eth.max_mcast_filters 0x%x \",\n+\t\tident->lif.eth.max_mcast_filters);\n+\n+\tIONIC_PRINT(INFO, \"eth.features 0x%lx \",\n+\t\tident->lif.eth.config.features);\n+\tIONIC_PRINT(INFO, \"eth.queue_count[IONIC_QTYPE_ADMINQ] 0x%x \",\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_ADMINQ]);\n+\tIONIC_PRINT(INFO, \"eth.queue_count[IONIC_QTYPE_NOTIFYQ] 0x%x \",\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_NOTIFYQ]);\n+\tIONIC_PRINT(INFO, \"eth.queue_count[IONIC_QTYPE_RXQ] 0x%x \",\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_RXQ]);\n+\tIONIC_PRINT(INFO, \"eth.queue_count[IONIC_QTYPE_TXQ] 0x%x \",\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ]);\n+\n+\treturn 0;\n+}\n+\n+int\n+ionic_lifs_size(struct ionic_adapter *adapter)\n+{\n+\tstruct ionic_identity *ident = &adapter->ident;\n+\tuint32_t nlifs = ident->dev.nlifs;\n+\tuint32_t nintrs, dev_nintrs = ident->dev.nintrs;\n+\n+\tadapter->max_ntxqs_per_lif =\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ];\n+\tadapter->max_nrxqs_per_lif =\n+\t\tident->lif.eth.config.queue_count[IONIC_QTYPE_RXQ];\n+\n+\tnintrs = nlifs * 1 /* notifyq */;\n+\n+\tif (nintrs > dev_nintrs) {\n+\t\tIONIC_PRINT(ERR, \"At most %d intr queues supported, minimum required is %u\",\n+\t\t\tdev_nintrs, nintrs);\n+\t\treturn -ENOSPC;\n+\t}\n+\n+\tadapter->nintrs = nintrs;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h\nnew file mode 100644\nindex 000000000..49bceaccf\n--- /dev/null\n+++ b/drivers/net/ionic/ionic_lif.h\n@@ -0,0 +1,48 @@\n+/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)\n+ * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.\n+ */\n+\n+#ifndef _IONIC_LIF_H_\n+#define _IONIC_LIF_H_\n+\n+#include <inttypes.h>\n+\n+#include <rte_ethdev.h>\n+#include <rte_ether.h>\n+\n+#include \"ionic_osdep.h\"\n+#include \"ionic_dev.h\"\n+\n+#define IONIC_LIF_F_INITED\t\tBIT(0)\n+\n+#define IONIC_LIF_NAME_MAX_SZ\t\t(32)\n+\n+struct ionic_lif {\n+\tstruct ionic_adapter *adapter;\n+\tstruct rte_eth_dev *eth_dev;\n+\tuint16_t port_id;  /**< Device port identifier */\n+\tuint32_t index;\n+\tuint32_t hw_index;\n+\tchar name[IONIC_LIF_NAME_MAX_SZ];\n+\tuint32_t state;\n+\tuint32_t info_sz;\n+\tstruct ionic_lif_info *info;\n+\trte_iova_t info_pa;\n+\tconst struct rte_memzone *info_z;\n+};\n+\n+int ionic_lif_identify(struct ionic_adapter *adapter);\n+int ionic_lifs_size(struct ionic_adapter *ionic);\n+\n+int ionic_lif_alloc(struct ionic_lif *lif);\n+void ionic_lif_free(struct ionic_lif *lif);\n+\n+int ionic_lif_init(struct ionic_lif *lif);\n+void ionic_lif_deinit(struct ionic_lif *lif);\n+\n+int ionic_lif_start(struct ionic_lif *lif);\n+\n+int ionic_lif_configure(struct ionic_lif *lif);\n+void ionic_lif_reset(struct ionic_lif *lif);\n+\n+#endif /* _IONIC_LIF_H_ */\ndiff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build\nindex 8de34ca5a..f28016105 100644\n--- a/drivers/net/ionic/meson.build\n+++ b/drivers/net/ionic/meson.build\n@@ -5,7 +5,7 @@ sources = files(\n \t'ionic_mac_api.c',\n \t'ionic_dev.c',\n \t'ionic_ethdev.c',\n-\t'ionic_main.c',\n-\t'ionic_ethdev.c'\n+\t'ionic_lif.c',\n+\t'ionic_main.c'\n )\n \n",
    "prefixes": [
        "v3",
        "06/17"
    ]
}