DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Zhao1, Wei" <wei.zhao1@intel.com>
To: Julien Meunier <julien.meunier@nokia.com>,
	"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/2] net/ixgbe: do not start on unsupported loopback mode
Date: Tue, 12 Feb 2019 06:36:22 +0000	[thread overview]
Message-ID: <A2573D2ACFCADC41BB3BE09C6DE313CA07EB1E87@PGSMSX103.gar.corp.intel.com> (raw)
In-Reply-To: <20190207173005.38372-1-julien.meunier@nokia.com>


Hi,  Meunier
   Only a little change need for this patch.

Acked-by: Wei Zhao <wei.zhao1@intel.com>

> -----Original Message-----
> From: Julien Meunier [mailto:julien.meunier@nokia.com]
> Sent: Friday, February 8, 2019 1:30 AM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH 1/2] net/ixgbe: do not start on unsupported loopback mode
> 
> Only TX->RX loopback is supported currently on 82599EB. If a user wants to
> apply an another loopback configuration (!= IXGBE_LPBK_82599_TX_RX),
> ixgbe PMD ignores it and continues the configuration without raising any
> error.
> 
> Let's robustify this part by checking if the requested loopback mode is correct
> for the current device, before starting it. If it is not valid, PMD will refuse to
> start.
> 
> Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
> ---
> v2:
> - factorize code
> - check if loopback is really supported
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 13 +++++++++----
>  drivers/net/ixgbe/ixgbe_rxtx.c   | 37 +++++++++++++++++++++++++++++--
> ------
>  drivers/net/ixgbe/ixgbe_rxtx.h   |  2 ++
>  3 files changed, 40 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 7493110..558f60b 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -2652,10 +2652,15 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
>  		goto error;
>  	}
> 
> -	/* Skip link setup if loopback mode is enabled for 82599. */
> -	if (hw->mac.type == ixgbe_mac_82599EB &&
> -			dev->data->dev_conf.lpbk_mode ==
> IXGBE_LPBK_82599_TX_RX)
> -		goto skip_link_setup;
> +	/* Skip link setup if loopback mode is enabled. */
> +	if (dev->data->dev_conf.lpbk_mode != 0) {
> +		err = ixgbe_check_supported_loopback_mode(dev);
> +		if (err < 0) {
> +			PMD_INIT_LOG(ERR, "Unsupported loopback
> mode");
> +			goto error;
> +		} else
> +			goto skip_link_setup;
> +	}
> 
>  	if (ixgbe_is_sfp(hw) && hw->phy.multispeed_fiber) {
>  		err = hw->mac.ops.setup_sfp(hw);
> diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
> index 9a79d18..c9a70a8 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.c
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.c
> @@ -4879,13 +4879,18 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev)
>  		hlreg0 &= ~IXGBE_HLREG0_JUMBOEN;
> 
>  	/*
> -	 * If loopback mode is configured for 82599, set LPBK bit.
> +	 * If loopback mode is configured, set LPBK bit.
>  	 */
> -	if (hw->mac.type == ixgbe_mac_82599EB &&
> -			dev->data->dev_conf.lpbk_mode ==
> IXGBE_LPBK_82599_TX_RX)
> +	if (dev->data->dev_conf.lpbk_mode != 0) {
> +		rc = ixgbe_check_supported_loopback_mode(dev);
> +		if (rc < 0) {
> +			PMD_INIT_LOG(ERR, "Unsupported loopback
> mode");
> +			return rc;
> +		}
>  		hlreg0 |= IXGBE_HLREG0_LPBK;
> -	else
> +	} else {
>  		hlreg0 &= ~IXGBE_HLREG0_LPBK;
> +	}
> 
>  	IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
> 
> @@ -5062,6 +5067,21 @@ ixgbe_dev_tx_init(struct rte_eth_dev *dev)  }
> 
>  /*
> + * Check if requested loopback mode is supported  */ int
> +ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev) {
> +	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
> +
> +	if (dev->data->dev_conf.lpbk_mode == IXGBE_LPBK_82599_TX_RX)
> +		if (hw->mac.type == ixgbe_mac_82599EB)
> +			return 0;
> +
> +	return -ENOTSUP;
> +}
> +
> +/*
>   * Set up link for 82599 loopback mode Tx->Rx.
>   */
>  static inline void __attribute__((cold)) @@ -5148,10 +5168,11 @@
> ixgbe_dev_rxtx_start(struct rte_eth_dev *dev)
>  	rxctrl |= IXGBE_RXCTRL_RXEN;
>  	hw->mac.ops.enable_rx_dma(hw, rxctrl);
> 
> -	/* If loopback mode is enabled for 82599, set up the link accordingly
> */
> -	if (hw->mac.type == ixgbe_mac_82599EB &&
> -			dev->data->dev_conf.lpbk_mode ==
> IXGBE_LPBK_82599_TX_RX)
> -		ixgbe_setup_loopback_link_82599(hw);
> +	/* If loopback mode is enabled, set up the link accordingly */
> +	if (dev->data->dev_conf.lpbk_mode != 0) {
> +		if (hw->mac.type == ixgbe_mac_82599EB)
> +			ixgbe_setup_loopback_link_82599(hw);
> +	}
> 
>  #ifdef RTE_LIBRTE_SECURITY
>  	if ((dev->data->dev_conf.rxmode.offloads & diff --git
> a/drivers/net/ixgbe/ixgbe_rxtx.h b/drivers/net/ixgbe/ixgbe_rxtx.h index
> 39378f7..2d8011d 100644
> --- a/drivers/net/ixgbe/ixgbe_rxtx.h
> +++ b/drivers/net/ixgbe/ixgbe_rxtx.h
> @@ -276,6 +276,8 @@ void ixgbe_set_tx_function(struct rte_eth_dev *dev,
> struct ixgbe_tx_queue *txq);
>   */
>  void ixgbe_set_rx_function(struct rte_eth_dev *dev);
> 
> +int ixgbe_check_supported_loopback_mode(struct rte_eth_dev *dev);
> +

Space needed?


>  uint16_t ixgbe_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
>  		uint16_t nb_pkts);
>  uint16_t ixgbe_recv_scattered_pkts_vec(void *rx_queue,
> --
> 2.10.2

  parent reply	other threads:[~2019-02-12  6:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-02 16:00 [dpdk-dev] [PATCH] net/ixgbe: add support of loopback for X540/X550 Julien Meunier
2019-01-07  6:53 ` Zhang, Qi Z
2019-01-07 15:53   ` Meunier, Julien (Nokia - FR/Paris-Saclay)
2019-01-08 10:10     ` Zhao1, Wei
2019-01-08 12:39       ` Zhang, Qi Z
2019-01-08 20:18         ` Meunier, Julien (Nokia - FR/Paris-Saclay)
2019-01-09  1:30         ` Zhao1, Wei
2019-01-07 10:05 ` Zhao1, Wei
2019-01-07 16:04   ` Meunier, Julien (Nokia - FR/Paris-Saclay)
2019-01-08  3:10     ` Zhao1, Wei
2019-02-07 17:30 ` [dpdk-dev] [PATCH 1/2] net/ixgbe: do not start on unsupported loopback mode Julien Meunier
2019-02-07 17:30   ` [dpdk-dev] [PATCH 2/2] net/ixgbe: add support of loopback for X540/X550 Julien Meunier
2019-02-12  6:37     ` Zhao1, Wei
2019-02-18 11:20       ` Meunier, Julien (Nokia - FR/Paris-Saclay)
2019-02-12  6:36   ` Zhao1, Wei [this message]
2019-02-20 21:05 ` [dpdk-dev] [PATCH v3 1/2] net/ixgbe: do not start on unsupported loopback mode Julien Meunier
2019-02-20 21:05   ` [dpdk-dev] [PATCH v3 2/2] net/ixgbe: add support of loopback for X540/X550 Julien Meunier
2019-02-21  2:30     ` Zhao1, Wei
2019-03-01  7:46       ` Zhang, Qi Z
2019-03-01  7:45   ` [dpdk-dev] [PATCH v3 1/2] net/ixgbe: do not start on unsupported loopback mode Zhang, Qi Z

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=A2573D2ACFCADC41BB3BE09C6DE313CA07EB1E87@PGSMSX103.gar.corp.intel.com \
    --to=wei.zhao1@intel.com \
    --cc=dev@dpdk.org \
    --cc=julien.meunier@nokia.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=wenzhuo.lu@intel.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).