From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7143EA0A0C; Fri, 2 Jul 2021 18:08:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 383C241363; Fri, 2 Jul 2021 18:08:37 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id A6DDE41353 for ; Fri, 2 Jul 2021 18:08:35 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 27CDE7F517; Fri, 2 Jul 2021 19:08:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 27CDE7F517 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1625242115; bh=0bhz38N6v52WIQDEqbTjjky49VItJtTy4RHHFjrnjf8=; h=Subject:To:References:From:Date:In-Reply-To; b=ho9P6HtkJ9Mqcl8VwBZ1qjdtu4Hfcp84boBZWGyYU1fcKFjLv22zDFzmyuGK7ggyh 7q7l9CYAb1OWTFLNwoswGB3C/r1CKgJaNuOSfQ4zJWAkD1IB4f+OE6awsX7KMCvBa7 wmm6QRivJHoBbdRP/ECvu1Irq5bJ8Lq+hGsHcRLk= To: Jiawen Wu , dev@dpdk.org References: <20210617110005.4132926-1-jiawenwu@trustnetic.com> <20210617110005.4132926-8-jiawenwu@trustnetic.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <4b0e19ac-7f94-3a21-55ff-aa9f98ca5fe8@oktetlabs.ru> Date: Fri, 2 Jul 2021 19:08:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210617110005.4132926-8-jiawenwu@trustnetic.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 07/19] net/ngbe: add HW initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 [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; > } > >