DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Gagandeep Singh <g.singh@nxp.com>, dev@dpdk.org
Cc: pankaj.chauhan@nxp.com
Subject: Re: [dpdk-dev] [PATCH v2 2/3] net/enetc: add ENETC PMD with basic operations
Date: Fri, 21 Sep 2018 14:27:33 +0100	[thread overview]
Message-ID: <6161caa1-1ad1-7010-d50a-9b0e086bcb43@intel.com> (raw)
In-Reply-To: <20180913094201.17098-3-g.singh@nxp.com>

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 <g.singh@nxp.com>
<...>

> @@ -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.

  reply	other threads:[~2018-09-21 13:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  5:54 [dpdk-dev] [PATCH 0/3] introduces the ENETC PMD Gagandeep Singh
2018-09-06  5:54 ` [dpdk-dev] [PATCH 1/3] doc: add usage doc for " Gagandeep Singh
2018-09-06  5:54 ` [dpdk-dev] [PATCH 2/3] net/enetc: add ENETC PMD with basic operations Gagandeep Singh
2018-09-19 12:15   ` Shreyansh Jain
2018-09-06  5:54 ` [dpdk-dev] [PATCH 3/3] net/enetc: enable Rx and Tx Gagandeep Singh
2018-09-13  9:41 ` [dpdk-dev] [PATCH v2 0/3] introduces the enetc PMD driver Gagandeep Singh
2018-09-13  9:41   ` [dpdk-dev] [PATCH v2 1/3] doc: add usage doc for ENETC PMD Gagandeep Singh
2018-09-21 13:22     ` Ferruh Yigit
2018-09-13  9:42   ` [dpdk-dev] [PATCH v2 2/3] net/enetc: add ENETC PMD with basic operations Gagandeep Singh
2018-09-21 13:27     ` Ferruh Yigit [this message]
2018-09-13  9:42   ` [dpdk-dev] [PATCH v2 3/3] net/enetc: enable Rx and Tx Gagandeep Singh
2018-09-19 12:26     ` Shreyansh Jain
2018-09-21 13:28     ` Ferruh Yigit
2018-09-28  5:16   ` [dpdk-dev] [PATCH v3 0/3] introduces the enetc PMD driver Gagandeep Singh
2018-09-28  5:16     ` [dpdk-dev] [PATCH v3 1/3] net/enetc: enable Rx and Tx Gagandeep Singh
2018-09-28  5:16     ` [dpdk-dev] [PATCH v3 2/3] net/enetc: support packet parse type Gagandeep Singh
2018-09-28  5:16     ` [dpdk-dev] [PATCH v3 3/3] doc: add usage doc for ENETC PMD Gagandeep Singh
2018-09-28  5:26     ` [dpdk-dev] [PATCH v3 0/3] introduces the enetc PMD driver Gagandeep Singh
2018-09-28  7:45     ` [dpdk-dev] [PATCH v4 0/4] " Gagandeep Singh
2018-09-28  7:45       ` [dpdk-dev] [PATCH v4 1/4] net/enetc: add ENETC PMD with basic operations Gagandeep Singh
2018-10-01 15:58         ` Ferruh Yigit
2018-09-28  7:45       ` [dpdk-dev] [PATCH v4 2/4] net/enetc: enable Rx and Tx Gagandeep Singh
2018-10-01 15:59         ` Ferruh Yigit
2018-09-28  7:46       ` [dpdk-dev] [PATCH v4 3/4] net/enetc: support packet parse type Gagandeep Singh
2018-09-28 10:17         ` Shreyansh Jain
2018-10-01 15:59           ` Ferruh Yigit
2018-09-28  7:46       ` [dpdk-dev] [PATCH v4 4/4] doc: add usage doc for ENETC PMD Gagandeep Singh
2018-10-01 16:00         ` Ferruh Yigit
2018-09-28 10:36       ` [dpdk-dev] [PATCH v4 0/4] introduces the enetc PMD driver Shreyansh Jain
2018-10-03 13:36       ` [dpdk-dev] [PATCH v5 " Gagandeep Singh
2018-10-03 13:36         ` [dpdk-dev] [PATCH v5 1/4] net/enetc: add ENETC PMD with basic operations Gagandeep Singh
2018-10-03 19:47           ` Ferruh Yigit
2018-10-03 13:36         ` [dpdk-dev] [PATCH v5 2/4] net/enetc: enable Rx and Tx Gagandeep Singh
2018-10-03 13:36         ` [dpdk-dev] [PATCH v5 3/4] net/enetc: support packet parse type Gagandeep Singh
2018-10-03 13:36         ` [dpdk-dev] [PATCH v5 4/4] doc: add usage doc for ENETC PMD Gagandeep Singh
2018-10-03 19:47           ` Ferruh Yigit
2018-10-03 19:48         ` [dpdk-dev] [PATCH v5 0/4] introduces the enetc PMD driver Ferruh Yigit
2018-11-21 17:36           ` Ferruh Yigit
2018-11-22 10:34             ` Shreyansh Jain
2018-11-22 12:08               ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6161caa1-1ad1-7010-d50a-9b0e086bcb43@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=g.singh@nxp.com \
    --cc=pankaj.chauhan@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).