All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] net/mlx5: cleanups
@ 2017-11-23  9:22 Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 1/5] net/mlx5: remove get priv internal function Nelio Laranjeiro
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil

This series apply on top of patch 31485.

Nelio Laranjeiro (5):
  net/mlx5: remove get priv internal function
  net/mlx5: fix secondary process verification
  net/mlx5: removes 32bits support
  net/mlx5: move variable declaration
  net/mlx5: remove redundant inline variable

 drivers/net/mlx5/mlx5.c         |  6 ++----
 drivers/net/mlx5/mlx5_ethdev.c  | 46 +++--------------------------------------
 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     | 10 ++-------
 drivers/net/mlx5/mlx5_rxtx.c    | 31 +++++++++++++--------------
 drivers/net/mlx5/mlx5_rxtx.h    |  1 -
 drivers/net/mlx5/mlx5_stats.c   |  8 +++----
 drivers/net/mlx5/mlx5_trigger.c |  6 ------
 drivers/net/mlx5/mlx5_txq.c     |  9 +-------
 11 files changed, 26 insertions(+), 106 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] net/mlx5: remove get priv internal function
  2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
@ 2017-11-23  9:22 ` Nelio Laranjeiro
  2017-11-27  7:30   ` Shahaf Shuler
  2017-11-23  9:22 ` [PATCH 2/5] net/mlx5: fix secondary process verification Nelio Laranjeiro
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil

mlx5_get_priv() is barely use across the driver.  To avoid mixing access,
this function is definitely removed.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5.c        |  2 +-
 drivers/net/mlx5/mlx5_ethdev.c | 21 +++------------------
 drivers/net/mlx5/mlx5_rxq.c    |  4 ++--
 drivers/net/mlx5/mlx5_stats.c  |  8 ++++----
 4 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index a5eb3fdc5..9d0f5f069 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -193,7 +193,7 @@ mlx5_free_verbs_buf(void *ptr, void *data __rte_unused)
 static void
 mlx5_dev_close(struct rte_eth_dev *dev)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	unsigned int i;
 	int ret;
 
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index a3cef6891..75be352cf 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -119,21 +119,6 @@ struct ethtool_link_settings {
 #endif
 
 /**
- * Return private structure associated with an Ethernet device.
- *
- * @param dev
- *   Pointer to Ethernet device structure.
- *
- * @return
- *   Pointer to private structure.
- */
-struct priv *
-mlx5_get_priv(struct rte_eth_dev *dev)
-{
-	return dev->data->dev_private;
-}
-
-/**
  * Check if running as a secondary process.
  *
  * @return
@@ -670,7 +655,7 @@ mlx5_dev_configure(struct rte_eth_dev *dev)
 void
 mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	unsigned int max;
 	char ifname[IF_NAMESIZE];
 
@@ -761,7 +746,7 @@ mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 static int
 mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct ethtool_cmd edata = {
 		.cmd = ETHTOOL_GSET /* Deprecated since Linux v4.5. */
 	};
@@ -827,7 +812,7 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev, int wait_to_complete)
 static int
 mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct ethtool_link_settings gcmd = { .cmd = ETHTOOL_GLINKSETTINGS };
 	struct ifreq ifr;
 	struct rte_eth_link dev_link;
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 85399eff5..a6eec2fa6 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -460,7 +460,7 @@ mlx5_arm_cq(struct mlx5_rxq_data *rxq, int sq_n_rxq)
 int
 mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct mlx5_rxq_data *rxq_data;
 	struct mlx5_rxq_ctrl *rxq_ctrl;
 	int ret = 0;
@@ -504,7 +504,7 @@ mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 int
 mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct mlx5_rxq_data *rxq_data;
 	struct mlx5_rxq_ctrl *rxq_ctrl;
 	struct mlx5_rxq_ibv *rxq_ibv = NULL;
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index 5e225d374..e689b0748 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -321,7 +321,7 @@ priv_xstats_reset(struct priv *priv)
 int
 mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct rte_eth_stats tmp = {0};
 	unsigned int i;
 	unsigned int idx;
@@ -427,7 +427,7 @@ int
 mlx5_xstats_get(struct rte_eth_dev *dev,
 		struct rte_eth_xstat *stats, unsigned int n)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	int ret = xstats_n;
 
 	if (n >= xstats_n && stats) {
@@ -457,7 +457,7 @@ mlx5_xstats_get(struct rte_eth_dev *dev,
 void
 mlx5_xstats_reset(struct rte_eth_dev *dev)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
 	int stats_n;
 
@@ -489,7 +489,7 @@ int
 mlx5_xstats_get_names(struct rte_eth_dev *dev,
 		struct rte_eth_xstat_name *xstats_names, unsigned int n)
 {
-	struct priv *priv = mlx5_get_priv(dev);
+	struct priv *priv = dev->data->dev_private;
 	unsigned int i;
 
 	if (n >= xstats_n && xstats_names) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] net/mlx5: fix secondary process verification
  2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 1/5] net/mlx5: remove get priv internal function Nelio Laranjeiro
@ 2017-11-23  9:22 ` Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 3/5] net/mlx5: removes 32bits support Nelio Laranjeiro
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil, xuemingl

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: xuemingl@mellanox.com

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 9d0f5f069..cd66fe162 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);
 }
