| 91 | static struct fsdev_list fsdev_list = TAILQ_HEAD_INITIALIZER(fsdev_list); |
| 92 | |
| 93 | static struct bcmfs_device * |
| 94 | fsdev_allocate_one_dev(struct rte_vdev_device *vdev, |
| 95 | char *dirpath, |
| 96 | char *devname, |
| 97 | enum bcmfs_device_type dev_type __rte_unused) |
| 98 | { |
| 99 | struct bcmfs_device *fsdev; |
| 100 | uint32_t i; |
| 101 | |
| 102 | fsdev = rte_calloc(__func__, 1, sizeof(*fsdev), 0); |
| 103 | if (!fsdev) |
| 104 | return NULL; |
| 105 | |
| 106 | if (strlen(dirpath) > sizeof(fsdev->dirname)) { |
| 107 | BCMFS_LOG(ERR, "dir path name is too long"); |
| 108 | goto cleanup; |
| 109 | } |
| 110 | |
| 111 | if (strlen(devname) > sizeof(fsdev->name)) { |
| 112 | BCMFS_LOG(ERR, "devname is too long"); |
| 113 | goto cleanup; |
| 114 | } |
| 115 | |
| 116 | /* check if registered ops name is present in directory path */ |
| 117 | for (i = 0; i < bcmfs_hw_queue_pair_ops_table.num_ops; i++) |
| 118 | if (strstr(dirpath, |
| 119 | bcmfs_hw_queue_pair_ops_table.qp_ops[i].name)) |
| 120 | fsdev->sym_hw_qp_ops = |
| 121 | &bcmfs_hw_queue_pair_ops_table.qp_ops[i]; |
| 122 | if (!fsdev->sym_hw_qp_ops) |
| 123 | goto cleanup; |
| 124 | |
| 125 | strcpy(fsdev->dirname, dirpath); |
| 126 | strcpy(fsdev->name, devname); |
| 127 | |
| 128 | fsdev->vdev = vdev; |
| 129 | |
| 130 | /* attach to VFIO */ |
| 131 | if (bcmfs_attach_vfio(fsdev)) |
| 132 | goto cleanup; |
| 133 | |
| 134 | /* Maximum number of QPs supported */ |
| 135 | fsdev->max_hw_qps = fsdev->mmap_size / BCMFS_HW_QUEUE_IO_ADDR_LEN; |
| 136 | |
| 137 | TAILQ_INSERT_TAIL(&fsdev_list, fsdev, next); |
| 138 | |
| 139 | return fsdev; |
| 140 | |
| 141 | cleanup: |
| 142 | rte_free(fsdev); |
| 143 | |
| 144 | return NULL; |
| 145 | } |
| 146 | |
| 147 | static struct bcmfs_device * |
| 148 | find_fsdev(struct rte_vdev_device *vdev) |
no test coverage detected