[v2,3/4] net/iavf_client: enable interrupt of control queue
Checks
Commit Message
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/net/iavf/iavf_client_ethdev.c | 29 +++++++++++++++++++++------
drivers/net/iavf/iavf_ethdev.c | 9 +++------
2 files changed, 26 insertions(+), 12 deletions(-)
@@ -59,6 +59,7 @@ iavf_client_vfio_user_setup(struct rte_eth_dev *dev, const char *path)
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct vfio_device *vfio_dev;
+ uint32_t max_fds, i;
vfio_dev = client_vfio_user_setup(path, dev->device->numa_node);
if (vfio_dev == NULL) {
@@ -87,11 +88,21 @@ iavf_client_vfio_user_setup(struct rte_eth_dev *dev, const char *path)
}
}
-
dev->intr_handle->fd = vfio_dev->irqfds[0];
dev->intr_handle->type = RTE_INTR_HANDLE_VDEV;
dev->intr_handle->max_intr = 1;
+ /* Assign rxq fds */
+ if (vfio_dev->nb_irqs > 1) {
+ max_fds = RTE_MIN((uint32_t)RTE_MAX_RXTX_INTR_VEC_ID,
+ vfio_dev->nb_irqs - 1);
+ dev->intr_handle->nb_efd = max_fds;
+ for (i = 0; i < max_fds; ++i)
+ dev->intr_handle->efds[i] =
+ vfio_dev->irqfds[i + RTE_INTR_VEC_RXTX_OFFSET];
+ dev->intr_handle->efd_counter_size = 0;
+ dev->intr_handle->max_intr += max_fds;
+ }
return 0;
}
@@ -108,8 +119,6 @@ avf_client_init_eth_ops(void)
iavf_client_eth_dev_ops.reta_query = NULL;
iavf_client_eth_dev_ops.rss_hash_update = NULL;
iavf_client_eth_dev_ops.rss_hash_conf_get = NULL;
- iavf_client_eth_dev_ops.rx_queue_intr_enable = NULL;
- iavf_client_eth_dev_ops.rx_queue_intr_disable = NULL;
}
#define IAVF_CLIENT_ALARM_INTERVAL 50000 /* us */
@@ -227,11 +236,12 @@ iavf_client_dev_close(struct rte_eth_dev *dev)
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_intr_handle *intr_handle = dev->intr_handle;
if (adapter->intr_mode) {
iavf_disable_irq0(hw);
/* unregister callback func from eal lib */
- rte_intr_callback_unregister(dev->intr_handle,
+ rte_intr_callback_unregister(intr_handle,
iavf_client_event_handler, dev);
} else {
rte_eal_alarm_cancel(iavf_client_dev_alarm_handler, dev);
@@ -240,8 +250,15 @@ iavf_client_dev_close(struct rte_eth_dev *dev)
if (!adapter->stopped) {
iavf_stop_queues(dev);
- if (dev->intr_handle) {
- rte_free(dev->intr_handle);
+ if (intr_handle) {
+ /* Disable the interrupt for Rx */
+ rte_intr_efd_disable(intr_handle);
+ /* Rx interrupt vector mapping free */
+ if (intr_handle->intr_vec) {
+ rte_free(intr_handle->intr_vec);
+ intr_handle->intr_vec = NULL;
+ }
+ rte_free(intr_handle);
dev->intr_handle = NULL;
}
@@ -1368,11 +1368,10 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
{
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
uint16_t msix_intr;
- msix_intr = pci_dev->intr_handle.intr_vec[queue_id];
+ msix_intr = dev->intr_handle->intr_vec[queue_id];
if (msix_intr == IAVF_MISC_VEC_ID) {
PMD_DRV_LOG(INFO, "MISC is also enabled for control");
IAVF_WRITE_REG(hw, IAVF_VFINT_DYN_CTL01,
@@ -1387,10 +1386,9 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
IAVF_VFINT_DYN_CTL01_CLEARPBA_MASK |
IAVF_VFINT_DYN_CTLN1_ITR_INDX_MASK);
}
-
IAVF_WRITE_FLUSH(hw);
- rte_intr_ack(&pci_dev->intr_handle);
+ rte_intr_ack(dev->intr_handle);
return 0;
}
@@ -1398,11 +1396,10 @@ iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
static int
iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
uint16_t msix_intr;
- msix_intr = pci_dev->intr_handle.intr_vec[queue_id];
+ msix_intr = dev->intr_handle->intr_vec[queue_id];
if (msix_intr == IAVF_MISC_VEC_ID) {
PMD_DRV_LOG(ERR, "MISC is used for control, cannot disable it");
return -EIO;