DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Qiu, Michael" <michael.qiu@intel.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] librte_pmd_ixgbe: Add queue start failure check
Date: Mon, 19 Jan 2015 15:50:58 +0000	[thread overview]
Message-ID: <533710CFB86FA344BFBF2D6802E60286CB76FD@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1421333111-22136-1-git-send-email-michael.qiu@intel.com>

Any comments?

On 2015/1/15 22:45, Qiu, Michael wrote:
> For ixgbe, when queue start failure, for example, mbuf allocate
> failure, the device will still start success, which could be
> an issue.
>
> Add return status check of queue start to avoid this issue.
>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.c |  6 +++++-
>  lib/librte_pmd_ixgbe/ixgbe_ethdev.h |  2 +-
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c   | 22 +++++++++++++++++-----
>  3 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> index 3fc3738..59e3321 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.c
> @@ -1491,7 +1491,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
>  		goto error;
>  	}
>  
> -	ixgbe_dev_rxtx_start(dev);
> +	err = ixgbe_dev_rxtx_start(dev);
> +	if (err < 0) {
> +		PMD_INIT_LOG(ERR, "Unable to start rxtx queues\n");
> +		goto error;
> +	}
>  
>  	if (ixgbe_is_sfp(hw) && hw->phy.multispeed_fiber) {
>  		err = hw->mac.ops.setup_sfp(hw);
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> index ca99170..7461450 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> +++ b/lib/librte_pmd_ixgbe/ixgbe_ethdev.h
> @@ -251,7 +251,7 @@ int ixgbe_dev_rx_init(struct rte_eth_dev *dev);
>  
>  void ixgbe_dev_tx_init(struct rte_eth_dev *dev);
>  
> -void ixgbe_dev_rxtx_start(struct rte_eth_dev *dev);
> +int ixgbe_dev_rxtx_start(struct rte_eth_dev *dev);
>  
>  int ixgbe_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
>  
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index e10d6a2..41a930e 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -3744,7 +3744,7 @@ ixgbe_setup_loopback_link_82599(struct ixgbe_hw *hw)
>  /*
>   * Start Transmit and Receive Units.
>   */
> -void
> +int
>  ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
>  {
>  	struct ixgbe_hw     *hw;
> @@ -3754,6 +3754,7 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
>  	uint32_t dmatxctl;
>  	uint32_t rxctrl;
>  	uint16_t i;
> +	int ret = 0;
>  
>  	PMD_INIT_FUNC_TRACE();
>  	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> @@ -3776,14 +3777,24 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
>  
>  	for (i = 0; i < dev->data->nb_tx_queues; i++) {
>  		txq = dev->data->tx_queues[i];
> -		if (!txq->tx_deferred_start)
> -			ixgbe_dev_tx_queue_start(dev, i);
> +		if (!txq->tx_deferred_start) {
> +			ret = ixgbe_dev_tx_queue_start(dev, i);
> +			if (ret < 0) {
> +				PMD_INIT_LOG(ERR, "Start tx queue failed\n");
> +				return ret;
> +			}
> +		}
>  	}
>  
>  	for (i = 0; i < dev->data->nb_rx_queues; i++) {
>  		rxq = dev->data->rx_queues[i];
> -		if (!rxq->rx_deferred_start)
> -			ixgbe_dev_rx_queue_start(dev, i);
> +		if (!rxq->rx_deferred_start) {
> +			ret = ixgbe_dev_rx_queue_start(dev, i);
> +			if (ret < 0) {
> +				PMD_INIT_LOG(ERR, "Start rx queue failed\n");
> +				return ret;
> +			}
> +		}
>  	}
>  
>  	/* Enable Receive engine */
> @@ -3798,6 +3809,7 @@ ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
>  			dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
>  		ixgbe_setup_loopback_link_82599(hw);
>  
> +	return 0;
>  }
>  
>  /*


  reply	other threads:[~2015-01-19 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 14:45 Michael Qiu
2015-01-19 15:50 ` Qiu, Michael [this message]
2015-01-27 10:00 ` Thomas Monjalon
2015-01-27 12:00   ` Qiu, Michael
2015-01-27 14:14     ` Thomas Monjalon
2015-01-27 12:16 ` [dpdk-dev] [PATCH v2] " Michael Qiu
2015-01-27 14:12   ` Thomas Monjalon

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=533710CFB86FA344BFBF2D6802E60286CB76FD@SHSMSX101.ccr.corp.intel.com \
    --to=michael.qiu@intel.com \
    --cc=dev@dpdk.org \
    /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).