| 491 | } |
| 492 | |
| 493 | int |
| 494 | failsafe_eth_dev_state_sync(struct rte_eth_dev *dev) |
| 495 | { |
| 496 | struct sub_device *sdev; |
| 497 | uint32_t inactive; |
| 498 | int ret; |
| 499 | uint8_t i; |
| 500 | |
| 501 | if (PRIV(dev)->state < DEV_PARSED) |
| 502 | return 0; |
| 503 | |
| 504 | ret = failsafe_args_parse_subs(dev); |
| 505 | if (ret) |
| 506 | goto err_remove; |
| 507 | |
| 508 | if (PRIV(dev)->state < DEV_PROBED) |
| 509 | return 0; |
| 510 | ret = failsafe_eal_init(dev); |
| 511 | if (ret) |
| 512 | goto err_remove; |
| 513 | if (PRIV(dev)->state < DEV_ACTIVE) |
| 514 | return 0; |
| 515 | inactive = 0; |
| 516 | FOREACH_SUBDEV(sdev, i, dev) { |
| 517 | if (sdev->state == DEV_PROBED) { |
| 518 | inactive |= UINT32_C(1) << i; |
| 519 | ret = eth_dev_flow_isolate_set(dev, sdev); |
| 520 | if (ret) { |
| 521 | ERROR("Could not apply configuration to sub_device %d", |
| 522 | i); |
| 523 | goto err_remove; |
| 524 | } |
| 525 | } |
| 526 | } |
| 527 | ret = dev->dev_ops->dev_configure(dev); |
| 528 | if (ret) |
| 529 | goto err_remove; |
| 530 | FOREACH_SUBDEV(sdev, i, dev) { |
| 531 | if (inactive & (UINT32_C(1) << i)) { |
| 532 | ret = fs_eth_dev_conf_apply(dev, sdev); |
| 533 | if (ret) { |
| 534 | ERROR("Could not apply configuration to sub_device %d", |
| 535 | i); |
| 536 | goto err_remove; |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | /* |
| 541 | * If new devices have been configured, check if |
| 542 | * the link state has changed. |
| 543 | */ |
| 544 | if (inactive) |
| 545 | dev->dev_ops->link_update(dev, 1); |
| 546 | if (PRIV(dev)->state < DEV_STARTED) |
| 547 | return 0; |
| 548 | ret = dev->dev_ops->dev_start(dev); |
| 549 | if (ret) |
| 550 | goto err_remove; |
no test coverage detected