DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ophir Munk <ophirmu@mellanox.com>
To: dev@dpdk.org
Cc: Raslan Darawsheh <rasland@mellanox.com>,
	Ophir Munk <ophirmu@mellanox.com>,
	Matan Azrad <matan@mellanox.com>
Subject: [dpdk-dev] [PATCH v2 5/8] net/mlx5: eliminate dependency on Linux in shared header
Date: Sun, 19 Jul 2020 07:11:09 +0000	[thread overview]
Message-ID: <20200719071112.8540-6-ophirmu@mellanox.com> (raw)
In-Reply-To: <20200719071112.8540-1-ophirmu@mellanox.com>

This commit eliminates Linux dependencies in shared file mlx5.h.

1. All functions using 'struct ifreq' are moved to file
linux/mlx5_ethdev_os.c such that this struct can be removed from mlx5.h.
2. Function mlx5_set_flags() that uses Linux flags (e.g. IFF_UP) is
changed to static and its prototype is removed from mlx5.h.
3. Remove redundant member verbs_action from 'struct mlx5_priv'.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/linux/mlx5_ethdev_os.c | 314 +++++++++++++++++++++++++++++++-
 drivers/net/mlx5/linux/mlx5_os.c        | 309 -------------------------------
 drivers/net/mlx5/mlx5.h                 |  15 +-
 3 files changed, 318 insertions(+), 320 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
index 6b8a151..e79d576 100644
--- a/drivers/net/mlx5/linux/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/linux/mlx5_ethdev_os.c
@@ -178,7 +178,7 @@ mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE])
  * @return
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-int
+static int
 mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr)
 {
 	int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
@@ -258,7 +258,7 @@ mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
  * @return
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-int
+static int
 mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, unsigned int flags)
 {
 	struct ifreq request;
@@ -1187,3 +1187,313 @@ int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 	mlx5_free(eeprom);
 	return ret;
 }
