get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 10572,
    "url": "http://patches.dpdk.org/api/patches/10572/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1455718817-14171-4-git-send-email-ferruh.yigit@intel.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": "<1455718817-14171-4-git-send-email-ferruh.yigit@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1455718817-14171-4-git-send-email-ferruh.yigit@intel.com",
    "date": "2016-02-17T14:20:17",
    "name": "[dpdk-dev,3/3] bonding: use ethdev helper functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "bb0d5823a0b663a40a4094b6af5287fcdcfa7293",
    "submitter": {
        "id": 324,
        "url": "http://patches.dpdk.org/api/people/324/?format=api",
        "name": "Ferruh Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1455718817-14171-4-git-send-email-ferruh.yigit@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/10572/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/10572/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 F0E50C344;\n\tWed, 17 Feb 2016 15:21:20 +0100 (CET)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 01E20C342\n\tfor <dev@dpdk.org>; Wed, 17 Feb 2016 15:21:18 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga103.fm.intel.com with ESMTP; 17 Feb 2016 06:20:53 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga002.fm.intel.com with ESMTP; 17 Feb 2016 06:20:52 -0800",
            "from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com\n\t[10.237.217.46])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tu1HEKpcR019203; Wed, 17 Feb 2016 14:20:51 GMT",
            "from sivswdev02.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev02.ir.intel.com with ESMTP id u1HEKpTt014605;\n\tWed, 17 Feb 2016 14:20:51 GMT",
            "(from fyigit@localhost)\n\tby sivswdev02.ir.intel.com with  id u1HEKpp4014601;\n\tWed, 17 Feb 2016 14:20:51 GMT"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,460,1449561600\"; d=\"scan'208\";a=\"917166055\"",
        "From": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Wed, 17 Feb 2016 14:20:17 +0000",
        "Message-Id": "<1455718817-14171-4-git-send-email-ferruh.yigit@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1455718817-14171-1-git-send-email-ferruh.yigit@intel.com>",
        "References": "<1455718817-14171-1-git-send-email-ferruh.yigit@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 3/3] bonding: use ethdev helper functions",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Use rte_eth_by_port(), rte_eth_private_by_port(),\nrte_eth_private_by_dev() helper functions.\n\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\n drivers/net/bonding/rte_eth_bond_8023ad.c | 10 ++--\n drivers/net/bonding/rte_eth_bond_api.c    | 76 +++++++++++++++----------------\n drivers/net/bonding/rte_eth_bond_args.c   | 13 ++++--\n drivers/net/bonding/rte_eth_bond_pmd.c    | 47 +++++++++++--------\n 4 files changed, 81 insertions(+), 65 deletions(-)",
    "diff": "diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c\nindex b3b30f6..18402c2 100644\n--- a/drivers/net/bonding/rte_eth_bond_8023ad.c\n+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c\n@@ -854,6 +854,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)\n \tuint32_t total_tx_desc;\n \tstruct bond_tx_queue *bd_tx_q;\n \tuint16_t q_id;\n+\tstruct rte_eth_dev *dev;\n \n \t/* Given slave mus not be in active list */\n \tRTE_VERIFY(find_slave_by_id(internals->active_slaves,\n@@ -882,7 +883,8 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, uint8_t slave_id)\n \n \tRTE_VERIFY(port->rx_ring == NULL);\n \tRTE_VERIFY(port->tx_ring == NULL);\n-\tsocket_id = rte_eth_devices[slave_id].data->numa_node;\n+\tdev = rte_eth_by_port(slave_id);\n+\tsocket_id = dev->data->numa_node;\n \n \telement_size = sizeof(struct slow_protocol_frame) + sizeof(struct rte_mbuf)\n \t\t\t\t+ RTE_PKTMBUF_HEADROOM;\n@@ -1153,7 +1155,7 @@ rte_eth_bond_8023ad_conf_get(uint8_t port_id,\n \tif (conf == NULL)\n \t\treturn -EINVAL;\n \n-\tbond_dev = &rte_eth_devices[port_id];\n+\tbond_dev = rte_eth_by_port(port_id);\n \tbond_mode_8023ad_conf_get(bond_dev, conf);\n \treturn 0;\n }\n@@ -1182,7 +1184,7 @@ rte_eth_bond_8023ad_setup(uint8_t port_id,\n \t\t}\n \t}\n \n-\tbond_dev = &rte_eth_devices[port_id];\n+\tbond_dev = rte_eth_by_port(port_id);\n \tbond_mode_8023ad_setup(bond_dev, conf);\n \n \treturn 0;\n@@ -1200,7 +1202,7 @@ rte_eth_bond_8023ad_slave_info(uint8_t port_id, uint8_t slave_id,\n \t\t\trte_eth_bond_mode_get(port_id) != BONDING_MODE_8023AD)\n \t\treturn -EINVAL;\n \n-\tbond_dev = &rte_eth_devices[port_id];\n+\tbond_dev = rte_eth_by_port(port_id);\n \n \tinternals = bond_dev->data->dev_private;\n \tif (find_slave_by_id(internals->active_slaves,\ndiff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c\nindex 8a000c8..c61ad01 100644\n--- a/drivers/net/bonding/rte_eth_bond_api.c\n+++ b/drivers/net/bonding/rte_eth_bond_api.c\n@@ -63,7 +63,7 @@ valid_bonded_port_id(uint8_t port_id)\n \tif (!rte_eth_dev_is_valid_port(port_id))\n \t\treturn -1;\n \n-\treturn check_for_bonded_ethdev(&rte_eth_devices[port_id]);\n+\treturn check_for_bonded_ethdev(rte_eth_by_port(port_id));\n }\n \n int\n@@ -74,7 +74,7 @@ valid_slave_port_id(uint8_t port_id)\n \t\treturn -1;\n \n \t/* Verify that port_id refers to a non bonded port */\n-\tif (check_for_bonded_ethdev(&rte_eth_devices[port_id]) == 0)\n+\tif (check_for_bonded_ethdev(rte_eth_by_port(port_id)) == 0)\n \t\treturn -1;\n \n \treturn 0;\n@@ -318,14 +318,14 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n \tif (valid_slave_port_id(slave_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n+\tbonded_eth_dev = rte_eth_by_port(bonded_port_id);\n \tinternals = bonded_eth_dev->data->dev_private;\n \n \t/* Verify that new slave device is not already a slave of another\n \t * bonded device */\n \tfor (i = rte_eth_dev_count()-1; i >= 0; i--) {\n-\t\tif (check_for_bonded_ethdev(&rte_eth_devices[i]) == 0) {\n-\t\t\ttemp_internals = rte_eth_devices[i].data->dev_private;\n+\t\tif (check_for_bonded_ethdev(rte_eth_by_port(i)) == 0) {\n+\t\t\ttemp_internals = rte_eth_private_by_port(i);\n \n \t\t\tfor (j = 0; j < temp_internals->slave_count; j++) {\n \t\t\t\t/* Device already a slave of a bonded device */\n@@ -338,7 +338,7 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n \t\t}\n \t}\n \n-\tslave_eth_dev = &rte_eth_devices[slave_port_id];\n+\tslave_eth_dev = rte_eth_by_port(slave_port_id);\n \n \t/* Add slave details to bonded device */\n \tslave_add(internals, slave_eth_dev);\n@@ -437,7 +437,6 @@ __eth_bond_slave_add_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n int\n rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id)\n {\n-\tstruct rte_eth_dev *bonded_eth_dev;\n \tstruct bond_dev_private *internals;\n \n \tint retval;\n@@ -446,8 +445,7 @@ rte_eth_bond_slave_add(uint8_t bonded_port_id, uint8_t slave_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \trte_spinlock_lock(&internals->lock);\n \n@@ -463,14 +461,15 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n {\n \tstruct rte_eth_dev *bonded_eth_dev;\n \tstruct bond_dev_private *internals;\n+\tstruct rte_eth_dev *dev;\n \n \tint i, slave_idx;\n \n \tif (valid_slave_port_id(slave_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tbonded_eth_dev = rte_eth_by_port(bonded_port_id);\n+\tinternals = rte_eth_private_by_dev(bonded_eth_dev);\n \n \t/* first remove from active slave list */\n \tslave_idx = find_slave_by_id(internals->active_slaves,\n@@ -495,15 +494,15 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n \n \t/* Un-register link status change callback with bonded device pointer as\n \t * argument*/\n+\tdev = rte_eth_by_port(bonded_port_id);\n \trte_eth_dev_callback_unregister(slave_port_id, RTE_ETH_EVENT_INTR_LSC,\n-\t\t\tbond_ethdev_lsc_event_callback,\n-\t\t\t&rte_eth_devices[bonded_port_id].data->port_id);\n+\t\t\tbond_ethdev_lsc_event_callback, &dev->data->port_id);\n \n \t/* Restore original MAC address of slave device */\n-\tmac_address_set(&rte_eth_devices[slave_port_id],\n+\tmac_address_set(rte_eth_by_port(slave_port_id),\n \t\t\t&(internals->slaves[slave_idx].persisted_mac_addr));\n \n-\tslave_remove(internals, &rte_eth_devices[slave_port_id]);\n+\tslave_remove(internals, rte_eth_by_port(slave_port_id));\n \n \t/*  first slave in the active list will be the primary by default,\n \t *  otherwise use first device in list */\n@@ -518,14 +517,15 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n \n \tif (internals->active_slave_count < 1) {\n \t\t/* reset device link properties as no slaves are active */\n-\t\tlink_properties_reset(&rte_eth_devices[bonded_port_id]);\n+\t\tlink_properties_reset(rte_eth_by_port(bonded_port_id));\n \n \t\t/* if no slaves are any longer attached to bonded device and MAC is not\n \t\t * user defined then clear MAC of bonded device as it will be reset\n \t\t * when a new slave is added */\n+\t\tdev = rte_eth_by_port(bonded_port_id);\n \t\tif (internals->slave_count < 1 && !internals->user_defined_mac)\n-\t\t\tmemset(rte_eth_devices[bonded_port_id].data->mac_addrs, 0,\n-\t\t\t\t\tsizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs)));\n+\t\t\tmemset(dev->data->mac_addrs, 0,\n+\t\t\t\t\tsizeof(*dev->data->mac_addrs));\n \t}\n \tif (internals->slave_count == 0) {\n \t\tinternals->rx_offload_capa = 0;\n@@ -539,15 +539,13 @@ __eth_bond_slave_remove_lock_free(uint8_t bonded_port_id, uint8_t slave_port_id)\n int\n rte_eth_bond_slave_remove(uint8_t bonded_port_id, uint8_t slave_port_id)\n {\n-\tstruct rte_eth_dev *bonded_eth_dev;\n \tstruct bond_dev_private *internals;\n \tint retval;\n \n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \trte_spinlock_lock(&internals->lock);\n \n@@ -564,7 +562,7 @@ rte_eth_bond_mode_set(uint8_t bonded_port_id, uint8_t mode)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\treturn bond_ethdev_mode_set(&rte_eth_devices[bonded_port_id], mode);\n+\treturn bond_ethdev_mode_set(rte_eth_by_port(bonded_port_id), mode);\n }\n \n int\n@@ -575,7 +573,7 @@ rte_eth_bond_mode_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \treturn internals->mode;\n }\n@@ -591,7 +589,7 @@ rte_eth_bond_primary_set(uint8_t bonded_port_id, uint8_t slave_port_id)\n \tif (valid_slave_port_id(slave_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals =  rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \tinternals->user_defined_primary_port = 1;\n \tinternals->primary_port = slave_port_id;\n@@ -609,7 +607,7 @@ rte_eth_bond_primary_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \tif (internals->slave_count < 1)\n \t\treturn -1;\n@@ -629,7 +627,7 @@ rte_eth_bond_slaves_get(uint8_t bonded_port_id, uint8_t slaves[], uint8_t len)\n \tif (slaves == NULL)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \tif (internals->slave_count > len)\n \t\treturn -1;\n@@ -652,7 +650,7 @@ rte_eth_bond_active_slaves_get(uint8_t bonded_port_id, uint8_t slaves[],\n \tif (slaves == NULL)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \tif (internals->active_slave_count > len)\n \t\treturn -1;\n@@ -672,8 +670,8 @@ rte_eth_bond_mac_address_set(uint8_t bonded_port_id,\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tbonded_eth_dev = rte_eth_by_port(bonded_port_id);\n+\tinternals = rte_eth_private_by_dev(bonded_eth_dev);\n \n \t/* Set MAC Address of Bonded Device */\n \tif (mac_address_set(bonded_eth_dev, mac_addr))\n@@ -697,8 +695,8 @@ rte_eth_bond_mac_address_reset(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tbonded_eth_dev = &rte_eth_devices[bonded_port_id];\n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tbonded_eth_dev = rte_eth_by_port(bonded_port_id);\n+\tinternals = rte_eth_private_by_dev(bonded_eth_dev);\n \n \tinternals->user_defined_mac = 0;\n \n@@ -725,7 +723,7 @@ rte_eth_bond_xmit_policy_set(uint8_t bonded_port_id, uint8_t policy)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \tswitch (policy) {\n \tcase BALANCE_XMIT_POLICY_LAYER2:\n@@ -755,7 +753,7 @@ rte_eth_bond_xmit_policy_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \treturn internals->balance_xmit_policy;\n }\n@@ -768,7 +766,7 @@ rte_eth_bond_link_monitoring_set(uint8_t bonded_port_id, uint32_t internal_ms)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \tinternals->link_status_polling_interval_ms = internal_ms;\n \n \treturn 0;\n@@ -782,7 +780,7 @@ rte_eth_bond_link_monitoring_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \treturn internals->link_status_polling_interval_ms;\n }\n@@ -796,7 +794,7 @@ rte_eth_bond_link_down_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \tinternals->link_down_delay_ms = delay_ms;\n \n \treturn 0;\n@@ -810,7 +808,7 @@ rte_eth_bond_link_down_prop_delay_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \treturn internals->link_down_delay_ms;\n }\n@@ -824,7 +822,7 @@ rte_eth_bond_link_up_prop_delay_set(uint8_t bonded_port_id, uint32_t delay_ms)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \tinternals->link_up_delay_ms = delay_ms;\n \n \treturn 0;\n@@ -838,7 +836,7 @@ rte_eth_bond_link_up_prop_delay_get(uint8_t bonded_port_id)\n \tif (valid_bonded_port_id(bonded_port_id) != 0)\n \t\treturn -1;\n \n-\tinternals = rte_eth_devices[bonded_port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(bonded_port_id);\n \n \treturn internals->link_up_delay_ms;\n }\ndiff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c\nindex 02ecde6..d461ead 100644\n--- a/drivers/net/bonding/rte_eth_bond_args.c\n+++ b/drivers/net/bonding/rte_eth_bond_args.c\n@@ -55,14 +55,16 @@ static inline int\n find_port_id_by_pci_addr(const struct rte_pci_addr *pci_addr)\n {\n \tstruct rte_pci_addr *eth_pci_addr;\n+\tstruct rte_eth_dev *dev;\n \tunsigned i;\n \n \tfor (i = 0; i < rte_eth_dev_count(); i++) {\n+\t\tdev = rte_eth_by_port(i);\n \n-\t\tif (rte_eth_devices[i].pci_dev == NULL)\n+\t\tif (dev->pci_dev == NULL)\n \t\t\tcontinue;\n \n-\t\teth_pci_addr = &(rte_eth_devices[i].pci_dev->addr);\n+\t\teth_pci_addr = &dev->pci_dev->addr;\n \n \t\tif (pci_addr->bus == eth_pci_addr->bus &&\n \t\t\tpci_addr->devid == eth_pci_addr->devid &&\n@@ -76,13 +78,16 @@ find_port_id_by_pci_addr(const struct rte_pci_addr *pci_addr)\n static inline int\n find_port_id_by_dev_name(const char *name)\n {\n+\tstruct rte_eth_dev *dev;\n \tunsigned i;\n \n \tfor (i = 0; i < rte_eth_dev_count(); i++) {\n-\t\tif (rte_eth_devices[i].data == NULL)\n+\t\tdev = rte_eth_by_port(i);\n+\n+\t\tif (dev->data == NULL)\n \t\t\tcontinue;\n \n-\t\tif (strcmp(rte_eth_devices[i].data->name, name) == 0)\n+\t\tif (strcmp(dev->data->name, name) == 0)\n \t\t\treturn i;\n \t}\n \treturn -1;\ndiff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c\nindex b63c886..c316fd7 100644\n--- a/drivers/net/bonding/rte_eth_bond_pmd.c\n+++ b/drivers/net/bonding/rte_eth_bond_pmd.c\n@@ -689,7 +689,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)\n \tstruct bond_dev_private *internals = bd_tx_q->dev_private;\n \n \tstruct rte_eth_dev *primary_port =\n-\t\t\t&rte_eth_devices[internals->primary_port];\n+\t\t\trte_eth_by_port(internals->primary_port);\n \tuint16_t num_tx_total = 0;\n \tuint8_t i, j;\n \n@@ -1192,7 +1192,9 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr)\n int\n mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)\n {\n-\tstruct bond_dev_private *internals = bonded_eth_dev->data->dev_private;\n+\tstruct bond_dev_private *internals =\n+\t\trte_eth_private_by_dev(bonded_eth_dev);\n+\tstruct rte_eth_dev *dev;\n \tint i;\n \n \t/* Update slave devices MAC addresses */\n@@ -1204,7 +1206,8 @@ mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)\n \tcase BONDING_MODE_BALANCE:\n \tcase BONDING_MODE_BROADCAST:\n \t\tfor (i = 0; i < internals->slave_count; i++) {\n-\t\t\tif (mac_address_set(&rte_eth_devices[internals->slaves[i].port_id],\n+\t\t\tdev = rte_eth_by_port(internals->slaves[i].port_id);\n+\t\t\tif (mac_address_set(dev,\n \t\t\t\t\tbonded_eth_dev->data->mac_addrs)) {\n \t\t\t\tRTE_BOND_LOG(ERR, \"Failed to update port Id %d MAC address\",\n \t\t\t\t\t\tinternals->slaves[i].port_id);\n@@ -1222,15 +1225,17 @@ mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)\n \t\tfor (i = 0; i < internals->slave_count; i++) {\n \t\t\tif (internals->slaves[i].port_id ==\n \t\t\t\t\tinternals->current_primary_port) {\n-\t\t\t\tif (mac_address_set(&rte_eth_devices[internals->primary_port],\n+\t\t\t\tdev = rte_eth_by_port(internals->primary_port);\n+\t\t\t\tif (mac_address_set(dev,\n \t\t\t\t\t\tbonded_eth_dev->data->mac_addrs)) {\n \t\t\t\t\tRTE_BOND_LOG(ERR, \"Failed to update port Id %d MAC address\",\n \t\t\t\t\t\t\tinternals->current_primary_port);\n \t\t\t\t\treturn -1;\n \t\t\t\t}\n \t\t\t} else {\n-\t\t\t\tif (mac_address_set(\n-\t\t\t\t\t\t&rte_eth_devices[internals->slaves[i].port_id],\n+\t\t\t\tdev = rte_eth_by_port(\n+\t\t\t\t\t\tinternals->slaves[i].port_id);\n+\t\t\t\tif (mac_address_set(dev,\n \t\t\t\t\t\t&internals->slaves[i].persisted_mac_addr)) {\n \t\t\t\t\tRTE_BOND_LOG(ERR, \"Failed to update port Id %d MAC address\",\n \t\t\t\t\t\t\tinternals->slaves[i].port_id);\n@@ -1443,6 +1448,7 @@ slave_add(struct bond_dev_private *internals,\n {\n \tstruct bond_slave_details *slave_details =\n \t\t\t&internals->slaves[internals->slave_count];\n+\tstruct rte_eth_dev *dev;\n \n \tslave_details->port_id = slave_eth_dev->data->port_id;\n \tslave_details->last_link_status = 0;\n@@ -1454,10 +1460,11 @@ slave_add(struct bond_dev_private *internals,\n \n \t\tif (!internals->link_status_polling_enabled) {\n \t\t\tinternals->link_status_polling_enabled = 1;\n+\t\t\tdev = rte_eth_by_port(internals->port_id);\n \n \t\t\trte_eal_alarm_set(internals->link_status_polling_interval_ms * 1000,\n \t\t\t\t\tbond_ethdev_slave_link_status_change_monitor,\n-\t\t\t\t\t(void *)&rte_eth_devices[internals->port_id]);\n+\t\t\t\t\t(void *)dev);\n \t\t}\n \t}\n \n@@ -1490,6 +1497,7 @@ static int\n bond_ethdev_start(struct rte_eth_dev *eth_dev)\n {\n \tstruct bond_dev_private *internals;\n+\tstruct rte_eth_dev *dev;\n \tint i;\n \n \t/* slave eth dev will be started by bonded device */\n@@ -1536,8 +1544,8 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev)\n \n \t/* Reconfigure each slave device if starting bonded device */\n \tfor (i = 0; i < internals->slave_count; i++) {\n-\t\tif (slave_configure(eth_dev,\n-\t\t\t\t&(rte_eth_devices[internals->slaves[i].port_id])) != 0) {\n+\t\tdev = rte_eth_by_port(internals->slaves[i].port_id);\n+\t\tif (slave_configure(eth_dev, dev) != 0) {\n \t\t\tRTE_BOND_LOG(ERR,\n \t\t\t\t\t\"bonded port (%d) failed to reconfigure slave device (%d)\",\n \t\t\t\t\teth_dev->data->port_id, internals->slaves[i].port_id);\n@@ -1730,7 +1738,7 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)\n \t\treturn;\n \n \tbonded_ethdev = (struct rte_eth_dev *)cb_arg;\n-\tinternals = (struct bond_dev_private *)bonded_ethdev->data->dev_private;\n+\tinternals = rte_eth_private_by_dev(bonded_ethdev);\n \n \tif (!bonded_ethdev->data->dev_started ||\n \t\t!internals->link_status_polling_enabled)\n@@ -1746,7 +1754,8 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)\n \t\t\tif (!internals->slaves[i].link_status_poll_enabled)\n \t\t\t\tcontinue;\n \n-\t\t\tslave_ethdev = &rte_eth_devices[internals->slaves[i].port_id];\n+\t\t\tslave_ethdev =\n+\t\t\t\trte_eth_by_port(internals->slaves[i].port_id);\n \t\t\tpolling_slave_found = 1;\n \n \t\t\t/* Update slave link status */\n@@ -1778,7 +1787,8 @@ static int\n bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev,\n \t\tint wait_to_complete)\n {\n-\tstruct bond_dev_private *internals = bonded_eth_dev->data->dev_private;\n+\tstruct bond_dev_private *internals =\n+\t\trte_eth_private_by_dev(bonded_eth_dev);\n \n \tif (!bonded_eth_dev->data->dev_started ||\n \t\tinternals->active_slave_count == 0) {\n@@ -1789,7 +1799,8 @@ bond_ethdev_link_update(struct rte_eth_dev *bonded_eth_dev,\n \t\tint i, link_up = 0;\n \n \t\tfor (i = 0; i < internals->active_slave_count; i++) {\n-\t\t\tslave_eth_dev = &rte_eth_devices[internals->active_slaves[i]];\n+\t\t\tslave_eth_dev =\n+\t\t\t\trte_eth_by_port(internals->active_slaves[i]);\n \n \t\t\t(*slave_eth_dev->dev_ops->link_update)(slave_eth_dev,\n \t\t\t\t\twait_to_complete);\n@@ -1927,13 +1938,13 @@ bond_ethdev_lsc_event_callback(uint8_t port_id, enum rte_eth_event_type type,\n \tif (type != RTE_ETH_EVENT_INTR_LSC || param == NULL)\n \t\treturn;\n \n-\tbonded_eth_dev = &rte_eth_devices[*(uint8_t *)param];\n-\tslave_eth_dev = &rte_eth_devices[port_id];\n+\tbonded_eth_dev = rte_eth_by_port(*(uint16_t *)param);\n+\tslave_eth_dev = rte_eth_by_port(port_id);\n \n \tif (check_for_bonded_ethdev(bonded_eth_dev))\n \t\treturn;\n \n-\tinternals = bonded_eth_dev->data->dev_private;\n+\tinternals = rte_eth_private_by_dev(bonded_eth_dev);\n \n \t/* If the device isn't started don't handle interrupts */\n \tif (!bonded_eth_dev->data->dev_started)\n@@ -2216,7 +2227,7 @@ bond_init(const char *name, const char *params)\n \t\t\t\t\"socket %u.\\n\",\tname, bonding_mode, socket_id);\n \t\tgoto parse_error;\n \t}\n-\tinternals = rte_eth_devices[port_id].data->dev_private;\n+\tinternals = rte_eth_private_by_port(port_id);\n \tinternals->kvlist = kvlist;\n \n \tRTE_LOG(INFO, EAL, \"Create bonded device %s on port %d in mode %u on \"\n@@ -2253,7 +2264,7 @@ static int\n bond_ethdev_configure(struct rte_eth_dev *dev)\n {\n \tchar *name = dev->data->name;\n-\tstruct bond_dev_private *internals = dev->data->dev_private;\n+\tstruct bond_dev_private *internals = rte_eth_private_by_dev(dev);\n \tstruct rte_kvargs *kvlist = internals->kvlist;\n \tint arg_count;\n \tuint8_t port_id = dev - rte_eth_devices;\n",
    "prefixes": [
        "dpdk-dev",
        "3/3"
    ]
}