net/ixgbe: fix blocked interrupts
authorQi Zhang <qi.z.zhang@intel.com>
Mon, 16 Jan 2017 19:23:52 +0000 (14:23 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 30 Jan 2017 21:18:26 +0000 (22:18 +0100)
While handling link status change (LSC) interrupt, all interrupts are
blocked until delayed interrupt handler finishes.

The wait duration is at least one second and this may cause timeouts in
VF to PF mailbox.

Make sure only LSC interrupt is blocked while waiting for delayed
interrupt handler to finish.

Fixes: 0a45657a6794 ("pci: rework interrupt handling")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/ixgbe/ixgbe_ethdev.h

index bdf4e2b..ad63e5a 100644 (file)
@@ -3786,7 +3786,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
                IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
        int64_t timeout;
        struct rte_eth_link link;
                IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
        int64_t timeout;
        struct rte_eth_link link;
-       int intr_enable_delay = false;
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -3819,20 +3818,19 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev,
                        timeout = IXGBE_LINK_DOWN_CHECK_TIMEOUT;
 
                ixgbe_dev_link_status_print(dev);
                        timeout = IXGBE_LINK_DOWN_CHECK_TIMEOUT;
 
                ixgbe_dev_link_status_print(dev);
-
-               intr_enable_delay = true;
-       }
-
-       if (intr_enable_delay) {
+               intr->mask_original = intr->mask;
+               /* only disable lsc interrupt */
+               intr->mask &= ~IXGBE_EIMS_LSC;
                if (rte_eal_alarm_set(timeout * 1000,
                                      ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0)
                        PMD_DRV_LOG(ERR, "Error setting alarm");
                if (rte_eal_alarm_set(timeout * 1000,
                                      ixgbe_dev_interrupt_delayed_handler, (void *)dev) < 0)
                        PMD_DRV_LOG(ERR, "Error setting alarm");
-       } else {
-               PMD_DRV_LOG(DEBUG, "enable intr immediately");
-               ixgbe_enable_intr(dev);
-               rte_intr_enable(intr_handle);
+               else
+                       intr->mask = intr->mask_original;
        }
 
        }
 
+       PMD_DRV_LOG(DEBUG, "enable intr immediately");
+       ixgbe_enable_intr(dev);
+       rte_intr_enable(intr_handle);
 
        return 0;
 }
 
        return 0;
 }
@@ -3863,6 +3861,8 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t eicr;
 
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
        uint32_t eicr;
 
+       ixgbe_disable_intr(hw);
+
        eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
        if (eicr & IXGBE_EICR_MAILBOX)
                ixgbe_pf_mbx_process(dev);
        eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
        if (eicr & IXGBE_EICR_MAILBOX)
                ixgbe_pf_mbx_process(dev);
@@ -3885,6 +3885,10 @@ ixgbe_dev_interrupt_delayed_handler(void *param)
                intr->flags &= ~IXGBE_FLAG_MACSEC;
        }
 
                intr->flags &= ~IXGBE_FLAG_MACSEC;
        }
 
+       /* restore original mask */
+       intr->mask = intr->mask_original;
+       intr->mask_original = 0;
+
        PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
        ixgbe_enable_intr(dev);
        rte_intr_enable(intr_handle);
        PMD_DRV_LOG(DEBUG, "enable intr in delayed handler S[%08x]", eicr);
        ixgbe_enable_intr(dev);
        rte_intr_enable(intr_handle);
index 6695b68..680d5d9 100644 (file)
@@ -200,6 +200,8 @@ struct ixgbe_hw_fdir_info {
 struct ixgbe_interrupt {
        uint32_t flags;
        uint32_t mask;
 struct ixgbe_interrupt {
        uint32_t flags;
        uint32_t mask;
+       /*to save original mask during delayed handler */
+       uint32_t mask_original;
 };
 
 struct ixgbe_stat_mapping_registers {
 };
 
 struct ixgbe_stat_mapping_registers {