+
+/**
+ * Read device counters table.
+ *
+ * @param dev
+ *   Pointer to Ethernet device.
+ * @param[out] stats
+ *   Counters table output buffer.
+ *
+ * @return
+ *   0 on success and stats is filled, negative errno value otherwise and
+ *   rte_errno is set.
+ */
+int
+mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)
+{
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+	unsigned int i;
+	struct ifreq ifr;
+	unsigned int stats_sz = xstats_ctrl->stats_n * sizeof(uint64_t);
+	unsigned char et_stat_buf[sizeof(struct ethtool_stats) + stats_sz];
+	struct ethtool_stats *et_stats = (struct ethtool_stats *)et_stat_buf;
+	int ret;
+
+	et_stats->cmd = ETHTOOL_GSTATS;
+	et_stats->n_stats = xstats_ctrl->stats_n;
+	ifr.ifr_data = (caddr_t)et_stats;
+	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
+	if (ret) {
+		DRV_LOG(WARNING,
+			"port %u unable to read statistic values from device",
+			dev->data->port_id);
+		return ret;
+	}
+	for (i = 0; i != xstats_ctrl->mlx5_stats_n; ++i) {
+		if (xstats_ctrl->info[i].dev) {
+			ret = mlx5_os_read_dev_stat(priv,
+					    xstats_ctrl->info[i].ctr_name,
+					    &stats[i]);
+			/* return last xstats counter if fail to read. */
+			if (ret == 0)
+				xstats_ctrl->xstats[i] = stats[i];
+			else
+				stats[i] = xstats_ctrl->xstats[i];
+		} else {
+			stats[i] = (uint64_t)
+				et_stats->data[xstats_ctrl->dev_table_idx[i]];
+		}
+	}
+	return 0;
+}
+
+/**
+ * Query the number of statistics provided by ETHTOOL.
+ *
+ * @param dev
+ *   Pointer to Ethernet device.
+ *
+ * @return
+ *   Number of statistics on success, negative errno value otherwise and
+ *   rte_errno is set.
+ */
+int
+mlx5_os_get_stats_n(struct rte_eth_dev *dev)
+{
+	struct ethtool_drvinfo drvinfo;
+	struct ifreq ifr;
+	int ret;
+
+	drvinfo.cmd = ETHTOOL_GDRVINFO;
+	ifr.ifr_data = (caddr_t)&drvinfo;
+	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
+	if (ret) {
+		DRV_LOG(WARNING, "port %u unable to query number of statistics",
+			dev->data->port_id);
+		return ret;
+	}
+	return drvinfo.n_stats;
+}
+
+static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
+	{
+		.dpdk_name = "rx_port_unicast_bytes",
+		.ctr_name = "rx_vport_unicast_bytes",
+	},
+	{
+		.dpdk_name = "rx_port_multicast_bytes",
+		.ctr_name = "rx_vport_multicast_bytes",
+	},
+	{
+		.dpdk_name = "rx_port_broadcast_bytes",
+		.ctr_name = "rx_vport_broadcast_bytes",
+	},
+	{
+		.dpdk_name = "rx_port_unicast_packets",
+		.ctr_name = "rx_vport_unicast_packets",
+	},
+	{
+		.dpdk_name = "rx_port_multicast_packets",
+		.ctr_name = "rx_vport_multicast_packets",
+	},
+	{
+		.dpdk_name = "rx_port_broadcast_packets",
+		.ctr_name = "rx_vport_broadcast_packets",
+	},
+	{
+		.dpdk_name = "tx_port_unicast_bytes",
+		.ctr_name = "tx_vport_unicast_bytes",
+	},
+	{
+		.dpdk_name = "tx_port_multicast_bytes",
+		.ctr_name = "tx_vport_multicast_bytes",
+	},
+	{
+		.dpdk_name = "tx_port_broadcast_bytes",
+		.ctr_name = "tx_vport_broadcast_bytes",
+	},
+	{
+		.dpdk_name = "tx_port_unicast_packets",
+		.ctr_name = "tx_vport_unicast_packets",
+	},
+	{
+		.dpdk_name = "tx_port_multicast_packets",
+		.ctr_name = "tx_vport_multicast_packets",
+	},
+	{
+		.dpdk_name = "tx_port_broadcast_packets",
+		.ctr_name = "tx_vport_broadcast_packets",
+	},
+	{
+		.dpdk_name = "rx_wqe_err",
+		.ctr_name = "rx_wqe_err",
+	},
+	{
+		.dpdk_name = "rx_crc_errors_phy",
+		.ctr_name = "rx_crc_errors_phy",
+	},
+	{
+		.dpdk_name = "rx_in_range_len_errors_phy",
+		.ctr_name = "rx_in_range_len_errors_phy",
+	},
+	{
+		.dpdk_name = "rx_symbol_err_phy",
+		.ctr_name = "rx_symbol_err_phy",
+	},
+	{
+		.dpdk_name = "tx_errors_phy",
+		.ctr_name = "tx_errors_phy",
+	},
+	{
+		.dpdk_name = "rx_out_of_buffer",
+		.ctr_name = "out_of_buffer",
+		.dev = 1,
+	},
+	{
+		.dpdk_name = "tx_packets_phy",
+		.ctr_name = "tx_packets_phy",
+	},
+	{
+		.dpdk_name = "rx_packets_phy",
+		.ctr_name = "rx_packets_phy",
+	},
+	{
+		.dpdk_name = "tx_discards_phy",
+		.ctr_name = "tx_discards_phy",
+	},
+	{
+		.dpdk_name = "rx_discards_phy",
+		.ctr_name = "rx_discards_phy",
+	},
+	{
+		.dpdk_name = "tx_bytes_phy",
+		.ctr_name = "tx_bytes_phy",
+	},
+	{
+		.dpdk_name = "rx_bytes_phy",
+		.ctr_name = "rx_bytes_phy",
+	},
+	/* Representor only */
+	{
+		.dpdk_name = "rx_packets",
+		.ctr_name = "vport_rx_packets",
+	},
+	{
+		.dpdk_name = "rx_bytes",
+		.ctr_name = "vport_rx_bytes",
+	},
+	{
+		.dpdk_name = "tx_packets",
+		.ctr_name = "vport_tx_packets",
+	},
+	{
+		.dpdk_name = "tx_bytes",
+		.ctr_name = "vport_tx_bytes",
+	},
+};
+
+static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
+
+/**
+ * Init the structures to read device counters.
+ *
+ * @param dev
+ *   Pointer to Ethernet device.
+ */
+void
+mlx5_os_stats_init(struct rte_eth_dev *dev)
+{
+	struct mlx5_priv *priv = dev->data->dev_private;
+	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
+	struct mlx5_stats_ctrl *stats_ctrl = &priv->stats_ctrl;
+	unsigned int i;
+	unsigned int j;
+	struct ifreq ifr;
+	struct ethtool_gstrings *strings = NULL;
+	unsigned int dev_stats_n;
+	unsigned int str_sz;
+	int ret;
+
+	/* So that it won't aggregate for each init. */
+	xstats_ctrl->mlx5_stats_n = 0;
+	ret = mlx5_os_get_stats_n(dev);
+	if (ret < 0) {
+		DRV_LOG(WARNING, "port %u no extended statistics available",
+			dev->data->port_id);
+		return;
+	}
+	dev_stats_n = ret;
+	/* Allocate memory to grab stat names and values. */
+	str_sz = dev_stats_n * ETH_GSTRING_LEN;
+	strings = (struct ethtool_gstrings *)
+		  mlx5_malloc(0, str_sz + sizeof(struct ethtool_gstrings), 0,
+			      SOCKET_ID_ANY);
+	if (!strings) {
+		DRV_LOG(WARNING, "port %u unable to allocate memory for xstats",
+		     dev->data->port_id);
+		return;
+	}
+	strings->cmd = ETHTOOL_GSTRINGS;
+	strings->string_set = ETH_SS_STATS;
+	strings->len = dev_stats_n;
+	ifr.ifr_data = (caddr_t)strings;
+	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
+	if (ret) {
+		DRV_LOG(WARNING, "port %u unable to get statistic names",
+			dev->data->port_id);
+		goto free;
+	}
+	for (i = 0; i != dev_stats_n; ++i) {
+		const char *curr_string = (const char *)
+			&strings->data[i * ETH_GSTRING_LEN];
+
+		for (j = 0; j != xstats_n; ++j) {
+			if (!strcmp(mlx5_counters_init[j].ctr_name,
+				    curr_string)) {
+				unsigned int idx = xstats_ctrl->mlx5_stats_n++;
+
+				xstats_ctrl->dev_table_idx[idx] = i;
+				xstats_ctrl->info[idx] = mlx5_counters_init[j];
+				break;
+			}
+		}
+	}
+	/* Add dev counters. */
+	for (i = 0; i != xstats_n; ++i) {
+		if (mlx5_counters_init[i].dev) {
+			unsigned int idx = xstats_ctrl->mlx5_stats_n++;
+
+			xstats_ctrl->info[idx] = mlx5_counters_init[i];
+			xstats_ctrl->hw_stats[idx] = 0;
+		}
+	}
+	MLX5_ASSERT(xstats_ctrl->mlx5_stats_n <= MLX5_MAX_XSTATS);
+	xstats_ctrl->stats_n = dev_stats_n;
+	/* Copy to base at first time. */
+	ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base);
+	if (ret)
+		DRV_LOG(ERR, "port %u cannot read device counters: %s",
+			dev->data->port_id, strerror(rte_errno));
+	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
+	stats_ctrl->imissed = 0;
+free:
+	mlx5_free(strings);
+}
+
+/**
+ * Get MAC address by querying netdevice.
+ *
+ * @param[in] dev
+ *   Pointer to Ethernet device.
+ * @param[out] mac
+ *   MAC address output buffer.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])
+{
+	struct ifreq request;
+	int ret;
+
+	ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request);
+	if (ret)
+		return ret;
+	memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);
+	return 0;
+}
+
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 14fffe3..4e21018 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -68,30 +68,6 @@
 #endif
 
 /**
- * Get MAC address by querying netdevice.
- *
- * @param[in] dev
- *   Pointer to Ethernet device.
- * @param[out] mac
- *   MAC address output buffer.
- *
- * @return
- *   0 on success, a negative errno value otherwise and rte_errno is set.
- */
-static int
-mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN])
-{
-	struct ifreq request;
-	int ret;
-
-	ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request);
-	if (ret)
-		return ret;
-	memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);
-	return 0;
-}
-
-/**
  * Get mlx5 device attributes. The glue function query_device_ex() is called
  * with out parameter of type 'struct ibv_device_attr_ex *'. Then fill in mlx5
  * device attributes from the glue out parameter.
@@ -2074,291 +2050,6 @@ mlx5_os_read_dev_stat(struct mlx5_priv *priv, const char *ctr_name,
 }
 
 /**
- * Read device counters table.
- *
- * @param dev
- *   Pointer to Ethernet device.
- * @param[out] stats
- *   Counters table output buffer.
- *
- * @return
- *   0 on success and stats is filled, negative errno value otherwise and
- *   rte_errno is set.
- */
-int
-mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats)
-{
-	struct mlx5_priv *priv = dev->data->dev_private;
-	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
-	unsigned int i;
-	struct ifreq ifr;
-	unsigned int stats_sz = xstats_ctrl->stats_n * sizeof(uint64_t);
-	unsigned char et_stat_buf[sizeof(struct ethtool_stats) + stats_sz];
-	struct ethtool_stats *et_stats = (struct ethtool_stats *)et_stat_buf;
-	int ret;
-
-	et_stats->cmd = ETHTOOL_GSTATS;
-	et_stats->n_stats = xstats_ctrl->stats_n;
-	ifr.ifr_data = (caddr_t)et_stats;
-	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
-	if (ret) {
-		DRV_LOG(WARNING,
-			"port %u unable to read statistic values from device",
-			dev->data->port_id);
-		return ret;
-	}
-	for (i = 0; i != xstats_ctrl->mlx5_stats_n; ++i) {
-		if (xstats_ctrl->info[i].dev) {
-			ret = mlx5_os_read_dev_stat(priv,
-					    xstats_ctrl->info[i].ctr_name,
-					    &stats[i]);
-			/* return last xstats counter if fail to read. */
-			if (ret == 0)
-				xstats_ctrl->xstats[i] = stats[i];
-			else
-				stats[i] = xstats_ctrl->xstats[i];
-		} else {
-			stats[i] = (uint64_t)
-				et_stats->data[xstats_ctrl->dev_table_idx[i]];
-		}
-	}
-	return 0;
-}
-
-/**
- * Query the number of statistics provided by ETHTOOL.
- *
- * @param dev
- *   Pointer to Ethernet device.
- *
- * @return
- *   Number of statistics on success, negative errno value otherwise and
- *   rte_errno is set.
- */
-int
-mlx5_os_get_stats_n(struct rte_eth_dev *dev)
-{
-	struct ethtool_drvinfo drvinfo;
-	struct ifreq ifr;
-	int ret;
-
-	drvinfo.cmd = ETHTOOL_GDRVINFO;
-	ifr.ifr_data = (caddr_t)&drvinfo;
-	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
-	if (ret) {
-		DRV_LOG(WARNING, "port %u unable to query number of statistics",
-			dev->data->port_id);
-		return ret;
-	}
-	return drvinfo.n_stats;
-}
-
-static const struct mlx5_counter_ctrl mlx5_counters_init[] = {
-	{
-		.dpdk_name = "rx_port_unicast_bytes",
-		.ctr_name = "rx_vport_unicast_bytes",
-	},
-	{
-		.dpdk_name = "rx_port_multicast_bytes",
-		.ctr_name = "rx_vport_multicast_bytes",
-	},
-	{
-		.dpdk_name = "rx_port_broadcast_bytes",
-		.ctr_name = "rx_vport_broadcast_bytes",
-	},
-	{
-		.dpdk_name = "rx_port_unicast_packets",
-		.ctr_name = "rx_vport_unicast_packets",
-	},
-	{
-		.dpdk_name = "rx_port_multicast_packets",
-		.ctr_name = "rx_vport_multicast_packets",
-	},
-	{
-		.dpdk_name = "rx_port_broadcast_packets",
-		.ctr_name = "rx_vport_broadcast_packets",
-	},
-	{
-		.dpdk_name = "tx_port_unicast_bytes",
-		.ctr_name = "tx_vport_unicast_bytes",
-	},
-	{
-		.dpdk_name = "tx_port_multicast_bytes",
-		.ctr_name = "tx_vport_multicast_bytes",
-	},
-	{
-		.dpdk_name = "tx_port_broadcast_bytes",
-		.ctr_name = "tx_vport_broadcast_bytes",
-	},
-	{
-		.dpdk_name = "tx_port_unicast_packets",
-		.ctr_name = "tx_vport_unicast_packets",
-	},
-	{
-		.dpdk_name = "tx_port_multicast_packets",
-		.ctr_name = "tx_vport_multicast_packets",
-	},
-	{
-		.dpdk_name = "tx_port_broadcast_packets",
-		.ctr_name = "tx_vport_broadcast_packets",
-	},
-	{
-		.dpdk_name = "rx_wqe_err",
-		.ctr_name = "rx_wqe_err",
-	},
-	{
-		.dpdk_name = "rx_crc_errors_phy",
-		.ctr_name = "rx_crc_errors_phy",
-	},
-	{
-		.dpdk_name = "rx_in_range_len_errors_phy",
-		.ctr_name = "rx_in_range_len_errors_phy",
-	},
-	{
-		.dpdk_name = "rx_symbol_err_phy",
-		.ctr_name = "rx_symbol_err_phy",
-	},
-	{
-		.dpdk_name = "tx_errors_phy",
-		.ctr_name = "tx_errors_phy",
-	},
-	{
-		.dpdk_name = "rx_out_of_buffer",
-		.ctr_name = "out_of_buffer",
-		.dev = 1,
-	},
-	{
-		.dpdk_name = "tx_packets_phy",
-		.ctr_name = "tx_packets_phy",
-	},
-	{
-		.dpdk_name = "rx_packets_phy",
-		.ctr_name = "rx_packets_phy",
-	},
-	{
-		.dpdk_name = "tx_discards_phy",
-		.ctr_name = "tx_discards_phy",
-	},
-	{
-		.dpdk_name = "rx_discards_phy",
-		.ctr_name = "rx_discards_phy",
-	},
-	{
-		.dpdk_name = "tx_bytes_phy",
-		.ctr_name = "tx_bytes_phy",
-	},
-	{
-		.dpdk_name = "rx_bytes_phy",
-		.ctr_name = "rx_bytes_phy",
-	},
-	/* Representor only */
-	{
-		.dpdk_name = "rx_packets",
-		.ctr_name = "vport_rx_packets",
-	},
-	{
-		.dpdk_name = "rx_bytes",
-		.ctr_name = "vport_rx_bytes",
-	},
-	{
-		.dpdk_name = "tx_packets",
-		.ctr_name = "vport_tx_packets",
-	},
-	{
-		.dpdk_name = "tx_bytes",
-		.ctr_name = "vport_tx_bytes",
-	},
-};
-
-static const unsigned int xstats_n = RTE_DIM(mlx5_counters_init);
-
-/**
- * Init the structures to read device counters.
- *
- * @param dev
- *   Pointer to Ethernet device.
- */
-void
-mlx5_os_stats_init(struct rte_eth_dev *dev)
-{
-	struct mlx5_priv *priv = dev->data->dev_private;
-	struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl;
-	struct mlx5_stats_ctrl *stats_ctrl = &priv->stats_ctrl;
-	unsigned int i;
-	unsigned int j;
-	struct ifreq ifr;
-	struct ethtool_gstrings *strings = NULL;
-	unsigned int dev_stats_n;
-	unsigned int str_sz;
-	int ret;
-
-	/* So that it won't aggregate for each init. */
-	xstats_ctrl->mlx5_stats_n = 0;
-	ret = mlx5_os_get_stats_n(dev);
-	if (ret < 0) {
-		DRV_LOG(WARNING, "port %u no extended statistics available",
-			dev->data->port_id);
-		return;
-	}
-	dev_stats_n = ret;
-	/* Allocate memory to grab stat names and values. */
-	str_sz = dev_stats_n * ETH_GSTRING_LEN;
-	strings = (struct ethtool_gstrings *)
-		  mlx5_malloc(0, str_sz + sizeof(struct ethtool_gstrings), 0,
-			      SOCKET_ID_ANY);
-	if (!strings) {
-		DRV_LOG(WARNING, "port %u unable to allocate memory for xstats",
-		     dev->data->port_id);
-		return;
-	}
-	strings->cmd = ETHTOOL_GSTRINGS;
-	strings->string_set = ETH_SS_STATS;
-	strings->len = dev_stats_n;
-	ifr.ifr_data = (caddr_t)strings;
-	ret = mlx5_ifreq(dev, SIOCETHTOOL, &ifr);
-	if (ret) {
-		DRV_LOG(WARNING, "port %u unable to get statistic names",
-			dev->data->port_id);
-		goto free;
-	}
-	for (i = 0; i != dev_stats_n; ++i) {
-		const char *curr_string = (const char *)
-			&strings->data[i * ETH_GSTRING_LEN];
-
-		for (j = 0; j != xstats_n; ++j) {
-			if (!strcmp(mlx5_counters_init[j].ctr_name,
-				    curr_string)) {
-				unsigned int idx = xstats_ctrl->mlx5_stats_n++;
-
-				xstats_ctrl->dev_table_idx[idx] = i;
-				xstats_ctrl->info[idx] = mlx5_counters_init[j];
-				break;
-			}
-		}
-	}
-	/* Add dev counters. */
-	for (i = 0; i != xstats_n; ++i) {
-		if (mlx5_counters_init[i].dev) {
-			unsigned int idx = xstats_ctrl->mlx5_stats_n++;
-
-			xstats_ctrl->info[idx] = mlx5_counters_init[i];
-			xstats_ctrl->hw_stats[idx] = 0;
-		}
-	}
-	MLX5_ASSERT(xstats_ctrl->mlx5_stats_n <= MLX5_MAX_XSTATS);
-	xstats_ctrl->stats_n = dev_stats_n;
-	/* Copy to base at first time. */
-	ret = mlx5_os_read_dev_counters(dev, xstats_ctrl->base);
-	if (ret)
-		DRV_LOG(ERR, "port %u cannot read device counters: %s",
-			dev->data->port_id, strerror(rte_errno));
-	mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base);
-	stats_ctrl->imissed = 0;
-free:
-	mlx5_free(strings);
-}
-
-/**
  * Set the reg_mr and dereg_mr call backs
  *
  * @param reg_mr_cb[out]
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index afc0e83..00ee2e3 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -736,7 +736,6 @@ struct mlx5_priv {
 	LIST_HEAD(ind_tables, mlx5_ind_table_obj) ind_tbls;
 	/* Pointer to next element. */
 	rte_atomic32_t refcnt; /**< Reference counter. */
