From: Michal Krawczyk Date: Thu, 7 Jun 2018 09:42:59 +0000 (+0200) Subject: net/ena: add interrupt handler for admin queue X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=15773e063feb93f6fa09b6ee73f60b93816c6b63;p=dpdk.git net/ena: add interrupt handler for admin queue The ENA device is able to send MSI-X when it will complete an command when polling mode is deactivated. Further, the same interrupt handler will be used for the AENQ handling - services of the ENA device, that allows to implement watchdog or LSC handler. Signed-off-by: Michal Krawczyk --- diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index f4b137a835..515d17feeb 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -246,6 +246,7 @@ static int ena_rss_reta_query(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); static int ena_get_sset_count(struct rte_eth_dev *dev, int sset); +static void ena_interrupt_handler_rte(void *cb_arg); static const struct eth_dev_ops ena_dev_ops = { .dev_configure = ena_dev_configure, @@ -459,9 +460,16 @@ static void ena_close(struct rte_eth_dev *dev) { struct ena_adapter *adapter = (struct ena_adapter *)(dev->data->dev_private); + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; adapter->state = ENA_ADAPTER_STATE_STOPPED; + rte_intr_disable(intr_handle); + rte_intr_callback_unregister(intr_handle, + ena_interrupt_handler_rte, + adapter); + ena_rx_queue_release_all(dev); ena_tx_queue_release_all(dev); } @@ -908,6 +916,8 @@ static int ena_start(struct rte_eth_dev *dev) { struct ena_adapter *adapter = (struct ena_adapter *)(dev->data->dev_private); + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; int rc = 0; if (!(adapter->state == ENA_ADAPTER_STATE_CONFIG || @@ -937,6 +947,11 @@ static int ena_start(struct rte_eth_dev *dev) ena_stats_restart(dev); + rte_intr_callback_register(intr_handle, + ena_interrupt_handler_rte, + adapter); + rte_intr_enable(intr_handle); + adapter->state = ENA_ADAPTER_STATE_RUNNING; return 0; @@ -1291,6 +1306,14 @@ err_mmio_read_less: return rc; } +static void ena_interrupt_handler_rte(__rte_unused void *cb_arg) +{ + struct ena_adapter *adapter = (struct ena_adapter *)cb_arg; + struct ena_com_dev *ena_dev = &adapter->ena_dev; + + ena_com_admin_q_comp_intr_handler(ena_dev); +} + static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) { struct rte_pci_device *pci_dev;