| 288 | } |
| 289 | |
| 290 | uint16_t |
| 291 | rte_eth_iterator_next(struct rte_dev_iterator *iter) |
| 292 | { |
| 293 | if (iter == NULL) { |
| 294 | RTE_ETHDEV_LOG(ERR, |
| 295 | "Cannot get next device from NULL iterator\n"); |
| 296 | return RTE_MAX_ETHPORTS; |
| 297 | } |
| 298 | |
| 299 | if (iter->cls == NULL) /* invalid ethdev iterator */ |
| 300 | return RTE_MAX_ETHPORTS; |
| 301 | |
| 302 | do { /* loop to try all matching rte_device */ |
| 303 | /* If not pure ethdev filter and */ |
| 304 | if (iter->bus != NULL && |
| 305 | /* not in middle of rte_eth_dev iteration, */ |
| 306 | iter->class_device == NULL) { |
| 307 | /* get next rte_device to try. */ |
| 308 | iter->device = iter->bus->dev_iterate( |
| 309 | iter->device, iter->bus_str, iter); |
| 310 | if (iter->device == NULL) |
| 311 | break; /* no more rte_device candidate */ |
| 312 | } |
| 313 | /* A device is matching bus part, need to check ethdev part. */ |
| 314 | iter->class_device = iter->cls->dev_iterate( |
| 315 | iter->class_device, iter->cls_str, iter); |
| 316 | if (iter->class_device != NULL) { |
| 317 | uint16_t id = eth_dev_to_id(iter->class_device); |
| 318 | |
| 319 | rte_eth_trace_iterator_next(iter, id); |
| 320 | |
| 321 | return id; /* match */ |
| 322 | } |
| 323 | } while (iter->bus != NULL); /* need to try next rte_device */ |
| 324 | |
| 325 | /* No more ethdev port to iterate. */ |
| 326 | rte_eth_iterator_cleanup(iter); |
| 327 | return RTE_MAX_ETHPORTS; |
| 328 | } |
| 329 | |
| 330 | void |
| 331 | rte_eth_iterator_cleanup(struct rte_dev_iterator *iter) |
nothing calls this directly
no test coverage detected