-	struct ibv_flow_action *verbs_action;
 	/**< Verbs modify header action object. */
 	uint8_t ft_type; /**< Flow table type, Rx or Tx. */
 	uint8_t max_lro_msg_size;
@@ -819,10 +818,8 @@ int mlx5_hairpin_cap_get(struct rte_eth_dev *dev,
 
 int mlx5_get_ifname(const struct rte_eth_dev *dev, char (*ifname)[IF_NAMESIZE]);
 unsigned int mlx5_ifindex(const struct rte_eth_dev *dev);
-int mlx5_ifreq(const struct rte_eth_dev *dev, int req, struct ifreq *ifr);
+int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]);
 int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu);
-int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep,
-		   unsigned int flags);
 int mlx5_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
 int mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock);
 int mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete);
@@ -856,6 +853,11 @@ int mlx5_get_module_info(struct rte_eth_dev *dev,
 int mlx5_get_module_eeprom(struct rte_eth_dev *dev,
 			   struct rte_dev_eeprom_info *info);
 int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);
+int mlx5_os_read_dev_stat(struct mlx5_priv *priv,
+			  const char *ctr_name, uint64_t *stat);
+int mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats);
+int mlx5_os_get_stats_n(struct rte_eth_dev *dev);
+void mlx5_os_stats_init(struct rte_eth_dev *dev);
 
 /* mlx5_mac.c */
 