@@ -687,7 +685,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) {
 			/* from rte_ethdev.c */
 			char name[RTE_ETH_NAME_MAX_LEN];
 
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 75be352cf..ca9ad0fef 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -119,18 +119,6 @@ struct ethtool_link_settings {
 #endif
 
 /**
- * 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
@@ -634,9 +622,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);
@@ -937,9 +922,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)
@@ -987,9 +969,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)) {
@@ -1038,9 +1017,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) ||
@@ -1302,7 +1278,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 f3de46de0..f4911359b 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -274,7 +274,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 a6eec2fa6..a4cdd374a 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 5de2d026e..ed80a6bee 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -132,9 +132,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);
@@ -213,9 +210,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 9c5860ff4..84d37be19 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] net/mlx5: removes 32bits support
  2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 1/5] net/mlx5: remove get priv internal function Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 2/5] net/mlx5: fix secondary process verification Nelio Laranjeiro
@ 2017-11-23  9:22 ` Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 4/5] net/mlx5: move variable declaration Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 5/5] net/mlx5: remove redundant inline variable Nelio Laranjeiro
  4 siblings, 0 replies; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil

naddr variable was introduced in
commit 9a7fa9f76d9e ("net/mlx5: use vector types to speed up processing")
to avoid compilation errors on 32bits compilation, as x86_32 is no more
supported by rdma-core nor by MLNX_OFED, this variable becomes useless and
can be safely removed.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 32bfa307c..932470602 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -370,7 +370,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		unsigned int ds = 0;
 		unsigned int sg = 0; /* counter of additional segs attached. */
 		uintptr_t addr;
-		uint64_t naddr;
 		uint16_t pkt_inline_sz = MLX5_WQE_DWORD_SIZE + 2;
 		uint16_t tso_header_sz = 0;
 		uint16_t ehdr;
@@ -594,12 +593,12 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			ds = 3;
 use_dseg:
 			/* Add the remaining packet as a simple ds. */
-			naddr = rte_cpu_to_be_64(addr);
+			addr = rte_cpu_to_be_64(addr);
 			*dseg = (rte_v128u32_t){
 				rte_cpu_to_be_32(length),
 				mlx5_tx_mb2mr(txq, buf),
-				naddr,
-				naddr >> 32,
+				addr,
+				addr >> 32,
 			};
 			++ds;
 			if (!segs_n)
@@ -633,12 +632,12 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 		total_length += length;
 #endif
 		/* Store segment information. */
-		naddr = rte_cpu_to_be_64(rte_pktmbuf_mtod(buf, uintptr_t));
+		addr = rte_cpu_to_be_64(rte_pktmbuf_mtod(buf, uintptr_t));
 		*dseg = (rte_v128u32_t){
 			rte_cpu_to_be_32(length),
 			mlx5_tx_mb2mr(txq, buf),
-			naddr,
-			naddr >> 32,
+			addr,
+			addr >> 32,
 		};
 		(*txq->elts)[++elts_head & elts_m] = buf;
 		++sg;
@@ -1339,7 +1338,6 @@ mlx5_tx_burst_empw(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	do {
 		struct rte_mbuf *buf = *(pkts++);
 		uintptr_t addr;
-		uint64_t naddr;
 		unsigned int n;
 		unsigned int do_inline = 0; /* Whether inline is possible. */
 		uint32_t length;
@@ -1521,12 +1519,12 @@ mlx5_tx_burst_empw(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			for (n = 0; n * RTE_CACHE_LINE_SIZE < length; n++)
 				rte_prefetch2((void *)(addr +
 						n * RTE_CACHE_LINE_SIZE));
-			naddr = rte_cpu_to_be_64(addr);
+			addr = rte_cpu_to_be_64(addr);
 			*dseg = (rte_v128u32_t) {
 				rte_cpu_to_be_32(length),
 				mlx5_tx_mb2mr(txq, buf),
-				naddr,
-				naddr >> 32,
+				addr,
+				addr >> 32,
 			};
 			mpw.data.raw = (volatile void *)(dseg + 1);
 			mpw.total_len += (inl_pad + sizeof(*dseg));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] net/mlx5: move variable declaration
  2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (2 preceding siblings ...)
  2017-11-23  9:22 ` [PATCH 3/5] net/mlx5: removes 32bits support Nelio Laranjeiro
@ 2017-11-23  9:22 ` Nelio Laranjeiro
  2017-11-23  9:22 ` [PATCH 5/5] net/mlx5: remove redundant inline variable Nelio Laranjeiro
  4 siblings, 0 replies; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil

Most of the variable in mlx5_tx_burst() are defined too soon.
This commit moves them their uses C block of code.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 932470602..d735e646c 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -344,15 +344,10 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	unsigned int j = 0;
 	unsigned int k = 0;
 	uint16_t max_elts;
-	unsigned int max_inline = txq->max_inline;
-	const unsigned int inline_en = !!max_inline && txq->inline_en;
 	uint16_t max_wqe;
 	unsigned int comp;
-	volatile struct mlx5_wqe_v *wqe = NULL;
 	volatile struct mlx5_wqe_ctrl *last_wqe = NULL;
 	unsigned int segs_n = 0;
-	struct rte_mbuf *buf = NULL;
-	uint8_t *raw;
 
 	if (unlikely(!pkts_n))
 		return 0;
@@ -365,6 +360,11 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	if (unlikely(!max_wqe))
 		return 0;
 	do {
+		unsigned int max_inline = txq->max_inline;
+		const unsigned int inline_en = !!max_inline && txq->inline_en;
+		struct rte_mbuf *buf = NULL;
+		uint8_t *raw;
+		volatile struct mlx5_wqe_v *wqe = NULL;
 		volatile rte_v128u32_t *dseg = NULL;
 		uint32_t length;
 		unsigned int ds = 0;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] net/mlx5: remove redundant inline variable
  2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
                   ` (3 preceding siblings ...)
  2017-11-23  9:22 ` [PATCH 4/5] net/mlx5: move variable declaration Nelio Laranjeiro
@ 2017-11-23  9:22 ` Nelio Laranjeiro
  4 siblings, 0 replies; 7+ messages in thread
From: Nelio Laranjeiro @ 2017-11-23  9:22 UTC (permalink / raw)
  To: dev; +Cc: Yongseok Koh, Adrien Mazarguil

A non max_inline 0 means an inline is requested, there is no need to
duplicate this information.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 5 ++---
 drivers/net/mlx5/mlx5_rxtx.h | 1 -
 drivers/net/mlx5/mlx5_txq.c  | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index d735e646c..28c0ad8ab 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -348,6 +348,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	unsigned int comp;
 	volatile struct mlx5_wqe_ctrl *last_wqe = NULL;
 	unsigned int segs_n = 0;
+	const unsigned int max_inline = txq->max_inline;
 
 	if (unlikely(!pkts_n))
 		return 0;
@@ -360,8 +361,6 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 	if (unlikely(!max_wqe))
 		return 0;
 	do {
-		unsigned int max_inline = txq->max_inline;
-		const unsigned int inline_en = !!max_inline && txq->inline_en;
 		struct rte_mbuf *buf = NULL;
 		uint8_t *raw;
 		volatile struct mlx5_wqe_v *wqe = NULL;
@@ -516,7 +515,7 @@ mlx5_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
 			}
 		}
 		/* Inline if enough room. */
-		if (inline_en || tso) {
+		if (max_inline || tso) {
 			uint32_t inl;
 			uintptr_t end = (uintptr_t)
 				(((uintptr_t)txq->wqes) +
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 63eb12c66..b8c7925a3 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -191,7 +191,6 @@ struct mlx5_txq_data {
 	uint16_t elts_n:4; /* (*elts)[] length (in log2). */
 	uint16_t cqe_n:4; /* Number of CQ elements (in log2). */
 	uint16_t wqe_n:4; /* Number of of WQ elements (in log2). */
-	uint16_t inline_en:1; /* When set inline is enabled. */
 	uint16_t tso_en:1; /* When set hardware TSO is enabled. */
 	uint16_t tunnel_en:1;
 	/* When set TX offload for tunneled packets are supported. */
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 84d37be19..a786a6b63 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -353,7 +353,7 @@ mlx5_priv_txq_ibv_new(struct priv *priv, uint16_t idx)
 		.pd = priv->pd,
 		.comp_mask = IBV_QP_INIT_ATTR_PD,
 	};
-	if (txq_data->inline_en)
+	if (txq_data->max_inline)
 		attr.init.cap.max_inline_data = txq_ctrl->max_inline_data;
 	if (txq_data->tso_en) {
 		attr.init.max_tso_header = txq_ctrl->max_tso_header;
@@ -589,7 +589,6 @@ mlx5_priv_txq_new(struct priv *priv, uint16_t idx, uint16_t desc,
 		tmpl->txq.max_inline =
 			((priv->txq_inline + (RTE_CACHE_LINE_SIZE - 1)) /
 			 RTE_CACHE_LINE_SIZE);
-		tmpl->txq.inline_en = 1;
 		/* TSO and MPS can't be enabled concurrently. */
 		assert(!priv->tso || !priv->mps);
 		if (priv->mps == MLX5_MPW_ENHANCED) {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/5] net/mlx5: remove get priv internal function
  2017-11-23  9:22 ` [PATCH 1/5] net/mlx5: remove get priv internal function Nelio Laranjeiro
@ 2017-11-27  7:30   ` Shahaf Shuler
  0 siblings, 0 replies; 7+ messages in thread
From: Shahaf Shuler @ 2017-11-27  7:30 UTC (permalink / raw)
  To: Nélio Laranjeiro, dev; +Cc: Yongseok Koh, Adrien Mazarguil

Thursday, November 23, 2017 11:23 AM, Nelio Laranjeiro:
> Subject: [dpdk-dev] [PATCH 1/5] net/mlx5: remove get priv internal function
> 
> mlx5_get_priv() is barely use across the driver.  To avoid mixing access, this
> function is definitely removed.
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>

Series applied to next-net-mlx, Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-27  7:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23  9:22 [PATCH 0/5] net/mlx5: cleanups Nelio Laranjeiro
2017-11-23  9:22 ` [PATCH 1/5] net/mlx5: remove get priv internal function Nelio Laranjeiro
2017-11-27  7:30   ` Shahaf Shuler
2017-11-23  9:22 ` [PATCH 2/5] net/mlx5: fix secondary process verification Nelio Laranjeiro
2017-11-23  9:22 ` [PATCH 3/5] net/mlx5: removes 32bits support Nelio Laranjeiro
2017-11-23  9:22 ` [PATCH 4/5] net/mlx5: move variable declaration Nelio Laranjeiro
2017-11-23  9:22 ` [PATCH 5/5] net/mlx5: remove redundant inline variable Nelio Laranjeiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.