| 22 | #include "failsafe_private.h" |
| 23 | |
| 24 | static int |
| 25 | fs_dev_configure(struct rte_eth_dev *dev) |
| 26 | { |
| 27 | struct sub_device *sdev; |
| 28 | uint8_t i; |
| 29 | int ret; |
| 30 | |
| 31 | ret = fs_lock(dev, 0); |
| 32 | if (ret != 0) |
| 33 | return ret; |
| 34 | FOREACH_SUBDEV(sdev, i, dev) { |
| 35 | int rmv_interrupt = 0; |
| 36 | int lsc_interrupt = 0; |
| 37 | int lsc_enabled; |
| 38 | |
| 39 | if (sdev->state != DEV_PROBED && |
| 40 | !(PRIV(dev)->alarm_lock == 0 && sdev->state == DEV_ACTIVE)) |
| 41 | continue; |
| 42 | |
| 43 | rmv_interrupt = ETH(sdev)->data->dev_flags & |
| 44 | RTE_ETH_DEV_INTR_RMV; |
| 45 | if (rmv_interrupt) { |
| 46 | DEBUG("Enabling RMV interrupts for sub_device %d", i); |
| 47 | dev->data->dev_conf.intr_conf.rmv = 1; |
| 48 | } else { |
| 49 | DEBUG("sub_device %d does not support RMV event", i); |
| 50 | } |
| 51 | lsc_enabled = dev->data->dev_conf.intr_conf.lsc; |
| 52 | lsc_interrupt = lsc_enabled && |
| 53 | (ETH(sdev)->data->dev_flags & |
| 54 | RTE_ETH_DEV_INTR_LSC); |
| 55 | if (lsc_interrupt) { |
| 56 | DEBUG("Enabling LSC interrupts for sub_device %d", i); |
| 57 | dev->data->dev_conf.intr_conf.lsc = 1; |
| 58 | } else if (lsc_enabled && !lsc_interrupt) { |
| 59 | DEBUG("Disabling LSC interrupts for sub_device %d", i); |
| 60 | dev->data->dev_conf.intr_conf.lsc = 0; |
| 61 | } |
| 62 | DEBUG("Configuring sub-device %d", i); |
| 63 | ret = rte_eth_dev_configure(PORT_ID(sdev), |
| 64 | dev->data->nb_rx_queues, |
| 65 | dev->data->nb_tx_queues, |
| 66 | &dev->data->dev_conf); |
| 67 | if (ret) { |
| 68 | if (!fs_err(sdev, ret)) |
| 69 | continue; |
| 70 | ERROR("Could not configure sub_device %d", i); |
| 71 | fs_unlock(dev, 0); |
| 72 | return ret; |
| 73 | } |
| 74 | if (rmv_interrupt && sdev->rmv_callback == 0) { |
| 75 | ret = rte_eth_dev_callback_register(PORT_ID(sdev), |
| 76 | RTE_ETH_EVENT_INTR_RMV, |
| 77 | failsafe_eth_rmv_event_callback, |
| 78 | sdev); |
| 79 | if (ret) |
| 80 | WARN("Failed to register RMV callback for sub_device %d", |
| 81 | SUB_ID(sdev)); |
nothing calls this directly
no test coverage detected