Patch set 73781–73783 v7

[v7,1/3] drivers/net: fix build with internal API usage

Submitter
Ferruh Yigit
Applied on
dpdk-next-net (76704fd5b49115b0b4849e1a472323cd4d0f75b4)
Date submitted
July 10, 2020, 9:43 p.m.

Test Results Apply Error

Checking patch app/test/meson.build...
error: while searching for:
# Strict-aliasing rules are violated by uint8_t[] to context size casts.
cflags += '-fno-strict-aliasing'

test_dep_objs = []
if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
	compress_test_dep = dependency('zlib', required: false)

error: patch failed: app/test/meson.build:396
Checking patch drivers/net/atlantic/rte_pmd_atlantic.h...
error: while searching for:
#ifndef _PMD_ATLANTIC_H_
#define _PMD_ATLANTIC_H_

#include <rte_ethdev_driver.h>

/**
 * @warning

error: patch failed: drivers/net/atlantic/rte_pmd_atlantic.h:11
Checking patch drivers/net/bnxt/rte_pmd_bnxt.h...
error: while searching for:
#ifndef _PMD_BNXT_H_
#define _PMD_BNXT_H_

#include <rte_ethdev_driver.h>

/*
 * Response sent back to the caller after callback

error: patch failed: drivers/net/bnxt/rte_pmd_bnxt.h:6
Checking patch drivers/net/dpaa/rte_pmd_dpaa.h...
error: while searching for:
 *
 */

#include <rte_ethdev_driver.h>

/**
 * Enable/Disable TX loopback
 *

error: patch failed: drivers/net/dpaa/rte_pmd_dpaa.h:15
Checking patch drivers/net/i40e/rte_pmd_i40e.h...
error: while searching for:
 *
 */

#include <rte_ethdev_driver.h>

/**
 * Response sent back to i40e driver from user app after callback

error: patch failed: drivers/net/i40e/rte_pmd_i40e.h:14
Checking patch drivers/net/ixgbe/rte_pmd_ixgbe.h...
error: while searching for:
#ifndef _PMD_IXGBE_H_
#define _PMD_IXGBE_H_

#include <rte_ethdev_driver.h>

/**
 * Notify VF when PF link status changes.

error: patch failed: drivers/net/ixgbe/rte_pmd_ixgbe.h:11
Applying patch app/test/meson.build with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/atlantic/rte_pmd_atlantic.h with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/bnxt/rte_pmd_bnxt.h with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/dpaa/rte_pmd_dpaa.h with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/i40e/rte_pmd_i40e.h with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/ixgbe/rte_pmd_ixgbe.h with 1 reject...
Rejected hunk #1.
diff a/app/test/meson.build b/app/test/meson.build	(rejected hunks)
@@ -396,6 +396,9 @@ cflags += '-D_GNU_SOURCE'
 # Strict-aliasing rules are violated by uint8_t[] to context size casts.
 cflags += '-fno-strict-aliasing'
 
+# Enable using internal APIs in unit tests
+cflags += ['-DALLOW_INTERNAL_API']
+
 test_dep_objs = []
 if dpdk_conf.has('RTE_LIBRTE_COMPRESSDEV')
 	compress_test_dep = dependency('zlib', required: false)
diff a/drivers/net/atlantic/rte_pmd_atlantic.h b/drivers/net/atlantic/rte_pmd_atlantic.h	(rejected hunks)
@@ -11,7 +11,7 @@
 #ifndef _PMD_ATLANTIC_H_
 #define _PMD_ATLANTIC_H_
 
-#include <rte_ethdev_driver.h>
+#include <rte_compat.h>
 
 /**
  * @warning
diff a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h	(rejected hunks)
@@ -6,7 +6,8 @@
 #ifndef _PMD_BNXT_H_
 #define _PMD_BNXT_H_
 
-#include <rte_ethdev_driver.h>
+#include <rte_ethdev.h>
+#include <rte_ether.h>
 
 /*
  * Response sent back to the caller after callback
diff a/drivers/net/dpaa/rte_pmd_dpaa.h b/drivers/net/dpaa/rte_pmd_dpaa.h	(rejected hunks)
@@ -15,8 +15,6 @@
  *
  */
 
