get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 23539,
    "url": "http://patches.dpdk.org/api/patches/23539/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/52365cd9f773e84eefadbf783a746594d3e77a74.1491924900.git.gaetan.rivet@6wind.com/",
    "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": "<52365cd9f773e84eefadbf783a746594d3e77a74.1491924900.git.gaetan.rivet@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/52365cd9f773e84eefadbf783a746594d3e77a74.1491924900.git.gaetan.rivet@6wind.com",
    "date": "2017-04-11T15:44:19",
    "name": "[dpdk-dev,v2,12/42] net/bonding: make bonding API call through EAL on create/free",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "6a315223c5dc2e6686b97b70ff8eaad07d09295d",
    "submitter": {
        "id": 269,
        "url": "http://patches.dpdk.org/api/people/269/?format=api",
        "name": "Gaëtan Rivet",
        "email": "gaetan.rivet@6wind.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/52365cd9f773e84eefadbf783a746594d3e77a74.1491924900.git.gaetan.rivet@6wind.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/23539/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/23539/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 8EC80D373;\n\tTue, 11 Apr 2017 17:45:40 +0200 (CEST)",
            "from mail-wr0-f180.google.com (mail-wr0-f180.google.com\n\t[209.85.128.180]) by dpdk.org (Postfix) with ESMTP id 80269D267\n\tfor <dev@dpdk.org>; Tue, 11 Apr 2017 17:45:16 +0200 (CEST)",
            "by mail-wr0-f180.google.com with SMTP id l28so750467wre.0\n\tfor <dev@dpdk.org>; Tue, 11 Apr 2017 08:45:16 -0700 (PDT)",
            "from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\tu63sm2933738wmu.22.2017.04.11.08.45.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 11 Apr 2017 08:45:15 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:in-reply-to:references;\n\tbh=G3tu00YGZ+uE31/psQ/iPIaGH8qkP5p2t++wwf4AoQY=;\n\tb=eHUGN2ukvoxibXjBlTx645Dc/TYkiGRrW/NaiW2bR5dl0zYu7wcXG0BVS44XxAqz2Q\n\tPEGsh2cHCi2veJMNQsNxc6Q+mz0Dc5ekDsH5gfrA1VglDhl2yd3uT8+RF9Xi4SP711bG\n\t/tQCbfvHejbrm7JE3+sOqgp1LSekN+pCwV3tfvcZjGLHm1UjZ6mX8WbIHomfPUfy2Ejo\n\tqsBQG9asm1UW0GLGM0Iz9uOmxb7im2TLnESx2BDsCqH+XtAGybwG9nvBZ/Tgd2QBDdkj\n\tfAQ/8U4LdGkgv2xt9zwX8R4rcUNAE6lsqfmR8CRVDIK0AurggWQ3vTcwn8EI6r3EKaIt\n\tgX5A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:in-reply-to:references;\n\tbh=G3tu00YGZ+uE31/psQ/iPIaGH8qkP5p2t++wwf4AoQY=;\n\tb=p0zncm1C8Mt4LpCI9YgTpvJeXU7F203aOfx5Rma/NgSf6aO6ltAmMfQIR93+9nEFcV\n\thR9dFzv6HuJgtVp1LFRjOH93U2uy/i7+B+1AAP5SgeNggaO4v9/WCMJncQiMfV6wHmvx\n\tNCtfCsq2Wj3Aa92M4AxB7KV4KiS8TB/Iykoab2dxIyXO9G10iV1zXIiayXTTMU70ID20\n\tMwwKv7Ew/yTLzrI12MuxODTSvitcNoE91GzpVRQDpjng5HypLPnFg6ow3tnGII7R9QCB\n\tvACxcbgVLMHBagsVWl5UbzIXG+M/Ft12NUF2CEzRbK8vbInaYyXaAIkCIYozJUJY/xQb\n\tq+7Q==",
        "X-Gm-Message-State": "AFeK/H2Nl0GyW9J+ql6LqUoXFRTCBxwhUs+8Z99F15+L0u/q4bComBTaI6ENzO2pry5SoyDo",
        "X-Received": "by 10.223.176.11 with SMTP id f11mr32182932wra.158.1491925516143;\n\tTue, 11 Apr 2017 08:45:16 -0700 (PDT)",
        "From": "Gaetan Rivet <gaetan.rivet@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jan Blunck <jblunck@infradead.org>",
        "Date": "Tue, 11 Apr 2017 17:44:19 +0200",
        "Message-Id": "<52365cd9f773e84eefadbf783a746594d3e77a74.1491924900.git.gaetan.rivet@6wind.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": [
            "<cover.1491924900.git.gaetan.rivet@6wind.com>",
            "<cover.1491924900.git.gaetan.rivet@6wind.com>"
        ],
        "References": [
            "<1488794430-25179-1-git-send-email-jblunck@infradead.org>\n\t<cover.1491924900.git.gaetan.rivet@6wind.com>",
            "<cover.1491924900.git.gaetan.rivet@6wind.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v2 12/42] net/bonding: make bonding API call\n\tthrough EAL on create/free",
        "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": "From: Jan Blunck <jblunck@infradead.org>\n\nTo properly embed the generic rte_device into the rte_eth_dev this reworks\nthe bonding API to call through rte_eal_vdev_init().\n\nSigned-off-by: Jan Blunck <jblunck@infradead.org>\n---\n drivers/net/bonding/rte_eth_bond_api.c  | 171 +++++--------------------------\n drivers/net/bonding/rte_eth_bond_args.c |   2 +-\n drivers/net/bonding/rte_eth_bond_pmd.c  | 174 ++++++++++++++++++++++++++++++--\n 3 files changed, 194 insertions(+), 153 deletions(-)",
    "diff": "diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c\nindex f552d96..80c7091 100644\n--- a/drivers/net/bonding/rte_eth_bond_api.c\n+++ b/drivers/net/bonding/rte_eth_bond_api.c\n@@ -38,13 +38,12 @@\n #include <rte_ethdev.h>\n #include <rte_tcp.h>\n #include <rte_vdev.h>\n+#include <rte_kvargs.h>\n \n #include \"rte_eth_bond.h\"\n #include \"rte_eth_bond_private.h\"\n #include \"rte_eth_bond_8023ad_private.h\"\n \n-#define DEFAULT_POLLING_INTERVAL_10_MS (10)\n-\n int\n check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev)\n {\n@@ -163,163 +162,45 @@ number_of_sockets(void)\n int\n rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)\n {\n-\tstruct bond_dev_private *internals = NULL;\n-\tstruct rte_eth_dev *eth_dev = NULL;\n-\tuint32_t vlan_filter_bmp_size;\n-\n-\t/* now do all data allocation - for eth_dev structure, dummy pci driver\n-\t * and internal (private) data\n-\t */\n+\tstruct bond_dev_private *internals;\n+\tchar devargs[52];\n+\tuint8_t port_id;\n+\tint ret;\n \n \tif (name == NULL) {\n \t\tRTE_BOND_LOG(ERR, \"Invalid name specified\");\n-\t\tgoto err;\n-\t}\n-\n-\tif (socket_id >= number_of_sockets()) {\n-\t\tRTE_BOND_LOG(ERR,\n-\t\t\t\t\"Invalid socket id specified to create bonded device on.\");\n-\t\tgoto err;\n+\t\treturn -EINVAL;\n \t}\n \n-\tinternals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);\n-\tif (internals == NULL) {\n-\t\tRTE_BOND_LOG(ERR, \"Unable to malloc internals on socket\");\n-\t\tgoto err;\n-\t}\n+\tret = snprintf(devargs, sizeof(devargs),\n+\t\t\"driver=net_bonding,mode=%d,socket_id=%d\", mode, socket_id);\n+\tif (ret < 0 || ret >= (int)sizeof(devargs))\n+\t\treturn -ENOMEM;\n \n-\t/* reserve an ethdev entry */\n-\teth_dev = rte_eth_dev_allocate(name);\n-\tif (eth_dev == NULL) {\n-\t\tRTE_BOND_LOG(ERR, \"Unable to allocate rte_eth_dev\");\n-\t\tgoto err;\n-\t}\n+\tret = rte_eal_vdev_init(name, devargs);\n+\tif (ret)\n+\t\treturn -ENOMEM;\n \n-\teth_dev->data->dev_private = internals;\n-\teth_dev->data->nb_rx_queues = (uint16_t)1;\n-\teth_dev->data->nb_tx_queues = (uint16_t)1;\n-\n-\teth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,\n-\t\t\tsocket_id);\n-\tif (eth_dev->data->mac_addrs == NULL) {\n-\t\tRTE_BOND_LOG(ERR, \"Unable to malloc mac_addrs\");\n-\t\tgoto err;\n-\t}\n-\n-\teth_dev->dev_ops = &default_dev_ops;\n-\teth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |\n-\t\tRTE_ETH_DEV_DETACHABLE;\n-\teth_dev->driver = NULL;\n-\teth_dev->data->kdrv = RTE_KDRV_NONE;\n-\teth_dev->data->drv_name = pmd_bond_drv.driver.name;\n-\teth_dev->data->numa_node =  socket_id;\n-\n-\trte_spinlock_init(&internals->lock);\n-\n-\tinternals->port_id = eth_dev->data->port_id;\n-\tinternals->mode = BONDING_MODE_INVALID;\n-\tinternals->current_primary_port = RTE_MAX_ETHPORTS + 1;\n-\tinternals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;\n-\tinternals->xmit_hash = xmit_l2_hash;\n-\tinternals->user_defined_mac = 0;\n-\tinternals->link_props_set = 0;\n-\n-\tinternals->link_status_polling_enabled = 0;\n-\n-\tinternals->link_status_polling_interval_ms = DEFAULT_POLLING_INTERVAL_10_MS;\n-\tinternals->link_down_delay_ms = 0;\n-\tinternals->link_up_delay_ms = 0;\n-\n-\tinternals->slave_count = 0;\n-\tinternals->active_slave_count = 0;\n-\tinternals->rx_offload_capa = 0;\n-\tinternals->tx_offload_capa = 0;\n-\tinternals->candidate_max_rx_pktlen = 0;\n-\tinternals->max_rx_pktlen = 0;\n-\n-\t/* Initially allow to choose any offload type */\n-\tinternals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;\n-\n-\tmemset(internals->active_slaves, 0, sizeof(internals->active_slaves));\n-\tmemset(internals->slaves, 0, sizeof(internals->slaves));\n-\n-\t/* Set mode 4 default configuration */\n-\tbond_mode_8023ad_setup(eth_dev, NULL);\n-\tif (bond_ethdev_mode_set(eth_dev, mode)) {\n-\t\tRTE_BOND_LOG(ERR, \"Failed to set bonded device %d mode too %d\",\n-\t\t\t\t eth_dev->data->port_id, mode);\n-\t\tgoto err;\n-\t}\n+\tret = rte_eth_dev_get_port_by_name(name, &port_id);\n+\tRTE_ASSERT(!ret);\n \n-\tvlan_filter_bmp_size =\n-\t\trte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1);\n-\tinternals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size,\n-\t\t\t\t\t\t   RTE_CACHE_LINE_SIZE);\n-\tif (internals->vlan_filter_bmpmem == NULL) {\n-\t\tRTE_BOND_LOG(ERR,\n-\t\t\t     \"Failed to allocate vlan bitmap for bonded device %u\\n\",\n-\t\t\t     eth_dev->data->port_id);\n-\t\tgoto err;\n-\t}\n-\n-\tinternals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1,\n-\t\t\tinternals->vlan_filter_bmpmem, vlan_filter_bmp_size);\n-\tif (internals->vlan_filter_bmp == NULL) {\n-\t\tRTE_BOND_LOG(ERR,\n-\t\t\t     \"Failed to init vlan bitmap for bonded device %u\\n\",\n-\t\t\t     eth_dev->data->port_id);\n-\t\trte_free(internals->vlan_filter_bmpmem);\n-\t\tgoto err;\n-\t}\n-\n-\treturn eth_dev->data->port_id;\n+\t/*\n+\t * To make bond_ethdev_configure() happy we need to free the\n+\t * internals->kvlist here.\n+\t *\n+\t * Also see comment in bond_ethdev_configure().\n+\t */\n+\tinternals = rte_eth_devices[port_id].data->dev_private;\n+\trte_kvargs_free(internals->kvlist);\n+\tinternals->kvlist = NULL;\n \n-err:\n-\trte_free(internals);\n-\tif (eth_dev != NULL) {\n-\t\trte_free(eth_dev->data->mac_addrs);\n-\t\trte_eth_dev_release_port(eth_dev);\n-\t}\n-\treturn -1;\n+\treturn port_id;\n }\n \n int\n rte_eth_bond_free(const char *name)\n {\n-\tstruct rte_eth_dev *eth_dev = NULL;\n-\tstruct bond_dev_private *internals;\n-\n-\t/* now free all data allocation - for eth_dev structure,\n-\t * dummy pci driver and internal (private) data\n-\t */\n-\n-\t/* find an ethdev entry */\n-\teth_dev = rte_eth_dev_allocated(name);\n-\tif (eth_dev == NULL)\n-\t\treturn -ENODEV;\n-\n-\tinternals = eth_dev->data->dev_private;\n-\tif (internals->slave_count != 0)\n-\t\treturn -EBUSY;\n-\n-\tif (eth_dev->data->dev_started == 1) {\n-\t\tbond_ethdev_stop(eth_dev);\n-\t\tbond_ethdev_close(eth_dev);\n-\t}\n-\n-\teth_dev->dev_ops = NULL;\n-\teth_dev->rx_pkt_burst = NULL;\n-\teth_dev->tx_pkt_burst = NULL;\n-\n-\tinternals = eth_dev->data->dev_private;\n-\trte_bitmap_free(internals->vlan_filter_bmp);\n-\trte_free(internals->vlan_filter_bmpmem);\n-\trte_free(eth_dev->data->dev_private);\n-\trte_free(eth_dev->data->mac_addrs);\n-\n-\trte_eth_dev_release_port(eth_dev);\n-\n-\treturn 0;\n+\treturn rte_eal_vdev_uninit(name);\n }\n \n static int\ndiff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c\nindex 3dca273..e3bdad9 100644\n--- a/drivers/net/bonding/rte_eth_bond_args.c\n+++ b/drivers/net/bonding/rte_eth_bond_args.c\n@@ -47,7 +47,7 @@ const char *pmd_bond_init_valid_arguments[] = {\n \tPMD_BOND_XMIT_POLICY_KVARG,\n \tPMD_BOND_SOCKET_ID_KVARG,\n \tPMD_BOND_MAC_ADDR_KVARG,\n-\n+\t\"driver\",\n \tNULL\n };\n \ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex 340d793..2b1db0b 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -51,6 +51,7 @@\n #include \"rte_eth_bond_8023ad_private.h\"\n \n #define REORDER_PERIOD_MS 10\n+#define DEFAULT_POLLING_INTERVAL_10_MS (10)\n \n #define HASH_L4_PORTS(h) ((h)->src_port ^ (h)->dst_port)\n \n@@ -2240,6 +2241,132 @@ const struct eth_dev_ops default_dev_ops = {\n };\n \n static int\n+bond_alloc(struct rte_vdev_device *dev, uint8_t mode)\n+{\n+\tconst char *name = rte_vdev_device_name(dev);\n+\tuint8_t socket_id = dev->device.numa_node;\n+\tstruct bond_dev_private *internals = NULL;\n+\tstruct rte_eth_dev *eth_dev = NULL;\n+\tuint32_t vlan_filter_bmp_size;\n+\n+\t/* now do all data allocation - for eth_dev structure, dummy pci driver\n+\t * and internal (private) data\n+\t */\n+\n+\tif (name == NULL) {\n+\t\tRTE_BOND_LOG(ERR, \"Invalid name specified\");\n+\t\tgoto err;\n+\t}\n+\n+\tif (socket_id >= number_of_sockets()) {\n+\t\tRTE_BOND_LOG(ERR,\n+\t\t\t\t\"Invalid socket id specified to create bonded device on.\");\n+\t\tgoto err;\n+\t}\n+\n+\tinternals = rte_zmalloc_socket(name, sizeof(*internals), 0, socket_id);\n+\tif (internals == NULL) {\n+\t\tRTE_BOND_LOG(ERR, \"Unable to malloc internals on socket\");\n+\t\tgoto err;\n+\t}\n+\n+\t/* reserve an ethdev entry */\n+\teth_dev = rte_eth_dev_allocate(name);\n+\tif (eth_dev == NULL) {\n+\t\tRTE_BOND_LOG(ERR, \"Unable to allocate rte_eth_dev\");\n+\t\tgoto err;\n+\t}\n+\n+\teth_dev->data->dev_private = internals;\n+\teth_dev->data->nb_rx_queues = (uint16_t)1;\n+\teth_dev->data->nb_tx_queues = (uint16_t)1;\n+\n+\teth_dev->data->mac_addrs = rte_zmalloc_socket(name, ETHER_ADDR_LEN, 0,\n+\t\t\tsocket_id);\n+\tif (eth_dev->data->mac_addrs == NULL) {\n+\t\tRTE_BOND_LOG(ERR, \"Unable to malloc mac_addrs\");\n+\t\tgoto err;\n+\t}\n+\n+\teth_dev->dev_ops = &default_dev_ops;\n+\teth_dev->data->dev_flags = RTE_ETH_DEV_INTR_LSC |\n+\t\tRTE_ETH_DEV_DETACHABLE;\n+\teth_dev->driver = NULL;\n+\teth_dev->data->kdrv = RTE_KDRV_NONE;\n+\teth_dev->data->drv_name = pmd_bond_drv.driver.name;\n+\teth_dev->data->numa_node =  socket_id;\n+\n+\trte_spinlock_init(&internals->lock);\n+\n+\tinternals->port_id = eth_dev->data->port_id;\n+\tinternals->mode = BONDING_MODE_INVALID;\n+\tinternals->current_primary_port = RTE_MAX_ETHPORTS + 1;\n+\tinternals->balance_xmit_policy = BALANCE_XMIT_POLICY_LAYER2;\n+\tinternals->xmit_hash = xmit_l2_hash;\n+\tinternals->user_defined_mac = 0;\n+\tinternals->link_props_set = 0;\n+\n+\tinternals->link_status_polling_enabled = 0;\n+\n+\tinternals->link_status_polling_interval_ms =\n+\t\tDEFAULT_POLLING_INTERVAL_10_MS;\n+\tinternals->link_down_delay_ms = 0;\n+\tinternals->link_up_delay_ms = 0;\n+\n+\tinternals->slave_count = 0;\n+\tinternals->active_slave_count = 0;\n+\tinternals->rx_offload_capa = 0;\n+\tinternals->tx_offload_capa = 0;\n+\tinternals->candidate_max_rx_pktlen = 0;\n+\tinternals->max_rx_pktlen = 0;\n+\n+\t/* Initially allow to choose any offload type */\n+\tinternals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK;\n+\n+\tmemset(internals->active_slaves, 0, sizeof(internals->active_slaves));\n+\tmemset(internals->slaves, 0, sizeof(internals->slaves));\n+\n+\t/* Set mode 4 default configuration */\n+\tbond_mode_8023ad_setup(eth_dev, NULL);\n+\tif (bond_ethdev_mode_set(eth_dev, mode)) {\n+\t\tRTE_BOND_LOG(ERR, \"Failed to set bonded device %d mode too %d\",\n+\t\t\t\t eth_dev->data->port_id, mode);\n+\t\tgoto err;\n+\t}\n+\n+\tvlan_filter_bmp_size =\n+\t\trte_bitmap_get_memory_footprint(ETHER_MAX_VLAN_ID + 1);\n+\tinternals->vlan_filter_bmpmem = rte_malloc(name, vlan_filter_bmp_size,\n+\t\t\t\t\t\t   RTE_CACHE_LINE_SIZE);\n+\tif (internals->vlan_filter_bmpmem == NULL) {\n+\t\tRTE_BOND_LOG(ERR,\n+\t\t\t     \"Failed to allocate vlan bitmap for bonded device %u\\n\",\n+\t\t\t     eth_dev->data->port_id);\n+\t\tgoto err;\n+\t}\n+\n+\tinternals->vlan_filter_bmp = rte_bitmap_init(ETHER_MAX_VLAN_ID + 1,\n+\t\t\tinternals->vlan_filter_bmpmem, vlan_filter_bmp_size);\n+\tif (internals->vlan_filter_bmp == NULL) {\n+\t\tRTE_BOND_LOG(ERR,\n+\t\t\t     \"Failed to init vlan bitmap for bonded device %u\\n\",\n+\t\t\t     eth_dev->data->port_id);\n+\t\trte_free(internals->vlan_filter_bmpmem);\n+\t\tgoto err;\n+\t}\n+\n+\treturn eth_dev->data->port_id;\n+\n+err:\n+\trte_free(internals);\n+\tif (eth_dev != NULL) {\n+\t\trte_free(eth_dev->data->mac_addrs);\n+\t\trte_eth_dev_release_port(eth_dev);\n+\t}\n+\treturn -1;\n+}\n+\n+static int\n bond_probe(struct rte_vdev_device *dev)\n {\n \tconst char *name;\n@@ -2248,6 +2375,9 @@ bond_probe(struct rte_vdev_device *dev)\n \tuint8_t bonding_mode, socket_id;\n \tint  arg_count, port_id;\n \n+\tif (!dev)\n+\t\treturn -EINVAL;\n+\n \tname = rte_vdev_device_name(dev);\n \tRTE_LOG(INFO, EAL, \"Initializing pmd_bond for %s\\n\", name);\n \n@@ -2289,8 +2419,10 @@ bond_probe(struct rte_vdev_device *dev)\n \t\tsocket_id = rte_socket_id();\n \t}\n \n+\tdev->device.numa_node = socket_id;\n+\n \t/* Create link bonding eth device */\n-\tport_id = rte_eth_bond_create(name, bonding_mode, socket_id);\n+\tport_id = bond_alloc(dev, bonding_mode);\n \tif (port_id < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Failed to create socket %s in mode %u on \"\n \t\t\t\t\"socket %u.\\n\",\tname, bonding_mode, socket_id);\n@@ -2312,8 +2444,9 @@ bond_probe(struct rte_vdev_device *dev)\n static int\n bond_remove(struct rte_vdev_device *dev)\n {\n+\tstruct rte_eth_dev *eth_dev;\n+\tstruct bond_dev_private *internals;\n \tconst char *name;\n-\tint  ret;\n \n \tif (!dev)\n \t\treturn -EINVAL;\n@@ -2321,12 +2454,39 @@ bond_remove(struct rte_vdev_device *dev)\n \tname = rte_vdev_device_name(dev);\n \tRTE_LOG(INFO, EAL, \"Uninitializing pmd_bond for %s\\n\", name);\n \n-\t/* free link bonding eth device */\n-\tret = rte_eth_bond_free(name);\n-\tif (ret < 0)\n-\t\tRTE_LOG(ERR, EAL, \"Failed to free %s\\n\", name);\n+\t/* now free all data allocation - for eth_dev structure,\n+\t * dummy pci driver and internal (private) data\n+\t */\n \n-\treturn ret;\n+\t/* find an ethdev entry */\n+\teth_dev = rte_eth_dev_allocated(name);\n+\tif (eth_dev == NULL)\n+\t\treturn -ENODEV;\n+\n+\tRTE_ASSERT(eth_dev->device == &dev->device);\n+\n+\tinternals = eth_dev->data->dev_private;\n+\tif (internals->slave_count != 0)\n+\t\treturn -EBUSY;\n+\n+\tif (eth_dev->data->dev_started == 1) {\n+\t\tbond_ethdev_stop(eth_dev);\n+\t\tbond_ethdev_close(eth_dev);\n+\t}\n+\n+\teth_dev->dev_ops = NULL;\n+\teth_dev->rx_pkt_burst = NULL;\n+\teth_dev->tx_pkt_burst = NULL;\n+\n+\tinternals = eth_dev->data->dev_private;\n+\trte_bitmap_free(internals->vlan_filter_bmp);\n+\trte_free(internals->vlan_filter_bmpmem);\n+\trte_free(eth_dev->data->dev_private);\n+\trte_free(eth_dev->data->mac_addrs);\n+\n+\trte_eth_dev_release_port(eth_dev);\n+\n+\treturn 0;\n }\n \n /* this part will resolve the slave portids after all the other pdev and vdev\n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "12/42"
    ]
}