@@ -1016,11 +1018,6 @@ int mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		       struct rte_pci_device *pci_dev);
 void mlx5_os_dev_shared_handler_install(struct mlx5_dev_ctx_shared *sh);
 void mlx5_os_dev_shared_handler_uninstall(struct mlx5_dev_ctx_shared *sh);
-int mlx5_os_read_dev_stat(struct mlx5_priv *priv,
-			  const char *ctr_name, uint64_t *stat);
-int mlx5_os_read_dev_counters(struct rte_eth_dev *dev, uint64_t *stats);
-int mlx5_os_get_stats_n(struct rte_eth_dev *dev);
-void mlx5_os_stats_init(struct rte_eth_dev *dev);
 void mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb,
 			   mlx5_dereg_mr_t *dereg_mr_cb);
 void mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
-- 
2.8.4


  parent reply	other threads:[~2020-07-19  7:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 14:20 [dpdk-dev] [PATCH v1 0/8] mlx5 PMD multi OS support - part #3 Ophir Munk
2020-07-14 14:20 ` [dpdk-dev] [PATCH v1 1/8] net/mlx5: move flow prio discovery and adjust under verbs Ophir Munk
2020-07-14 14:20 ` [dpdk-dev] [PATCH v1 2/8] net/mlx5: replace Linux specific calls with rte API Ophir Munk
2020-07-14 14:20 ` [dpdk-dev] [PATCH v1 3/8] net/mlx5: refactor Linux MAC operations Ophir Munk
2020-07-14 14:20 ` [dpdk-dev] [PATCH v1 4/8] linux/mlx5: add setters for promiscuous and all-multi Ophir Munk
2020-07-14 14:20 ` [dpdk-dev] [PATCH v1 5/8] net/mlx5: eliminate dependency on Linux in shared header Ophir Munk
2020-07-14 14:21 ` [dpdk-dev] [PATCH v1 6/8] net/mlx5: header file cleanup Ophir Munk
2020-07-14 14:21 ` [dpdk-dev] [PATCH v1 7/8] net/mlx5: refactor multi process communication Ophir Munk
2020-07-14 14:21 ` [dpdk-dev] [PATCH v1 8/8] mlx5: remove inclusion of verbs header files Ophir Munk
2020-07-19  7:11   ` [dpdk-dev] [PATCH v2 0/8] mlx5 PMD multi OS support - part #3 Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 1/8] net/mlx5: move flow prio discovery and adjust under Verbs Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 2/8] net/mlx5: replace Linux specific calls with rte API Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 3/8] net/mlx5: refactor Linux MAC operations Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 4/8] linux/mlx5: add setters for promiscuous and all-multi Ophir Munk
2020-07-19  7:11     ` Ophir Munk [this message]
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 6/8] net/mlx5: header file cleanup Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 7/8] net/mlx5: refactor multi process communication Ophir Munk
2020-07-19  7:11     ` [dpdk-dev] [PATCH v2 8/8] mlx5: remove inclusion of Verbs header files Ophir Munk
2020-07-19 10:18       ` [dpdk-dev] [PATCH v3 0/8] mlx5 PMD multi OS support - part #3 Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 1/8] net/mlx5: move flow prio discovery and adjust under Verbs Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 2/8] net/mlx5: replace Linux specific calls with rte API Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 3/8] net/mlx5: refactor Linux MAC operations Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 4/8] linux/mlx5: add setters for promiscuous and all-multi Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 5/8] net/mlx5: eliminate dependency on Linux in shared header Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 6/8] net/mlx5: header file cleanup Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 7/8] net/mlx5: refactor multi process communication Ophir Munk
2020-07-19 10:18         ` [dpdk-dev] [PATCH v3 8/8] mlx5: remove inclusion of Verbs header files Ophir Munk
2020-07-19 14:56         ` [dpdk-dev] [PATCH v3 0/8] mlx5 PMD multi OS support - part #3 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=20200719071112.8540-6-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).