-#include <rte_ethdev_driver.h>
-
 /**
  * Enable/Disable TX loopback
  *
diff a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h	(rejected hunks)
@@ -14,7 +14,9 @@
  *
  */
 
-#include <rte_ethdev_driver.h>
+#include <rte_compat.h>
+#include <rte_ethdev.h>
+#include <rte_ether.h>
 
 /**
  * Response sent back to i40e driver from user app after callback
diff a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h	(rejected hunks)
@@ -11,7 +11,9 @@
 #ifndef _PMD_IXGBE_H_
 #define _PMD_IXGBE_H_
 
-#include <rte_ethdev_driver.h>
+#include <rte_compat.h>
+#include <rte_ethdev.h>
+#include <rte_ether.h>
 
 /**
  * Notify VF when PF link status changes.
Checking patch lib/librte_ethdev/rte_ethdev.c...
error: while searching for:
	return fd;
}

const struct rte_memzone *
rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
			 uint16_t queue_id, size_t size, unsigned align,

error: patch failed: lib/librte_ethdev/rte_ethdev.c:4201
error: while searching for:
	const struct rte_memzone *mz;
	int rc;

	rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
		      dev->data->port_id, queue_id, ring_name);
	if (rc >= RTE_MEMZONE_NAMESIZE) {
		RTE_ETHDEV_LOG(ERR, "ring name too long\n");
		rte_errno = ENAMETOOLONG;

error: patch failed: lib/librte_ethdev/rte_ethdev.c:4210
error: while searching for:
			RTE_MEMZONE_IOVA_CONTIG, align);
}

int
rte_eth_dev_create(struct rte_device *device, const char *name,
	size_t priv_data_size,

error: patch failed: lib/librte_ethdev/rte_ethdev.c:4236
Checking patch lib/librte_ethdev/rte_ethdev_driver.h...
error: while searching for:
			 uint16_t queue_id, size_t size,
			 unsigned align, int socket_id);

/**
 * @internal
 * Atomically set the link status for the specific device.

error: patch failed: lib/librte_ethdev/rte_ethdev_driver.h:180
Checking patch lib/librte_ethdev/rte_ethdev_version.map...
error: while searching for:
	__rte_ethdev_trace_tx_burst;
	rte_flow_get_aged_flows;
};

error: patch failed: lib/librte_ethdev/rte_ethdev_version.map:242
Applying patch lib/librte_ethdev/rte_ethdev.c with 3 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.
Applying patch lib/librte_ethdev/rte_ethdev_driver.h with 1 reject...
Rejected hunk #1.
Applying patch lib/librte_ethdev/rte_ethdev_version.map with 1 reject...
Rejected hunk #1.
diff a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c	(rejected hunks)
@@ -4201,6 +4201,14 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id)
 	return fd;
 }
 
+static inline int
+eth_dma_mzone_name(char *name, size_t len, uint16_t port_id, uint16_t queue_id,
+		const char *ring_name)
+{
+	return snprintf(name, len, "eth_p%d_q%d_%s",
+			port_id, queue_id, ring_name);
+}
+
 const struct rte_memzone *
 rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
 			 uint16_t queue_id, size_t size, unsigned align,
@@ -4210,8 +4218,8 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
 	const struct rte_memzone *mz;
 	int rc;
 
-	rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
-		      dev->data->port_id, queue_id, ring_name);
+	rc = eth_dma_mzone_name(z_name, sizeof(z_name), dev->data->port_id,
+			queue_id, ring_name);
 	if (rc >= RTE_MEMZONE_NAMESIZE) {
 		RTE_ETHDEV_LOG(ERR, "ring name too long\n");
 		rte_errno = ENAMETOOLONG;
@@ -4236,6 +4244,30 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
 			RTE_MEMZONE_IOVA_CONTIG, align);
 }
 
+int
+rte_eth_dma_zone_free(const struct rte_eth_dev *dev, const char *ring_name,
+		uint16_t queue_id)
+{
+	char z_name[RTE_MEMZONE_NAMESIZE];
+	const struct rte_memzone *mz;
+	int rc = 0;
+
+	rc = eth_dma_mzone_name(z_name, sizeof(z_name), dev->data->port_id,
+			queue_id, ring_name);
+	if (rc >= RTE_MEMZONE_NAMESIZE) {
+		RTE_ETHDEV_LOG(ERR, "ring name too long\n");
+		return -ENAMETOOLONG;
+	}
+
+	mz = rte_memzone_lookup(z_name);
+	if (mz)
+		rc = rte_memzone_free(mz);
+	else
+		rc = -ENOENT;
+
+	return rc;
+}
+
 int
 rte_eth_dev_create(struct rte_device *device, const char *name,
 	size_t priv_data_size,
diff a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h	(rejected hunks)
@@ -180,6 +180,23 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name,
 			 uint16_t queue_id, size_t size,
 			 unsigned align, int socket_id);
 
+/**
+ * Free previously allocated memzone for HW rings.
+ *
+ * @param eth_dev
+ *   The *eth_dev* pointer is the address of the *rte_eth_dev* structure
+ * @param name
+ *   The name of the memory zone
+ * @param queue_id
+ *   The index of the queue to add to name
+ * @return
+ *   Negative errno value on error, 0 on success.
+ */
+__rte_internal
+int
+rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name,
+		 uint16_t queue_id);
+
 /**
  * @internal
  * Atomically set the link status for the specific device.
diff a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map	(rejected hunks)
@@ -242,3 +242,10 @@ EXPERIMENTAL {
 	__rte_ethdev_trace_tx_burst;
 	rte_flow_get_aged_flows;
 };
+
+INTERNAL {
+	global:
+
+	rte_eth_dma_zone_free;
+};
+
Checking patch drivers/net/e1000/em_rxtx.c...
error: while searching for:
	for (i = 0; i < dev->data->nb_rx_queues; i++) {
		eth_em_rx_queue_release(dev->data->rx_queues[i]);
		dev->data->rx_queues[i] = NULL;
	}
	dev->data->nb_rx_queues = 0;

	for (i = 0; i < dev->data->nb_tx_queues; i++) {
		eth_em_tx_queue_release(dev->data->tx_queues[i]);
		dev->data->tx_queues[i] = NULL;
	}
	dev->data->nb_tx_queues = 0;
}

error: patch failed: drivers/net/e1000/em_rxtx.c:1611
Checking patch drivers/net/e1000/igb_rxtx.c...
error: while searching for:
	for (i = 0; i < dev->data->nb_rx_queues; i++) {
		eth_igb_rx_queue_release(dev->data->rx_queues[i]);
		dev->data->rx_queues[i] = NULL;
	}
	dev->data->nb_rx_queues = 0;

	for (i = 0; i < dev->data->nb_tx_queues; i++) {
		eth_igb_tx_queue_release(dev->data->tx_queues[i]);
		dev->data->tx_queues[i] = NULL;
	}
	dev->data->nb_tx_queues = 0;
}

error: patch failed: drivers/net/e1000/igb_rxtx.c:1884
Checking patch drivers/net/i40e/i40e_fdir.c...
error: while searching for:
{
	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
	struct i40e_vsi *vsi;

	vsi = pf->fdir.fdir_vsi;
	if (!vsi)

error: patch failed: drivers/net/i40e/i40e_fdir.c:269
error: while searching for:
	if (err)
		PMD_DRV_LOG(DEBUG, "Failed to do FDIR RX switch off");
	i40e_dev_rx_queue_release(pf->fdir.rxq);
	pf->fdir.rxq = NULL;
	i40e_dev_tx_queue_release(pf->fdir.txq);
	pf->fdir.txq = NULL;
	i40e_vsi_release(vsi);
	pf->fdir.fdir_vsi = NULL;

error: patch failed: drivers/net/i40e/i40e_fdir.c:280
Checking patch drivers/net/i40e/i40e_rxtx.c...
error: while searching for:
			continue;
		i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
		dev->data->rx_queues[i] = NULL;
	}

	for (i = 0; i < dev->data->nb_tx_queues; i++) {

error: patch failed: drivers/net/i40e/i40e_rxtx.c:2928
error: while searching for:
			continue;
		i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
		dev->data->tx_queues[i] = NULL;
	}
}


error: patch failed: drivers/net/i40e/i40e_rxtx.c:2935
Checking patch drivers/net/ice/ice_rxtx.c...
error: while searching for:
			continue;
		ice_rx_queue_release(dev->data->rx_queues[i]);
		dev->data->rx_queues[i] = NULL;
	}
	dev->data->nb_rx_queues = 0;


error: patch failed: drivers/net/ice/ice_rxtx.c:1905
error: while searching for:
			continue;
		ice_tx_queue_release(dev->data->tx_queues[i]);
		dev->data->tx_queues[i] = NULL;
	}
	dev->data->nb_tx_queues = 0;
}

error: patch failed: drivers/net/ice/ice_rxtx.c:1913
Checking patch drivers/net/ixgbe/ixgbe_rxtx.c...
error: while searching for:
	for (i = 0; i < dev->data->nb_rx_queues; i++) {
		ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]);
		dev->data->rx_queues[i] = NULL;
	}
	dev->data->nb_rx_queues = 0;

	for (i = 0; i < dev->data->nb_tx_queues; i++) {
		ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]);
		dev->data->tx_queues[i] = NULL;
	}
	dev->data->nb_tx_queues = 0;
}

error: patch failed: drivers/net/ixgbe/ixgbe_rxtx.c:3368
Applying patch drivers/net/e1000/em_rxtx.c with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/e1000/igb_rxtx.c with 1 reject...
Rejected hunk #1.
Applying patch drivers/net/i40e/i40e_fdir.c with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applying patch drivers/net/i40e/i40e_rxtx.c with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applying patch drivers/net/ice/ice_rxtx.c with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Applying patch drivers/net/ixgbe/ixgbe_rxtx.c with 1 reject...
Rejected hunk #1.
diff a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c	(rejected hunks)
@@ -1611,12 +1611,14 @@ em_dev_free_queues(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		eth_em_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		eth_em_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 	dev->data->nb_tx_queues = 0;
 }
diff a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c	(rejected hunks)
@@ -1884,12 +1884,14 @@ igb_dev_free_queues(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		eth_igb_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		eth_igb_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 	dev->data->nb_tx_queues = 0;
 }
diff a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c	(rejected hunks)
@@ -269,6 +269,7 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
 	struct i40e_vsi *vsi;
+	struct rte_eth_dev *dev = pf->adapter->eth_dev;
 
 	vsi = pf->fdir.fdir_vsi;
 	if (!vsi)
@@ -280,8 +281,10 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 	if (err)
 		PMD_DRV_LOG(DEBUG, "Failed to do FDIR RX switch off");
 	i40e_dev_rx_queue_release(pf->fdir.rxq);
+	rte_eth_dma_zone_free(dev, "fdir_rx_ring", pf->fdir.rxq->queue_id);
 	pf->fdir.rxq = NULL;
 	i40e_dev_tx_queue_release(pf->fdir.txq);
+	rte_eth_dma_zone_free(dev, "fdir_tx_ring", pf->fdir.txq->queue_id);
 	pf->fdir.txq = NULL;
 	i40e_vsi_release(vsi);
 	pf->fdir.fdir_vsi = NULL;
diff a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c	(rejected hunks)
@@ -2928,6 +2928,7 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
 			continue;
 		i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -2935,6 +2936,7 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
 			continue;
 		i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 }
 
diff a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c	(rejected hunks)
@@ -1905,6 +1905,7 @@ ice_free_queues(struct rte_eth_dev *dev)
 			continue;
 		ice_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 	dev->data->nb_rx_queues = 0;
 
@@ -1913,6 +1914,7 @@ ice_free_queues(struct rte_eth_dev *dev)
 			continue;
 		ice_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 	dev->data->nb_tx_queues = 0;
 }
diff a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c	(rejected hunks)
@@ -3368,12 +3368,14 @@ ixgbe_dev_free_queues(struct rte_eth_dev *dev)
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		ixgbe_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
 		ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
+		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 	dev->data->nb_tx_queues = 0;
 }