DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ophir Munk <ophirmu@mellanox.com>
To: dev@dpdk.org, Matan Azrad <matan@mellanox.com>,
	Raslan Darawsheh <rasland@mellanox.com>
Cc: Ophir Munk <ophirmu@mellanox.com>
Subject: [dpdk-dev] [PATCH v1 2/8] net/mlx5: rename ib in names
Date: Wed, 10 Jun 2020 09:32:27 +0000	[thread overview]
Message-ID: <20200610093233.23902-3-ophirmu@mellanox.com> (raw)
In-Reply-To: <20200610093233.23902-1-ophirmu@mellanox.com>

Renames in this commit:
mlx5_ibv_list -> mlx5_dev_ctx_list
mlx5_alloc_shared_ibctx -> mlx5_alloc_shared_dev_ctx
mlx5_free_shared_ibctx -> mlx5_free_shared_dev_ctx
mlx5_ibv_shared_port -> mlx5_dev_shared_port
ibv_port -> dev_port

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
 drivers/net/mlx5/linux/mlx5_os.c   |  6 +++---
 drivers/net/mlx5/mlx5.c            | 41 +++++++++++++++++++-------------------
 drivers/net/mlx5/mlx5.h            | 14 ++++++-------
 drivers/net/mlx5/mlx5_flow.c       |  2 +-
 drivers/net/mlx5/mlx5_flow_dv.c    |  4 ++--
 drivers/net/mlx5/mlx5_flow_verbs.c |  2 +-
 drivers/net/mlx5/mlx5_rxtx.c       |  2 +-
 drivers/net/mlx5/mlx5_stats.c      |  2 +-
 drivers/net/mlx5/mlx5_trigger.c    |  8 ++++----
 drivers/net/mlx5/mlx5_txq.c        |  2 +-
 10 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 21eff38..abe9b04 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -563,7 +563,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			strerror(rte_errno));
 		goto error;
 	}
-	sh = mlx5_alloc_shared_ibctx(spawn, &config);
+	sh = mlx5_alloc_shared_dev_ctx(spawn, &config);
 	if (!sh)
 		return NULL;
 	config.devx = sh->devx;
@@ -693,7 +693,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		goto error;
 	}
 	priv->sh = sh;
-	priv->ibv_port = spawn->phys_port;
+	priv->dev_port = spawn->phys_port;
 	priv->pci_dev = spawn->pci_dev;
 	priv->mtu = RTE_ETHER_MTU;
 	priv->mp_id.port_id = port_id;
@@ -1188,7 +1188,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 		rte_eth_dev_release_port(eth_dev);
 	}
 	if (sh)
-		mlx5_free_shared_ibctx(sh);
+		mlx5_free_shared_dev_ctx(sh);
 	MLX5_ASSERT(err > 0);
 	rte_errno = err;
 	return NULL;
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 7c5e23d..f07386d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -176,8 +176,9 @@ static struct mlx5_local_data mlx5_local_data;
 /** Driver-specific log messages type. */
 int mlx5_logtype;
 
-static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_ibv_list = LIST_HEAD_INITIALIZER();
-static pthread_mutex_t mlx5_ibv_list_mutex = PTHREAD_MUTEX_INITIALIZER;
+static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =
+						LIST_HEAD_INITIALIZER();
+static pthread_mutex_t mlx5_dev_ctx_list_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
@@ -579,18 +580,18 @@ mlx5_flow_ipool_destroy(struct mlx5_dev_ctx_shared *sh)
 }
 
 /**
- * Allocate shared IB device context. If there is multiport device the
+ * Allocate shared device context. If there is multiport device the
  * master and representors will share this context, if there is single
- * port dedicated IB device, the context will be used by only given
+ * port dedicated device, the context will be used by only given
  * port due to unification.
  *
- * Routine first searches the context for the specified IB device name,
+ * Routine first searches the context for the specified device name,
  * if found the shared context assumed and reference counter is incremented.
  * If no context found the new one is created and initialized with specified
- * IB device context and parameters.
+ * device context and parameters.
  *
  * @param[in] spawn
- *   Pointer to the IB device attributes (name, port, etc).
+ *   Pointer to the device attributes (name, port, etc).
  * @param[in] config
  *   Pointer to device configuration structure.
  *
@@ -599,8 +600,8 @@ mlx5_flow_ipool_destroy(struct mlx5_dev_ctx_shared *sh)
  *   otherwise NULL and rte_errno is set.
  */
 struct mlx5_dev_ctx_shared *
-mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
-			const struct mlx5_dev_config *config)
+mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
+			   const struct mlx5_dev_config *config)
 {
 	struct mlx5_dev_ctx_shared *sh;
 	int err = 0;
@@ -610,9 +611,9 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
 	MLX5_ASSERT(spawn);
 	/* Secondary process should not create the shared context. */
 	MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
-	pthread_mutex_lock(&mlx5_ibv_list_mutex);
+	pthread_mutex_lock(&mlx5_dev_ctx_list_mutex);
 	/* Search for IB context by device name. */
-	LIST_FOREACH(sh, &mlx5_ibv_list, next) {
+	LIST_FOREACH(sh, &mlx5_dev_ctx_list, next) {
 		if (!strcmp(sh->ibdev_name,
 			mlx5_os_get_dev_device_name(spawn->phys_dev))) {
 			sh->refcnt++;
@@ -624,7 +625,7 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
 	sh = rte_zmalloc("ethdev shared ib context",
 			 sizeof(struct mlx5_dev_ctx_shared) +
 			 spawn->max_port *
-			 sizeof(struct mlx5_ibv_shared_port),
+			 sizeof(struct mlx5_dev_shared_port),
 			 RTE_CACHE_LINE_SIZE);
 	if (!sh) {
 		DRV_LOG(ERR, "shared context allocation failure");
@@ -713,12 +714,12 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
 			 sh, mem_event_cb);
 	rte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock);
 	/* Add context to the global device list. */
-	LIST_INSERT_HEAD(&mlx5_ibv_list, sh, next);
+	LIST_INSERT_HEAD(&mlx5_dev_ctx_list, sh, next);
 exit:
-	pthread_mutex_unlock(&mlx5_ibv_list_mutex);
+	pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex);
 	return sh;
 error:
-	pthread_mutex_unlock(&mlx5_ibv_list_mutex);
+	pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex);
 	MLX5_ASSERT(sh);
 	if (sh->tis)
 		claim_zero(mlx5_devx_cmd_destroy(sh->tis));
@@ -744,14 +745,14 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
  *   Pointer to mlx5_dev_ctx_shared object to free
  */
 void
-mlx5_free_shared_ibctx(struct mlx5_dev_ctx_shared *sh)
+mlx5_free_shared_dev_ctx(struct mlx5_dev_ctx_shared *sh)
 {
-	pthread_mutex_lock(&mlx5_ibv_list_mutex);
+	pthread_mutex_lock(&mlx5_dev_ctx_list_mutex);
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	/* Check the object presence in the list. */
 	struct mlx5_dev_ctx_shared *lctx;
 
-	LIST_FOREACH(lctx, &mlx5_ibv_list, next)
+	LIST_FOREACH(lctx, &mlx5_dev_ctx_list, next)
 		if (lctx == sh)
 			break;
 	MLX5_ASSERT(lctx);
@@ -793,7 +794,7 @@ mlx5_free_shared_ibctx(struct mlx5_dev_ctx_shared *sh)
 		mlx5_flow_id_pool_release(sh->flow_id_pool);
 	rte_free(sh);
 exit:
-	pthread_mutex_unlock(&mlx5_ibv_list_mutex);
+	pthread_mutex_unlock(&mlx5_dev_ctx_list_mutex);
 }
 
 /**
@@ -1193,7 +1194,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	 * mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
 	 * ifindex if Netlink fails.
 	 */
-	mlx5_free_shared_ibctx(priv->sh);
+	mlx5_free_shared_dev_ctx(priv->sh);
 	if (priv->domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) {
 		unsigned int c = 0;
 		uint16_t port_id;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index d624740..abe5099 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -446,7 +446,7 @@ struct mlx5_flow_counter_mng {
 #define MLX5_AGE_GET(age_info, BIT) \
 	((age_info)->flags & (1 << (BIT)))
 #define GET_PORT_AGE_INFO(priv) \
-	(&((priv)->sh->port[(priv)->ibv_port - 1].age_info))
+	(&((priv)->sh->port[(priv)->dev_port - 1].age_info))
 
 /* Aging information for per port. */
 struct mlx5_age_info {
@@ -456,7 +456,7 @@ struct mlx5_age_info {
 };
 
 /* Per port data of shared IB device. */
-struct mlx5_ibv_shared_port {
+struct mlx5_dev_shared_port {
 	uint32_t ih_port_id;
 	uint32_t devx_ih_port_id;
 	/*
@@ -571,7 +571,7 @@ struct mlx5_dev_ctx_shared {
 	struct mlx5_devx_obj *tis; /* TIS object. */
 	struct mlx5_devx_obj *td; /* Transport domain. */
 	struct mlx5_flow_id_pool *flow_id_pool; /* Flow ID pool. */
-	struct mlx5_ibv_shared_port port[]; /* per device port data array. */
+	struct mlx5_dev_shared_port port[]; /* per device port data array. */
 };
 
 /* Per-process private structure. */
@@ -593,7 +593,7 @@ TAILQ_HEAD(mlx5_flow_meters, mlx5_flow_meter);
 struct mlx5_priv {
 	struct rte_eth_dev_data *dev_data;  /* Pointer to device data. */
 	struct mlx5_dev_ctx_shared *sh; /* Shared device context. */
-	uint32_t ibv_port; /* IB device port number. */
+	uint32_t dev_port; /* Device port number. */
 	struct rte_pci_device *pci_dev; /* Backend PCI device. */
 	struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */
 	BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES);
@@ -697,9 +697,9 @@ void mlx5_dev_close(struct rte_eth_dev *dev);
 	     port_id = mlx5_eth_find_next(port_id + 1, pci_dev))
 int mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs);
 struct mlx5_dev_ctx_shared *
-mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
-			const struct mlx5_dev_config *config);
-void mlx5_free_shared_ibctx(struct mlx5_dev_ctx_shared *sh);
+mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
+			   const struct mlx5_dev_config *config);
+void mlx5_free_shared_dev_ctx(struct mlx5_dev_ctx_shared *sh);
 void mlx5_free_table_hash_list(struct mlx5_priv *priv);
 int mlx5_alloc_table_hash_list(struct mlx5_priv *priv);
 void mlx5_set_min_inline(struct mlx5_dev_spawn_data *spawn,
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index e375b10..0e0b0fb 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -509,7 +509,7 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
 	} flow_attr = {
 		.attr = {
 			.num_of_specs = 2,
-			.port = (uint8_t)priv->ibv_port,
+			.port = (uint8_t)priv->dev_port,
 		},
 		.eth = {
 			.type = IBV_FLOW_SPEC_ETH,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 81f5bd4..a323356 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2725,7 +2725,7 @@ flow_dv_port_id_action_resource_register
 	*cache_resource = *resource;
 	/*
 	 * Depending on rdma_core version the glue routine calls
-	 * either mlx5dv_dr_action_create_dest_ib_port(domain, ibv_port)
+	 * either mlx5dv_dr_action_create_dest_ib_port(domain, dev_port)
 	 * or mlx5dv_dr_action_create_dest_vport(domain, vport_id).
 	 */
 	cache_resource->action =
@@ -7557,7 +7557,7 @@ flow_dv_translate_action_port_id(struct rte_eth_dev *dev,
 	 * This parameter is transferred to
 	 * mlx5dv_dr_action_create_dest_ib_port().
 	 */
-	*dst_port_id = priv->ibv_port;
+	*dst_port_id = priv->dev_port;
 #else
 	/*
 	 * Legacy mode, no LAG configurations is supported.
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index c266e56..150f6bb 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1755,7 +1755,7 @@ flow_verbs_translate(struct rte_eth_dev *dev,
 	/* Other members of attr will be ignored. */
 	dev_flow->verbs.attr.priority =
 		mlx5_flow_adjust_priority(dev, priority, subpriority);
-	dev_flow->verbs.attr.port = (uint8_t)priv->ibv_port;
+	dev_flow->verbs.attr.port = (uint8_t)priv->dev_port;
 	return 0;
 }
 
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 6a17a9a..22cdf15 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -946,7 +946,7 @@ mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 			container_of(txq, struct mlx5_txq_ctrl, txq);
 		struct ibv_qp_attr mod = {
 			.qp_state = IBV_QPS_RESET,
-			.port_num = (uint8_t)priv->ibv_port,
+			.port_num = (uint8_t)priv->dev_port,
 		};
 		struct ibv_qp *qp = txq_ctrl->obj->qp;
 
diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c
index b4ca692..7999c5f 100644
--- a/drivers/net/mlx5/mlx5_stats.c
+++ b/drivers/net/mlx5/mlx5_stats.c
@@ -149,7 +149,7 @@ mlx5_read_ib_stat(struct mlx5_priv *priv, const char *ctr_name, uint64_t *stat)
 	if (priv->sh) {
 		MKSTR(path, "%s/ports/%d/hw_counters/%s",
 			  priv->sh->ibdev_path,
-			  priv->ibv_port,
+			  priv->dev_port,
 			  ctr_name);
 		fd = open(path, O_RDONLY);
 		if (fd != -1) {
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index f123193..a9af2e6 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -342,7 +342,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 	/* Enable datapath on secondary process. */
 	mlx5_mp_req_start_rxtx(dev);
 	if (priv->sh->intr_handle.fd >= 0) {
-		priv->sh->port[priv->ibv_port - 1].ih_port_id =
+		priv->sh->port[priv->dev_port - 1].ih_port_id =
 					(uint32_t)dev->data->port_id;
 	} else {
 		DRV_LOG(INFO, "port %u starts without LSC and RMV interrupts.",
@@ -351,7 +351,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		dev->data->dev_conf.intr_conf.rmv = 0;
 	}
 	if (priv->sh->intr_handle_devx.fd >= 0)
-		priv->sh->port[priv->ibv_port - 1].devx_ih_port_id =
+		priv->sh->port[priv->dev_port - 1].devx_ih_port_id =
 					(uint32_t)dev->data->port_id;
 	return 0;
 error:
@@ -394,8 +394,8 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
 	/* All RX queue flags will be cleared in the flush interface. */
 	mlx5_flow_list_flush(dev, &priv->flows, true);
 	mlx5_rx_intr_vec_disable(dev);
-	priv->sh->port[priv->ibv_port - 1].ih_port_id = RTE_MAX_ETHPORTS;
-	priv->sh->port[priv->ibv_port - 1].devx_ih_port_id = RTE_MAX_ETHPORTS;
+	priv->sh->port[priv->dev_port - 1].ih_port_id = RTE_MAX_ETHPORTS;
+	priv->sh->port[priv->dev_port - 1].devx_ih_port_id = RTE_MAX_ETHPORTS;
 	mlx5_txq_stop(dev);
 	mlx5_rxq_stop(dev);
 }
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index f7b548f..507febf 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -684,7 +684,7 @@ mlx5_txq_obj_new(struct rte_eth_dev *dev, uint16_t idx,
 		/* Move the QP to this state. */
 		.qp_state = IBV_QPS_INIT,
 		/* IB device port number. */
-		.port_num = (uint8_t)priv->ibv_port,
+		.port_num = (uint8_t)priv->dev_port,
 	};
 	ret = mlx5_glue->modify_qp(tmpl.qp, &attr.mod,
 				   (IBV_QP_STATE | IBV_QP_PORT));
-- 
2.8.4


  parent reply	other threads:[~2020-06-10  9:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  9:32 [dpdk-dev] [PATCH v1 0/8] mlx5 PMD multi OS support - part #2 Ophir Munk
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 1/8] net/mlx5: remove dv dependency in mlx5_dev_ctx_shared struct Ophir Munk
2020-06-10  9:32 ` Ophir Munk [this message]
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 3/8] net/mlx5: move socket files under Linux directory Ophir Munk
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 4/8] net/mlx5: split mlx5 ethdev " Ophir Munk
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 5/8] net/mlx5: refactor eth dev ops for Linux Ophir Munk
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 6/8] common/mlx5: exclude ibv dependent calls in devx commands Ophir Munk
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 7/8] common/mlx5: exclude OS dependency " Ophir Munk
2020-06-18 22:47   ` Thomas Monjalon
2020-06-18 22:48     ` Thomas Monjalon
2020-06-10  9:32 ` [dpdk-dev] [PATCH v1 8/8] net/mlx5: refactor statistics Ophir Munk
2020-06-14  8:21 ` [dpdk-dev] [PATCH v1 0/8] mlx5 PMD multi OS support - part #2 Matan Azrad
2020-06-15  6:58   ` Raslan Darawsheh

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=20200610093233.23902-3-ophirmu@mellanox.com \
    --to=ophirmu@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=rasland@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).