- rte_spinlock_lock(&hv->vf_lock);
- vf_dev = hv->vf_dev;
- if (vf_dev && vf_dev->dev_ops->link_update)
- ret = (*vf_dev->dev_ops->link_update)(dev, wait_to_complete);
- rte_spinlock_unlock(&hv->vf_lock);
-
- return ret;
-}
-
-/* called when VF has link state interrupts enabled */
-static int hn_vf_lsc_event(uint16_t port_id __rte_unused,
- enum rte_eth_event_type event,
- void *cb_arg, void *out __rte_unused)
-{
- struct rte_eth_dev *dev = cb_arg;
-
- if (event != RTE_ETH_EVENT_INTR_LSC)
- return 0;
-
- /* if link state has changed pass on */
- if (hn_dev_link_update(dev, 0) == 0)
- return 0; /* no change */
-
- return _rte_eth_dev_callback_process(dev,
- RTE_ETH_EVENT_INTR_LSC,
- NULL);
-}
-
-static int _hn_vf_configure(struct rte_eth_dev *dev,
- struct rte_eth_dev *vf_dev,
- const struct rte_eth_conf *dev_conf)
-{
- struct rte_eth_conf vf_conf = *dev_conf;
- uint16_t vf_port = vf_dev->data->port_id;
- int ret;
-
- if (dev_conf->intr_conf.lsc &&
- (vf_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)) {
- PMD_DRV_LOG(DEBUG, "enabling LSC for VF %u",
- vf_port);
- vf_conf.intr_conf.lsc = 1;
- } else {
- PMD_DRV_LOG(DEBUG, "disabling LSC for VF %u",
- vf_port);
- vf_conf.intr_conf.lsc = 0;
- }
-
- ret = rte_eth_dev_configure(vf_port,
- dev->data->nb_rx_queues,
- dev->data->nb_tx_queues,
- &vf_conf);
- if (ret) {
- PMD_DRV_LOG(ERR,
- "VF configuration failed: %d", ret);
- } else if (vf_conf.intr_conf.lsc) {
- ret = rte_eth_dev_callback_register(vf_port,
- RTE_ETH_DEV_INTR_LSC,
- hn_vf_lsc_event, dev);
- if (ret)
- PMD_DRV_LOG(ERR,
- "Failed to register LSC callback for VF %u",
- vf_port);
- }