On 6/17/21 1:59 PM, Jiawen Wu wrote:
> Initialize the hardware by resetting the hardware in base code.
> 
> Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>

[snip]

> diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
> index c779c46dd5..31d4dda976 100644
> --- a/drivers/net/ngbe/ngbe_ethdev.c
> +++ b/drivers/net/ngbe/ngbe_ethdev.c
> @@ -60,6 +60,7 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void 
> *init_params __rte_unused)
>  {
>       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>       struct ngbe_hw *hw = ngbe_dev_hw(eth_dev);
> +     const struct rte_memzone *mz;
>       int err;
>  
>       PMD_INIT_FUNC_TRACE();
> @@ -76,6 +77,15 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void 
> *init_params __rte_unused)
>       ngbe_map_device_id(hw);
>       hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
>  
> +     /* Reserve memory for interrupt status block */
> +     mz = rte_eth_dma_zone_reserve(eth_dev, "ngbe_driver", -1,
> +             NGBE_ISB_SIZE, NGBE_ALIGN, SOCKET_ID_ANY);
> +     if (mz == NULL)
> +             return -ENOMEM;
> +
> +     hw->isb_dma = TMZ_PADDR(mz);
> +     hw->isb_mem = TMZ_VADDR(mz);
> +
>       /* Initialize the shared code (base driver) */
>       err = ngbe_init_shared_code(hw);
>       if (err != 0) {
> @@ -99,6 +109,13 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void 
> *init_params __rte_unused)
>               return -EIO;
>       }
>  
> +     err = hw->mac.init_hw(hw);
> +

Please, remove the empty line to avoid logical separation
of the operation and its result check.

> +     if (err != 0) {
> +             PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d", err);
> +             return -EIO;
> +     }
> +
>       return 0;
>  }
>  
> 

Reply via email to