From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 68B571B53 for ; Fri, 21 Sep 2018 15:27:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2018 06:27:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="71831100" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.39]) ([10.237.221.39]) by fmsmga007.fm.intel.com with ESMTP; 21 Sep 2018 06:27:34 -0700 To: Gagandeep Singh , dev@dpdk.org Cc: pankaj.chauhan@nxp.com References: <20180906055449.21731-1-g.singh@nxp.com> <20180913094201.17098-1-g.singh@nxp.com> <20180913094201.17098-3-g.singh@nxp.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: <6161caa1-1ad1-7010-d50a-9b0e086bcb43@intel.com> Date: Fri, 21 Sep 2018 14:27:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180913094201.17098-3-g.singh@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/enetc: add ENETC PMD with basic operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Sep 2018 13:27:37 -0000 On 9/13/2018 10:42 AM, Gagandeep Singh wrote: > This patch introduces the enetc PMD with basic > initialisation functions includes probe, teardown, > hardware initialisation > > Signed-off-by: Gagandeep Singh <...> > @@ -0,0 +1,24 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright 2018 NXP > + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# > +# library name > +# > +LIB = librte_pmd_enetc.a > + > +CFLAGS += -O3 Can you please add following to catch errors. +CFLAGS += $(WERROR_FLAGS) <...> > +struct enetc_eth_mac_info { > + uint8_t addr[ETH_ADDR_LEN]; > + uint8_t perm_addr[ETH_ADDR_LEN]; > + bool get_link_status; Don't use bool in structures, this is slightly new, please check: https://patches.dpdk.org/patch/44817/ <...> > +/* > + * RX/TX ENETC function prototypes > + */ > +int enetc_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, > + uint16_t nb_rx_desc, unsigned int socket_id, > + const struct rte_eth_rxconf *rx_conf, > + struct rte_mempool *mb_pool); > + > +int enetc_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, > + uint16_t nb_tx_desc, unsigned int socket_id, > + const struct rte_eth_txconf *tx_conf); > + > +uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts, > + uint16_t nb_pkts); > +uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, > + uint16_t nb_pkts); Should these function declerations be in next patch? <...> > +static int > +enetc_dev_init(struct rte_eth_dev *eth_dev) > +{ > + int error = 0, i; > + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); > + struct enetc_eth_hw *hw = > + ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > + struct enetc_eth_adapter *adapter = > + ENETC_DEV_PRIVATE(eth_dev->data->dev_private); > + > + PMD_INIT_FUNC_TRACE(); > + eth_dev->dev_ops = &enetc_ops; > + eth_dev->rx_pkt_burst = NULL; > + eth_dev->tx_pkt_burst = NULL; > + > + rte_eth_copy_pci_info(eth_dev, pci_dev); Isn't this alredy done by rte_eth_dev_pci_generic_probe() ? > + > + /* Retrieving and storing the HW base address of device */ > + hw->hw.reg = (void *)pci_dev->mem_resource[0].addr; > + > + adapter->tx_bd_count = MAX_BD_COUNT; > + adapter->rx_bd_count = MAX_BD_COUNT; > + > + adapter->num_rx_rings = MAX_RX_RINGS; > + adapter->num_tx_rings = MAX_TX_RINGS; > + > + for (i = 0; i < adapter->num_rx_rings; i++) { > + adapter->rx_ring[i] = rte_zmalloc(NULL, > + sizeof(struct enetc_bdr), 0); > + if (!adapter->rx_ring[i]) { > + ENETC_PMD_ERR("Failed to allocate RX ring memory"); > + while (--i >= 0) > + rte_free(adapter->rx_ring[i]); > + error = -ENOMEM; > + goto err_late; > + } > + adapter->rx_ring[i]->bd_count = adapter->rx_bd_count; > + } There are dev->data->nb_rx_queues & dev->data->nb_tx_queues variables set with user provided values, Also there are dev->data->rx_queues & dev->data->tx_queues already allocated by ethdev according queue numbers. Why you are not using them but having a private version of them and use them? <...> > +static int > +enetc_dev_uninit(struct rte_eth_dev *eth_dev) error: unused parameter ‘eth_dev’ [-Werror=unused-parameter] same is valid for below a few more functions. <...> > +static int > +enetc_hardware_init(struct enetc_eth_hw *hw) > +{ > + uint32_t psipmr = 0; > + > + /* Calculating and storing the base HW addresses */ > + hw->hw.port = hw->hw.reg + ENETC_PORT_BASE; > + hw->hw.global = hw->hw.reg + ENETC_GLOBAL_BASE; error: pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith] You will get more of this when warnings enabled (please check above suggested change on Makefile) <...> > +static void > +enetc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > +{ > + struct enetc_eth_adapter *adapter = > + ENETC_DEV_PRIVATE(dev->data->dev_private); > + > + dev_info->max_rx_queues = adapter->num_rx_rings; > + dev_info->max_tx_queues = adapter->num_tx_rings; > + dev_info->max_rx_pktlen = 1500 rte_eth_dev_info_get() also returns dev_info->nb_rx_queues & dev_info->nb_tx_queues based on dev->data->nb_[r/t]x_queues but that is wrong for this driver becase it uses different values as number of [r/t]x queues. This is related to the above comment. Using dev->data->nb_[r/t]x_queues instead of adapter->num_[r/t]x_rings will fix this.