On 12/21/2015 6:20 PM, Shaopeng He wrote:
> Previous dev_stop function stops the rx/tx queues. This patch adds logic
> to disable rx queue interrupt, clean the datapath event and queue/vec map.
>
> Signed-off-by: Shaopeng He <shaopeng.he at intel.com>
> Acked-by: Jing Chen <jing.d.chen at intel.com>
> ---
>  drivers/net/fm10k/fm10k_ethdev.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c 
> b/drivers/net/fm10k/fm10k_ethdev.c
> index a34c5e2..b5b809c 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -1125,6 +1125,8 @@ fm10k_dev_start(struct rte_eth_dev *dev)
>  static void
>  fm10k_dev_stop(struct rte_eth_dev *dev)
>  {
> +     struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +     struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
>       int i;
>  
>       PMD_INIT_FUNC_TRACE();
> @@ -1136,6 +1138,26 @@ fm10k_dev_stop(struct rte_eth_dev *dev)
>       if (dev->data->rx_queues)
>               for (i = 0; i < dev->data->nb_rx_queues; i++)
>                       fm10k_dev_rx_queue_stop(dev, i);
> +
> +     /* Disable datapath event */
> +     if (rte_intr_dp_is_en(intr_handle)) {
> +             for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +                     FM10K_WRITE_REG(hw, FM10K_RXINT(i),
> +                             3 << FM10K_RXINT_TIMER_SHIFT);
> +                     if (hw->mac.type == fm10k_mac_pf)
> +                             FM10K_WRITE_REG(hw, FM10K_ITR(Q2V(dev, i)),
> +                                     FM10K_ITR_MASK_SET);
> +                     else
> +                             FM10K_WRITE_REG(hw, FM10K_VFITR(Q2V(dev, i)),
> +                                     FM10K_ITR_MASK_SET);
> +             }
> +     }
> +     /* Clean datapath event and queue/vec mapping */
> +     rte_intr_efd_disable(intr_handle);
> +     if (intr_handle->intr_vec != NULL) {

This line could be removed, because rte_free already do the check, see
below:
void rte_free(void *addr)
{
    if (addr == NULL) return;
    if (malloc_elem_free(malloc_elem_from_data(addr)) < 0)
        rte_panic("Fatal error: Invalid memory\n");
}

> +             rte_free(intr_handle->intr_vec);
> +             intr_handle->intr_vec = NULL;
> +     }
>  }
>  
>  static void

Reply via email to