@@ -89,25 +89,6 @@ enum rte_dpaa2_dev_type {
DPAA2_DEVTYPE_MAX,
};
-TAILQ_HEAD(rte_dpaa2_object_list, rte_dpaa2_object);
-
-typedef int (*rte_dpaa2_obj_create_t)(int vdev_fd,
- struct vfio_device_info *obj_info,
- int object_id);
-
-typedef void (*rte_dpaa2_obj_close_t)(int object_id);
-
-/**
- * A structure describing a DPAA2 object.
- */
-struct rte_dpaa2_object {
- TAILQ_ENTRY(rte_dpaa2_object) next; /**< Next in list. */
- const char *name; /**< Name of Object. */
- enum rte_dpaa2_dev_type dev_type; /**< Type of device */
- rte_dpaa2_obj_create_t create;
- rte_dpaa2_obj_close_t close;
-};
-
/**
* A structure describing a DPAA2 device.
*/
@@ -123,6 +104,7 @@ struct rte_dpaa2_device {
enum rte_dpaa2_dev_type dev_type; /**< Device Type */
uint16_t object_id; /**< DPAA2 Object ID */
enum rte_dpaa2_dev_type ep_dev_type; /**< Endpoint Device Type */
+ struct dpaa2_dprc_dev *container;
uint16_t ep_object_id; /**< Endpoint DPAA2 Object ID */
char ep_name[RTE_DEV_NAME_MAX_LEN];
struct rte_intr_handle *intr_handle; /**< Interrupt handle */
@@ -130,10 +112,29 @@ struct rte_dpaa2_device {
char name[FSLMC_OBJECT_MAX_LEN]; /**< DPAA2 Object name*/
};
+typedef int (*rte_dpaa2_obj_create_t)(int vdev_fd,
+ struct vfio_device_info *obj_info,
+ struct rte_dpaa2_device *dev);
+
+typedef void (*rte_dpaa2_obj_close_t)(int object_id);
+
typedef int (*rte_dpaa2_probe_t)(struct rte_dpaa2_driver *dpaa2_drv,
struct rte_dpaa2_device *dpaa2_dev);
typedef int (*rte_dpaa2_remove_t)(struct rte_dpaa2_device *dpaa2_dev);
+TAILQ_HEAD(rte_dpaa2_object_list, rte_dpaa2_object);
+
+/**
+ * A structure describing a DPAA2 object.
+ */
+struct rte_dpaa2_object {
+ TAILQ_ENTRY(rte_dpaa2_object) next; /**< Next in list. */
+ const char *name; /**< Name of Object. */
+ enum rte_dpaa2_dev_type dev_type; /**< Type of device */
+ rte_dpaa2_obj_create_t create;
+ rte_dpaa2_obj_close_t close;
+};
+
/**
* A structure describing a DPAA2 driver.
*/
@@ -1458,8 +1458,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)
case DPAA2_DPRC:
TAILQ_FOREACH(object, &dpaa2_obj_list, next) {
if (dev->dev_type == object->dev_type)
- object->create(dev_fd, &device_info,
- dev->object_id);
+ object->create(dev_fd, &device_info, dev);
else
continue;
}
@@ -47,11 +47,11 @@ static struct dpaa2_dpbp_dev *get_dpbp_from_id(uint32_t dpbp_id)
static int
dpaa2_create_dpbp_device(int vdev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dpbp_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dpbp_dev *dpbp_node;
- int ret;
+ int ret, dpbp_id = obj->object_id;
static int register_once;
/* Allocate DPAA2 dpbp handle */
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright 2017,2020 NXP
+ * Copyright 2017, 2020, 2023 NXP
*
*/
@@ -45,15 +45,15 @@ static struct dpaa2_dpci_dev *get_dpci_from_id(uint32_t dpci_id)
static int
rte_dpaa2_create_dpci_device(int vdev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dpci_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dpci_dev *dpci_node;
struct dpci_attr attr;
struct dpci_rx_queue_cfg rx_queue_cfg;
struct dpci_rx_queue_attr rx_attr;
struct dpci_tx_queue_attr tx_attr;
- int ret, i;
+ int ret, i, dpci_id = obj->object_id;
/* Allocate DPAA2 dpci handle */
dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0);
@@ -399,14 +399,14 @@ dpaa2_close_dpio_device(int object_id)
static int
dpaa2_create_dpio_device(int vdev_fd,
- struct vfio_device_info *obj_info,
- int object_id)
+ struct vfio_device_info *obj_info,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dpio_dev *dpio_dev = NULL;
struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)};
struct qbman_swp_desc p_des;
struct dpio_attr attr;
- int ret;
+ int ret, object_id = obj->object_id;
if (obj_info->num_regions < NUM_DPIO_REGIONS) {
DPAA2_BUS_ERR("Not sufficient number of DPIO regions");
@@ -23,13 +23,13 @@ static struct dprc_dev_list dprc_dev_list
static int
rte_dpaa2_create_dprc_device(int vdev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dprc_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dprc_dev *dprc_node;
struct dprc_endpoint endpoint1, endpoint2;
struct rte_dpaa2_device *dev, *dev_tmp;
- int ret;
+ int ret, dprc_id = obj->object_id;
/* Allocate DPAA2 dprc handle */
dprc_node = rte_malloc(NULL, sizeof(struct dpaa2_dprc_dev), 0);
@@ -50,6 +50,8 @@ rte_dpaa2_create_dprc_device(int vdev_fd __rte_unused,
}
RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_tmp) {
+ /** DPRC is always created before it's children are created.*/
+ dev->container = dprc_node;
if (dev->dev_type == DPAA2_ETH) {
int link_state;
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright 2017,2020 NXP
+ * Copyright 2017, 2020, 2023 NXP
*
*/
@@ -45,12 +45,12 @@ static struct dpaa2_dpcon_dev *get_dpcon_from_id(uint32_t dpcon_id)
static int
rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dpcon_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dpcon_dev *dpcon_node;
struct dpcon_attr attr;
- int ret;
+ int ret, dpcon_id = obj->object_id;
/* Allocate DPAA2 dpcon handle */
dpcon_node = rte_malloc(NULL, sizeof(struct dpaa2_dpcon_dev), 0);
@@ -374,12 +374,12 @@ rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if)
static int
dpaa2_create_dpdmux_device(int vdev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dpdmux_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dpaa2_dpdmux_dev *dpdmux_dev;
struct dpdmux_attr attr;
- int ret;
+ int ret, dpdmux_id = obj->object_id;
uint16_t maj_ver;
uint16_t min_ver;
uint8_t skip_reset_flags;
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2019 NXP
+ * Copyright 2019, 2023 NXP
*/
#include <sys/queue.h>
@@ -134,11 +134,11 @@ int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
#if defined(RTE_LIBRTE_IEEE1588)
static int
dpaa2_create_dprtc_device(int vdev_fd __rte_unused,
- struct vfio_device_info *obj_info __rte_unused,
- int dprtc_id)
+ struct vfio_device_info *obj_info __rte_unused,
+ struct rte_dpaa2_device *obj)
{
struct dprtc_attr attr;
- int ret;
+ int ret, dprtc_id = obj->object_id;
PMD_INIT_FUNC_TRACE();