| 233 | |
| 234 | |
| 235 | static int |
| 236 | bcmfs_vdev_probe(struct rte_vdev_device *vdev) |
| 237 | { |
| 238 | struct bcmfs_device *fsdev; |
| 239 | char top_dirpath[BCMFS_MAX_PATH_LEN]; |
| 240 | char sub_dirpath[BCMFS_MAX_PATH_LEN]; |
| 241 | char out_dirpath[BCMFS_MAX_PATH_LEN]; |
| 242 | char out_dirname[BCMFS_MAX_PATH_LEN]; |
| 243 | uint32_t fsdev_dev[BCMFS_MAX_NODES]; |
| 244 | enum bcmfs_device_type dtype; |
| 245 | int err; |
| 246 | int i = 0; |
| 247 | int dev_idx; |
| 248 | int count = 0; |
| 249 | bool found = false; |
| 250 | |
| 251 | sprintf(top_dirpath, "%s", SYSFS_BCM_PLTFORM_DEVICES); |
| 252 | while (strlen(dev_table[i].name)) { |
| 253 | found = fsdev_find_sub_dir(top_dirpath, |
| 254 | dev_table[i].name, |
| 255 | sub_dirpath); |
| 256 | if (found) |
| 257 | break; |
| 258 | i++; |
| 259 | } |
| 260 | if (!found) { |
| 261 | BCMFS_LOG(ERR, "No supported bcmfs dev found"); |
| 262 | return -ENODEV; |
| 263 | } |
| 264 | |
| 265 | dev_idx = i; |
| 266 | dtype = dev_table[i].type; |
| 267 | |
| 268 | snprintf(out_dirpath, sizeof(out_dirpath), "%s/%s", |
| 269 | top_dirpath, sub_dirpath); |
| 270 | count = fsdev_find_all_devs(out_dirpath, |
| 271 | dev_table[dev_idx].suffix, |
| 272 | fsdev_dev); |
| 273 | if (!count) { |
| 274 | BCMFS_LOG(ERR, "No supported bcmfs dev found"); |
| 275 | return -ENODEV; |
| 276 | } |
| 277 | |
| 278 | i = 0; |
| 279 | while (count) { |
| 280 | /* format the device name present in the patch */ |
| 281 | snprintf(out_dirname, sizeof(out_dirname), "%x.%s", |
| 282 | fsdev_dev[i], dev_table[dev_idx].suffix); |
| 283 | fsdev = fsdev_allocate_one_dev(vdev, out_dirpath, |
| 284 | out_dirname, dtype); |
| 285 | if (!fsdev) { |
| 286 | count--; |
| 287 | i++; |
| 288 | continue; |
| 289 | } |
| 290 | break; |
| 291 | } |
| 292 | if (fsdev == NULL) { |
nothing calls this directly
no test coverage detected