patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Cc: stable@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Yongseok Koh <yskoh@mellanox.com>
Subject: Re: [dpdk-stable] [PATCH 1/3] net/mlx5: fix secondary process verification
Date: Fri, 16 Feb 2018 21:01:09 +0800	[thread overview]
Message-ID: <20180216130109.GC2152@yliu-mob> (raw)
In-Reply-To: <9e4118bfe3df2a78d9cf6d5ca74efe4ece730799.1518598604.git.nelio.laranjeiro@6wind.com>

On Wed, Feb 14, 2018 at 09:58:29AM +0100, Nelio Laranjeiro wrote:
> From: Nélio Laranjeiro <nelio.laranjeiro@6wind.com>
> 
> [ backported from upstream commit 51e7fa8d20876cb221b11013cd23b1881cc9b75c ]

All 3 patches are applied to dpdk-stable/17.11.

Thanks!

	--yliu
> 
> Since the secondary process has its own devops, function which cannot be
> called by the secondary don't need anymore to verify which process is
> calling it.
> 
> Fixes: 87ec44ce1651 ("net/mlx5: add operations for secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5.c         |  4 +---
>  drivers/net/mlx5/mlx5_ethdev.c  | 25 -------------------------
>  drivers/net/mlx5/mlx5_mac.c     |  6 ------
>  drivers/net/mlx5/mlx5_rss.c     |  1 -
>  drivers/net/mlx5/mlx5_rxmode.c  |  8 --------
>  drivers/net/mlx5/mlx5_rxq.c     |  6 ------
>  drivers/net/mlx5/mlx5_trigger.c |  6 ------
>  drivers/net/mlx5/mlx5_txq.c     |  6 ------
>  8 files changed, 1 insertion(+), 61 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 47ac8af48..45e0e8dba 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -158,7 +158,6 @@ mlx5_alloc_verbs_buf(size_t size, void *data)
>  	size_t alignment = sysconf(_SC_PAGESIZE);
>  
>  	assert(data != NULL);
> -	assert(!mlx5_is_secondary());
>  	ret = rte_malloc_socket(__func__, size, alignment,
>  				priv->dev->device->numa_node);
>  	DEBUG("Extern alloc size: %lu, align: %lu: %p", size, alignment, ret);
> @@ -177,7 +176,6 @@ static void
>  mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)
>  {
>  	assert(data != NULL);
> -	assert(!mlx5_is_secondary());
>  	DEBUG("Extern free request: %p", ptr);
>  	rte_free(ptr);
>  }
> @@ -692,7 +690,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
>  
>  		mlx5_dev[idx].ports |= test;
>  
> -		if (mlx5_is_secondary()) {
> +		if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
>  			eth_dev = rte_eth_dev_attach_secondary(name);
>  			if (eth_dev == NULL) {
>  				ERROR("can not attach rte ethdev");
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index fc0860fbc..ffe1cdd64 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -134,18 +134,6 @@ mlx5_get_priv(struct rte_eth_dev *dev)
>  }
>  
>  /**
> - * Check if running as a secondary process.
> - *
> - * @return
> - *   Nonzero if running as a secondary process.
> - */
> -inline int
> -mlx5_is_secondary(void)
> -{
> -	return rte_eal_process_type() == RTE_PROC_SECONDARY;
> -}
> -
> -/**
>   * Get interface name from private structure.
>   *
>   * @param[in] priv
> @@ -649,9 +637,6 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
>  	struct priv *priv = dev->data->dev_private;
>  	int ret;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	priv_lock(priv);
>  	ret = dev_configure(dev);
>  	assert(ret >= 0);
> @@ -1059,9 +1044,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
>  	uint16_t kern_mtu;
>  	int ret = 0;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	priv_lock(priv);
>  	ret = priv_get_mtu(priv, &kern_mtu);
>  	if (ret)
> @@ -1109,9 +1091,6 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
>  	};
>  	int ret;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	ifr.ifr_data = (void *)&ethpause;
>  	priv_lock(priv);
>  	if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) {
> @@ -1160,9 +1139,6 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
>  	};
>  	int ret;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	ifr.ifr_data = (void *)&ethpause;
>  	ethpause.autoneg = fc_conf->autoneg;
>  	if (((fc_conf->mode & RTE_FC_FULL) == RTE_FC_FULL) ||
> @@ -1429,7 +1405,6 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev)
>  {
>  	int rc, flags;
>  
> -	assert(!mlx5_is_secondary());
>  	assert(priv->ctx->async_fd > 0);
>  	flags = fcntl(priv->ctx->async_fd, F_GETFL);
>  	rc = fcntl(priv->ctx->async_fd, F_SETFL, flags | O_NONBLOCK);
> diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c
> index d17b991e4..9fb5ba5e7 100644
> --- a/drivers/net/mlx5/mlx5_mac.c
> +++ b/drivers/net/mlx5/mlx5_mac.c
> @@ -93,8 +93,6 @@ priv_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN])
>  void
>  mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	assert(index < MLX5_MAX_MAC_ADDRESSES);
>  	memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr));
>  	if (!dev->data->promiscuous && !dev->data->all_multicast)
> @@ -124,8 +122,6 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
>  	int ret = 0;
>  
>  	(void)vmdq;
> -	if (mlx5_is_secondary())
> -		return 0;
>  	assert(index < MLX5_MAX_MAC_ADDRESSES);
>  	/* First, make sure this address isn't already configured. */
>  	for (i = 0; (i != MLX5_MAX_MAC_ADDRESSES); ++i) {
> @@ -154,8 +150,6 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac,
>  void
>  mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	DEBUG("%p: setting primary MAC address", (void *)dev);
>  	mlx5_mac_addr_add(dev, mac_addr, 0, 0);
>  }
> diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
> index 7c0cf4de8..f47bda667 100644
> --- a/drivers/net/mlx5/mlx5_rss.c
> +++ b/drivers/net/mlx5/mlx5_rss.c
> @@ -279,7 +279,6 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
>  	int ret;
>  	struct priv *priv = dev->data->dev_private;
>  
> -	assert(!mlx5_is_secondary());
>  	priv_lock(priv);
>  	ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size);
>  	priv_unlock(priv);
> diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
> index 0ef2cdf09..6fb245ba1 100644
> --- a/drivers/net/mlx5/mlx5_rxmode.c
> +++ b/drivers/net/mlx5/mlx5_rxmode.c
> @@ -60,8 +60,6 @@
>  void
>  mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	dev->data->promiscuous = 1;
>  	mlx5_traffic_restart(dev);
>  }
> @@ -75,8 +73,6 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>  void
>  mlx5_promiscuous_disable(struct rte_eth_dev *dev)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	dev->data->promiscuous = 0;
>  	mlx5_traffic_restart(dev);
>  }
> @@ -90,8 +86,6 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
>  void
>  mlx5_allmulticast_enable(struct rte_eth_dev *dev)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	dev->data->all_multicast = 1;
>  	mlx5_traffic_restart(dev);
>  }
> @@ -105,8 +99,6 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
>  void
>  mlx5_allmulticast_disable(struct rte_eth_dev *dev)
>  {
> -	if (mlx5_is_secondary())
> -		return;
>  	dev->data->all_multicast = 0;
>  	mlx5_traffic_restart(dev);
>  }
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 85399eff5..20f3ec6c9 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -242,8 +242,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  	int ret = 0;
>  
>  	(void)conf;
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
>  	priv_lock(priv);
>  	if (!rte_is_power_of_2(desc)) {
>  		desc = 1 << log2above(desc);
> @@ -294,9 +292,6 @@ mlx5_rx_queue_release(void *dpdk_rxq)
>  	struct mlx5_rxq_ctrl *rxq_ctrl;
>  	struct priv *priv;
>  
> -	if (mlx5_is_secondary())
> -		return;
> -
>  	if (rxq == NULL)
>  		return;
>  	rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);
> @@ -327,7 +322,6 @@ priv_rx_intr_vec_enable(struct priv *priv)
>  	unsigned int count = 0;
>  	struct rte_intr_handle *intr_handle = priv->dev->intr_handle;
>  
> -	assert(!mlx5_is_secondary());
>  	if (!priv->dev->data->dev_conf.intr_conf.rxq)
>  		return 0;
>  	priv_rx_intr_vec_disable(priv);
> diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
> index bbb7b531b..d682ea2c9 100644
> --- a/drivers/net/mlx5/mlx5_trigger.c
> +++ b/drivers/net/mlx5/mlx5_trigger.c
> @@ -135,9 +135,6 @@ mlx5_dev_start(struct rte_eth_dev *dev)
>  	struct mlx5_mr *mr = NULL;
>  	int err;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	dev->data->dev_started = 1;
>  	priv_lock(priv);
>  	err = priv_flow_create_drop_queue(priv);
> @@ -207,9 +204,6 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
>  	struct priv *priv = dev->data->dev_private;
>  	struct mlx5_mr *mr;
>  
> -	if (mlx5_is_secondary())
> -		return;
> -
>  	priv_lock(priv);
>  	dev->data->dev_started = 0;
>  	/* Prevent crashes when queues are still in use. */
> diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
> index 31110a732..7ca99f5aa 100644
> --- a/drivers/net/mlx5/mlx5_txq.c
> +++ b/drivers/net/mlx5/mlx5_txq.c
> @@ -142,9 +142,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
>  		container_of(txq, struct mlx5_txq_ctrl, txq);
>  	int ret = 0;
>  
> -	if (mlx5_is_secondary())
> -		return -E_RTE_SECONDARY;
> -
>  	priv_lock(priv);
>  	if (desc <= MLX5_TX_COMP_THRESH) {
>  		WARN("%p: number of descriptors requested for TX queue %u"
> @@ -203,9 +200,6 @@ mlx5_tx_queue_release(void *dpdk_txq)
>  	struct priv *priv;
>  	unsigned int i;
>  
> -	if (mlx5_is_secondary())
> -		return;
> -
>  	if (txq == NULL)
>  		return;
>  	txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq);
> -- 
> 2.11.0

  reply	other threads:[~2018-02-16 13:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07  9:31 [dpdk-stable] please help backporting some patches to LTS release 17.11.1 Yuanhan Liu
2018-02-08  7:44 ` [dpdk-stable] 答复: " wang.yong19
2018-02-08  8:46 ` [dpdk-stable] " Pavan Nikhilesh
2018-02-08  8:56   ` Yuanhan Liu
2018-02-11  4:54 ` Yuanhan Liu
2018-02-12 10:36 ` Burakov, Anatoly
2018-02-13 11:46   ` Yuanhan Liu
2018-02-13 11:49     ` Burakov, Anatoly
2018-02-20 11:02       ` Burakov, Anatoly
2019-03-06 10:56         ` Burakov, Anatoly
2019-03-06 19:03           ` Yongseok Koh
2019-03-07 12:04             ` Burakov, Anatoly
2019-03-07 20:10               ` Yongseok Koh
2018-02-14  8:58 ` [dpdk-stable] [PATCH 1/3] net/mlx5: fix secondary process verification Nelio Laranjeiro
2018-02-16 13:01   ` Yuanhan Liu [this message]
2018-02-14  8:58 ` [dpdk-stable] [PATCH 2/3] net/mlx5: fix port stop by verify flows are still present Nelio Laranjeiro
2018-02-14  8:58 ` [dpdk-stable] [PATCH 3/3] net/mlx5: fix flow priority on queue action Nelio Laranjeiro
2018-02-27  9:36 ` [dpdk-stable] [PATCH 1/3] Revert "net/mlx5: fix flow priority on queue action" Nelio Laranjeiro
2018-02-27  9:49   ` Yuanhan Liu
2018-02-27  9:36 ` [dpdk-stable] [PATCH 2/3] net/mlx5: remove parser/flow drop queue Nelio Laranjeiro
2018-02-27  9:36 ` [dpdk-stable] [PATCH 3/3] net/mlx5: fix flow priority on queue action Nelio Laranjeiro

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=20180216130109.GC2152@yliu-mob \
    --to=yliu@fridaylinux.org \
    --cc=adrien.mazarguil@6wind.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=stable@dpdk.org \
    --cc=yskoh@mellanox.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).