Skip to contentSkip to conversation

Crypto API and device framework

PATCH Superseded Declan Doherty 8 participants 115 messages Oct 2, 2015 – Nov 25, 2015 Page 2 of 2

Subsystems (2)
lore
Share & tools
lore
#70 lore raw

PATCH v7 1/10 ethdev: rename macros to have RTE_ prefix

In reply to Declan Doherty

The macros to check that the function pointers and port ids are valid for an ethdev are potentially useful to have in a common headers for use with all PMDs. However, since they would then become externally visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

---
 lib/librte_ether/rte_ethdev.c | 595 +++++++++++++++++++++---------------------
 1 file changed, 298 insertions(+), 297 deletions(-)
lib/librte_ether/rte_ethdev.c +298 -297
index e0e1dca..3bb25e4 100644
@@ -70,58 +70,59 @@
 #include "rte_ethdev.h"
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define PMD_DEBUG_TRACE(fmt, args...) do {                        \
+#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \
 		RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
 	} while (0)
 #else
-#define PMD_DEBUG_TRACE(fmt, args...)
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
 #endif
 
 /* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define PROC_PRIMARY_OR_RET() do { \
+#define RTE_PROC_PRIMARY_OR_RET() do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for invalid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for valid port */
-#define VALID_PORTID_OR_ERR_RET(port_id, retval) do {		\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return retval;					\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) {  \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return retval; \
+	} \
 } while (0)
 
-#define VALID_PORTID_OR_RET(port_id) do {			\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return;						\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return; \
+	} \
 } while (0)
 
+
 static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
 static struct rte_eth_dev_data *rte_eth_dev_data;
@@ -244,7 +245,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 
 	port_id = rte_eth_dev_find_free_port();
 	if (port_id == RTE_MAX_ETHPORTS) {
-		PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
+		RTE_PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
 		return NULL;
 	}
 
@@ -252,7 +253,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 		rte_eth_dev_data_alloc();
 
 	if (rte_eth_dev_allocated(name) != NULL) {
-		PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
+		RTE_PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
 				name);
 		return NULL;
 	}
@@ -339,7 +340,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 	if (diag == 0)
 		return 0;
 
-	PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
+	RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
 			pci_drv->name,
 			(unsigned) pci_dev->id.vendor_id,
 			(unsigned) pci_dev->id.device_id);
@@ -447,10 +448,10 @@ rte_eth_dev_get_device_type(uint8_t port_id)
 static int
 rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
 {
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -463,10 +464,10 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 {
 	char *tmp;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -483,7 +484,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 	int i;
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -509,7 +510,7 @@ rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
 	struct rte_pci_device *pci_dev = NULL;
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -536,7 +537,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 	uint32_t dev_flags;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
@@ -735,7 +736,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
 
 		rxq = dev->data->rx_queues;
 
@@ -766,20 +767,20 @@ rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -796,20 +797,20 @@ rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -826,20 +827,20 @@ rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -856,20 +857,20 @@ rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -895,7 +896,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
 
 		txq = dev->data->tx_queues;
 
@@ -929,19 +930,19 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of RX queues requested (%u) is greater than max supported(%d)\n",
 			nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of TX queues requested (%u) is greater than max supported(%d)\n",
 			nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
@@ -949,11 +950,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
@@ -965,22 +966,22 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 	if (nb_rx_q > dev_info.max_rx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
 				port_id, nb_rx_q, dev_info.max_rx_queues);
 		return -EINVAL;
 	}
 	if (nb_rx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
 				port_id, nb_tx_q, dev_info.max_tx_queues);
 		return -EINVAL;
 	}
 	if (nb_tx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
@@ -993,7 +994,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	if ((dev_conf->intr_conf.lsc == 1) &&
 		(!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
-			PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+			RTE_PMD_DEBUG_TRACE("driver %s does not support lsc\n",
 					dev->data->drv_name);
 			return -EINVAL;
 	}
@@ -1005,14 +1006,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	if (dev_conf->rxmode.jumbo_frame == 1) {
 		if (dev_conf->rxmode.max_rx_pkt_len >
 		    dev_info.max_rx_pktlen) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" > max valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
 				(unsigned)dev_info.max_rx_pktlen);
 			return -EINVAL;
 		} else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" < min valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
@@ -1032,14 +1033,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	diag = rte_eth_dev_rx_queue_config(dev, nb_rx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
 				port_id, diag);
 		return diag;
 	}
 
 	diag = rte_eth_dev_tx_queue_config(dev, nb_tx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		return diag;
@@ -1047,7 +1048,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	diag = (*dev->dev_ops->dev_configure)(dev);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		rte_eth_dev_tx_queue_config(dev, 0);
@@ -1086,7 +1087,7 @@ rte_eth_dev_config_restore(uint8_t port_id)
 			(dev->data->mac_pool_sel[i] & (1ULL << pool)))
 			(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
 		else {
-			PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
 					port_id);
 			/* exit the loop but not return an error */
 			break;
@@ -1114,16 +1115,16 @@ rte_eth_dev_start(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
 
 	if (dev->data->dev_started != 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already started\n",
 			port_id);
 		return 0;
@@ -1138,7 +1139,7 @@ rte_eth_dev_start(uint8_t port_id)
 	rte_eth_dev_config_restore(port_id);
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 	return 0;
@@ -1151,15 +1152,15 @@ rte_eth_dev_stop(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
 
 	if (dev->data->dev_started == 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already stopped\n",
 			port_id);
 		return;
@@ -1176,13 +1177,13 @@ rte_eth_dev_set_link_up(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_up)(dev);
 }
 
@@ -1193,13 +1194,13 @@ rte_eth_dev_set_link_down(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_down)(dev);
 }
 
@@ -1210,12 +1211,12 @@ rte_eth_dev_close(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
 	dev->data->dev_started = 0;
 	(*dev->dev_ops->dev_close)(dev);
 
@@ -1238,24 +1239,24 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
 
 	/*
 	 * Check the size of the mbuf data buffer.
@@ -1264,7 +1265,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	 */
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if (mp->private_data_size < sizeof(struct rte_pktmbuf_pool_private)) {
-		PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
+		RTE_PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
 				mp->name, (int) mp->private_data_size,
 				(int) sizeof(struct rte_pktmbuf_pool_private));
 		return -ENOSPC;
@@ -1272,7 +1273,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	mbp_buf_size = rte_pktmbuf_data_room_size(mp);
 
 	if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
-		PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
+		RTE_PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
 				"(RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)"
 				"=%d)\n",
 				mp->name,
@@ -1288,7 +1289,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 			nb_rx_desc < dev_info.rx_desc_lim.nb_min ||
 			nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) {
 
-		PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
+		RTE_PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
 			"should be: <= %hu, = %hu, and a product of %hu\n",
 			nb_rx_desc,
 			dev_info.rx_desc_lim.nb_max,
@@ -1321,24 +1322,24 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
 
 	rte_eth_dev_info_get(port_id, &dev_info);
 
@@ -1354,10 +1355,10 @@ rte_eth_promiscuous_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
 }
@@ -1367,10 +1368,10 @@ rte_eth_promiscuous_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
 }
@@ -1380,7 +1381,7 @@ rte_eth_promiscuous_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->promiscuous;
@@ -1391,10 +1392,10 @@ rte_eth_allmulticast_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
 	(*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = 1;
 }
@@ -1404,10 +1405,10 @@ rte_eth_allmulticast_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
 	dev->data->all_multicast = 0;
 	(*dev->dev_ops->allmulticast_disable)(dev);
 }
@@ -1417,7 +1418,7 @@ rte_eth_allmulticast_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->all_multicast;
@@ -1442,13 +1443,13 @@ rte_eth_link_get(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1459,13 +1460,13 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1476,12 +1477,12 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	memset(stats, 0, sizeof(*stats));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
 	(*dev->dev_ops->stats_get)(dev, stats);
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return 0;
@@ -1492,10 +1493,10 @@ rte_eth_stats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1510,7 +1511,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
 	signed xcount = 0;
 	uint64_t val, *stats_ptr;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
@@ -1590,7 +1591,7 @@ rte_eth_xstats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	/* implemented by the driver */
@@ -1609,11 +1610,11 @@ set_queue_stats_mapping(uint8_t port_id, uint16_t queue_id, uint8_t stat_idx,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
 	return (*dev->dev_ops->queue_stats_mapping_set)
 			(dev, queue_id, stat_idx, is_rx);
 }
@@ -1647,14 +1648,14 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 		.nb_align = 1,
 	};
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
 	dev_info->rx_desc_lim = lim;
 	dev_info->tx_desc_lim = lim;
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	dev_info->pci_dev = dev->pci_dev;
 	dev_info->driver_name = dev->data->drv_name;
@@ -1665,7 +1666,7 @@ rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 	ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
 }
@@ -1676,7 +1677,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	*mtu = dev->data->mtu;
@@ -1689,9 +1690,9 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
 
 	ret = (*dev->dev_ops->mtu_set)(dev, mtu);
 	if (!ret)
@@ -1705,19 +1706,19 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) {
-		PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
 		return -ENOSYS;
 	}
 
 	if (vlan_id > 4095) {
-		PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
+		RTE_PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
 				port_id, (unsigned) vlan_id);
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
 
 	return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 }
@@ -1727,14 +1728,14 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -1745,9 +1746,9 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id, uint16_t tpid)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_tpid_set)(dev, tpid);
 
 	return 0;
@@ -1761,7 +1762,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	int mask = 0;
 	int cur, org = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	/*check which option changed by application*/
@@ -1790,7 +1791,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	if (mask == 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_offload_set)(dev, mask);
 
 	return ret;
@@ -1802,7 +1803,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 	struct rte_eth_dev *dev;
 	int ret = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.rxmode.hw_vlan_strip)
@@ -1822,9 +1823,9 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_pvid_set)(dev, pvid, on);
 
 	return 0;
@@ -1835,9 +1836,9 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf);
 }
@@ -1847,14 +1848,14 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) {
-		PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
 	return (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf);
 }
 
@@ -1863,9 +1864,9 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) {
-		PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
 		return -EINVAL;
 	}
 
@@ -1886,7 +1887,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (reta_size != RTE_ALIGN(reta_size, RTE_RETA_GROUP_SIZE)) {
-		PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
+		RTE_PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
 							RTE_RETA_GROUP_SIZE);
 		return -EINVAL;
 	}
@@ -1911,7 +1912,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (max_rxq == 0) {
-		PMD_DEBUG_TRACE("No receive queue is available\n");
+		RTE_PMD_DEBUG_TRACE("No receive queue is available\n");
 		return -EINVAL;
 	}
 
@@ -1920,7 +1921,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		shift = i % RTE_RETA_GROUP_SIZE;
 		if ((reta_conf[idx].mask & (1ULL << shift)) &&
 			(reta_conf[idx].reta[shift] >= max_rxq)) {
-			PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
+			RTE_PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
 				"the maximum rxq index: %u\n", idx, shift,
 				reta_conf[idx].reta[shift], max_rxq);
 			return -EINVAL;
@@ -1938,7 +1939,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	struct rte_eth_dev *dev;
 	int ret;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	/* Check mask bits */
 	ret = rte_eth_check_reta_mask(reta_conf, reta_size);
 	if (ret < 0)
@@ -1952,7 +1953,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	if (ret < 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
 	return (*dev->dev_ops->reta_update)(dev, reta_conf, reta_size);
 }
 
@@ -1965,7 +1966,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 	int ret;
 
 	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
@@ -1975,7 +1976,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 		return ret;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
 	return (*dev->dev_ops->reta_query)(dev, reta_conf, reta_size);
 }
 
@@ -1985,16 +1986,16 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
 	struct rte_eth_dev *dev;
 	uint16_t rss_hash_protos;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	rss_hash_protos = rss_conf->rss_hf;
 	if ((rss_hash_protos != 0) &&
 	    ((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
-		PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
+		RTE_PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
 				rss_hash_protos);
 		return -EINVAL;
 	}
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_update)(dev, rss_conf);
 }
 
@@ -2004,9 +2005,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf);
 }
 
@@ -2016,19 +2017,19 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_add)(dev, udp_tunnel);
 }
 
@@ -2038,20 +2039,20 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_del)(dev, udp_tunnel);
 }
 
@@ -2060,9 +2061,9 @@ rte_eth_led_on(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_on)(dev);
 }
 
@@ -2071,9 +2072,9 @@ rte_eth_led_off(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_off)(dev);
 }
 
@@ -2107,17 +2108,17 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	int index;
 	uint64_t pool_mask;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
 
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
 	if (pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
+		RTE_PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
 
@@ -2125,7 +2126,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	if (index < 0) {
 		index = get_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 				port_id);
 			return -ENOSPC;
 		}
@@ -2155,13 +2156,13 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
 	struct rte_eth_dev *dev;
 	int index;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
 
 	index = get_mac_addr_index(port_id, addr);
 	if (index == 0) {
-		PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
 		return -EADDRINUSE;
 	} else if (index < 0)
 		return 0;  /* Do nothing if address wasn't found */
@@ -2183,13 +2184,13 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (!is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
 
 	/* Update default address in NIC data structure */
 	ether_addr_copy(addr, &dev->data->mac_addrs[0]);
@@ -2207,22 +2208,22 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
 		return -EINVAL;
 	}
 
 	if (rx_mode == 0) {
-		PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on);
 }
 
@@ -2257,11 +2258,11 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -2273,20 +2274,20 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 
 	if (index < 0) {
 		if (!on) {
-			PMD_DEBUG_TRACE("port %d: the MAC address was not "
+			RTE_PMD_DEBUG_TRACE("port %d: the MAC address was not "
 				"set in UTA\n", port_id);
 			return -EINVAL;
 		}
 
 		index = get_hash_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 					port_id);
 			return -ENOSPC;
 		}
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -2306,11 +2307,11 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
 	return (*dev->dev_ops->uc_all_hash_table_set)(dev, on);
 }
 
@@ -2321,18 +2322,18 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx)(dev, vf, on);
 }
 
@@ -2343,18 +2344,18 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_tx)(dev, vf, on);
 }
 
@@ -2364,22 +2365,22 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
 	if (vlan_id > ETHER_MAX_VLAN_ID) {
-		PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
 			vlan_id);
 		return -EINVAL;
 	}
 
 	if (vf_mask == 0) {
-		PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id,
 						   vf_mask, vlan_on);
 }
@@ -2391,26 +2392,26 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_link link;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (queue_idx > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("set queue rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:port %d: "
 				"invalid queue id=%d\n", port_id, queue_idx);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 			tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_queue_rate_limit)(dev, queue_idx, tx_rate);
 }
 
@@ -2424,26 +2425,26 @@ int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf, uint16_t tx_rate,
 	if (q_msk == 0)
 		return 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (vf > dev_info.max_vfs) {
-		PMD_DEBUG_TRACE("set VF rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:port %d: "
 				"invalid vf id=%d\n", port_id, vf);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 				tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk);
 }
 
@@ -2454,14 +2455,14 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (mirror_conf->rule_type == 0) {
-		PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if (mirror_conf->dst_pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
+		RTE_PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
 				ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
@@ -2469,18 +2470,18 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 	if ((mirror_conf->rule_type & (ETH_MIRROR_VIRTUAL_POOL_UP |
 	     ETH_MIRROR_VIRTUAL_POOL_DOWN)) &&
 	    (mirror_conf->pool_mask == 0)) {
-		PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if ((mirror_conf->rule_type & ETH_MIRROR_VLAN) &&
 	    mirror_conf->vlan.vlan_mask == 0) {
-		PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_set)(dev, mirror_conf, rule_id, on);
 }
@@ -2490,10 +2491,10 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_reset)(dev, rule_id);
 }
@@ -2505,12 +2506,12 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
@@ -2523,13 +2524,13 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id],
@@ -2541,10 +2542,10 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
 	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
 }
 
@@ -2553,10 +2554,10 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
 	return (*dev->dev_ops->rx_descriptor_done)(dev->data->rx_queues[queue_id],
 						   offset);
 }
@@ -2573,7 +2574,7 @@ rte_eth_dev_callback_register(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2613,7 +2614,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2676,14 +2677,14 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
@@ -2691,7 +2692,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 		vec = intr_handle->intr_vec[qid];
 		rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 		if (rc && rc != -EEXIST) {
-			PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+			RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 					" op %d epfd %d vec %u\n",
 					port_id, qid, op, epfd, vec);
 		}
@@ -2710,26 +2711,26 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
 		return -EINVAL;
 	}
 
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
 	vec = intr_handle->intr_vec[queue_id];
 	rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 	if (rc && rc != -EEXIST) {
-		PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+		RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 				" op %d epfd %d vec %u\n",
 				port_id, queue_id, op, epfd, vec);
 		return rc;
@@ -2745,13 +2746,13 @@ rte_eth_dev_rx_intr_enable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id);
 }
 
@@ -2762,13 +2763,13 @@ rte_eth_dev_rx_intr_disable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id);
 }
 
@@ -2777,10 +2778,10 @@ int rte_eth_dev_bypass_init(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
 	(*dev->dev_ops->bypass_init)(dev);
 	return 0;
 }
@@ -2790,10 +2791,10 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_show)(dev, state);
 	return 0;
 }
@@ -2803,10 +2804,10 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_set)(dev, new_state);
 	return 0;
 }
@@ -2816,10 +2817,10 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_show)(dev, event, state);
 	return 0;
 }
@@ -2829,11 +2830,11 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_set)(dev, event, state);
 	return 0;
 }
@@ -2843,11 +2844,11 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_set)(dev, timeout);
 	return 0;
 }
@@ -2857,11 +2858,11 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_ver_show)(dev, ver);
 	return 0;
 }
@@ -2871,11 +2872,11 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_show)(dev, wd_timeout);
 	return 0;
 }
@@ -2885,11 +2886,11 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_reset)(dev);
 	return 0;
 }
@@ -2900,10 +2901,10 @@ rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type,
 				RTE_ETH_FILTER_NOP, NULL);
 }
@@ -2914,10 +2915,10 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
 }
 
@@ -3087,18 +3088,18 @@ rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -3111,18 +3112,18 @@ rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -3136,10 +3137,10 @@ rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
 	return dev->dev_ops->set_mc_addr_list(dev, mc_addr_set, nb_mc_addr);
 }
 
@@ -3148,10 +3149,10 @@ rte_eth_timesync_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_enable)(dev);
 }
 
@@ -3160,10 +3161,10 @@ rte_eth_timesync_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_disable)(dev);
 }
 
@@ -3173,10 +3174,10 @@ rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_rx_timestamp)(dev, timestamp, flags);
 }
 
@@ -3185,10 +3186,10 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_tx_timestamp)(dev, timestamp);
 }
 
@@ -3197,10 +3198,10 @@ rte_eth_dev_get_reg_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
 	return (*dev->dev_ops->get_reg_length)(dev);
 }
 
@@ -3209,10 +3210,10 @@ rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
 	return (*dev->dev_ops->get_reg)(dev, info);
 }
 
@@ -3221,10 +3222,10 @@ rte_eth_dev_get_eeprom_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom_length)(dev);
 }
 
@@ -3233,10 +3234,10 @@ rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom)(dev, info);
 }
 
@@ -3245,10 +3246,10 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->set_eeprom)(dev, info);
 }
 
@@ -3259,14 +3260,14 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
 	return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
 }
 
@@ -3274,7 +3275,7 @@ void
 rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
 				eth_dev, pci_dev);
 	}
 
Signature · 1 line
2.5.0
#71 lore raw

Re: [PATCH v7 01/10] ethdev: rename macros to have RTE_ prefix

Quoted 5 lines · Declan Doherty

The macros to check that the function pointers and port ids are valid for an ethdev are potentially useful to have in a common headers for use with all PMDs. However, since they would then become externally visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

Quoted 8 lines
---
  lib/librte_ether/rte_ethdev.c | 595 +++++++++++++++++++++---------------------
  1 file changed, 298 insertions(+), 297 deletions(-)

<snip>

Hey Thomas,

this patch needs to be re-based due to the committal of Daniel's patch "ethdev: add ieee1588 functions for device clock time" is it ok to just send an updated patch for this single patch as it doesn't effect the other 9 patches in the series?

Thanks
Declan

#72 lore raw

Re: [PATCH v7 01/10] ethdev: rename macros to have RTE_ prefix

2015-11-17 14:44, Declan Doherty:

Quoted 6 lines

Hey Thomas,

this patch needs to be re-based due to the committal of Daniel's patch "ethdev: add ieee1588 functions for device clock time" is it ok to just send an updated patch for this single patch as it doesn't effect the other 9 patches in the series?

Yes, please use --in-reply-to to thread below v7 01/10 and change its state in patchwork.
Thanks

#73 lore raw

PATCH v5 1/10 ethdev: rename macros to have RTE_ prefix

In reply to Declan Doherty

The macros to check that the function pointers and port ids are valid for an ethdev are potentially useful to have in a common headers for use with all PMDs. However, since they would then become externally visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

---
 lib/librte_ether/rte_ethdev.c | 607 +++++++++++++++++++++---------------------
 1 file changed, 304 insertions(+), 303 deletions(-)
lib/librte_ether/rte_ethdev.c +304 -303
index b19ac9a..71775dc 100644
@@ -70,58 +70,59 @@
 #include "rte_ethdev.h"
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define PMD_DEBUG_TRACE(fmt, args...) do {                        \
+#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \
 		RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
 	} while (0)
 #else
-#define PMD_DEBUG_TRACE(fmt, args...)
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
 #endif
 
 /* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define PROC_PRIMARY_OR_RET() do { \
+#define RTE_PROC_PRIMARY_OR_RET() do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for invalid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for valid port */
-#define VALID_PORTID_OR_ERR_RET(port_id, retval) do {		\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return retval;					\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) {  \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return retval; \
+	} \
 } while (0)
 
-#define VALID_PORTID_OR_RET(port_id) do {			\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return;						\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return; \
+	} \
 } while (0)
 
+
 static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
 static struct rte_eth_dev_data *rte_eth_dev_data;
@@ -244,7 +245,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 
 	port_id = rte_eth_dev_find_free_port();
 	if (port_id == RTE_MAX_ETHPORTS) {
-		PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
+		RTE_PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
 		return NULL;
 	}
 
@@ -252,7 +253,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 		rte_eth_dev_data_alloc();
 
 	if (rte_eth_dev_allocated(name) != NULL) {
-		PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
+		RTE_PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
 				name);
 		return NULL;
 	}
@@ -339,7 +340,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 	if (diag == 0)
 		return 0;
 
-	PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
+	RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
 			pci_drv->name,
 			(unsigned) pci_dev->id.vendor_id,
 			(unsigned) pci_dev->id.device_id);
@@ -447,10 +448,10 @@ rte_eth_dev_get_device_type(uint8_t port_id)
 static int
 rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
 {
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -463,10 +464,10 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 {
 	char *tmp;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -483,7 +484,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 	int i;
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -509,7 +510,7 @@ rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
 	struct rte_pci_device *pci_dev = NULL;
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -536,7 +537,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 	uint32_t dev_flags;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
@@ -735,7 +736,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
 
 		rxq = dev->data->rx_queues;
 
@@ -766,20 +767,20 @@ rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -796,20 +797,20 @@ rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -826,20 +827,20 @@ rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -856,20 +857,20 @@ rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -895,7 +896,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
 
 		txq = dev->data->tx_queues;
 
@@ -929,19 +930,19 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of RX queues requested (%u) is greater than max supported(%d)\n",
 			nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of TX queues requested (%u) is greater than max supported(%d)\n",
 			nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
@@ -949,11 +950,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
@@ -965,22 +966,22 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 	if (nb_rx_q > dev_info.max_rx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
 				port_id, nb_rx_q, dev_info.max_rx_queues);
 		return -EINVAL;
 	}
 	if (nb_rx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
 				port_id, nb_tx_q, dev_info.max_tx_queues);
 		return -EINVAL;
 	}
 	if (nb_tx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
@@ -993,7 +994,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	if ((dev_conf->intr_conf.lsc == 1) &&
 		(!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
-			PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+			RTE_PMD_DEBUG_TRACE("driver %s does not support lsc\n",
 					dev->data->drv_name);
 			return -EINVAL;
 	}
@@ -1005,14 +1006,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	if (dev_conf->rxmode.jumbo_frame == 1) {
 		if (dev_conf->rxmode.max_rx_pkt_len >
 		    dev_info.max_rx_pktlen) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" > max valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
 				(unsigned)dev_info.max_rx_pktlen);
 			return -EINVAL;
 		} else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" < min valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
@@ -1032,14 +1033,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	diag = rte_eth_dev_rx_queue_config(dev, nb_rx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
 				port_id, diag);
 		return diag;
 	}
 
 	diag = rte_eth_dev_tx_queue_config(dev, nb_tx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		return diag;
@@ -1047,7 +1048,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	diag = (*dev->dev_ops->dev_configure)(dev);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		rte_eth_dev_tx_queue_config(dev, 0);
@@ -1086,7 +1087,7 @@ rte_eth_dev_config_restore(uint8_t port_id)
 			(dev->data->mac_pool_sel[i] & (1ULL << pool)))
 			(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
 		else {
-			PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
 					port_id);
 			/* exit the loop but not return an error */
 			break;
@@ -1114,16 +1115,16 @@ rte_eth_dev_start(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
 
 	if (dev->data->dev_started != 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already started\n",
 			port_id);
 		return 0;
@@ -1138,7 +1139,7 @@ rte_eth_dev_start(uint8_t port_id)
 	rte_eth_dev_config_restore(port_id);
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 	return 0;
@@ -1151,15 +1152,15 @@ rte_eth_dev_stop(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
 
 	if (dev->data->dev_started == 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already stopped\n",
 			port_id);
 		return;
@@ -1176,13 +1177,13 @@ rte_eth_dev_set_link_up(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_up)(dev);
 }
 
@@ -1193,13 +1194,13 @@ rte_eth_dev_set_link_down(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_down)(dev);
 }
 
@@ -1210,12 +1211,12 @@ rte_eth_dev_close(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
 	dev->data->dev_started = 0;
 	(*dev->dev_ops->dev_close)(dev);
 
@@ -1238,24 +1239,24 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
 
 	/*
 	 * Check the size of the mbuf data buffer.
@@ -1264,7 +1265,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	 */
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if (mp->private_data_size < sizeof(struct rte_pktmbuf_pool_private)) {
-		PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
+		RTE_PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
 				mp->name, (int) mp->private_data_size,
 				(int) sizeof(struct rte_pktmbuf_pool_private));
 		return -ENOSPC;
@@ -1272,7 +1273,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	mbp_buf_size = rte_pktmbuf_data_room_size(mp);
 
 	if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
-		PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
+		RTE_PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
 				"(RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)"
 				"=%d)\n",
 				mp->name,
@@ -1288,7 +1289,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 			nb_rx_desc < dev_info.rx_desc_lim.nb_min ||
 			nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) {
 
-		PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
+		RTE_PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
 			"should be: <= %hu, = %hu, and a product of %hu\n",
 			nb_rx_desc,
 			dev_info.rx_desc_lim.nb_max,
@@ -1321,24 +1322,24 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
 
 	rte_eth_dev_info_get(port_id, &dev_info);
 
@@ -1354,10 +1355,10 @@ rte_eth_promiscuous_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
 }
@@ -1367,10 +1368,10 @@ rte_eth_promiscuous_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
 }
@@ -1380,7 +1381,7 @@ rte_eth_promiscuous_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->promiscuous;
@@ -1391,10 +1392,10 @@ rte_eth_allmulticast_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
 	(*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = 1;
 }
@@ -1404,10 +1405,10 @@ rte_eth_allmulticast_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
 	dev->data->all_multicast = 0;
 	(*dev->dev_ops->allmulticast_disable)(dev);
 }
@@ -1417,7 +1418,7 @@ rte_eth_allmulticast_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->all_multicast;
@@ -1442,13 +1443,13 @@ rte_eth_link_get(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1459,13 +1460,13 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1476,12 +1477,12 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	memset(stats, 0, sizeof(*stats));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
 	(*dev->dev_ops->stats_get)(dev, stats);
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return 0;
@@ -1492,10 +1493,10 @@ rte_eth_stats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1510,7 +1511,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
 	signed xcount = 0;
 	uint64_t val, *stats_ptr;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
@@ -1584,7 +1585,7 @@ rte_eth_xstats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	/* implemented by the driver */
@@ -1603,11 +1604,11 @@ set_queue_stats_mapping(uint8_t port_id, uint16_t queue_id, uint8_t stat_idx,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
 	return (*dev->dev_ops->queue_stats_mapping_set)
 			(dev, queue_id, stat_idx, is_rx);
 }
@@ -1641,14 +1642,14 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 		.nb_align = 1,
 	};
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
 	dev_info->rx_desc_lim = lim;
 	dev_info->tx_desc_lim = lim;
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	dev_info->pci_dev = dev->pci_dev;
 	dev_info->driver_name = dev->data->drv_name;
@@ -1659,7 +1660,7 @@ rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 	ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
 }
@@ -1670,7 +1671,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	*mtu = dev->data->mtu;
@@ -1683,9 +1684,9 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
 
 	ret = (*dev->dev_ops->mtu_set)(dev, mtu);
 	if (!ret)
@@ -1699,19 +1700,19 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) {
-		PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
 		return -ENOSYS;
 	}
 
 	if (vlan_id > 4095) {
-		PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
+		RTE_PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
 				port_id, (unsigned) vlan_id);
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
 
 	return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 }
@@ -1721,14 +1722,14 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -1739,9 +1740,9 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id, uint16_t tpid)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_tpid_set)(dev, tpid);
 
 	return 0;
@@ -1755,7 +1756,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	int mask = 0;
 	int cur, org = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	/*check which option changed by application*/
@@ -1784,7 +1785,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	if (mask == 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_offload_set)(dev, mask);
 
 	return ret;
@@ -1796,7 +1797,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 	struct rte_eth_dev *dev;
 	int ret = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.rxmode.hw_vlan_strip)
@@ -1816,9 +1817,9 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_pvid_set)(dev, pvid, on);
 
 	return 0;
@@ -1829,9 +1830,9 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf);
 }
@@ -1841,14 +1842,14 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) {
-		PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
 	return (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf);
 }
 
@@ -1857,9 +1858,9 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) {
-		PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
 		return -EINVAL;
 	}
 
@@ -1880,7 +1881,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (reta_size != RTE_ALIGN(reta_size, RTE_RETA_GROUP_SIZE)) {
-		PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
+		RTE_PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
 							RTE_RETA_GROUP_SIZE);
 		return -EINVAL;
 	}
@@ -1905,7 +1906,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (max_rxq == 0) {
-		PMD_DEBUG_TRACE("No receive queue is available\n");
+		RTE_PMD_DEBUG_TRACE("No receive queue is available\n");
 		return -EINVAL;
 	}
 
@@ -1914,7 +1915,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		shift = i % RTE_RETA_GROUP_SIZE;
 		if ((reta_conf[idx].mask & (1ULL << shift)) &&
 			(reta_conf[idx].reta[shift] >= max_rxq)) {
-			PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
+			RTE_PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
 				"the maximum rxq index: %u\n", idx, shift,
 				reta_conf[idx].reta[shift], max_rxq);
 			return -EINVAL;
@@ -1932,7 +1933,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	struct rte_eth_dev *dev;
 	int ret;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	/* Check mask bits */
 	ret = rte_eth_check_reta_mask(reta_conf, reta_size);
 	if (ret < 0)
@@ -1946,7 +1947,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	if (ret < 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
 	return (*dev->dev_ops->reta_update)(dev, reta_conf, reta_size);
 }
 
@@ -1959,7 +1960,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 	int ret;
 
 	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
@@ -1969,7 +1970,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 		return ret;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
 	return (*dev->dev_ops->reta_query)(dev, reta_conf, reta_size);
 }
 
@@ -1979,16 +1980,16 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
 	struct rte_eth_dev *dev;
 	uint16_t rss_hash_protos;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	rss_hash_protos = rss_conf->rss_hf;
 	if ((rss_hash_protos != 0) &&
 	    ((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
-		PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
+		RTE_PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
 				rss_hash_protos);
 		return -EINVAL;
 	}
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_update)(dev, rss_conf);
 }
 
@@ -1998,9 +1999,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf);
 }
 
@@ -2010,19 +2011,19 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_add)(dev, udp_tunnel);
 }
 
@@ -2032,20 +2033,20 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_del)(dev, udp_tunnel);
 }
 
@@ -2054,9 +2055,9 @@ rte_eth_led_on(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_on)(dev);
 }
 
@@ -2065,9 +2066,9 @@ rte_eth_led_off(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_off)(dev);
 }
 
@@ -2101,17 +2102,17 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	int index;
 	uint64_t pool_mask;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
 
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
 	if (pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
+		RTE_PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
 
@@ -2119,7 +2120,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	if (index < 0) {
 		index = get_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 				port_id);
 			return -ENOSPC;
 		}
@@ -2149,13 +2150,13 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
 	struct rte_eth_dev *dev;
 	int index;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
 
 	index = get_mac_addr_index(port_id, addr);
 	if (index == 0) {
-		PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
 		return -EADDRINUSE;
 	} else if (index < 0)
 		return 0;  /* Do nothing if address wasn't found */
@@ -2177,13 +2178,13 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (!is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
 
 	/* Update default address in NIC data structure */
 	ether_addr_copy(addr, &dev->data->mac_addrs[0]);
@@ -2201,22 +2202,22 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
 		return -EINVAL;
 	}
 
 	if (rx_mode == 0) {
-		PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on);
 }
 
@@ -2251,11 +2252,11 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -2267,20 +2268,20 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 
 	if (index < 0) {
 		if (!on) {
-			PMD_DEBUG_TRACE("port %d: the MAC address was not "
+			RTE_PMD_DEBUG_TRACE("port %d: the MAC address was not "
 				"set in UTA\n", port_id);
 			return -EINVAL;
 		}
 
 		index = get_hash_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 					port_id);
 			return -ENOSPC;
 		}
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -2300,11 +2301,11 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
 	return (*dev->dev_ops->uc_all_hash_table_set)(dev, on);
 }
 
@@ -2315,18 +2316,18 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx)(dev, vf, on);
 }
 
@@ -2337,18 +2338,18 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_tx)(dev, vf, on);
 }
 
@@ -2358,22 +2359,22 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
 	if (vlan_id > ETHER_MAX_VLAN_ID) {
-		PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
 			vlan_id);
 		return -EINVAL;
 	}
 
 	if (vf_mask == 0) {
-		PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id,
 						   vf_mask, vlan_on);
 }
@@ -2385,26 +2386,26 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_link link;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (queue_idx > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("set queue rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:port %d: "
 				"invalid queue id=%d\n", port_id, queue_idx);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 			tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_queue_rate_limit)(dev, queue_idx, tx_rate);
 }
 
@@ -2418,26 +2419,26 @@ int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf, uint16_t tx_rate,
 	if (q_msk == 0)
 		return 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (vf > dev_info.max_vfs) {
-		PMD_DEBUG_TRACE("set VF rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:port %d: "
 				"invalid vf id=%d\n", port_id, vf);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 				tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk);
 }
 
@@ -2448,14 +2449,14 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (mirror_conf->rule_type == 0) {
-		PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if (mirror_conf->dst_pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
+		RTE_PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
 				ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
@@ -2463,18 +2464,18 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 	if ((mirror_conf->rule_type & (ETH_MIRROR_VIRTUAL_POOL_UP |
 	     ETH_MIRROR_VIRTUAL_POOL_DOWN)) &&
 	    (mirror_conf->pool_mask == 0)) {
-		PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if ((mirror_conf->rule_type & ETH_MIRROR_VLAN) &&
 	    mirror_conf->vlan.vlan_mask == 0) {
-		PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_set)(dev, mirror_conf, rule_id, on);
 }
@@ -2484,10 +2485,10 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_reset)(dev, rule_id);
 }
@@ -2499,12 +2500,12 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
@@ -2517,13 +2518,13 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id],
@@ -2535,10 +2536,10 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
 	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
 }
 
@@ -2547,10 +2548,10 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
 	return (*dev->dev_ops->rx_descriptor_done)(dev->data->rx_queues[queue_id],
 						   offset);
 }
@@ -2567,7 +2568,7 @@ rte_eth_dev_callback_register(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2607,7 +2608,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2670,14 +2671,14 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
@@ -2685,7 +2686,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 		vec = intr_handle->intr_vec[qid];
 		rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 		if (rc && rc != -EEXIST) {
-			PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+			RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 					" op %d epfd %d vec %u\n",
 					port_id, qid, op, epfd, vec);
 		}
@@ -2728,26 +2729,26 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
 		return -EINVAL;
 	}
 
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
 	vec = intr_handle->intr_vec[queue_id];
 	rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 	if (rc && rc != -EEXIST) {
-		PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+		RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 				" op %d epfd %d vec %u\n",
 				port_id, queue_id, op, epfd, vec);
 		return rc;
@@ -2763,13 +2764,13 @@ rte_eth_dev_rx_intr_enable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id);
 }
 
@@ -2780,13 +2781,13 @@ rte_eth_dev_rx_intr_disable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id);
 }
 
@@ -2795,10 +2796,10 @@ int rte_eth_dev_bypass_init(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
 	(*dev->dev_ops->bypass_init)(dev);
 	return 0;
 }
@@ -2808,10 +2809,10 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_show)(dev, state);
 	return 0;
 }
@@ -2821,10 +2822,10 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_set)(dev, new_state);
 	return 0;
 }
@@ -2834,10 +2835,10 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_show)(dev, event, state);
 	return 0;
 }
@@ -2847,11 +2848,11 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_set)(dev, event, state);
 	return 0;
 }
@@ -2861,11 +2862,11 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_set)(dev, timeout);
 	return 0;
 }
@@ -2875,11 +2876,11 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_ver_show)(dev, ver);
 	return 0;
 }
@@ -2889,11 +2890,11 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_show)(dev, wd_timeout);
 	return 0;
 }
@@ -2903,11 +2904,11 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_reset)(dev);
 	return 0;
 }
@@ -2918,10 +2919,10 @@ rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type,
 				RTE_ETH_FILTER_NOP, NULL);
 }
@@ -2932,10 +2933,10 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
 }
 
@@ -3105,18 +3106,18 @@ rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -3129,18 +3130,18 @@ rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -3154,10 +3155,10 @@ rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
 	return dev->dev_ops->set_mc_addr_list(dev, mc_addr_set, nb_mc_addr);
 }
 
@@ -3166,10 +3167,10 @@ rte_eth_timesync_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_enable)(dev);
 }
 
@@ -3178,10 +3179,10 @@ rte_eth_timesync_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_disable)(dev);
 }
 
@@ -3191,10 +3192,10 @@ rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_rx_timestamp)(dev, timestamp, flags);
 }
 
@@ -3203,10 +3204,10 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_tx_timestamp)(dev, timestamp);
 }
 
@@ -3215,10 +3216,10 @@ rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_adjust_time)(dev, delta);
 }
 
@@ -3227,10 +3228,10 @@ rte_eth_timesync_read_time(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_time)(dev, timestamp);
 }
 
@@ -3239,10 +3240,10 @@ rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_write_time)(dev, timestamp);
 }
 
@@ -3251,10 +3252,10 @@ rte_eth_dev_get_reg_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
 	return (*dev->dev_ops->get_reg_length)(dev);
 }
 
@@ -3263,10 +3264,10 @@ rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
 	return (*dev->dev_ops->get_reg)(dev, info);
 }
 
@@ -3275,10 +3276,10 @@ rte_eth_dev_get_eeprom_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom_length)(dev);
 }
 
@@ -3287,10 +3288,10 @@ rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom)(dev, info);
 }
 
@@ -3299,10 +3300,10 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->set_eeprom)(dev, info);
 }
 
@@ -3313,14 +3314,14 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
 	return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
 }
 
@@ -3328,7 +3329,7 @@ void
 rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
 				eth_dev, pci_dev);
 		return;
 	}
Signature · 1 line
2.5.0
#74 lore raw

PATCH v7 2/10 ethdev: make error checking macros public

In reply to Declan Doherty

Move the function pointer and port id checking macros to rte_ethdev and rte_dev header files, so that they can be used in the static inline functions there. Also replace the RTE_LOG call within RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag

---
 lib/librte_eal/common/include/rte_dev.h | 53 ++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c           | 54 ---------------------------------
 lib/librte_ether/rte_ethdev.h           | 26 ++++++++++++++++
 3 files changed, 79 insertions(+), 54 deletions(-)
lib/librte_eal/common/include/rte_dev.h +53 -0
index f601d21..f1b5507 100644
@@ -46,8 +46,61 @@
 extern "C" {
 #endif
 
+#include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_log.h>
+
+__attribute__((format(printf, 2, 0)))
+static inline void
+rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+
+	char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
+
+	va_end(ap);
+
+	va_start(ap, fmt);
+	vsnprintf(buffer, sizeof(buffer), fmt, ap);
+	va_end(ap);
+
+	rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
+}
+
+/* Macros for checking for restricting functions to primary instance only */
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_PROC_PRIMARY_OR_RET() do { \
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		return; \
+	} \
+} while (0)
+
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+	if ((func) == NULL) { \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+	if ((func) == NULL) { \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+		return; \
+	} \
+} while (0)
+
+
 /** Double linked list of device drivers. */
 TAILQ_HEAD(rte_driver_list, rte_driver);
 
lib/librte_ether/rte_ethdev.c +0 -54

60 lines not on this page · raw message

lib/librte_ether/rte_ethdev.h +26 -0
index 48a540d..9b07a0b 100644
@@ -172,6 +172,8 @@ extern "C" {
 
 #include <stdint.h>
 
+#include <rte_dev.h>
+
 /* Use this macro to check if LRO API is supported */
 #define RTE_ETHDEV_HAS_LRO_SUPPORT
 
@@ -931,6 +933,30 @@ struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 
+
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#define RTE_PMD_DEBUG_TRACE(...) \
+	rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
+#endif
+
+
+/* Macros to check for valid port */
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return; \
+	} \
+} while (0)
+
 /*
  * Definitions of all functions exported by an Ethernet driver through the
  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
Signature · 1 line
2.5.0
#75 lore raw

PATCH v7 3/10 eal: add __rte_packed /__rte_aligned macros

In reply to Declan Doherty

Adding a new macro for specifying __aligned__ attribute, and updating the current __rte_cache_aligned macro to use it.

Also adding a new macro to specify the __packed__ attribute

---
 lib/librte_eal/common/include/rte_memory.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
lib/librte_eal/common/include/rte_memory.h +12 -2
index 1bed415..18fd952 100644
@@ -76,9 +76,19 @@ enum rte_page_sizes {
 /**< Return the first cache-aligned value greater or equal to size. */
 
 /**
+ * Force alignment
+ */
+#define __rte_aligned(a) __attribute__((__aligned__(a)))
+
+/**
  * Force alignment to cache line.
  */
-#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
+
+/**
+ * Force a structure to be packed
+ */
+#define __rte_packed __attribute__((__packed__))
 
 typedef uint64_t phys_addr_t; /**< Physical address definition. */
 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
@@ -104,7 +114,7 @@ struct rte_memseg {
 	 /**< store segment MFNs */
 	uint64_t mfn[DOM0_NUM_MEMBLOCK];
 #endif
-} __attribute__((__packed__));
+} __rte_packed;
 
 /**
  * Lock page in physical memory and prevent from swapping.
Signature · 1 line
2.5.0
#76 lore raw

PATCH v7 4/10 mbuf: add new marcos to get the physical address of data

In reply to Declan Doherty
---
 lib/librte_mbuf/rte_mbuf.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
lib/librte_mbuf/rte_mbuf.h +23 -0
index 4a93189..ef1ee26 100644
@@ -1622,6 +1622,29 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)
 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
 
 /**
+ * A macro that returns the physical address that points to an offset of the
+ * start of the data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys_offset(m, o) \
+	(phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
+
+/**
+ * A macro that returns the physical address that points to the start of the
+ * data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
+
+/**
  * A macro that returns the length of the packet.
  *
  * The value can be read or assigned.
Signature · 1 line
2.5.0
#77 lore raw

Re: [PATCH v7 04/10] mbuf: add new marcos to get the physical address of data

2015-11-13 18:58, Declan Doherty:

lib/librte_mbuf/rte_mbuf.h static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m) · line 1645

Quoted 10 lines
lib/librte_mbuf/rte_mbuf.h +10 -0
+/**
+ * A macro that returns the physical address that points to the start of the
+ * data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)

The parameter o does not exist.
Wrong copy paste, I guess.

#78 lore raw

PATCH v7 5/10 cryptodev: Initial DPDK Crypto APIs and device framework release

In reply to Declan Doherty

This patch contains the initial proposed APIs and device framework for integrating crypto packet processing into DPDK.

features include:
- Crypto device configuration / management APIs
- Definitions of supported cipher algorithms and operations.
- Definitions of supported hash/authentication algorithms and operations.
- Crypto session management APIs
- Crypto operation data structures and APIs allocation of crypto operation structure used to specify the crypto operations to be performed on a particular mbuf.
- Extension of mbuf to contain crypto operation data pointer and extra flags.
- Burst enqueue / dequeue APIs for processing of crypto operations.

changes from RFC:
- Session management API changes to support specification of crypto transform(xform) chains using linked list of xforms.
- Changes to the crypto operation struct as a result of session management changes.
- Some movement of common MACROS shared by cryptodevs and ethdevs to common headers

---
 MAINTAINERS                                    |    4 +
 config/common_bsdapp                           |   10 +-
 config/common_linuxapp                         |   10 +-
 doc/api/doxy-api-index.md                      |    1 +
 doc/api/doxy-api.conf                          |    1 +
 lib/Makefile                                   |    1 +
 lib/librte_cryptodev/Makefile                  |   60 ++
 lib/librte_cryptodev/rte_crypto.h              |  613 +++++++++++++
 lib/librte_cryptodev/rte_cryptodev.c           | 1092 ++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.h           |  649 ++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  549 ++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |   32 +
 lib/librte_eal/common/include/rte_log.h        |    1 +
 mk/rte.app.mk                                  |    1 +
 14 files changed, 3022 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_cryptodev/Makefile
 create mode 100644 lib/librte_cryptodev/rte_crypto.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.c
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_pmd.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_version.map
MAINTAINERS +4 -0
index c8be5d2..68c6d74 100644
@@ -196,6 +196,10 @@ M: Thomas Monjalon <[email protected]>
 F: lib/librte_ether/
 F: scripts/test-null.sh
 
+Crypto API
+M: Declan Doherty <[email protected]>
+F: lib/librte_cryptodev
+F: docs/guides/cryptodevs
 
 Drivers
 -------
config/common_bsdapp +9 -1
index fba29e5..8803350 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -147,6 +147,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 
 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
config/common_linuxapp +9 -1
index 7248262..815bea3 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -145,6 +145,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 
 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
doc/api/doxy-api-index.md +1 -0
index 72ac3c4..bdb6130 100644
@@ -39,6 +39,7 @@ There are many libraries, so their headers may be grouped by topics:
   [dev]                (@ref rte_dev.h),
   [ethdev]             (@ref rte_ethdev.h),
   [ethctrl]            (@ref rte_eth_ctrl.h),
+  [cryptodev]          (@ref rte_cryptodev.h),
   [devargs]            (@ref rte_devargs.h),
   [bond]               (@ref rte_eth_bond.h),
   [vhost]              (@ref rte_virtio_net.h),
doc/api/doxy-api.conf +1 -0
index cfb4627..7244b8f 100644
@@ -37,6 +37,7 @@ INPUT                   = doc/api/doxy-api-index.md \
                           lib/librte_cfgfile \
                           lib/librte_cmdline \
                           lib/librte_compat \
+                          lib/librte_cryptodev \
                           lib/librte_distributor \
                           lib/librte_ether \
                           lib/librte_hash \
lib/Makefile +1 -0
index 9727b83..4c5c1b4 100644
@@ -40,6 +40,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
 DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
+DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
lib/librte_cryptodev/Makefile new file +60 -0

61 lines not on this page · raw message

lib/librte_cryptodev/rte_crypto.h new file +613 -0

613 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev.c new file +1092 -0

1,092 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev.h new file +649 -0

649 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.h new file +549 -0

512 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map new file +32 -0
new file mode 100644
index 0000000..ff8e93d

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/include/rte_log.h +1 -0
index ede0dca..2e47e7f 100644

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +1 -0
index 724efa7..5d382bb 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#79 lore raw

Re: [PATCH v7 05/10] cryptodev: Initial DPDK Crypto APIs and device framework release

2015-11-13 18:58, Declan Doherty:

Quoted 3 lines
 lib/librte_cryptodev/rte_crypto.h              |  613 +++++++++++++
 lib/librte_cryptodev/rte_cryptodev.c           | 1092 ++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.h           |  649 ++++++++++++++

Doxygen reports some errors:

lib/librte_cryptodev/rte_crypto.h:565: warning: unable to resolve reference to `rte_crypto_hash_setup_data' for \ref command

lib/librte_cryptodev/rte_crypto.h:585: warning: argument 'm' of command @param is not found in the argument list of __rte_crypto_op_reset(struct rte_crypto_op *op)

lib/librte_cryptodev/rte_crypto.h:589: warning: unable to resolve reference to `rte_crypto_hash_params' for \ref command

lib/librte_cryptodev/rte_crypto.h:593: warning: The following parameters of __rte_crypto_op_reset(struct rte_crypto_op *op) are not documented:

lib/librte_cryptodev/rte_cryptodev.h:241: warning: argument 'nb_qp_queue' of command @param is not found in the argument list of rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config)

lib/librte_cryptodev/rte_cryptodev.h:256: warning: The following parameters of rte_cryptodev_configure(uint8_t dev_id, struct rte_cryptodev_config *config) are not documented:

lib/librte_cryptodev/rte_cryptodev.h:563: warning: argument 'queue_id' of command @param is not found in the argument list of rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_mbuf **pkts, uint16_t nb_pkts)

lib/librte_cryptodev/rte_cryptodev.h:563: warning: argument 'tx_pkts' of command @param is not found in the argument list of rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_mbuf **pkts, uint16_t nb_pkts)

lib/librte_cryptodev/rte_cryptodev.h:593: warning: The following parameters of rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, struct rte_mbuf **pkts, uint16_t nb_pkts) are not documented:

#80 lore raw

PATCH v7 6/10 mbuf_offload: library to support attaching offloads to a mbuf

In reply to Declan Doherty

This library add support for adding a chain of offload operations to a mbuf. It contains the definition of the rte_mbuf_offload structure as well as helper functions for attaching offloads to mbufs and a mempool management functions.

This initial implementation supports attaching multiple offload operations to a single mbuf, but only a single offload operation of a specific type can be attach to that mbuf.

---
 MAINTAINERS                                        |   4 +
 config/common_bsdapp                               |   6 +
 config/common_linuxapp                             |   6 +
 doc/api/doxy-api-index.md                          |   1 +
 doc/api/doxy-api.conf                              |   1 +
 lib/Makefile                                       |   1 +
 lib/librte_mbuf/rte_mbuf.h                         |   6 +
 lib/librte_mbuf_offload/Makefile                   |  52 ++++
 lib/librte_mbuf_offload/rte_mbuf_offload.c         | 100 +++++++
 lib/librte_mbuf_offload/rte_mbuf_offload.h         | 302 +++++++++++++++++++++
 .../rte_mbuf_offload_version.map                   |   7 +
 mk/rte.app.mk                                      |   1 +
 12 files changed, 487 insertions(+)
 create mode 100644 lib/librte_mbuf_offload/Makefile
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map
MAINTAINERS +4 -0
index 68c6d74..73d9578 100644
@@ -191,6 +191,10 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c
 
+Packet buffer offload
+M: Declan Doherty <[email protected]>
+F: lib/librte_mbuf_offload/
+
 Ethernet API
 M: Thomas Monjalon <[email protected]>
 F: lib/librte_ether/
config/common_bsdapp +6 -0
index 8803350..ba2533a 100644
@@ -332,6 +332,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
config/common_linuxapp +6 -0
index 815bea3..4c52f78 100644
@@ -340,6 +340,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
doc/api/doxy-api-index.md +1 -0
index bdb6130..199cc2c 100644
@@ -104,6 +104,7 @@ There are many libraries, so their headers may be grouped by topics:
 
 - **containers**:
   [mbuf]               (@ref rte_mbuf.h),
+  [mbuf_offload]       (@ref rte_mbuf_offload.h),
   [ring]               (@ref rte_ring.h),
   [distributor]        (@ref rte_distributor.h),
   [reorder]            (@ref rte_reorder.h),
doc/api/doxy-api.conf +1 -0
index 7244b8f..15bba16 100644
@@ -48,6 +48,7 @@ INPUT                   = doc/api/doxy-api-index.md \
                           lib/librte_kvargs \
                           lib/librte_lpm \
                           lib/librte_mbuf \
+                          lib/librte_mbuf_offload \
                           lib/librte_mempool \
                           lib/librte_meter \
                           lib/librte_net \
lib/Makefile +1 -0
index 4c5c1b4..ef172ea 100644
@@ -36,6 +36,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
lib/librte_mbuf/rte_mbuf.h +6 -0
index ef1ee26..0b6741a 100644
@@ -728,6 +728,9 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
                                * with a single assignment */
 
+/** Opaque rte_mbuf_offload  structure declarations */
+struct rte_mbuf_offload;
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -841,6 +844,9 @@ struct rte_mbuf {
 
 	/** Timesync flags for use with IEEE1588. */
 	uint16_t timesync;
+
+	/* Chain of off-load operations to perform on mbuf */
+	struct rte_mbuf_offload *offload_ops;
 } __rte_cache_aligned;
 
 static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
lib/librte_mbuf_offload/Makefile new file +52 -0

52 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload.c new file +100 -0

100 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload.h new file +302 -0

302 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload_version.map new file +7 -0
new file mode 100644
index 0000000..3d3b06a
@@ -0,0 +1,7 @@
+DPDK_2.2 {
+	global:
+
+	rte_pktmbuf_offload_pool_create;
+
+	local: *;
+};
mk/rte.app.mk +1 -0
index 5d382bb..2b8ddce 100644
@@ -116,6 +116,7 @@ ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)         += -lrte_kvargs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD)   += -lrte_mbuf_offload
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)          += -lethdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV)      += -lrte_cryptodev
Signature · 1 line
2.5.0
#81 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Hi Declan,

Please find some comments below.

Quoted 21 lines · Declan Doherty

This library add support for adding a chain of offload operations to a mbuf. It contains the definition of the rte_mbuf_offload structure as well as helper functions for attaching offloads to mbufs and a mempool management functions.

This initial implementation supports attaching multiple offload operations to a single mbuf, but only a single offload operation of a specific type can be attach to that mbuf.

---
 MAINTAINERS                                        |   4 +
 config/common_bsdapp                               |   6 +
 config/common_linuxapp                             |   6 +
 doc/api/doxy-api-index.md                          |   1 +
 doc/api/doxy-api.conf                              |   1 +
 lib/Makefile                                       |   1 +
 lib/librte_mbuf/rte_mbuf.h                         |   6 +
 lib/librte_mbuf_offload/Makefile                   |  52 ++++
 lib/librte_mbuf_offload/rte_mbuf_offload.c         | 100 +++++++
Quoted 8 lines
 lib/librte_mbuf_offload/rte_mbuf_offload.h         | 302 +++++++++++++++++++++
 .../rte_mbuf_offload_version.map                   |   7 +
 mk/rte.app.mk                                      |   1 +
 12 files changed, 487 insertions(+)
 create mode 100644 lib/librte_mbuf_offload/Makefile
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

The new files are called rte_mbuf_offload, but from what I understand, it is more like a mbuf metadata api. What you call "offload operation" is not called because an offload is attached, but because you call rte_cryptodev_enqueue_burst() on it.

Quoted 1 line

From what I see, it is not said in the help of

rte_cryptodev_enqueue_burst() that the offload structure has to be set in the given mbufs.

Is my understanding correct?

Quoted 21 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +21 -0
+/**
+ * @file
+ * RTE mbuf offload
+ *
+ * The rte_mbuf_offload library provides the ability to specify a device generic
+ * off-load operation independent of the current Rx/Tx Ethernet offloads
+ * supported within the rte_mbuf structure, and add supports for multiple
+ * off-load operations and offload device types.
+ *
+ * The rte_mbuf_offload specifies the particular off-load operation type, such
+ * as a crypto operation, and provides a container for the operations
+ * parameter's inside the op union. These parameters are then used by the
+ * device which supports that operation to perform the specified offload.
+ *
+ * This library provides an API to create pre-allocated mempool of offload
+ * operations, with supporting allocate and free functions. It also provides
+ * APIs for attaching an offload to a mbuf, as well as an API to retrieve a
+ * specified offload type from an mbuf offload chain.
+ */
+
+#include <rte_mbuf.h>

lib/librte_mbuf_offload/rte_mbuf_offload.h line 66

Quoted 10 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +10 -0
+#include <rte_crypto.h>
+
+
+/** packet mbuf offload operation types */
+enum rte_mbuf_ol_op_type {
+	RTE_PKTMBUF_OL_NOT_SPECIFIED = 0,
+	/**< Off-load not specified */
+	RTE_PKTMBUF_OL_CRYPTO
+	/**< Crypto offload operation */
+};

Here, the mbuf offload API is presented as a generic API for offload. But it includes rte_crypto. Actually, it means that at the end this API needs to be aware of any offload type.

Wouldn't it be possible to hide the knowledge of the metadata structure to this API?

Quoted 17 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +17 -0
+/**
+ * Attach a rte_mbuf_offload to a mbuf. We only support a single offload of any
+ * one type in our chain of offloads.
+ *
+ * @param	m	packet mbuf.
+ * @param	ol	rte_mbuf_offload strucutre to be attached
+ *
+ * @returns
+ * - On success returns the pointer to the offload we just added
+ * - On failure returns NULL
+ */
+static inline struct rte_mbuf_offload *
+rte_pktmbuf_offload_attach(struct rte_mbuf *m, struct rte_mbuf_offload *ol)
+{
+	struct rte_mbuf_offload **ol_last;
+
+	for (ol_last = &m->offload_ops;	ol_last[0] != NULL;

lib/librte_mbuf_offload/rte_mbuf_offload.h line 177

Quoted 10 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +10 -0
+			ol_last = &ol_last[0]->next)
+		if (ol_last[0]->type == ol->type)
+			return NULL;
+
+	ol_last[0] = ol;
+	ol_last[0]->m = m;
+	ol_last[0]->next = NULL;
+
+	return ol_last[0];
+}

*ol_last would be clearer than ol_last[0] as it's not a table. Here we expect that m->offload_ops == NULL at mbuf initialization. I cannot find where it is initialized.

Quoted 7 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +7 -0
+
+
+/** Rearms rte_mbuf_offload default parameters */
+static inline void
+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,
+		enum rte_mbuf_ol_op_type type)
+{

lib/librte_mbuf_offload/rte_mbuf_offload.h line 194

Quoted 10 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +10 -0
+	ol->m = NULL;
+	ol->type = type;
+
+	switch (type) {
+	case RTE_PKTMBUF_OL_CRYPTO:
+		__rte_crypto_op_reset(&ol->op.crypto); break;
+	default:
+		break;
+	}
+}

Would it work if several OL are registered?

Also, what is not clear to me is how the offload structure is freed. For instance, I think that calling rte_pktmbuf_free(m) on a mbuf that has a offload attached would result in a leak.

It would mean that it is not allowed to call any function that free or reassemble a mbuf when an offload is attached.

I'm wondering if there is such a leak in l2fwd_crypto_send_burst():

	/* <<<<<<< here packets have the offload attached */
	ret = rte_cryptodev_enqueue_burst(cparams->dev_id,
		cparams->qp_id, pkt_buffer, (uint16_t) n);
	crypto_statistics[cparams->dev_id].enqueued += ret;
	if (unlikely(ret < n)) {
		crypto_statistics[cparams->dev_id].errors += (n - ret);
		do {
			/* <<<<<<<<< offload struct is lost? */
			rte_pktmbuf_free(pkt_buffer[ret]);
		} while (++ret < n);
	}

It seems that these offload structures are only used to pass crypto info to the cryptodev. Would it be a problem to have an API like this?

  rx_burst(port, q, mbuf_tab, crypto_tab, n);

Or even:

  rx_burst(port, q, crypto_tab, n);

with each *cryto_tab pointing to a mbuf

If we really want to use mbufs to store the crypto info (is it something we want? for pipelining?), another idea would be to use the usual metadata after the mbuf. It may require to enhance this metadata framework to allow to better register room for metadata, because today anyone using metadata expects that its metadata are the only ones.

Pros:
- no additional allocation for crypto offload struct
- no risk of leak
Cons:
- room is reserved for crypto in all mbufs even if no crypto is done on them

Regards,
Olivier

#82 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Hey Oliver, see reply inline.

Quoted 35 lines · Olivier MATZ

Hi Declan,

Please find some comments below.

Quoted 25 lines · Declan Doherty

This library add support for adding a chain of offload operations to a mbuf. It contains the definition of the rte_mbuf_offload structure as well as helper functions for attaching offloads to mbufs and a mempool management functions.

This initial implementation supports attaching multiple offload operations to a single mbuf, but only a single offload operation of a specific type can be attach to that mbuf.

---
  MAINTAINERS                                        |   4 +
  config/common_bsdapp                               |   6 +
  config/common_linuxapp                             |   6 +
  doc/api/doxy-api-index.md                          |   1 +
  doc/api/doxy-api.conf                              |   1 +
  lib/Makefile                                       |   1 +
  lib/librte_mbuf/rte_mbuf.h                         |   6 +
  lib/librte_mbuf_offload/Makefile                   |  52 ++++
  lib/librte_mbuf_offload/rte_mbuf_offload.c         | 100 +++++++
  lib/librte_mbuf_offload/rte_mbuf_offload.h         | 302 +++++++++++++++++++++
  .../rte_mbuf_offload_version.map                   |   7 +
  mk/rte.app.mk                                      |   1 +
  12 files changed, 487 insertions(+)
Quoted 4 lines

create mode 100644 lib/librte_mbuf_offload/Makefile
create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map

Quoted 4 lines

The new files are called rte_mbuf_offload, but from what I understand, it is more like a mbuf metadata api. What you call "offload operation" is not called because an offload is attached, but because you call rte_cryptodev_enqueue_burst() on it.

Maybe rte_mbuf_offload_metadata would be a better name, if not a bit more long winded :) The idea of this API set is to give a generic framework for attaching the the offload operation meta data to a mbuf which will be retrieved at a later point, when the particular offload burst function is called. I guess as we only have a single offload device at the moment the API may look a little over the top!

Quoted 5 lines

From what I see, it is not said in the help of
rte_cryptodev_enqueue_burst() that the offload structure has to be set in the given mbufs.

I need to update the API documentation to make that explicit.

Quoted 39 lines

Is my understanding correct?

Quoted 21 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +21 -0
+/**
+ * @file
+ * RTE mbuf offload
+ *
+ * The rte_mbuf_offload library provides the ability to specify a device generic
+ * off-load operation independent of the current Rx/Tx Ethernet offloads
+ * supported within the rte_mbuf structure, and add supports for multiple
+ * off-load operations and offload device types.
+ *
+ * The rte_mbuf_offload specifies the particular off-load operation type, such
+ * as a crypto operation, and provides a container for the operations
+ * parameter's inside the op union. These parameters are then used by the
+ * device which supports that operation to perform the specified offload.
+ *
+ * This library provides an API to create pre-allocated mempool of offload
+ * operations, with supporting allocate and free functions. It also provides
+ * APIs for attaching an offload to a mbuf, as well as an API to retrieve a
+ * specified offload type from an mbuf offload chain.
+ */
+
+#include <rte_mbuf.h>

lib/librte_mbuf_offload/rte_mbuf_offload.h line 66

Quoted 10 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +10 -0
+#include <rte_crypto.h>
+
+
+/** packet mbuf offload operation types */
+enum rte_mbuf_ol_op_type {
+	RTE_PKTMBUF_OL_NOT_SPECIFIED = 0,
+	/**< Off-load not specified */
+	RTE_PKTMBUF_OL_CRYPTO
+	/**< Crypto offload operation */
+};

Here, the mbuf offload API is presented as a generic API for offload. But it includes rte_crypto. Actually, it means that at the end this API needs to be aware of any offload type.

Quoted 2 lines

Wouldn't it be possible to hide the knowledge of the metadata structure to this API?

The design makes the offload API aware of the underlying offload operations, but I don't see this as a problem, the main idea was to have a no dependencies other than the structure pointer added to the rte_mbuf, while also making the offload extensible in the future. Also this approach makes the management of the offload elements very straight forward, with very simplified pool management functions and also there isn't the need for another level of indirection to the actual offload operation.

Quoted 23 lines
Quoted 23 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +21 -0
+/**
+ * Attach a rte_mbuf_offload to a mbuf. We only support a single offload of any
+ * one type in our chain of offloads.
+ *
+ * @param	m	packet mbuf.
+ * @param	ol	rte_mbuf_offload strucutre to be attached
+ *
+ * @returns
+ * - On success returns the pointer to the offload we just added
+ * - On failure returns NULL
+ */
+static inline struct rte_mbuf_offload *
+rte_pktmbuf_offload_attach(struct rte_mbuf *m, struct rte_mbuf_offload *ol)
+{
+	struct rte_mbuf_offload **ol_last;
+
+	for (ol_last = &m->offload_ops;	ol_last[0] != NULL;
+			ol_last = &ol_last[0]->next)
+		if (ol_last[0]->type == ol->type)
+			return NULL;
+
Quoted 8 lines

lib/librte_mbuf_offload/rte_mbuf_offload.h line 177

Quoted 6 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +6 -0
+	ol_last[0] = ol;
+	ol_last[0]->m = m;
+	ol_last[0]->next = NULL;
+
+	return ol_last[0];
+}

*ol_last would be clearer than ol_last[0] as it's not a table.

Just a personal preference, but I can submit a change later.

Quoted 3 lines

Here we expect that m->offload_ops == NULL at mbuf initialization. I cannot find where it is initialized.

I'll need to add the initialization to rte_pktmbuf_reset()

Quoted 11 lines
Quoted 11 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +11 -0
+
+
+/** Rearms rte_mbuf_offload default parameters */
+static inline void
+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,
+		enum rte_mbuf_ol_op_type type)
+{
+	ol->m = NULL;
+	ol->type = type;
+
+	switch (type) {
Quoted 9 lines

lib/librte_mbuf_offload/rte_mbuf_offload.h line 194

Quoted 6 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +6 -0
+	case RTE_PKTMBUF_OL_CRYPTO:
+		__rte_crypto_op_reset(&ol->op.crypto); break;
+	default:
+		break;
+	}
+}

Would it work if several OL are registered?

I can't see any reason why it wouldn't

Quoted 7 lines

Also, what is not clear to me is how the offload structure is freed. For instance, I think that calling rte_pktmbuf_free(m) on a mbuf that has a offload attached would result in a leak.

It would mean that it is not allowed to call any function that free or reassemble a mbuf when an offload is attached.

We just need to walk the chain of offloads calling rte_pktmbuf_offload_free(), before freeing the mbuf, which will be an issue with any externally attached meta data. In the case of reassembling I don't see why we would just move the chain to the head mbuf.

Quoted 16 lines

I'm wondering if there is such a leak in l2fwd_crypto_send_burst():

	/* <<<<<<< here packets have the offload attached */
	ret = rte_cryptodev_enqueue_burst(cparams->dev_id,
		cparams->qp_id, pkt_buffer, (uint16_t) n);
	crypto_statistics[cparams->dev_id].enqueued += ret;
	if (unlikely(ret < n)) {
		crypto_statistics[cparams->dev_id].errors += (n - ret);
		do {
			/* <<<<<<<<< offload struct is lost? */
			rte_pktmbuf_free(pkt_buffer[ret]);
		} while (++ret < n);
	}

I'll push a fix for this leak, I just noticed it myself this morning.

Quoted 5 lines

It seems that these offload structures are only used to pass crypto info to the cryptodev. Would it be a problem to have an API like this?

   rx_burst(port, q, mbuf_tab, crypto_tab, n);

I really dislike this option, there's no direct linkage between mbuf and offload operation.

Quoted 6 lines

Or even:

   rx_burst(port, q, crypto_tab, n);

with each *cryto_tab pointing to a mbuf

I looked at this but it would really hamstring any pipelining applications which might want to attach multiple offloads to a mbuf at a point in the pipeline for processing at later steps.

Quoted 8 lines

If we really want to use mbufs to store the crypto info (is it something we want? for pipelining?), another idea would be to use the usual metadata after the mbuf. It may require to enhance this metadata framework to allow to better register room for metadata, because today anyone using metadata expects that its metadata are the only ones.

Quoted 7 lines

Pros:
- no additional allocation for crypto offload struct
- no risk of leak
Cons:
- room is reserved for crypto in all mbufs even if no crypto is done on them

I have some further API to add in R2.3 which would allow the offload to allocated in the private data of the mbuf but they are not fully tested as yet. Also I don't think it's practical from a memory management point of view to make the assumption that there will always be enough space in the mbufs private data, especially if a number of offloads were to be attached to a single mbuf.

Quoted 4 lines

Regards,
Olivier

#83 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Hi Declan,

Quoted 11 lines · Declan Doherty
Quoted 4 lines

The new files are called rte_mbuf_offload, but from what I understand, it is more like a mbuf metadata api. What you call "offload operation" is not called because an offload is attached, but because you call rte_cryptodev_enqueue_burst() on it.

Maybe rte_mbuf_offload_metadata would be a better name, if not a bit more long winded :) The idea of this API set is to give a generic framework for attaching the the offload operation meta data to a mbuf which will be retrieved at a later point, when the particular offload burst function is called. I guess as we only have a single offload device at the moment the API may look a little over the top!

Indeed, not sure rte_mbuf_offload_metadata is better.
I'm still not convinced that offload should appear in the name, it is a bit confusing with hardware offloads (ol_flags). Also, it suggests that a work is delegated to another entity, but for instance in this case it is just used as a storage area:

	ol = rte_pktmbuf_offload_alloc(pool, RTE_PKTMBUF_OL_CRYPTO);
	rte_crypto_op_attach_session(&ol->op.crypto, session);
	ol->op.crypto.digest.data = rte_pktmbuf_append(m, digest_len);
	ol->op.crypto.digest.phys_addr = ...;
	/* ... */
	rte_pktmbuf_offload_attach(m, ol);
	ret = rte_cryptodev_enqueue_burst(dev_id, qp_id, &m, 1);

Do you have some other examples in mind that would use this API?

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +9 -0
+/** Rearms rte_mbuf_offload default parameters */
+static inline void
+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,
+        enum rte_mbuf_ol_op_type type)
+{
+    ol->m = NULL;
+    ol->type = type;
+
+    switch (type) {
Quoted 8 lines

lib/librte_mbuf_offload/rte_mbuf_offload.h line 194

Quoted 6 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +6 -0
+    case RTE_PKTMBUF_OL_CRYPTO:
+        __rte_crypto_op_reset(&ol->op.crypto); break;
+    default:
+        break;
+    }
+}

Would it work if several OL are registered?

Quoted 1 line

I can't see any reason why it wouldn't

Sorry, I read it to quickly. I thought it was a rte_pktmbuf_offload_detach() function. By the way there is no such function?

Quoted 11 lines
Quoted 6 lines

Also, what is not clear to me is how the offload structure is freed. For instance, I think that calling rte_pktmbuf_free(m) on a mbuf that has a offload attached would result in a leak.

It would mean that it is not allowed to call any function that free or reassemble a mbuf when an offload is attached.

We just need to walk the chain of offloads calling rte_pktmbuf_offload_free(), before freeing the mbuf, which will be an issue with any externally attached meta data. In the case of reassembling I don't see why we would just move the chain to the head mbuf.

Walking the chain of offload + adding the initialization will probably have a little cost that should be evaluated.

The freeing is probably not the only problem:
- packet duplication: are the offload infos copied? If no, it means that the copy is not exactly a copy
- if you chain 2 mbufs that both have offload info attached, how does it behave?
- if you prepend a segment to your mbuf, you need to copy the mbuf offload pointer, and also parse the list of offload to update the ol->m pointer of each element.

Quoted 11 lines
Quoted 5 lines

It seems that these offload structures are only used to pass crypto info to the cryptodev. Would it be a problem to have an API like this?

   rx_burst(port, q, mbuf_tab, crypto_tab, n);

I really dislike this option, there's no direct linkage between mbuf and offload operation.

Quoted 2 lines

Or even:

Quoted 8 lines
Quoted 4 lines
   rx_burst(port, q, crypto_tab, n);

with each *cryto_tab pointing to a mbuf

I looked at this but it would really hamstring any pipelining applications which might want to attach multiple offloads to a mbuf at a point in the pipeline for processing at later steps.

As far as I can see, there is already a way to chain several crypto operations in the crypto structure.

Another option is to use the mbuf offload API (or the m->userdata pointer which already works for that) only in the application:

- the field is completely ignored by the mbuf api and the dpdk driver
- it is up to the application to initialize it and free it

-> it can only be used when passing mbuf from a part of the app
to another, so it perfectly matches the pipeline use case.

Example:

app_core1:

  /* receive a mbuf */
  crypto = alloc()
  crypto->xxx = yyy:
  /* ... */
  m->userdata = crypto;
  enqueue(m, app_core2);

app_core2:

  m = dequeue();
  crypto = m->userdata;
  m->userdata = NULL;
  /* api is tx_burst(port, q, mbuf_tab, crypto_tab, n) */
  tx_burst(port, q, &m, &crypto, 1);

Regards,
Olivier

#84 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Hi Olivier,

Quoted 101 lines · Declan Doherty
Quoted 11 lines
Quoted 4 lines

The new files are called rte_mbuf_offload, but from what I understand, it is more like a mbuf metadata api. What you call "offload operation" is not called because an offload is attached, but because you call rte_cryptodev_enqueue_burst() on it.

Maybe rte_mbuf_offload_metadata would be a better name, if not a bit more long winded :) The idea of this API set is to give a generic framework for attaching the the offload operation meta data to a mbuf which will be retrieved at a later point, when the particular offload burst function is called. I guess as we only have a single offload device at the moment the API may look a little over the top!

Indeed, not sure rte_mbuf_offload_metadata is better.
I'm still not convinced that offload should appear in the name, it is a bit confusing with hardware offloads (ol_flags). Also, it suggests that a work is delegated to another entity, but for instance in this case it is just used as a storage area:

	ol = rte_pktmbuf_offload_alloc(pool, RTE_PKTMBUF_OL_CRYPTO);
	rte_crypto_op_attach_session(&ol->op.crypto, session);
	ol->op.crypto.digest.data = rte_pktmbuf_append(m, digest_len);
	ol->op.crypto.digest.phys_addr = ...;
	/* ... */
	rte_pktmbuf_offload_attach(m, ol);
	ret = rte_cryptodev_enqueue_burst(dev_id, qp_id, &m, 1);

Do you have some other examples in mind that would use this API?

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +9 -0
+/** Rearms rte_mbuf_offload default parameters */
+static inline void
+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,
+        enum rte_mbuf_ol_op_type type)
+{
+    ol->m = NULL;
+    ol->type = type;
+
+    switch (type) {
Quoted 8 lines

lib/librte_mbuf_offload/rte_mbuf_offload.h line 194

Quoted 6 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +6 -0
+    case RTE_PKTMBUF_OL_CRYPTO:
+        __rte_crypto_op_reset(&ol->op.crypto); break;
+    default:
+        break;
+    }
+}

Would it work if several OL are registered?

Quoted 1 line

I can't see any reason why it wouldn't

Sorry, I read it to quickly. I thought it was a rte_pktmbuf_offload_detach() function. By the way there is no such function?

Quoted 11 lines
Quoted 6 lines

Also, what is not clear to me is how the offload structure is freed. For instance, I think that calling rte_pktmbuf_free(m) on a mbuf that has a offload attached would result in a leak.

It would mean that it is not allowed to call any function that free or reassemble a mbuf when an offload is attached.

We just need to walk the chain of offloads calling rte_pktmbuf_offload_free(), before freeing the mbuf, which will be an issue with any externally attached meta data. In the case of reassembling I don't see why we would just move the chain to the head mbuf.

Walking the chain of offload + adding the initialization will probably have a little cost that should be evaluated.

The freeing is probably not the only problem:
- packet duplication: are the offload infos copied? If no, it means that the copy is not exactly a copy
- if you chain 2 mbufs that both have offload info attached, how does it behave?
- if you prepend a segment to your mbuf, you need to copy the mbuf offload pointer, and also parse the list of offload to update the ol->m pointer of each element.

Quoted 11 lines
Quoted 5 lines

It seems that these offload structures are only used to pass crypto info to the cryptodev. Would it be a problem to have an API like this?

   rx_burst(port, q, mbuf_tab, crypto_tab, n);

I really dislike this option, there's no direct linkage between mbuf and offload operation.

Quoted 2 lines

Or even:

Quoted 8 lines
Quoted 4 lines
   rx_burst(port, q, crypto_tab, n);

with each *cryto_tab pointing to a mbuf

I looked at this but it would really hamstring any pipelining applications which might want to attach multiple offloads to a mbuf at a point in the pipeline for processing at later steps.

As far as I can see, there is already a way to chain several crypto operations in the crypto structure.

Quoted 8 lines

Another option is to use the mbuf offload API (or the m->userdata pointer which already works for that) only in the application:

- the field is completely ignored by the mbuf api and the dpdk driver
- it is up to the application to initialize it and free it

-> it can only be used when passing mbuf from a part of the app
to another, so it perfectly matches the pipeline use case.

I don't think we should start to re-use userdata.
Userdata was intended for the upper layer app to pass/store it's private data associated with mbuf, and we probably should keep it this way. While mbuf_offload (or whatever we'll name it) supposed to keep data necessary for crypto (and other future type of devices) to operate with mbuf.

All your comments above about that this new field is just ignored by most mbuf operations (copy/attach/append/free, etc) are valid.
By I suppose for now we can just state that for mbuf_offload is not supported by
all these mbuf ops.
I understand that current API is probably not perfect and might need to be revised in future. Again, as it is completely new feature, I suspect it would be a lot of change requests for it anyway. But we need some generic way to pass other (not ethdev) specific information within mbuf between user-level and PMDs for non-ethernet devices (and probably between different PMDs too).

Konstantin

#85 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Quoted 127 lines · Konstantin

Hi Olivier,

Quoted 101 lines · Declan Doherty
Quoted 11 lines
Quoted 4 lines

The new files are called rte_mbuf_offload, but from what I understand, it is more like a mbuf metadata api. What you call "offload operation" is not called because an offload is attached, but because you call rte_cryptodev_enqueue_burst() on it.

Maybe rte_mbuf_offload_metadata would be a better name, if not a bit more long winded :) The idea of this API set is to give a generic framework for attaching the the offload operation meta data to a mbuf which will be retrieved at a later point, when the particular offload burst function is called. I guess as we only have a single offload device at the moment the API may look a little over the top!

Indeed, not sure rte_mbuf_offload_metadata is better.
I'm still not convinced that offload should appear in the name, it is a bit confusing with hardware offloads (ol_flags). Also, it suggests that a work is delegated to another entity, but for instance in this case it is just used as a storage area:

	ol = rte_pktmbuf_offload_alloc(pool, RTE_PKTMBUF_OL_CRYPTO);
	rte_crypto_op_attach_session(&ol->op.crypto, session);
	ol->op.crypto.digest.data = rte_pktmbuf_append(m, digest_len);
	ol->op.crypto.digest.phys_addr = ...;
	/* ... */
	rte_pktmbuf_offload_attach(m, ol);
	ret = rte_cryptodev_enqueue_burst(dev_id, qp_id, &m, 1);

Do you have some other examples in mind that would use this API?

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +9 -0
+/** Rearms rte_mbuf_offload default parameters */
+static inline void
+__rte_pktmbuf_offload_reset(struct rte_mbuf_offload *ol,
+        enum rte_mbuf_ol_op_type type)
+{
+    ol->m = NULL;
+    ol->type = type;
+
+    switch (type) {
Quoted 8 lines

lib/librte_mbuf_offload/rte_mbuf_offload.h line 194

Quoted 6 lines
lib/librte_mbuf_offload/rte_mbuf_offload.h new file +6 -0
+    case RTE_PKTMBUF_OL_CRYPTO:
+        __rte_crypto_op_reset(&ol->op.crypto); break;
+    default:
+        break;
+    }
+}

Would it work if several OL are registered?

Quoted 1 line

I can't see any reason why it wouldn't

Sorry, I read it to quickly. I thought it was a rte_pktmbuf_offload_detach() function. By the way there is no such function?

Quoted 11 lines
Quoted 6 lines

Also, what is not clear to me is how the offload structure is freed. For instance, I think that calling rte_pktmbuf_free(m) on a mbuf that has a offload attached would result in a leak.

It would mean that it is not allowed to call any function that free or reassemble a mbuf when an offload is attached.

We just need to walk the chain of offloads calling rte_pktmbuf_offload_free(), before freeing the mbuf, which will be an issue with any externally attached meta data. In the case of reassembling I don't see why we would just move the chain to the head mbuf.

Walking the chain of offload + adding the initialization will probably have a little cost that should be evaluated.

The freeing is probably not the only problem:
- packet duplication: are the offload infos copied? If no, it means that the copy is not exactly a copy
- if you chain 2 mbufs that both have offload info attached, how does it behave?
- if you prepend a segment to your mbuf, you need to copy the mbuf offload pointer, and also parse the list of offload to update the ol->m pointer of each element.

Quoted 11 lines
Quoted 5 lines

It seems that these offload structures are only used to pass crypto info to the cryptodev. Would it be a problem to have an API like this?

    rx_burst(port, q, mbuf_tab, crypto_tab, n);

I really dislike this option, there's no direct linkage between mbuf and offload operation.

Quoted 2 lines

Or even:

Quoted 8 lines
Quoted 4 lines

rx_burst(port, q, crypto_tab, n);

with each *cryto_tab pointing to a mbuf

I looked at this but it would really hamstring any pipelining applications which might want to attach multiple offloads to a mbuf at a point in the pipeline for processing at later steps.

As far as I can see, there is already a way to chain several crypto operations in the crypto structure.

Quoted 8 lines

Another option is to use the mbuf offload API (or the m->userdata pointer which already works for that) only in the application:

- the field is completely ignored by the mbuf api and the dpdk driver
- it is up to the application to initialize it and free it

-> it can only be used when passing mbuf from a part of the app
to another, so it perfectly matches the pipeline use case.

I don't think we should start to re-use userdata.
Userdata was intended for the upper layer app to pass/store it's private data associated with mbuf, and we probably should keep it this way. While mbuf_offload (or whatever we'll name it) supposed to keep data necessary for crypto (and other future type of devices) to operate with mbuf.

All your comments above about that this new field is just ignored by most mbuf operations (copy/attach/append/free, etc) are valid.
By I suppose for now we can just state that for mbuf_offload is not supported by
all these mbuf ops.
I understand that current API is probably not perfect and might need to be revised in future. Again, as it is completely new feature, I suspect it would be a lot of change requests for it anyway. But we need some generic way to pass other (not ethdev) specific information within mbuf between user-level and PMDs for non-ethernet devices (and probably between different PMDs too).

Quoted 2 lines

Konstantin

Just to re-iterate Konstantin's point above. I'm aware that a number of mbuf operations currently are not supported and are not aware of the rte_mbuf_offload, but we will be continuing development throughout 2.3 and beyond to address this. Also I hope we will get much more community feedback and interaction so we can get a more definite feature set for the library, and by minimizing the features in this release, it will allow more flexibility on how we can develop this part of handling offloaded operations and it will limit the ABI issues we will face if it turns out we need to change this going forwards.

Thanks
Declan

#86 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Hi,

Quoted 4 lines · Declan Doherty
Quoted 4 lines

I don't think we should start to re-use userdata.
Userdata was intended for the upper layer app to pass/store it's private data associated with mbuf, and we probably should keep it this way.

If the crypto API PMD takes both mbuf and crypto instead of just the mbuf, the mbuf_offload and the userdata wouldn't be very different, as the metadata would stay inside the application.

So, if it's application private (the dpdk does not know how to handle it in case of mbuf free, dup, ...), the content of it should be app-specific.

Quoted 3 lines
Quoted 3 lines

While mbuf_offload (or whatever we'll name it) supposed to keep data necessary for crypto (and other future type of devices) to operate with mbuf.

Any idea of future devices?

Quoted 6 lines
Quoted 6 lines

All your comments above about that this new field is just ignored by most mbuf
operations (copy/attach/append/free, etc) are valid.
By I suppose for now we can just state that for mbuf_offload is not supported by
all these mbuf ops.

So, who is responsible of freeing the mbuf offload metadata? The crypto pmd ?

It means that as soon as the mbuf offload is added to the mbuf, it is not possible to call any other dpdk function that would process the mbuf... if we cannot call anything else before, why not just passing the crypto argument as a parameter?

Managing offload data would even be more complex in the future if there are more than one mbuf_offload attached to the mbuf.

Quoted 2 lines
Quoted 2 lines

I understand that current API is probably not perfect and might need to be revised in future.

The problem is that it's not easy to change the dpdk API now.

Quoted 6 lines
Quoted 6 lines

Again, as it is completely new feature, I suspect it would be a lot of change requests for it anyway.
But we need some generic way to pass other (not ethdev) specific information within mbuf
between user-level and PMDs for non-ethernet devices (and probably between different PMDs too).

If a crypto PMD needs a crypto info, why not adding a crypto argument? I feel it's clearer from a user point of view.

About PMD to PMD metadata, do you have any use case?

Quoted 9 lines

Just to re-iterate Konstantin's point above. I'm aware that a number of mbuf operations currently are not supported and are not aware of the rte_mbuf_offload, but we will be continuing development throughout 2.3 and beyond to address this. Also I hope we will get much more community feedback and interaction so we can get a more definite feature set for the library, and by minimizing the features in this release, it will allow more flexibility on how we can develop this part of handling offloaded operations and it will limit the ABI issues we will face if it turns out we need to change this going forwards.

I can see the amount of work you've done for making the cryptodev happen in dpdk. I also recognize that I didn't make comments very early.

If we really want to have this feature in the next release, maybe there is a way to mark it as experimental, meaning that the API is subject to change? What do you think?

Thomas, any comment?

Regards,
Olivier

#87 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

2015-11-23 14:08, Olivier MATZ:

Quoted 6 lines

2015-11-23 12:16, Declan Doherty:

Quoted 3 lines

2015-11-23 11:52, Ananyev, Konstantin:

Quoted 2 lines

I understand that current API is probably not perfect and might need to be revised in future.

The problem is that it's not easy to change the dpdk API now.

[...]

Quoted 10 lines
Quoted 9 lines

Just to re-iterate Konstantin's point above. I'm aware that a number of mbuf operations currently are not supported and are not aware of the rte_mbuf_offload, but we will be continuing development throughout 2.3 and beyond to address this. Also I hope we will get much more community feedback and interaction so we can get a more definite feature set for the library, and by minimizing the features in this release, it will allow more flexibility on how we can develop this part of handling offloaded operations and it will limit the ABI issues we will face if it turns out we need to change this going forwards.

Quoted 8 lines

I can see the amount of work you've done for making the cryptodev happen in dpdk. I also recognize that I didn't make comments very early.

If we really want to have this feature in the next release, maybe there is a way to mark it as experimental, meaning that the API is subject to change? What do you think?

Thomas, any comment?

Yes, it is a totally new work and it probably needs more time to have a design working well for most of use cases.
As I already discussed with Olivier, I think it should be considered as experimental. It means we can try it but do not consider it as a stable API. So the deprecation process would not apply until the experimental flag is removed.

For the release 2.2, it would be better to remove the crypto dependency in mbuf. Do you think it is possible?

#88 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

2015-11-23 15:17, Thomas Monjalon:

Quoted 6 lines

Yes, it is a totally new work and it probably needs more time to have a design working well for most of use cases.
As I already discussed with Olivier, I think it should be considered as experimental. It means we can try it but do not consider it as a stable API. So the deprecation process would not apply until the experimental flag is removed.

If nobody complains, I'll apply this v7 and will send a patch to add some experimental markers.

Quoted 2 lines

For the release 2.2, it would be better to remove the crypto dependency in mbuf. Do you think it is possible?

Sorry, forget it, the dependency is in mbuf_offload.

#89 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

Quoted 8 lines · Thomas Monjalon

2015-11-23 15:17, Thomas Monjalon:

Quoted 6 lines

Yes, it is a totally new work and it probably needs more time to have a design working well for most of use cases.
As I already discussed with Olivier, I think it should be considered as experimental. It means we can try it but do not consider it as a stable API. So the deprecation process would not apply until the experimental flag is removed.

Quoted 8 lines

If nobody complains, I'll apply this v7 and will send a patch to add some experimental markers.

Quoted 2 lines

For the release 2.2, it would be better to remove the crypto dependency in mbuf. Do you think it is possible?

Sorry, forget it, the dependency is in mbuf_offload.

That sounds good to me, thanks Thomas!

#90 lore raw

Re: [PATCH v7 06/10] mbuf_offload: library to support attaching offloads to a mbuf

In reply to Olivier MATZ
Quoted 16 lines · Olivier MATZ

Hi,

Quoted 4 lines · Declan Doherty
Quoted 4 lines

I don't think we should start to re-use userdata.
Userdata was intended for the upper layer app to pass/store it's private data associated with mbuf, and we probably should keep it this way.

If the crypto API PMD takes both mbuf and crypto instead of just the mbuf, the mbuf_offload and the userdata wouldn't be very different, as the metadata would stay inside the application.

So, if it's application private (the dpdk does not know how to handle it in case of mbuf free, dup, ...), the content of it should be app-specific.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

While mbuf_offload (or whatever we'll name it) supposed to keep data necessary for crypto (and other future type of devices) to operate with mbuf.

Any idea of future devices?

Well the QAT hardware supports compression, so I guess that might be a likely candidate for future work.

Quoted 31 lines
Quoted 7 lines
Quoted 7 lines

All your comments above about that this new field is just ignored by most mbuf
operations (copy/attach/append/free, etc) are valid.
By I suppose for now we can just state that for mbuf_offload is not supported by
all these mbuf ops.

So, who is responsible of freeing the mbuf offload metadata? The crypto pmd ?

It means that as soon as the mbuf offload is added to the mbuf, it is not possible to call any other dpdk function that would process the mbuf... if we cannot call anything else before, why not just passing the crypto argument as a parameter?

Managing offload data would even be more complex in the future if there are more than one mbuf_offload attached to the mbuf.

Quoted 2 lines
Quoted 2 lines

I understand that current API is probably not perfect and might need to be revised in future.

The problem is that it's not easy to change the dpdk API now.

Quoted 6 lines
Quoted 6 lines

Again, as it is completely new feature, I suspect it would be a lot of change requests for it anyway.
But we need some generic way to pass other (not ethdev) specific information within mbuf
between user-level and PMDs for non-ethernet devices (and probably between different PMDs too).

Quoted 4 lines

If a crypto PMD needs a crypto info, why not adding a crypto argument? I feel it's clearer from a user point of view.

About PMD to PMD metadata, do you have any use case?

One use case that comes to mind would be the enablement of inline IPsec. To enable this you would need a mechanism to attach the IPsec metadata, ESP header offsets etc to an mbuf which the PMD can then use to correctly complete the tx descriptor.

Quoted 12 lines
Quoted 11 lines

Just to re-iterate Konstantin's point above. I'm aware that a number of mbuf operations currently are not supported and are not aware of the rte_mbuf_offload, but we will be continuing development throughout 2.3 and beyond to address this. Also I hope we will get much more community feedback and interaction so we can get a more definite feature set for the library, and by minimizing the features in this release, it will allow more flexibility on how we can develop this part of handling offloaded operations and it will limit the ABI issues we will face if it turns out we need to change this going forwards.

Quoted 6 lines

I can see the amount of work you've done for making the cryptodev happen in dpdk. I also recognize that I didn't make comments very early.

If we really want to have this feature in the next release, maybe there is a way to mark it as experimental, meaning that the API is subject to change? What do you think?

I wouldn't be against this idea. I think a mechanism for marking new libraries / APIs as experimental for their initial release could be very useful to allow new features to be introduced with the flexibility to make further API changes on user feedback without the overhead of ABI management in the subsequent release.

Quoted 6 lines

Thomas, any comment?

Regards,
Olivier

#91 lore raw

PATCH v7 7/10 qat_crypto_pmd: Addition of a new QAT DPDK PMD.

In reply to Declan Doherty

This patch adds a PMD for the Intel Quick Assist Technology DH895xxC hardware accelerator.

This patch depends on a QAT PF driver for device initialization. See the file docs/guides/cryptodevs/qat.rst for configuration details

This patch supports a limited subset of QAT device functionality, currently supporting chaining of cipher and hash operations for the following algorithmsd:

Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES128_CBC
- RTE_CRYPTO_CIPHER_AES256_CBC
- RTE_CRYPTO_CIPHER_AES512_CBC

Hash algorithms:
- RTE_CRYPTO_AUTH_SHA1_HMAC
- RTE_CRYPTO_AUTH_SHA256_HMAC
- RTE_CRYPTO_AUTH_SHA512_HMAC
- RTE_CRYPTO_AUTH_AES_XCBC_MAC

Some limitation on this patchset which shall be contributed in a subsequent release:
- Chained mbufs are not supported.
- Hash only is not supported.
- Cipher only is not supported.
- Only in-place is currently supported (destination address is the same as source address).
- Only supports session-oriented API implementation (session-less APIs are not supported).

---
 config/common_bsdapp                               |  14 +
 config/common_linuxapp                             |  14 +
 doc/guides/cryptodevs/index.rst                    |  42 ++
 doc/guides/cryptodevs/qat.rst                      | 194 +++++++
 doc/guides/index.rst                               |   1 +
 drivers/Makefile                                   |   1 +
 drivers/crypto/Makefile                            |  37 ++
 drivers/crypto/qat/Makefile                        |  63 +++
 .../qat/qat_adf/adf_transport_access_macros.h      | 174 ++++++
 drivers/crypto/qat/qat_adf/icp_qat_fw.h            | 316 +++++++++++
 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h         | 404 ++++++++++++++
 drivers/crypto/qat/qat_adf/icp_qat_hw.h            | 306 +++++++++++
 drivers/crypto/qat/qat_adf/qat_algs.h              | 125 +++++
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   | 601 +++++++++++++++++++++
 drivers/crypto/qat/qat_crypto.c                    | 561 +++++++++++++++++++
 drivers/crypto/qat/qat_crypto.h                    | 124 +++++
 drivers/crypto/qat/qat_logs.h                      |  78 +++
 drivers/crypto/qat/qat_qp.c                        | 429 +++++++++++++++
 drivers/crypto/qat/rte_pmd_qat_version.map         |   3 +
 drivers/crypto/qat/rte_qat_cryptodev.c             | 137 +++++
 mk/rte.app.mk                                      |   3 +
 21 files changed, 3627 insertions(+)
 create mode 100644 doc/guides/cryptodevs/index.rst
 create mode 100644 doc/guides/cryptodevs/qat.rst
 create mode 100644 drivers/crypto/Makefile
 create mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/qat_adf/adf_transport_access_macros.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_hw.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
 create mode 100644 drivers/crypto/qat/qat_crypto.c
 create mode 100644 drivers/crypto/qat/qat_crypto.h
 create mode 100644 drivers/crypto/qat/qat_logs.h
 create mode 100644 drivers/crypto/qat/qat_qp.c
 create mode 100644 drivers/crypto/qat/rte_pmd_qat_version.map
 create mode 100644 drivers/crypto/qat/rte_qat_cryptodev.c
config/common_bsdapp +14 -0
index ba2533a..0068b20 100644
@@ -155,6 +155,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64
 
 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_MAX_QAT_SESSIONS=200
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
config/common_linuxapp +14 -0
index 4c52f78..b29d3dd 100644
@@ -153,6 +153,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64
 
 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
doc/guides/cryptodevs/index.rst new file +42 -0

42 lines not on this page · raw message

doc/guides/cryptodevs/qat.rst new file +194 -0

194 lines not on this page · raw message

doc/guides/index.rst +1 -0
index 439c7e3..c5d7a9f 100644
@@ -42,6 +42,7 @@ Contents:
    xen/index
    prog_guide/index
    nics/index
+   cryptodevs/index
    sample_app_ug/index
    testpmd_app_ug/index
    faq/index
drivers/Makefile +1 -0
index b60eb5e..6ec67f6 100644
@@ -32,5 +32,6 @@
 include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-y += net
+DIRS-y += crypto
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/crypto/Makefile new file +37 -0
new file mode 100644
index 0000000..f6aecea
@@ -0,0 +1,37 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of Intel Corporation nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
+
+include $(RTE_SDK)/mk/rte.sharelib.mk
+include $(RTE_SDK)/mk/rte.subdir.mk
\ No newline at end of file
drivers/crypto/qat/Makefile new file +63 -0

63 lines not on this page · raw message

drivers/crypto/qat/qat_adf/adf_transport_access_macros.h new file +174 -0

174 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_fw.h new file +316 -0

316 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_fw_la.h new file +404 -0

404 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_hw.h new file +306 -0

306 lines not on this page · raw message

drivers/crypto/qat/qat_adf/qat_algs.h new file +125 -0

125 lines not on this page · raw message

drivers/crypto/qat/qat_adf/qat_algs_build_desc.c new file +601 -0

601 lines not on this page · raw message

drivers/crypto/qat/qat_crypto.c new file +561 -0

561 lines not on this page · raw message

drivers/crypto/qat/qat_crypto.h new file +124 -0

123 lines not on this page · raw message

drivers/crypto/qat/qat_logs.h new file +78 -0

78 lines not on this page · raw message

drivers/crypto/qat/qat_qp.c new file +429 -0

429 lines not on this page · raw message

drivers/crypto/qat/rte_pmd_qat_version.map new file +3 -0
new file mode 100644
index 0000000..bbaf1c8

Lines of this file are not shown. View the raw message.

drivers/crypto/qat/rte_qat_cryptodev.c new file +137 -0

137 lines not on this page · raw message

mk/rte.app.mk +3 -0
index 2b8ddce..cfcb064 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#92 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

2015-11-13 18:58, Declan Doherty:

Quoted 2 lines

+Crypto Device Drivers
+====================================

It is a quite long underlining :)

It raise a question to me:
John, have you reviewed the crypto docs?

#93 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

Quoted 8 lines

-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, November 25, 2015 1:01 AM
To: Mcnamara, John
Cc: [email protected]; Doherty, Declan
Subject: Re: [dpdk-dev] [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

Quoted 8 lines

2015-11-13 18:58, Declan Doherty:

Quoted 2 lines

+Crypto Device Drivers
+====================================

It is a quite long underlining :)

It raise a question to me:
John, have you reviewed the crypto docs?

No. I'll do it now.

John.

#94 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

In reply to Declan Doherty

2015-11-13 18:58, Declan Doherty:

doc/guides/cryptodevs/qat.rst line 97

Quoted 9 lines
doc/guides/cryptodevs/qat.rst new file +9 -0
+Build and install the SRIOV-enabled QAT driver
+
+.. code-block:: console
+
+    "mkdir /QAT; cd /QAT"
+    copy qatmux.l.2.3.0-34.tgz to this location
+    "tar zxof qatmux.l.2.3.0-34.tgz"
+    "export ICP_WITHOUT_IOMMU=1"
+    "./installer.sh install QAT1.6 host"

People may want to install QAT in a specific directory to just test build regression.
Is there an easy way to do it?

#95 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

2015-11-25 11:34, Thomas Monjalon:

Quoted 14 lines

2015-11-13 18:58, Declan Doherty:

doc/guides/cryptodevs/qat.rst line 97

Quoted 9 lines
doc/guides/cryptodevs/qat.rst new file +9 -0
+Build and install the SRIOV-enabled QAT driver
+
+.. code-block:: console
+
+    "mkdir /QAT; cd /QAT"
+    copy qatmux.l.2.3.0-34.tgz to this location
+    "tar zxof qatmux.l.2.3.0-34.tgz"
+    "export ICP_WITHOUT_IOMMU=1"
+    "./installer.sh install QAT1.6 host"

People may want to install QAT in a specific directory to just test build regression.
Is there an easy way to do it?

For reference, I use this script:

tar xf qatmux-2.5.0-80/QAT1.6/QAT1.6.L.2.5.0-80.tar.gz
export ICP_ROOT=$(readlink -e $qat_dir)
export ICP_ENV_DIR=$ICP_ROOT/quickassist/build_system/build_files/env_files export ICP_TOOLS_TARGET="accelcomp"
make -C $ICP_ROOT/quickassist

And it fails here:

qat-1.6/quickassist/adf/include/icp_adf_transport_dp.h:118:18:
error: inlining failed in call to always_inline ‘icp_adf_pollQueue’:
function body not available

#96 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

Quoted 24 lines · Thomas Monjalon

2015-11-25 11:34, Thomas Monjalon:

Quoted 14 lines

2015-11-13 18:58, Declan Doherty:

doc/guides/cryptodevs/qat.rst line 97

Quoted 9 lines
doc/guides/cryptodevs/qat.rst new file +9 -0
+Build and install the SRIOV-enabled QAT driver
+
+.. code-block:: console
+
+    "mkdir /QAT; cd /QAT"
+    copy qatmux.l.2.3.0-34.tgz to this location
+    "tar zxof qatmux.l.2.3.0-34.tgz"
+    "export ICP_WITHOUT_IOMMU=1"
+    "./installer.sh install QAT1.6 host"

People may want to install QAT in a specific directory to just test build regression.
Is there an easy way to do it?

For reference, I use this script:

tar xf qatmux-2.5.0-80/QAT1.6/QAT1.6.L.2.5.0-80.tar.gz
export ICP_ROOT=$(readlink -e $qat_dir)
export ICP_ENV_DIR=$ICP_ROOT/quickassist/build_system/build_files/env_files export ICP_TOOLS_TARGET="accelcomp"
make -C $ICP_ROOT/quickassist

Quoted 6 lines

And it fails here:

qat-1.6/quickassist/adf/include/icp_adf_transport_dp.h:118:18:
error: inlining failed in call to always_inline ‘icp_adf_pollQueue’:
function body not available

Hey Thomas, I'm just following up with the team on this. There is no actual build dependency on the QAT PMD to have the driver installed, it's only required for management of the PF and allocation of VF's which are subsequently used within DPDK. The only external header dependencies outside of DPDK should be on openssl/libcrypto.

Declan

#97 lore raw

Re: [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

In reply to Declan Doherty
Quoted 13 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Declan Doherty
Sent: Friday, November 13, 2015 6:58 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH v7 07/10] qat_crypto_pmd: Addition of a new QAT DPDK PMD.

This patch adds a PMD for the Intel Quick Assist Technology DH895xxC hardware accelerator.

doc/guides/cryptodevs/index.rst line 37

Quoted 8 lines
doc/guides/cryptodevs/index.rst new file +8 -0
+Crypto Device Drivers
+====================================
+
+|today|
+
+
+**Contents**
+

It is best to omit the |today| since it isn't generally useful. Also, **Content** is added automatically in the PDF out and not really required in Html output so that can be omitted as well.

Quoted 7 lines
doc/guides/cryptodevs/qat.rst new file +6 -0
+Quick Assist Crypto Poll Mode Driver
+====================================
+
+The QAT PMD provides poll mode crypto driver support for **Intel
+QuickAssist Technology DH895xxC** hardware accelerator. QAT PMD has
+current been tested on Fedora 21 64-bit with gcc and on the 4.3

kernel.org

Typo: current(ly) but it is probably clearer without that word.

doc/guides/cryptodevs/qat.rst line 46

Quoted 8 lines
doc/guides/cryptodevs/qat.rst new file +8 -0
+Features
+--------
+QAT PMD has support for:
+
+Cipher algorithms:
+* RTE_CRYPTO_SYM_CIPHER_AES128_CBC
+* RTE_CRYPTO_SYM_CIPHER_AES256_CBC
+* RTE_CRYPTO_SYM_CIPHER_AES512_CBC

The list needs to be separated from the previous line with a blank line to render correctly. It would also be worth rending the algorithms as fixed width text.

Cipher algorithms:

* ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC``
* ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC``
* ``RTE_CRYPTO_SYM_CIPHER_AES512_CBC``

Same comments for next paragraph.

Quoted 10 lines
doc/guides/cryptodevs/qat.rst new file +6 -0
+Installation
+------------
+To use the DPDK QAT PMD an SRIOV-enabled QAT kernel driver is required.
+The VF devices exposed by this driver will be used by QAT PMD.
+
+If you are running on kernel 4.3 or greater, see instructions for

"Installation using
+kernel.org QAT driver". If you're on a kernel earlier than 4.3, see "Installation using the
+01.org QAT driver".

The section references don't match the section names. These could also be links like this:

If you are running on kernel 4.3 or greater, see instructions for Installation using kernel.org driver_ below. If you're on a kernel earlier than 4.3, see Installation using 01.org QAT driver_.

Quoted 5 lines
(quoted diff) +2 -0
+Compiling the 01.org driver - notes:
+If using a later kernel and the build fails with an error relating to

strict_stroul not being available patch the following file:
+
+.. code-block:: console

You could "use code-block:: diff" here to render the patch nicely in the docs.

doc/guides/cryptodevs/qat.rst line 135

Quoted 3 lines
doc/guides/cryptodevs/qat.rst new file +3 -0
+If build fails due to missing header files you may need to do following:
+  *  sudo yum install zlib-devel
+  *  sudo yum install openssl-devel

Probably should be rendered as a code block with ::

Quoted 6 lines
doc/guides/cryptodevs/qat.rst new file +5 -0
+
+Installation using kernel.org driver
+------------------------------------
+
+Assuming you are running on at least a 4.3 kernel, you can use the stock

kernel.org QAT

doc/guides/cryptodevs/qat.rst line 155

Quoted 10 lines
doc/guides/cryptodevs/qat.rst new file +10 -0
+driver to start the QAT hardware.
+
+Steps below assume
+  * running DPDK on a platform with one DH895xCC device
+  * on a kernel at least version 4.3
+
+In BIOS ensure that SRIOV is enabled and VT-d is disabled.
+
+Ensure the QAT driver is loaded on your system, by executing:
+    lsmod | grep qat

The commands in this section should be rendered with ::

Ensure the QAT driver is loaded on your system, by executing::

lsmod | grep qat

Quoted 15 lines
doc/guides/cryptodevs/qat.rst new file +3 -0
+Binding the available VFs to the DPDK UIO driver
+------------------------------------------------
+The unbind command below assumes bdfs of 03:01.00-03:04.07, if yours are

different adjust the unbind command below.

doc/guides/cryptodevs/qat.rst new file +9 -0
+
+Make available to DPDK
+
+.. code-block:: console
+
+   cd $(RTE_SDK) (See http://dpdk.org/doc/quick-start to install DPDK)
+   "modprobe uio"
+   "insmod ./build/kmod/igb_uio.ko"
+   "for device in $(seq 1 4); do for fn in $(seq 0 7); do echo -n

0000:03:0${device}.${fn} > /sys/bus/pci/devices/0000\:03\:0${device}.${fn}/driver/unbind;done ;done"

doc/guides/cryptodevs/qat.rst line 193

Quoted 2 lines
doc/guides/cryptodevs/qat.rst new file +2 -0
+   "echo "8086 0443" > /sys/bus/pci/drivers/igb_uio/new_id"
+

This is too long to be rendered in PDF. Something like the following would work better in the docs while being functionally the same:

The unbind command below assumes ``bdfs`` of ``03:01.00-03:04.07``, if yours are different adjust the unbind command below::

cd $RTE_SDK
modprobe uio
insmod ./build/kmod/igb_uio.ko

   for device in $(seq 1 4); do \
       for fn in $(seq 0 7); do \
           echo -n 0000:03:0${device}.${fn} > \
           /sys/bus/pci/devices/0000\:03\:0${device}.${fn}/driver/unbind; \
       done; \
   done

echo "8086 0443" > /sys/bus/pci/drivers/igb_uio/new_id

You can use ``lspci -vvd:443`` to confirm that all devices are now in use by igb_uio kernel driver.

John.

#98 lore raw

PATCH v7 8/10 aesni_mb_pmd: Initial implementation of multi buffer based crypto device

In reply to Declan Doherty

This patch provides the initial implementation of the AES-NI multi-buffer based crypto poll mode driver using DPDK's new cryptodev framework.

This PMD is dependent on Intel's multibuffer library, see the whitepaper "Fast Multi-buffer IPsec Implementations on Intel® Architecture Processors", see ref 1 for details on the library's design and ref 2 to download the library itself. This initial implementation is limited to supporting the chained operations of "hash then cipher" or "cipher then hash" for the following cipher and hash algorithms:

Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES128_CBC
- RTE_CRYPTO_CIPHER_AES256_CBC
- RTE_CRYPTO_CIPHER_AES512_CBC

Hash algorithms:
- RTE_CRYPTO_AUTH_SHA1_HMAC
- RTE_CRYPTO_AUTH_SHA256_HMAC
- RTE_CRYPTO_AUTH_SHA512_HMAC
- RTE_CRYPTO_AUTH_AES_XCBC_MAC

Important Note:
Due to the fact that the multi-buffer library is designed for accelerating IPsec crypto oepration, the digest's generated for the HMAC functions are truncated to lengths specified by IPsec RFC's, ie RFC2404 for using HMAC-SHA-1 with IPsec specifies that the digest is truncate from 20 to 12 bytes.

Build instructions:
To build DPKD with the AESNI_MB_PMD the user is required to download (ref 2) and compile the multi-buffer library on there user system before building DPDK. The environmental variable AESNI_MULTI_BUFFER_LIB_PATH must be exported with the path where you extracted and built the multi buffer library and finally set CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y in config/common_linuxapp.

Current status: It's doesn't support crypto operation across chained mbufs, or cipher only or hash only operations.

ref 1:
https://www-ssl.intel.com/content/www/us/en/intelligent-systems/intel-technology/fast-multi-buffer-ipsec-implementations-ia-processors-p

ref 2: https://downloadcenter.intel.com/download/22972

---
 MAINTAINERS                                        |   3 +
 config/common_bsdapp                               |   7 +
 config/common_linuxapp                             |   7 +
 doc/guides/cryptodevs/aesni_mb.rst                 |  76 +++
 doc/guides/cryptodevs/index.rst                    |   1 +
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/aesni_mb/Makefile                   |  63 ++
 drivers/crypto/aesni_mb/aesni_mb_ops.h             | 210 +++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 669 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 298 +++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 229 +++++++
 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map  |   3 +
 mk/rte.app.mk                                      |   4 +
 13 files changed, 1571 insertions(+)
 create mode 100644 doc/guides/cryptodevs/aesni_mb.rst
 create mode 100644 drivers/crypto/aesni_mb/Makefile
 create mode 100644 drivers/crypto/aesni_mb/aesni_mb_ops.h
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
 create mode 100644 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map
MAINTAINERS +3 -0
index 73d9578..2d5808c 100644
@@ -303,6 +303,9 @@ Null PMD
 M: Tetsuya Mukawa <[email protected]>
 F: drivers/net/null/
 
+Crypto AES-NI Multi-Buffer PMD
+M: Declan Doherty <[email protected]>
+F: driver/crypto/aesni_mb
 
 Packet processing
 -----------------
config/common_bsdapp +7 -0
index 0068b20..a18e817 100644
@@ -168,6 +168,13 @@ CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_MAX_QAT_SESSIONS=200
 
+
+#
+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_AESNI_MB_DEBUG=n
+
 #
 # Support NIC bypass logic
 #
config/common_linuxapp +7 -0
index b29d3dd..d9c8c5c 100644
@@ -166,6 +166,13 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
 
+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS=8
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_SESSIONS=2048
+
 #
 # Support NIC bypass logic
 #
doc/guides/cryptodevs/aesni_mb.rst new file +76 -0

76 lines not on this page · raw message

doc/guides/cryptodevs/index.rst +1 -0
index 1c31697..8949fd0 100644
@@ -39,4 +39,5 @@ Crypto Device Drivers
     :maxdepth: 2
     :numbered:
 
+    aesni_mb
     qat
drivers/crypto/Makefile +1 -0
index f6aecea..d07ee96 100644
@@ -31,6 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
 
 include $(RTE_SDK)/mk/rte.sharelib.mk
drivers/crypto/aesni_mb/Makefile new file +63 -0

63 lines not on this page · raw message

drivers/crypto/aesni_mb/aesni_mb_ops.h new file +210 -0

210 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c new file +669 -0

669 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c new file +298 -0

298 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h new file +229 -0

229 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_pmd_aesni_version.map new file +3 -0
new file mode 100644
index 0000000..ad607bb
@@ -0,0 +1,3 @@
+DPDK_2.2 {
+	local: *;
+};
mk/rte.app.mk +4 -0
index cfcb064..4a660e6 100644
@@ -153,6 +153,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
 # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)        += -lrte_pmd_qat -lcrypto
 
+# AESNI MULTI BUFFER is dependent on the IPSec_MB library
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -lrte_pmd_aesni_mb
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
+
 endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
Signature · 1 line
2.5.0
#99 lore raw

Re: [PATCH v7 08/10] aesni_mb_pmd: Initial implementation of multi buffer based crypto device

2015-11-13 18:58, Declan Doherty:

doc/guides/cryptodevs/aesni_mb.rst

Quoted 3 lines
doc/guides/cryptodevs/aesni_mb.rst new file +3 -0
+To build DPKD with the AESNI_MB_PMD the user is required to download the library
+from `here <https://downloadcenter.intel.com/download/22972>`_ and compile it on
+their user system before building DPDK.

Maybe it is worth saying that yasm must be installed
and compilation is done with "make YASM=yasm" (because of a hard-coded path).

#100 lore raw

PATCH v7 9/10 app/test: add cryptodev unit and performance tests

In reply to Declan Doherty

unit tests are run by using cryptodev_qat_autotest or cryptodev_aesni_autotest from the test apps interactive console.

performance tests are run by using the cryptodev_qat_perftest or cryptodev_aesni_mb_perftest command from the test apps interactive console.

If you which to run the tests on a QAT device there must be one bound to igb_uio kernel driver.

---
 MAINTAINERS                          |    2 +
 app/test/Makefile                    |    4 +
 app/test/test.c                      |   92 +-
 app/test/test.h                      |   34 +-
 app/test/test_cryptodev.c            | 1986 ++++++++++++++++++++++++++++++++
 app/test/test_cryptodev.h            |   68 ++
 app/test/test_cryptodev_perf.c       | 2062 ++++++++++++++++++++++++++++++++++
 app/test/test_link_bonding.c         |    6 +-
 app/test/test_link_bonding_mode4.c   |    7 +-
 app/test/test_link_bonding_rssconf.c |    7 +-
 10 files changed, 4219 insertions(+), 49 deletions(-)
 create mode 100644 app/test/test_cryptodev.c
 create mode 100644 app/test/test_cryptodev.h
 create mode 100644 app/test/test_cryptodev_perf.c
MAINTAINERS +2 -0
index 2d5808c..1f72f8c 100644
@@ -204,6 +204,8 @@ Crypto API
 M: Declan Doherty <[email protected]>
 F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
+F: app/test/test_cryptodev.c
+F: app/test/test_cryptodev_perf.c
 
 Drivers
 -------
app/test/Makefile +4 -0
index de63235..ec33e1a 100644
@@ -149,6 +149,10 @@ endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
+
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
 
 CFLAGS += -O3
app/test/test.c +61 -31

112 lines not on this page · raw message

app/test/test.h +27 -7
index 62eb51d..a2fba60 100644
@@ -33,7 +33,7 @@
 
 #ifndef _TEST_H_
 #define _TEST_H_
-
+#include <stddef.h>
 #include <sys/queue.h>
 
 #define TEST_SUCCESS  (0)
@@ -64,6 +64,17 @@
 		}                                                        \
 } while (0)
 
+
+#define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len,  msg, ...) do {	\
+	if (memcmp(a, b, len)) {                                        \
+		printf("TestCase %s() line %d failed: "              \
+			msg "\n", __func__, __LINE__, ##__VA_ARGS__);    \
+		TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);    \
+		return TEST_FAILED;                                  \
+	}                                                        \
+} while (0)
+
+
 #define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do {               \
 		if (!(a != b)) {                                         \
 			printf("TestCase %s() line %d failed: "              \
@@ -113,27 +124,36 @@
 
 struct unit_test_case {
 	int (*setup)(void);
-	int (*teardown)(void);
+	void (*teardown)(void);
 	int (*testcase)(void);
 	const char *success_msg;
 	const char *fail_msg;
+	unsigned enabled;
 };
 
-#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed"}
+#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed", 1 }
 
 #define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name " succeeded", \
-		name " failed"}
+		name " failed", 1 }
 
 #define TEST_CASE_ST(setup, teardown, testcase)         \
 		{ setup, teardown, testcase, #testcase " succeeded",    \
-		#testcase " failed "}
+		#testcase " failed ", 1 }
+
+
+#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn " succeeded", \
+	#fn " failed", 0 }
+
+#define TEST_CASE_ST_DISABLED(setup, teardown, testcase)         \
+		{ setup, teardown, testcase, #testcase " succeeded",    \
+		#testcase " failed ", 0 }
 
-#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL }
+#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 }
 
 struct unit_test_suite {
 	const char *suite_name;
 	int (*setup)(void);
-	int (*teardown)(void);
+	void (*teardown)(void);
 	struct unit_test_case unit_test_cases[];
 };
 
app/test/test_cryptodev.c new file +1986 -0

1,986 lines not on this page · raw message

app/test/test_cryptodev.h new file +68 -0

68 lines not on this page · raw message

app/test/test_cryptodev_perf.c new file +2062 -0

749 lines not on this page · raw message

app/test/test_link_bonding.c +3 -3
index 388cf11..2d98958 100644

Lines of this file are not shown. View the raw message.

app/test/test_link_bonding_mode4.c +3 -4
index 460539d..713368d 100644

Lines of this file are not shown. View the raw message.

app/test/test_link_bonding_rssconf.c +3 -4
index e6714b4..0a3162e 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#101 lore raw

PATCH v7 10/10 l2fwd-crypto: crypto

In reply to Declan Doherty

This patch creates a new sample applicaiton based off the l2fwd application which performs specified crypto operations on IP packet payloads which are forwarding.

---
 MAINTAINERS                    |    1 +
 examples/Makefile              |    1 +
 examples/l2fwd-crypto/Makefile |   50 ++
 examples/l2fwd-crypto/main.c   | 1473 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1525 insertions(+)
 create mode 100644 examples/l2fwd-crypto/Makefile
 create mode 100644 examples/l2fwd-crypto/main.c
MAINTAINERS +1 -0
index 1f72f8c..fa85e55 100644
@@ -206,6 +206,7 @@ F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
 F: app/test/test_cryptodev.c
 F: app/test/test_cryptodev_perf.c
+F: examples/l2fwd-crypto
 
 Drivers
 -------
examples/Makefile +1 -0
index b4eddbd..4bb6f57 100644
@@ -74,5 +74,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
 DIRS-y += vmdq
 DIRS-y += vmdq_dcb
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager
+DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += l2fwd-crypto
 
 include $(RTE_SDK)/mk/rte.extsubdir.mk
examples/l2fwd-crypto/Makefile new file +50 -0

50 lines not on this page · raw message

examples/l2fwd-crypto/main.c new file +1473 -0

1,473 lines not on this page · raw message

Signature · 1 line
2.5.0
#102 lore raw

Re: [PATCH v7 10/10] l2fwd-crypto: crypto

2015-11-13 18:58, Declan Doherty:

examples/l2fwd-crypto/main.c line 259

Quoted 8 lines
examples/l2fwd-crypto/main.c new file +8 -0
+               printf("\nStatistics for cryptodev %lu -------------------------"
+                          "\nPackets enqueued: %28"PRIu64
+                          "\nPackets dequeued: %28"PRIu64
+                          "\nPackets errors: %30"PRIu64,
+                          cdevid,
+                          crypto_statistics[cdevid].enqueued,
+                          crypto_statistics[cdevid].dequeued,
+                          crypto_statistics[cdevid].errors);

There is a compilation error on 32-bit:

examples/l2fwd-crypto/main.c:252:10:
error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t {aka long long unsigned int}’

#103 lore raw

v8 cover Crypto API and device framework

In reply to Declan Doherty

This series of patches defines a set of application burst oriented APIs for asynchronous symmetric cryptographic functions within DPDK. It also contains a poll mode driver cryptographic device framework for the implementation of crypto devices within DPDK.

In the patch set we also have included 2 reference implementations of crypto PMDs. Currently both implementations support AES-CBC with HMAC_SHA1/SHA256/SHA512 authentication operations. The first device is a purely software PMD based on Intel's multi-buffer library, which utilises both AES-NI instructions and vector operations to accelerate crypto operations and the second PMD utilises Intel's Quick Assist Technology (on DH895xxC) to provide hardware accelerated crypto operations.

The API set supports two functional modes of operation:

1, A session oriented mode. In this mode the user creates a crypto session which defines all the immutable data required to perform a particular crypto operation in advance, including cipher/hash algorithms and operations to be performed as well as the keys to used etc. The session is then referenced by the crypto operation data structure which is a data structure specific to each mbuf. It is contains all mutable data about the crypto operation to be performed, such as data offsets and lengths into the mbuf's data payload for cipher and hash operations to be performed.

2, A session-less mode. In this mode the user is able to provision crypto operations on an mbuf without the need to have a cached session created in advance, but at the cost of entailing the overhead of calculating authentication pre-computes and preforming key expansions in-line with the crypto operation. The crypto xform chain is directly attached to the op struct in this mode, so the op struct now contains all of the immutable crypto operation parameters that would be normally set within a session. Once all mutable and immutable parameters are set the crypto operation data structure can be attached to the specified mbuf and enqueued on a specified crypto device for processing.

The patch set contains the following features:
- Crypto device APIs and device framework
- Implementation of a software crypto PMD based on multi-buffer library
- Implementation of a hardware crypto PMD baed on Intel QAT(DH895xxC)
- Unit and performance test's which give and example of utilising the crypto API's.
- Sample application which performs crypto operations on the IP payload of the packets being forwarded

Current Status:
There is no support for chained mbuf's and as mentioned above the PMD's have currently implemented support for AES128-CBC/AES192-CBC/AES256-CBC and HMAC_SHA1/SHA256/SHA512 and AES_XCBC_MAC.

v8:
- Doxygen comment fix for rte_pktmbuf_mtophys macro
- Doxygen fixes for public headers in rte_crypto.h
- QAT documentation tidy up based on J. McNamara comments
- Detailed requirement to set YASM path when building multi-buffer library
- l2fwd-crypto: fix for 32-bit build; fix for possible memory leak if rte_cryptodev_burst_enqueue fails; and handling for failure to allocate rte_mbuf_offload.

v7:
- Fix typos in commit message of eal: add __rte_packed /__rte_aligned macros patch
- Include rte_mbuf_offload in doxygen build and updates file comments to clarify lib, usage. Also moved clean which was in wrong patch into this rte_mbuf_offload patch.
- Tidy up map file for cryptodev library.
- Add l2fwdc-crypto to main examples makefile.
v6:
- Fix 32-bit build issue caused by casting in new rte_pktmbuf_mtophys_offset macro
- Fix truncation of log message by new rte_pmd_debug_trace inline function

v5:
- Making ethdev marcos for function pointer and port id checking public and available for use in by the cryptodev. The intialise to patches combine changes from original cryptodev patch and discussion in
http://dpdk.org/ml/archives/dev/2015-November/027871.html
- Split out changes to create new __rte_packed and __rte_aligned macros into seperate patches form the main cryptodev patch set for clairty
- further code cleaning, removal of currently unsupported gcm code from aesni_mb pmd

v4:
- Some more EOF whitespace and checkpatch fixes

v3:
- Fixes a document build error, which I missed in the V2
- Fixes for remaining checkpatch errors
- Disables QAT and AESNI_MB PMD being build by default as they have external library dependences

v2:
- Introduces a new library to support attaching offload operations to a mbuf
- Remove unused APIs from cryptodev
- PMD code refactor due to new rte_mbuf_offload structure
- General bug fixes and code tidy up

Declan Doherty (10):
ethdev: rename macros to have RTE_ prefix
ethdev: make error checking macros public
eal: add __rte_packed /__rte_aligned macros
mbuf: add new marcos to get the physical address of data
cryptodev: Initial DPDK Crypto APIs and device framework release
mbuf_offload: library to support attaching offloads to a mbuf
qat_crypto_pmd: Addition of a new QAT DPDK PMD.
aesni_mb_pmd: Initial implementation of multi buffer based crypto
device
app/test: add cryptodev unit and performance tests
l2fwd-crypto: crypto

 MAINTAINERS                                        |   14 +
 app/test/Makefile                                  |    4 +
 app/test/test.c                                    |   92 +-
 app/test/test.h                                    |   34 +-
 app/test/test_cryptodev.c                          | 1986 +++++++++++++++++++
 app/test/test_cryptodev.h                          |   68 +
 app/test/test_cryptodev_perf.c                     | 2062 ++++++++++++++++++++
 app/test/test_link_bonding.c                       |    6 +-
 app/test/test_link_bonding_mode4.c                 |    7 +-
 app/test/test_link_bonding_rssconf.c               |    7 +-
 config/common_bsdapp                               |   37 +-
 config/common_linuxapp                             |   37 +-
 doc/api/doxy-api-index.md                          |    2 +
 doc/api/doxy-api.conf                              |    2 +
 doc/guides/cryptodevs/aesni_mb.rst                 |   85 +
 doc/guides/cryptodevs/index.rst                    |   39 +
 doc/guides/cryptodevs/qat.rst                      |  219 +++
 doc/guides/index.rst                               |    1 +
 drivers/Makefile                                   |    1 +
 drivers/crypto/Makefile                            |   38 +
 drivers/crypto/aesni_mb/Makefile                   |   63 +
 drivers/crypto/aesni_mb/aesni_mb_ops.h             |  210 ++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         |  669 +++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     |  298 +++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h |  229 +++
 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map  |    3 +
 drivers/crypto/qat/Makefile                        |   63 +
 .../qat/qat_adf/adf_transport_access_macros.h      |  174 ++
 drivers/crypto/qat/qat_adf/icp_qat_fw.h            |  316 +++
 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h         |  404 ++++
 drivers/crypto/qat/qat_adf/icp_qat_hw.h            |  306 +++
 drivers/crypto/qat/qat_adf/qat_algs.h              |  125 ++
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   |  601 ++++++
 drivers/crypto/qat/qat_crypto.c                    |  561 ++++++
 drivers/crypto/qat/qat_crypto.h                    |  124 ++
 drivers/crypto/qat/qat_logs.h                      |   78 +
 drivers/crypto/qat/qat_qp.c                        |  429 ++++
 drivers/crypto/qat/rte_pmd_qat_version.map         |    3 +
 drivers/crypto/qat/rte_qat_cryptodev.c             |  137 ++
 examples/Makefile                                  |    1 +
 examples/l2fwd-crypto/Makefile                     |   50 +
 examples/l2fwd-crypto/main.c                       | 1489 ++++++++++++++
 lib/Makefile                                       |    2 +
 lib/librte_cryptodev/Makefile                      |   60 +
 lib/librte_cryptodev/rte_crypto.h                  |  610 ++++++
 lib/librte_cryptodev/rte_cryptodev.c               | 1092 +++++++++++
 lib/librte_cryptodev/rte_cryptodev.h               |  651 ++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h           |  549 ++++++
 lib/librte_cryptodev/rte_cryptodev_version.map     |   32 +
 lib/librte_eal/common/include/rte_dev.h            |   53 +
 lib/librte_eal/common/include/rte_log.h            |    1 +
 lib/librte_eal/common/include/rte_memory.h         |   14 +-
 lib/librte_ether/rte_ethdev.c                      |  619 +++---
 lib/librte_ether/rte_ethdev.h                      |   26 +
 lib/librte_mbuf/rte_mbuf.h                         |   27 +
 lib/librte_mbuf_offload/Makefile                   |   52 +
 lib/librte_mbuf_offload/rte_mbuf_offload.c         |  100 +
 lib/librte_mbuf_offload/rte_mbuf_offload.h         |  302 +++
 .../rte_mbuf_offload_version.map                   |    7 +
 mk/rte.app.mk                                      |    9 +
 60 files changed, 14891 insertions(+), 389 deletions(-)
 create mode 100644 app/test/test_cryptodev.c
 create mode 100644 app/test/test_cryptodev.h
 create mode 100644 app/test/test_cryptodev_perf.c
 create mode 100644 doc/guides/cryptodevs/aesni_mb.rst
 create mode 100644 doc/guides/cryptodevs/index.rst
 create mode 100644 doc/guides/cryptodevs/qat.rst
 create mode 100644 drivers/crypto/Makefile
 create mode 100644 drivers/crypto/aesni_mb/Makefile
 create mode 100644 drivers/crypto/aesni_mb/aesni_mb_ops.h
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
 create mode 100644 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map
 create mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/qat_adf/adf_transport_access_macros.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_hw.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
 create mode 100644 drivers/crypto/qat/qat_crypto.c
 create mode 100644 drivers/crypto/qat/qat_crypto.h
 create mode 100644 drivers/crypto/qat/qat_logs.h
 create mode 100644 drivers/crypto/qat/qat_qp.c
 create mode 100644 drivers/crypto/qat/rte_pmd_qat_version.map
 create mode 100644 drivers/crypto/qat/rte_qat_cryptodev.c
 create mode 100644 examples/l2fwd-crypto/Makefile
 create mode 100644 examples/l2fwd-crypto/main.c
 create mode 100644 lib/librte_cryptodev/Makefile
 create mode 100644 lib/librte_cryptodev/rte_crypto.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.c
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_pmd.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_version.map
 create mode 100644 lib/librte_mbuf_offload/Makefile
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map
Signature · 1 line
2.5.0
#104 lore raw

PATCH v8 1/10 ethdev: rename macros to have RTE_ prefix

The macros to check that the function pointers and port ids are valid for an ethdev are potentially useful to have in a common headers for use with all PMDs. However, since they would then become externally visible, we apply the RTE_ & RTE_ETH_ prefix to them as approtiate.

---
 lib/librte_ether/rte_ethdev.c | 607 +++++++++++++++++++++---------------------
 1 file changed, 304 insertions(+), 303 deletions(-)
lib/librte_ether/rte_ethdev.c +304 -303
index b19ac9a..71775dc 100644
@@ -70,58 +70,59 @@
 #include "rte_ethdev.h"
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define PMD_DEBUG_TRACE(fmt, args...) do {                        \
+#define RTE_PMD_DEBUG_TRACE(fmt, args...) do { \
 		RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
 	} while (0)
 #else
-#define PMD_DEBUG_TRACE(fmt, args...)
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
 #endif
 
 /* Macros for checking for restricting functions to primary instance only */
-#define PROC_PRIMARY_OR_ERR_RET(retval) do { \
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define PROC_PRIMARY_OR_RET() do { \
+#define RTE_PROC_PRIMARY_OR_RET() do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for invalid function pointers in dev_ops structure */
-#define FUNC_PTR_OR_ERR_RET(func, retval) do { \
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return (retval); \
 	} \
 } while (0)
 
-#define FUNC_PTR_OR_RET(func) do { \
+#define RTE_FUNC_PTR_OR_RET(func) do { \
 	if ((func) == NULL) { \
-		PMD_DEBUG_TRACE("Function not supported\n"); \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
 		return; \
 	} \
 } while (0)
 
 /* Macros to check for valid port */
-#define VALID_PORTID_OR_ERR_RET(port_id, retval) do {		\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return retval;					\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) {  \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return retval; \
+	} \
 } while (0)
 
-#define VALID_PORTID_OR_RET(port_id) do {			\
-	if (!rte_eth_dev_is_valid_port(port_id)) {		\
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
-		return;						\
-	}							\
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return; \
+	} \
 } while (0)
 
+
 static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
 struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
 static struct rte_eth_dev_data *rte_eth_dev_data;
@@ -244,7 +245,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 
 	port_id = rte_eth_dev_find_free_port();
 	if (port_id == RTE_MAX_ETHPORTS) {
-		PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
+		RTE_PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
 		return NULL;
 	}
 
@@ -252,7 +253,7 @@ rte_eth_dev_allocate(const char *name, enum rte_eth_dev_type type)
 		rte_eth_dev_data_alloc();
 
 	if (rte_eth_dev_allocated(name) != NULL) {
-		PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
+		RTE_PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
 				name);
 		return NULL;
 	}
@@ -339,7 +340,7 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv,
 	if (diag == 0)
 		return 0;
 
-	PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
+	RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(vendor_id=0x%u device_id=0x%x) failed\n",
 			pci_drv->name,
 			(unsigned) pci_dev->id.vendor_id,
 			(unsigned) pci_dev->id.device_id);
@@ -447,10 +448,10 @@ rte_eth_dev_get_device_type(uint8_t port_id)
 static int
 rte_eth_dev_get_addr_by_port(uint8_t port_id, struct rte_pci_addr *addr)
 {
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -463,10 +464,10 @@ rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 {
 	char *tmp;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -483,7 +484,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 	int i;
 
 	if (name == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -509,7 +510,7 @@ rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id)
 	struct rte_pci_device *pci_dev = NULL;
 
 	if (addr == NULL) {
-		PMD_DEBUG_TRACE("Null pointer is specified\n");
+		RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
 		return -EINVAL;
 	}
 
@@ -536,7 +537,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)
 	uint32_t dev_flags;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
@@ -735,7 +736,7 @@ rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, -ENOTSUP);
 
 		rxq = dev->data->rx_queues;
 
@@ -766,20 +767,20 @@ rte_eth_dev_rx_queue_start(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_start, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -796,20 +797,20 @@ rte_eth_dev_rx_queue_stop(uint8_t port_id, uint16_t rx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_stop, -ENOTSUP);
 
 	if (dev->data->rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			rx_queue_id, port_id);
 		return 0;
@@ -826,20 +827,20 @@ rte_eth_dev_tx_queue_start(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_start, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] != RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already started\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -856,20 +857,20 @@ rte_eth_dev_tx_queue_stop(uint8_t port_id, uint16_t tx_queue_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_stop, -ENOTSUP);
 
 	if (dev->data->tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STOPPED) {
-		PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Queue %" PRIu16" of device with port_id=%" PRIu8
 			" already stopped\n",
 			tx_queue_id, port_id);
 		return 0;
@@ -895,7 +896,7 @@ rte_eth_dev_tx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 			return -(ENOMEM);
 		}
 	} else { /* re-configure */
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_release, -ENOTSUP);
 
 		txq = dev->data->tx_queues;
 
@@ -929,19 +930,19 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	if (nb_rx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of RX queues requested (%u) is greater than max supported(%d)\n",
 			nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 			"Number of TX queues requested (%u) is greater than max supported(%d)\n",
 			nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
 		return -EINVAL;
@@ -949,11 +950,11 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
@@ -965,22 +966,22 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
 	if (nb_rx_q > dev_info.max_rx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_queues=%d > %d\n",
 				port_id, nb_rx_q, dev_info.max_rx_queues);
 		return -EINVAL;
 	}
 	if (nb_rx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_rx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
 	if (nb_tx_q > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_queues=%d > %d\n",
 				port_id, nb_tx_q, dev_info.max_tx_queues);
 		return -EINVAL;
 	}
 	if (nb_tx_q == 0) {
-		PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
+		RTE_PMD_DEBUG_TRACE("ethdev port_id=%d nb_tx_q == 0\n", port_id);
 		return -EINVAL;
 	}
 
@@ -993,7 +994,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	if ((dev_conf->intr_conf.lsc == 1) &&
 		(!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC))) {
-			PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+			RTE_PMD_DEBUG_TRACE("driver %s does not support lsc\n",
 					dev->data->drv_name);
 			return -EINVAL;
 	}
@@ -1005,14 +1006,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	if (dev_conf->rxmode.jumbo_frame == 1) {
 		if (dev_conf->rxmode.max_rx_pkt_len >
 		    dev_info.max_rx_pktlen) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" > max valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
 				(unsigned)dev_info.max_rx_pktlen);
 			return -EINVAL;
 		} else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) {
-			PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
+			RTE_PMD_DEBUG_TRACE("ethdev port_id=%d max_rx_pkt_len %u"
 				" < min valid value %u\n",
 				port_id,
 				(unsigned)dev_conf->rxmode.max_rx_pkt_len,
@@ -1032,14 +1033,14 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	 */
 	diag = rte_eth_dev_rx_queue_config(dev, nb_rx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_rx_queue_config = %d\n",
 				port_id, diag);
 		return diag;
 	}
 
 	diag = rte_eth_dev_tx_queue_config(dev, nb_tx_q);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d rte_eth_dev_tx_queue_config = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		return diag;
@@ -1047,7 +1048,7 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 
 	diag = (*dev->dev_ops->dev_configure)(dev);
 	if (diag != 0) {
-		PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
+		RTE_PMD_DEBUG_TRACE("port%d dev_configure = %d\n",
 				port_id, diag);
 		rte_eth_dev_rx_queue_config(dev, 0);
 		rte_eth_dev_tx_queue_config(dev, 0);
@@ -1086,7 +1087,7 @@ rte_eth_dev_config_restore(uint8_t port_id)
 			(dev->data->mac_pool_sel[i] & (1ULL << pool)))
 			(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
 		else {
-			PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array not supported\n",
 					port_id);
 			/* exit the loop but not return an error */
 			break;
@@ -1114,16 +1115,16 @@ rte_eth_dev_start(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP);
 
 	if (dev->data->dev_started != 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already started\n",
 			port_id);
 		return 0;
@@ -1138,7 +1139,7 @@ rte_eth_dev_start(uint8_t port_id)
 	rte_eth_dev_config_restore(port_id);
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
-		FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
+		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
 		(*dev->dev_ops->link_update)(dev, 0);
 	}
 	return 0;
@@ -1151,15 +1152,15 @@ rte_eth_dev_stop(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_stop);
 
 	if (dev->data->dev_started == 0) {
-		PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
+		RTE_PMD_DEBUG_TRACE("Device with port_id=%" PRIu8
 			" already stopped\n",
 			port_id);
 		return;
@@ -1176,13 +1177,13 @@ rte_eth_dev_set_link_up(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_up, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_up)(dev);
 }
 
@@ -1193,13 +1194,13 @@ rte_eth_dev_set_link_down(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_set_link_down, -ENOTSUP);
 	return (*dev->dev_ops->dev_set_link_down)(dev);
 }
 
@@ -1210,12 +1211,12 @@ rte_eth_dev_close(uint8_t port_id)
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_RET();
+	RTE_PROC_PRIMARY_OR_RET();
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close);
 	dev->data->dev_started = 0;
 	(*dev->dev_ops->dev_close)(dev);
 
@@ -1238,24 +1239,24 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
 
 	/*
 	 * Check the size of the mbuf data buffer.
@@ -1264,7 +1265,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	 */
 	rte_eth_dev_info_get(port_id, &dev_info);
 	if (mp->private_data_size < sizeof(struct rte_pktmbuf_pool_private)) {
-		PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
+		RTE_PMD_DEBUG_TRACE("%s private_data_size %d < %d\n",
 				mp->name, (int) mp->private_data_size,
 				(int) sizeof(struct rte_pktmbuf_pool_private));
 		return -ENOSPC;
@@ -1272,7 +1273,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 	mbp_buf_size = rte_pktmbuf_data_room_size(mp);
 
 	if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
-		PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
+		RTE_PMD_DEBUG_TRACE("%s mbuf_data_room_size %d < %d "
 				"(RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)"
 				"=%d)\n",
 				mp->name,
@@ -1288,7 +1289,7 @@ rte_eth_rx_queue_setup(uint8_t port_id, uint16_t rx_queue_id,
 			nb_rx_desc < dev_info.rx_desc_lim.nb_min ||
 			nb_rx_desc % dev_info.rx_desc_lim.nb_align != 0) {
 
-		PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
+		RTE_PMD_DEBUG_TRACE("Invalid value for nb_rx_desc(=%hu), "
 			"should be: <= %hu, = %hu, and a product of %hu\n",
 			nb_rx_desc,
 			dev_info.rx_desc_lim.nb_max,
@@ -1321,24 +1322,24 @@ rte_eth_tx_queue_setup(uint8_t port_id, uint16_t tx_queue_id,
 
 	/* This function is only safe when called from the primary process
 	 * in a multi-process setup*/
-	PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
+	RTE_PROC_PRIMARY_OR_ERR_RET(-E_RTE_SECONDARY);
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	if (tx_queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
 		return -EINVAL;
 	}
 
 	if (dev->data->dev_started) {
-		PMD_DEBUG_TRACE(
+		RTE_PMD_DEBUG_TRACE(
 		    "port %d must be stopped to allow configuration\n", port_id);
 		return -EBUSY;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
 
 	rte_eth_dev_info_get(port_id, &dev_info);
 
@@ -1354,10 +1355,10 @@ rte_eth_promiscuous_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
 }
@@ -1367,10 +1368,10 @@ rte_eth_promiscuous_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
 }
@@ -1380,7 +1381,7 @@ rte_eth_promiscuous_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->promiscuous;
@@ -1391,10 +1392,10 @@ rte_eth_allmulticast_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable);
 	(*dev->dev_ops->allmulticast_enable)(dev);
 	dev->data->all_multicast = 1;
 }
@@ -1404,10 +1405,10 @@ rte_eth_allmulticast_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable);
 	dev->data->all_multicast = 0;
 	(*dev->dev_ops->allmulticast_disable)(dev);
 }
@@ -1417,7 +1418,7 @@ rte_eth_allmulticast_get(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	return dev->data->all_multicast;
@@ -1442,13 +1443,13 @@ rte_eth_link_get(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 1);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1459,13 +1460,13 @@ rte_eth_link_get_nowait(uint8_t port_id, struct rte_eth_link *eth_link)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.intr_conf.lsc != 0)
 		rte_eth_dev_atomic_read_link_status(dev, eth_link);
 	else {
-		FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
+		RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
 		(*dev->dev_ops->link_update)(dev, 0);
 		*eth_link = dev->data->dev_link;
 	}
@@ -1476,12 +1477,12 @@ rte_eth_stats_get(uint8_t port_id, struct rte_eth_stats *stats)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	memset(stats, 0, sizeof(*stats));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
 	(*dev->dev_ops->stats_get)(dev, stats);
 	stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
 	return 0;
@@ -1492,10 +1493,10 @@ rte_eth_stats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->stats_reset);
 	(*dev->dev_ops->stats_reset)(dev);
 }
 
@@ -1510,7 +1511,7 @@ rte_eth_xstats_get(uint8_t port_id, struct rte_eth_xstats *xstats,
 	signed xcount = 0;
 	uint64_t val, *stats_ptr;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 
@@ -1584,7 +1585,7 @@ rte_eth_xstats_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	/* implemented by the driver */
@@ -1603,11 +1604,11 @@ set_queue_stats_mapping(uint8_t port_id, uint16_t queue_id, uint8_t stat_idx,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
 	return (*dev->dev_ops->queue_stats_mapping_set)
 			(dev, queue_id, stat_idx, is_rx);
 }
@@ -1641,14 +1642,14 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info)
 		.nb_align = 1,
 	};
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 
 	memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
 	dev_info->rx_desc_lim = lim;
 	dev_info->tx_desc_lim = lim;
 
-	FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
+	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
 	(*dev->dev_ops->dev_infos_get)(dev, dev_info);
 	dev_info->pci_dev = dev->pci_dev;
 	dev_info->driver_name = dev->data->drv_name;
@@ -1659,7 +1660,7 @@ rte_eth_macaddr_get(uint8_t port_id, struct ether_addr *mac_addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_RET(port_id);
 	dev = &rte_eth_devices[port_id];
 	ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
 }
@@ -1670,7 +1671,7 @@ rte_eth_dev_get_mtu(uint8_t port_id, uint16_t *mtu)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	*mtu = dev->data->mtu;
@@ -1683,9 +1684,9 @@ rte_eth_dev_set_mtu(uint8_t port_id, uint16_t mtu)
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mtu_set, -ENOTSUP);
 
 	ret = (*dev->dev_ops->mtu_set)(dev, mtu);
 	if (!ret)
@@ -1699,19 +1700,19 @@ rte_eth_dev_vlan_filter(uint8_t port_id, uint16_t vlan_id, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (!(dev->data->dev_conf.rxmode.hw_vlan_filter)) {
-		PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: vlan-filtering disabled\n", port_id);
 		return -ENOSYS;
 	}
 
 	if (vlan_id > 4095) {
-		PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
+		RTE_PMD_DEBUG_TRACE("(port_id=%d) invalid vlan_id=%u > 4095\n",
 				port_id, (unsigned) vlan_id);
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_filter_set, -ENOTSUP);
 
 	return (*dev->dev_ops->vlan_filter_set)(dev, vlan_id, on);
 }
@@ -1721,14 +1722,14 @@ rte_eth_dev_set_vlan_strip_on_queue(uint8_t port_id, uint16_t rx_queue_id, int o
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 	if (rx_queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid rx_queue_id=%d\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_strip_queue_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_strip_queue_set)(dev, rx_queue_id, on);
 
 	return 0;
@@ -1739,9 +1740,9 @@ rte_eth_dev_set_vlan_ether_type(uint8_t port_id, uint16_t tpid)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_tpid_set)(dev, tpid);
 
 	return 0;
@@ -1755,7 +1756,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	int mask = 0;
 	int cur, org = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	/*check which option changed by application*/
@@ -1784,7 +1785,7 @@ rte_eth_dev_set_vlan_offload(uint8_t port_id, int offload_mask)
 	if (mask == 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_offload_set)(dev, mask);
 
 	return ret;
@@ -1796,7 +1797,7 @@ rte_eth_dev_get_vlan_offload(uint8_t port_id)
 	struct rte_eth_dev *dev;
 	int ret = 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (dev->data->dev_conf.rxmode.hw_vlan_strip)
@@ -1816,9 +1817,9 @@ rte_eth_dev_set_vlan_pvid(uint8_t port_id, uint16_t pvid, int on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
 	(*dev->dev_ops->vlan_pvid_set)(dev, pvid, on);
 
 	return 0;
@@ -1829,9 +1830,9 @@ rte_eth_dev_flow_ctrl_get(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
 	memset(fc_conf, 0, sizeof(*fc_conf));
 	return (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf);
 }
@@ -1841,14 +1842,14 @@ rte_eth_dev_flow_ctrl_set(uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) {
-		PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid send_xon, only 0/1 allowed\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
 	return (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf);
 }
 
@@ -1857,9 +1858,9 @@ rte_eth_dev_priority_flow_ctrl_set(uint8_t port_id, struct rte_eth_pfc_conf *pfc
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) {
-		PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
+		RTE_PMD_DEBUG_TRACE("Invalid priority, only 0-7 allowed\n");
 		return -EINVAL;
 	}
 
@@ -1880,7 +1881,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (reta_size != RTE_ALIGN(reta_size, RTE_RETA_GROUP_SIZE)) {
-		PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
+		RTE_PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
 							RTE_RETA_GROUP_SIZE);
 		return -EINVAL;
 	}
@@ -1905,7 +1906,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		return -EINVAL;
 
 	if (max_rxq == 0) {
-		PMD_DEBUG_TRACE("No receive queue is available\n");
+		RTE_PMD_DEBUG_TRACE("No receive queue is available\n");
 		return -EINVAL;
 	}
 
@@ -1914,7 +1915,7 @@ rte_eth_check_reta_entry(struct rte_eth_rss_reta_entry64 *reta_conf,
 		shift = i % RTE_RETA_GROUP_SIZE;
 		if ((reta_conf[idx].mask & (1ULL << shift)) &&
 			(reta_conf[idx].reta[shift] >= max_rxq)) {
-			PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
+			RTE_PMD_DEBUG_TRACE("reta_conf[%u]->reta[%u]: %u exceeds "
 				"the maximum rxq index: %u\n", idx, shift,
 				reta_conf[idx].reta[shift], max_rxq);
 			return -EINVAL;
@@ -1932,7 +1933,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	struct rte_eth_dev *dev;
 	int ret;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	/* Check mask bits */
 	ret = rte_eth_check_reta_mask(reta_conf, reta_size);
 	if (ret < 0)
@@ -1946,7 +1947,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id,
 	if (ret < 0)
 		return ret;
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
 	return (*dev->dev_ops->reta_update)(dev, reta_conf, reta_size);
 }
 
@@ -1959,7 +1960,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 	int ret;
 
 	if (port_id >= nb_ports) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
@@ -1969,7 +1970,7 @@ rte_eth_dev_rss_reta_query(uint8_t port_id,
 		return ret;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
 	return (*dev->dev_ops->reta_query)(dev, reta_conf, reta_size);
 }
 
@@ -1979,16 +1980,16 @@ rte_eth_dev_rss_hash_update(uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
 	struct rte_eth_dev *dev;
 	uint16_t rss_hash_protos;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	rss_hash_protos = rss_conf->rss_hf;
 	if ((rss_hash_protos != 0) &&
 	    ((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
-		PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
+		RTE_PMD_DEBUG_TRACE("Invalid rss_hash_protos=0x%x\n",
 				rss_hash_protos);
 		return -EINVAL;
 	}
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_update)(dev, rss_conf);
 }
 
@@ -1998,9 +1999,9 @@ rte_eth_dev_rss_hash_conf_get(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
 	return (*dev->dev_ops->rss_hash_conf_get)(dev, rss_conf);
 }
 
@@ -2010,19 +2011,19 @@ rte_eth_dev_udp_tunnel_add(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_add, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_add)(dev, udp_tunnel);
 }
 
@@ -2032,20 +2033,20 @@ rte_eth_dev_udp_tunnel_delete(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	if (udp_tunnel == NULL) {
-		PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
+		RTE_PMD_DEBUG_TRACE("Invalid udp_tunnel parameter\n");
 		return -EINVAL;
 	}
 
 	if (udp_tunnel->prot_type >= RTE_TUNNEL_TYPE_MAX) {
-		PMD_DEBUG_TRACE("Invalid tunnel type\n");
+		RTE_PMD_DEBUG_TRACE("Invalid tunnel type\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_del, -ENOTSUP);
 	return (*dev->dev_ops->udp_tunnel_del)(dev, udp_tunnel);
 }
 
@@ -2054,9 +2055,9 @@ rte_eth_led_on(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_on, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_on)(dev);
 }
 
@@ -2065,9 +2066,9 @@ rte_eth_led_off(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_led_off, -ENOTSUP);
 	return (*dev->dev_ops->dev_led_off)(dev);
 }
 
@@ -2101,17 +2102,17 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	int index;
 	uint64_t pool_mask;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
 
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
 	if (pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
+		RTE_PMD_DEBUG_TRACE("pool id must be 0-%d\n", ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
 
@@ -2119,7 +2120,7 @@ rte_eth_dev_mac_addr_add(uint8_t port_id, struct ether_addr *addr,
 	if (index < 0) {
 		index = get_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 				port_id);
 			return -ENOSPC;
 		}
@@ -2149,13 +2150,13 @@ rte_eth_dev_mac_addr_remove(uint8_t port_id, struct ether_addr *addr)
 	struct rte_eth_dev *dev;
 	int index;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
 
 	index = get_mac_addr_index(port_id, addr);
 	if (index == 0) {
-		PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot remove default MAC address\n", port_id);
 		return -EADDRINUSE;
 	} else if (index < 0)
 		return 0;  /* Do nothing if address wasn't found */
@@ -2177,13 +2178,13 @@ rte_eth_dev_default_mac_addr_set(uint8_t port_id, struct ether_addr *addr)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (!is_valid_assigned_ether_addr(addr))
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
 
 	/* Update default address in NIC data structure */
 	ether_addr_copy(addr, &dev->data->mac_addrs[0]);
@@ -2201,22 +2202,22 @@ rte_eth_dev_set_vf_rxmode(uint8_t port_id,  uint16_t vf,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:invalid VF id %d\n", vf);
 		return -EINVAL;
 	}
 
 	if (rx_mode == 0) {
-		PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
+		RTE_PMD_DEBUG_TRACE("set VF RX mode:mode mask ca not be zero\n");
 		return -EINVAL;
 	}
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx_mode, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on);
 }
 
@@ -2251,11 +2252,11 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 	int ret;
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	if (is_zero_ether_addr(addr)) {
-		PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
+		RTE_PMD_DEBUG_TRACE("port %d: Cannot add NULL MAC address\n",
 			port_id);
 		return -EINVAL;
 	}
@@ -2267,20 +2268,20 @@ rte_eth_dev_uc_hash_table_set(uint8_t port_id, struct ether_addr *addr,
 
 	if (index < 0) {
 		if (!on) {
-			PMD_DEBUG_TRACE("port %d: the MAC address was not "
+			RTE_PMD_DEBUG_TRACE("port %d: the MAC address was not "
 				"set in UTA\n", port_id);
 			return -EINVAL;
 		}
 
 		index = get_hash_mac_addr_index(port_id, &null_mac_addr);
 		if (index < 0) {
-			PMD_DEBUG_TRACE("port %d: MAC address array full\n",
+			RTE_PMD_DEBUG_TRACE("port %d: MAC address array full\n",
 					port_id);
 			return -ENOSPC;
 		}
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_hash_table_set, -ENOTSUP);
 	ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
 	if (ret == 0) {
 		/* Update address in NIC data structure */
@@ -2300,11 +2301,11 @@ rte_eth_dev_uc_all_hash_table_set(uint8_t port_id, uint8_t on)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->uc_all_hash_table_set, -ENOTSUP);
 	return (*dev->dev_ops->uc_all_hash_table_set)(dev, on);
 }
 
@@ -2315,18 +2316,18 @@ rte_eth_dev_set_vf_rx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
+		RTE_PMD_DEBUG_TRACE("port %d: invalid vf id\n", port_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rx)(dev, vf, on);
 }
 
@@ -2337,18 +2338,18 @@ rte_eth_dev_set_vf_tx(uint8_t port_id, uint16_t vf, uint8_t on)
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	num_vfs = dev_info.max_vfs;
 	if (vf > num_vfs) {
-		PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
+		RTE_PMD_DEBUG_TRACE("set pool tx:invalid pool id=%d\n", vf);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_tx, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_tx)(dev, vf, on);
 }
 
@@ -2358,22 +2359,22 @@ rte_eth_dev_set_vf_vlan_filter(uint8_t port_id, uint16_t vlan_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
 	if (vlan_id > ETHER_MAX_VLAN_ID) {
-		PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:invalid VLAN id=%d\n",
 			vlan_id);
 		return -EINVAL;
 	}
 
 	if (vf_mask == 0) {
-		PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
+		RTE_PMD_DEBUG_TRACE("VF VLAN filter:pool_mask can not be 0\n");
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_vlan_filter, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_vlan_filter)(dev, vlan_id,
 						   vf_mask, vlan_on);
 }
@@ -2385,26 +2386,26 @@ int rte_eth_set_queue_rate_limit(uint8_t port_id, uint16_t queue_idx,
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_link link;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (queue_idx > dev_info.max_tx_queues) {
-		PMD_DEBUG_TRACE("set queue rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:port %d: "
 				"invalid queue id=%d\n", port_id, queue_idx);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set queue rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 			tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_queue_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_queue_rate_limit)(dev, queue_idx, tx_rate);
 }
 
@@ -2418,26 +2419,26 @@ int rte_eth_set_vf_rate_limit(uint8_t port_id, uint16_t vf, uint16_t tx_rate,
 	if (q_msk == 0)
 		return 0;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 	rte_eth_dev_info_get(port_id, &dev_info);
 	link = dev->data->dev_link;
 
 	if (vf > dev_info.max_vfs) {
-		PMD_DEBUG_TRACE("set VF rate limit:port %d: "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:port %d: "
 				"invalid vf id=%d\n", port_id, vf);
 		return -EINVAL;
 	}
 
 	if (tx_rate > link.link_speed) {
-		PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
+		RTE_PMD_DEBUG_TRACE("set VF rate limit:invalid tx_rate=%d, "
 				"bigger than link speed= %d\n",
 				tx_rate, link.link_speed);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_vf_rate_limit, -ENOTSUP);
 	return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk);
 }
 
@@ -2448,14 +2449,14 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	if (mirror_conf->rule_type == 0) {
-		PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("mirror rule type can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if (mirror_conf->dst_pool >= ETH_64_POOLS) {
-		PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
+		RTE_PMD_DEBUG_TRACE("Invalid dst pool, pool id must be 0-%d\n",
 				ETH_64_POOLS - 1);
 		return -EINVAL;
 	}
@@ -2463,18 +2464,18 @@ rte_eth_mirror_rule_set(uint8_t port_id,
 	if ((mirror_conf->rule_type & (ETH_MIRROR_VIRTUAL_POOL_UP |
 	     ETH_MIRROR_VIRTUAL_POOL_DOWN)) &&
 	    (mirror_conf->pool_mask == 0)) {
-		PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid mirror pool, pool mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	if ((mirror_conf->rule_type & ETH_MIRROR_VLAN) &&
 	    mirror_conf->vlan.vlan_mask == 0) {
-		PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
+		RTE_PMD_DEBUG_TRACE("Invalid vlan mask, vlan mask can not be 0.\n");
 		return -EINVAL;
 	}
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_set)(dev, mirror_conf, rule_id, on);
 }
@@ -2484,10 +2485,10 @@ rte_eth_mirror_rule_reset(uint8_t port_id, uint8_t rule_id)
 {
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
 
 	return (*dev->dev_ops->mirror_rule_reset)(dev, rule_id);
 }
@@ -2499,12 +2500,12 @@ rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
@@ -2517,13 +2518,13 @@ rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return 0;
 	}
 	return (*dev->tx_pkt_burst)(dev->data->tx_queues[queue_id],
@@ -2535,10 +2536,10 @@ rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, 0);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
 	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
 }
 
@@ -2547,10 +2548,10 @@ rte_eth_rx_descriptor_done(uint8_t port_id, uint16_t queue_id, uint16_t offset)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_descriptor_done, -ENOTSUP);
 	return (*dev->dev_ops->rx_descriptor_done)(dev->data->rx_queues[queue_id],
 						   offset);
 }
@@ -2567,7 +2568,7 @@ rte_eth_dev_callback_register(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2607,7 +2608,7 @@ rte_eth_dev_callback_unregister(uint8_t port_id,
 	if (!cb_fn)
 		return -EINVAL;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
 
 	dev = &rte_eth_devices[port_id];
 	rte_spinlock_lock(&rte_eth_dev_cb_lock);
@@ -2670,14 +2671,14 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
@@ -2685,7 +2686,7 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
 		vec = intr_handle->intr_vec[qid];
 		rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 		if (rc && rc != -EEXIST) {
-			PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+			RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 					" op %d epfd %d vec %u\n",
 					port_id, qid, op, epfd, vec);
 		}
@@ -2728,26 +2729,26 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
 	int rc;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%u\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%u\n", queue_id);
 		return -EINVAL;
 	}
 
 	intr_handle = &dev->pci_dev->intr_handle;
 	if (!intr_handle->intr_vec) {
-		PMD_DEBUG_TRACE("RX Intr vector unset\n");
+		RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
 		return -EPERM;
 	}
 
 	vec = intr_handle->intr_vec[queue_id];
 	rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
 	if (rc && rc != -EEXIST) {
-		PMD_DEBUG_TRACE("p %u q %u rx ctl error"
+		RTE_PMD_DEBUG_TRACE("p %u q %u rx ctl error"
 				" op %d epfd %d vec %u\n",
 				port_id, queue_id, op, epfd, vec);
 		return rc;
@@ -2763,13 +2764,13 @@ rte_eth_dev_rx_intr_enable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id);
 }
 
@@ -2780,13 +2781,13 @@ rte_eth_dev_rx_intr_disable(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
 	return (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id);
 }
 
@@ -2795,10 +2796,10 @@ int rte_eth_dev_bypass_init(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_init, -ENOTSUP);
 	(*dev->dev_ops->bypass_init)(dev);
 	return 0;
 }
@@ -2808,10 +2809,10 @@ rte_eth_dev_bypass_state_show(uint8_t port_id, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_show)(dev, state);
 	return 0;
 }
@@ -2821,10 +2822,10 @@ rte_eth_dev_bypass_state_set(uint8_t port_id, uint32_t *new_state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_state_set)(dev, new_state);
 	return 0;
 }
@@ -2834,10 +2835,10 @@ rte_eth_dev_bypass_event_show(uint8_t port_id, uint32_t event, uint32_t *state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_state_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_show)(dev, event, state);
 	return 0;
 }
@@ -2847,11 +2848,11 @@ rte_eth_dev_bypass_event_store(uint8_t port_id, uint32_t event, uint32_t state)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_event_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_event_set)(dev, event, state);
 	return 0;
 }
@@ -2861,11 +2862,11 @@ rte_eth_dev_wd_timeout_store(uint8_t port_id, uint32_t timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_set, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_set)(dev, timeout);
 	return 0;
 }
@@ -2875,11 +2876,11 @@ rte_eth_dev_bypass_ver_show(uint8_t port_id, uint32_t *ver)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_ver_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_ver_show)(dev, ver);
 	return 0;
 }
@@ -2889,11 +2890,11 @@ rte_eth_dev_bypass_wd_timeout_show(uint8_t port_id, uint32_t *wd_timeout)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_timeout_show, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_timeout_show)(dev, wd_timeout);
 	return 0;
 }
@@ -2903,11 +2904,11 @@ rte_eth_dev_bypass_wd_reset(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->bypass_wd_reset, -ENOTSUP);
 	(*dev->dev_ops->bypass_wd_reset)(dev);
 	return 0;
 }
@@ -2918,10 +2919,10 @@ rte_eth_dev_filter_supported(uint8_t port_id, enum rte_filter_type filter_type)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type,
 				RTE_ETH_FILTER_NOP, NULL);
 }
@@ -2932,10 +2933,10 @@ rte_eth_dev_filter_ctrl(uint8_t port_id, enum rte_filter_type filter_type,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
 	return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
 }
 
@@ -3105,18 +3106,18 @@ rte_eth_rx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_rx_queues) {
-		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rxq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
@@ -3129,18 +3130,18 @@ rte_eth_tx_queue_info_get(uint8_t port_id, uint16_t queue_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	if (qinfo == NULL)
 		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	if (queue_id >= dev->data->nb_tx_queues) {
-		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
+		RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return -EINVAL;
 	}
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->txq_info_get, -ENOTSUP);
 
 	memset(qinfo, 0, sizeof(*qinfo));
 	dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
@@ -3154,10 +3155,10 @@ rte_eth_dev_set_mc_addr_list(uint8_t port_id,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_mc_addr_list, -ENOTSUP);
 	return dev->dev_ops->set_mc_addr_list(dev, mc_addr_set, nb_mc_addr);
 }
 
@@ -3166,10 +3167,10 @@ rte_eth_timesync_enable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_enable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_enable)(dev);
 }
 
@@ -3178,10 +3179,10 @@ rte_eth_timesync_disable(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_disable, -ENOTSUP);
 	return (*dev->dev_ops->timesync_disable)(dev);
 }
 
@@ -3191,10 +3192,10 @@ rte_eth_timesync_read_rx_timestamp(uint8_t port_id, struct timespec *timestamp,
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_rx_timestamp)(dev, timestamp, flags);
 }
 
@@ -3203,10 +3204,10 @@ rte_eth_timesync_read_tx_timestamp(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_tx_timestamp)(dev, timestamp);
 }
 
@@ -3215,10 +3216,10 @@ rte_eth_timesync_adjust_time(uint8_t port_id, int64_t delta)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_adjust_time)(dev, delta);
 }
 
@@ -3227,10 +3228,10 @@ rte_eth_timesync_read_time(uint8_t port_id, struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_read_time)(dev, timestamp);
 }
 
@@ -3239,10 +3240,10 @@ rte_eth_timesync_write_time(uint8_t port_id, const struct timespec *timestamp)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
 	return (*dev->dev_ops->timesync_write_time)(dev, timestamp);
 }
 
@@ -3251,10 +3252,10 @@ rte_eth_dev_get_reg_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg_length, -ENOTSUP);
 	return (*dev->dev_ops->get_reg_length)(dev);
 }
 
@@ -3263,10 +3264,10 @@ rte_eth_dev_get_reg_info(uint8_t port_id, struct rte_dev_reg_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
 	return (*dev->dev_ops->get_reg)(dev, info);
 }
 
@@ -3275,10 +3276,10 @@ rte_eth_dev_get_eeprom_length(uint8_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom_length, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom_length)(dev);
 }
 
@@ -3287,10 +3288,10 @@ rte_eth_dev_get_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->get_eeprom)(dev, info);
 }
 
@@ -3299,10 +3300,10 @@ rte_eth_dev_set_eeprom(uint8_t port_id, struct rte_dev_eeprom_info *info)
 {
 	struct rte_eth_dev *dev;
 
-	VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
 	return (*dev->dev_ops->set_eeprom)(dev, info);
 }
 
@@ -3313,14 +3314,14 @@ rte_eth_dev_get_dcb_info(uint8_t port_id,
 	struct rte_eth_dev *dev;
 
 	if (!rte_eth_dev_is_valid_port(port_id)) {
-		PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
 		return -ENODEV;
 	}
 
 	dev = &rte_eth_devices[port_id];
 	memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
 
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
 	return (*dev->dev_ops->get_dcb_info)(dev, dcb_info);
 }
 
@@ -3328,7 +3329,7 @@ void
 rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
 {
 	if ((eth_dev == NULL) || (pci_dev == NULL)) {
-		PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
+		RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p pci_dev=%p\n",
 				eth_dev, pci_dev);
 		return;
 	}
Signature · 1 line
2.5.0
#105 lore raw

PATCH v8 2/10 ethdev: make error checking macros public

In reply to Declan Doherty

Move the function pointer and port id checking macros to rte_ethdev and rte_dev header files, so that they can be used in the static inline functions there. Also replace the RTE_LOG call within RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag

---
 lib/librte_eal/common/include/rte_dev.h | 53 ++++++++++++++++++++++++++++++++
 lib/librte_ether/rte_ethdev.c           | 54 ---------------------------------
 lib/librte_ether/rte_ethdev.h           | 26 ++++++++++++++++
 3 files changed, 79 insertions(+), 54 deletions(-)
lib/librte_eal/common/include/rte_dev.h +53 -0
index f601d21..f1b5507 100644
@@ -46,8 +46,61 @@
 extern "C" {
 #endif
 
+#include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_log.h>
+
+__attribute__((format(printf, 2, 0)))
+static inline void
+rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+
+	char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
+
+	va_end(ap);
+
+	va_start(ap, fmt);
+	vsnprintf(buffer, sizeof(buffer), fmt, ap);
+	va_end(ap);
+
+	rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
+}
+
+/* Macros for checking for restricting functions to primary instance only */
+#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_PROC_PRIMARY_OR_RET() do { \
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
+		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
+		return; \
+	} \
+} while (0)
+
+/* Macros to check for invalid function pointers */
+#define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
+	if ((func) == NULL) { \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_FUNC_PTR_OR_RET(func) do { \
+	if ((func) == NULL) { \
+		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+		return; \
+	} \
+} while (0)
+
+
 /** Double linked list of device drivers. */
 TAILQ_HEAD(rte_driver_list, rte_driver);
 
lib/librte_ether/rte_ethdev.c +0 -54

60 lines not on this page · raw message

lib/librte_ether/rte_ethdev.h +26 -0
index e92bf8d..b51b8aa 100644
@@ -172,6 +172,8 @@ extern "C" {
 
 #include <stdint.h>
 
+#include <rte_dev.h>
+
 /* Use this macro to check if LRO API is supported */
 #define RTE_ETHDEV_HAS_LRO_SUPPORT
 
@@ -931,6 +933,30 @@ struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 
+
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+#define RTE_PMD_DEBUG_TRACE(...) \
+	rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(fmt, args...)
+#endif
+
+
+/* Macros to check for valid port */
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return retval; \
+	} \
+} while (0)
+
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+	if (!rte_eth_dev_is_valid_port(port_id)) { \
+		RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+		return; \
+	} \
+} while (0)
+
 /*
  * Definitions of all functions exported by an Ethernet driver through the
  * the generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev*
Signature · 1 line
2.5.0
#106 lore raw

PATCH v8 3/10 eal: add __rte_packed /__rte_aligned macros

In reply to Declan Doherty

Adding a new macro for specifying __aligned__ attribute, and updating the current __rte_cache_aligned macro to use it.

Also adding a new macro to specify the __packed__ attribute

---
 lib/librte_eal/common/include/rte_memory.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
lib/librte_eal/common/include/rte_memory.h +12 -2
index 067be10..20feed9 100644
@@ -78,9 +78,19 @@ enum rte_page_sizes {
 /**< Return the first cache-aligned value greater or equal to size. */
 
 /**
+ * Force alignment
+ */
+#define __rte_aligned(a) __attribute__((__aligned__(a)))
+
+/**
  * Force alignment to cache line.
  */
-#define __rte_cache_aligned __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)))
+#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
+
+/**
+ * Force a structure to be packed
+ */
+#define __rte_packed __attribute__((__packed__))
 
 typedef uint64_t phys_addr_t; /**< Physical address definition. */
 #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1)
@@ -106,7 +116,7 @@ struct rte_memseg {
 	 /**< store segment MFNs */
 	uint64_t mfn[DOM0_NUM_MEMBLOCK];
 #endif
-} __attribute__((__packed__));
+} __rte_packed;
 
 /**
  * Lock page in physical memory and prevent from swapping.
Signature · 1 line
2.5.0
#107 lore raw

PATCH v8 4/10 mbuf: add new marcos to get the physical address of data

In reply to Declan Doherty
---
 lib/librte_mbuf/rte_mbuf.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
lib/librte_mbuf/rte_mbuf.h +21 -0
index 4a93189..6a1c133 100644
@@ -1622,6 +1622,27 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)
 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
 
 /**
+ * A macro that returns the physical address that points to an offset of the
+ * start of the data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ * @param o
+ *   The offset into the data to calculate address from.
+ */
+#define rte_pktmbuf_mtophys_offset(m, o) \
+	(phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
+
+/**
+ * A macro that returns the physical address that points to the start of the
+ * data in the mbuf
+ *
+ * @param m
+ *   The packet mbuf.
+ */
+#define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
+
+/**
  * A macro that returns the length of the packet.
  *
  * The value can be read or assigned.
Signature · 1 line
2.5.0
#108 lore raw

PATCH v8 5/10 cryptodev: Initial DPDK Crypto APIs and device framework release

In reply to Declan Doherty

This patch contains the initial proposed APIs and device framework for integrating crypto packet processing into DPDK.

features include:
- Crypto device configuration / management APIs
- Definitions of supported cipher algorithms and operations.
- Definitions of supported hash/authentication algorithms and operations.
- Crypto session management APIs
- Crypto operation data structures and APIs allocation of crypto operation structure used to specify the crypto operations to be performed on a particular mbuf.
- Extension of mbuf to contain crypto operation data pointer and extra flags.
- Burst enqueue / dequeue APIs for processing of crypto operations.

changes from RFC:
- Session management API changes to support specification of crypto transform(xform) chains using linked list of xforms.
- Changes to the crypto operation struct as a result of session management changes.
- Some movement of common MACROS shared by cryptodevs and ethdevs to common headers

---
 MAINTAINERS                                    |    4 +
 config/common_bsdapp                           |   10 +-
 config/common_linuxapp                         |   10 +-
 doc/api/doxy-api-index.md                      |    1 +
 doc/api/doxy-api.conf                          |    1 +
 lib/Makefile                                   |    1 +
 lib/librte_cryptodev/Makefile                  |   60 ++
 lib/librte_cryptodev/rte_crypto.h              |  610 +++++++++++++
 lib/librte_cryptodev/rte_cryptodev.c           | 1092 ++++++++++++++++++++++++
 lib/librte_cryptodev/rte_cryptodev.h           |  651 ++++++++++++++
 lib/librte_cryptodev/rte_cryptodev_pmd.h       |  549 ++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |   32 +
 lib/librte_eal/common/include/rte_log.h        |    1 +
 mk/rte.app.mk                                  |    1 +
 14 files changed, 3021 insertions(+), 2 deletions(-)
 create mode 100644 lib/librte_cryptodev/Makefile
 create mode 100644 lib/librte_cryptodev/rte_crypto.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.c
 create mode 100644 lib/librte_cryptodev/rte_cryptodev.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_pmd.h
 create mode 100644 lib/librte_cryptodev/rte_cryptodev_version.map
MAINTAINERS +4 -0
index d6feada..9138bbb 100644
@@ -196,6 +196,10 @@ M: Thomas Monjalon <[email protected]>
 F: lib/librte_ether/
 F: scripts/test-null.sh
 
+Crypto API
+M: Declan Doherty <[email protected]>
+F: lib/librte_cryptodev
+F: docs/guides/cryptodevs
 
 Drivers
 -------
config/common_bsdapp +9 -1
index 7df0763..3bfb3f6 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -150,6 +150,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 
 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
config/common_linuxapp +9 -1
index 52173d5..cd7a2d4 100644
@@ -1,6 +1,6 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -148,6 +148,14 @@ CONFIG_RTE_ETHDEV_QUEUE_STAT_CNTRS=16
 CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 
 #
+# Compile generic Crypto device library
+#
+CONFIG_RTE_LIBRTE_CRYPTODEV=y
+CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n
+CONFIG_RTE_CRYPTO_MAX_DEVS=64
+CONFIG_RTE_CRYPTODEV_NAME_LEN=64
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
doc/api/doxy-api-index.md +1 -0
index 72ac3c4..bdb6130 100644
@@ -39,6 +39,7 @@ There are many libraries, so their headers may be grouped by topics:
   [dev]                (@ref rte_dev.h),
   [ethdev]             (@ref rte_ethdev.h),
   [ethctrl]            (@ref rte_eth_ctrl.h),
+  [cryptodev]          (@ref rte_cryptodev.h),
   [devargs]            (@ref rte_devargs.h),
   [bond]               (@ref rte_eth_bond.h),
   [vhost]              (@ref rte_virtio_net.h),
doc/api/doxy-api.conf +1 -0
index cfb4627..7244b8f 100644
@@ -37,6 +37,7 @@ INPUT                   = doc/api/doxy-api-index.md \
                           lib/librte_cfgfile \
                           lib/librte_cmdline \
                           lib/librte_compat \
+                          lib/librte_cryptodev \
                           lib/librte_distributor \
                           lib/librte_ether \
                           lib/librte_hash \
lib/Makefile +1 -0
index 9727b83..4c5c1b4 100644
@@ -40,6 +40,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
 DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
+DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
lib/librte_cryptodev/Makefile new file +60 -0

61 lines not on this page · raw message

lib/librte_cryptodev/rte_crypto.h new file +610 -0

610 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev.c new file +1092 -0

1,092 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev.h new file +651 -0

651 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.h new file +549 -0

513 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map new file +32 -0
new file mode 100644
index 0000000..ff8e93d

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/include/rte_log.h +1 -0
index ede0dca..2e47e7f 100644

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +1 -0
index 724efa7..5d382bb 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#109 lore raw

PATCH v8 6/10 mbuf_offload: library to support attaching offloads to a mbuf

In reply to Declan Doherty

This library add support for adding a chain of offload operations to a mbuf. It contains the definition of the rte_mbuf_offload structure as well as helper functions for attaching offloads to mbufs and a mempool management functions.

This initial implementation supports attaching multiple offload operations to a single mbuf, but only a single offload operation of a specific type can be attach to that mbuf.

---
 MAINTAINERS                                        |   4 +
 config/common_bsdapp                               |   6 +
 config/common_linuxapp                             |   6 +
 doc/api/doxy-api-index.md                          |   1 +
 doc/api/doxy-api.conf                              |   1 +
 lib/Makefile                                       |   1 +
 lib/librte_mbuf/rte_mbuf.h                         |   6 +
 lib/librte_mbuf_offload/Makefile                   |  52 ++++
 lib/librte_mbuf_offload/rte_mbuf_offload.c         | 100 +++++++
 lib/librte_mbuf_offload/rte_mbuf_offload.h         | 302 +++++++++++++++++++++
 .../rte_mbuf_offload_version.map                   |   7 +
 mk/rte.app.mk                                      |   1 +
 12 files changed, 487 insertions(+)
 create mode 100644 lib/librte_mbuf_offload/Makefile
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h
 create mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map
MAINTAINERS +4 -0
index 9138bbb..dd8be0f 100644
@@ -191,6 +191,10 @@ F: lib/librte_mbuf/
 F: doc/guides/prog_guide/mbuf_lib.rst
 F: app/test/test_mbuf.c
 
+Packet buffer offload
+M: Declan Doherty <[email protected]>
+F: lib/librte_mbuf_offload/
+
 Ethernet API
 M: Thomas Monjalon <[email protected]>
 F: lib/librte_ether/
config/common_bsdapp +6 -0
index 3bfb3f6..e536fdf 100644
@@ -335,6 +335,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
config/common_linuxapp +6 -0
index cd7a2d4..1947ce3 100644
@@ -343,6 +343,12 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y
 CONFIG_RTE_PKTMBUF_HEADROOM=128
 
 #
+# Compile librte_mbuf_offload
+#
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y
+CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n
+
+#
 # Compile librte_timer
 #
 CONFIG_RTE_LIBRTE_TIMER=y
doc/api/doxy-api-index.md +1 -0
index bdb6130..199cc2c 100644
@@ -104,6 +104,7 @@ There are many libraries, so their headers may be grouped by topics:
 
 - **containers**:
   [mbuf]               (@ref rte_mbuf.h),
+  [mbuf_offload]       (@ref rte_mbuf_offload.h),
   [ring]               (@ref rte_ring.h),
   [distributor]        (@ref rte_distributor.h),
   [reorder]            (@ref rte_reorder.h),
doc/api/doxy-api.conf +1 -0
index 7244b8f..15bba16 100644
@@ -48,6 +48,7 @@ INPUT                   = doc/api/doxy-api-index.md \
                           lib/librte_kvargs \
                           lib/librte_lpm \
                           lib/librte_mbuf \
+                          lib/librte_mbuf_offload \
                           lib/librte_mempool \
                           lib/librte_meter \
                           lib/librte_net \
lib/Makefile +1 -0
index 4c5c1b4..ef172ea 100644
@@ -36,6 +36,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
lib/librte_mbuf/rte_mbuf.h +6 -0
index 6a1c133..cb4583d 100644
@@ -728,6 +728,9 @@ typedef uint8_t  MARKER8[0];  /**< generic marker with 1B alignment */
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
                                * with a single assignment */
 
+/** Opaque rte_mbuf_offload  structure declarations */
+struct rte_mbuf_offload;
+
 /**
  * The generic rte_mbuf, containing a packet mbuf.
  */
@@ -841,6 +844,9 @@ struct rte_mbuf {
 
 	/** Timesync flags for use with IEEE1588. */
 	uint16_t timesync;
+
+	/* Chain of off-load operations to perform on mbuf */
+	struct rte_mbuf_offload *offload_ops;
 } __rte_cache_aligned;
 
 static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);
lib/librte_mbuf_offload/Makefile new file +52 -0

52 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload.c new file +100 -0

100 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload.h new file +302 -0

302 lines not on this page · raw message

lib/librte_mbuf_offload/rte_mbuf_offload_version.map new file +7 -0
new file mode 100644
index 0000000..3d3b06a
@@ -0,0 +1,7 @@
+DPDK_2.2 {
+	global:
+
+	rte_pktmbuf_offload_pool_create;
+
+	local: *;
+};
mk/rte.app.mk +1 -0
index 5d382bb..2b8ddce 100644
@@ -116,6 +116,7 @@ ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)         += -lrte_kvargs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD)   += -lrte_mbuf_offload
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag
 _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)          += -lethdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV)      += -lrte_cryptodev
Signature · 1 line
2.5.0
#110 lore raw

PATCH v8 7/10 qat_crypto_pmd: Addition of a new QAT DPDK PMD.

In reply to Declan Doherty

This patch adds a PMD for the Intel Quick Assist Technology DH895xxC hardware accelerator.

This patch depends on a QAT PF driver for device initialization. See the file docs/guides/cryptodevs/qat.rst for configuration details

This patch supports a limited subset of QAT device functionality, currently supporting chaining of cipher and hash operations for the following algorithmsd:

Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES_CBC (with 128-bit, 192-bit and 256-bit keys supported)

Hash algorithms:
- RTE_CRYPTO_AUTH_SHA1_HMAC
- RTE_CRYPTO_AUTH_SHA256_HMAC
- RTE_CRYPTO_AUTH_SHA512_HMAC
- RTE_CRYPTO_AUTH_AES_XCBC_MAC

Some limitation on this patchset which shall be contributed in a subsequent release:
- Chained mbufs are not supported.
- Hash only is not supported.
- Cipher only is not supported.
- Only in-place is currently supported (destination address is the same as source address).
- Only supports session-oriented API implementation (session-less APIs are not supported).

---
 config/common_bsdapp                               |  14 +
 config/common_linuxapp                             |  14 +
 doc/guides/cryptodevs/index.rst                    |  38 ++
 doc/guides/cryptodevs/qat.rst                      | 219 ++++++++
 doc/guides/index.rst                               |   1 +
 drivers/Makefile                                   |   1 +
 drivers/crypto/Makefile                            |  37 ++
 drivers/crypto/qat/Makefile                        |  63 +++
 .../qat/qat_adf/adf_transport_access_macros.h      | 174 ++++++
 drivers/crypto/qat/qat_adf/icp_qat_fw.h            | 316 +++++++++++
 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h         | 404 ++++++++++++++
 drivers/crypto/qat/qat_adf/icp_qat_hw.h            | 306 +++++++++++
 drivers/crypto/qat/qat_adf/qat_algs.h              | 125 +++++
 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c   | 601 +++++++++++++++++++++
 drivers/crypto/qat/qat_crypto.c                    | 561 +++++++++++++++++++
 drivers/crypto/qat/qat_crypto.h                    | 124 +++++
 drivers/crypto/qat/qat_logs.h                      |  78 +++
 drivers/crypto/qat/qat_qp.c                        | 429 +++++++++++++++
 drivers/crypto/qat/rte_pmd_qat_version.map         |   3 +
 drivers/crypto/qat/rte_qat_cryptodev.c             | 137 +++++
 mk/rte.app.mk                                      |   3 +
 21 files changed, 3648 insertions(+)
 create mode 100644 doc/guides/cryptodevs/index.rst
 create mode 100644 doc/guides/cryptodevs/qat.rst
 create mode 100644 drivers/crypto/Makefile
 create mode 100644 drivers/crypto/qat/Makefile
 create mode 100644 drivers/crypto/qat/qat_adf/adf_transport_access_macros.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_fw_la.h
 create mode 100644 drivers/crypto/qat/qat_adf/icp_qat_hw.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs.h
 create mode 100644 drivers/crypto/qat/qat_adf/qat_algs_build_desc.c
 create mode 100644 drivers/crypto/qat/qat_crypto.c
 create mode 100644 drivers/crypto/qat/qat_crypto.h
 create mode 100644 drivers/crypto/qat/qat_logs.h
 create mode 100644 drivers/crypto/qat/qat_qp.c
 create mode 100644 drivers/crypto/qat/rte_pmd_qat_version.map
 create mode 100644 drivers/crypto/qat/rte_qat_cryptodev.c
config/common_bsdapp +14 -0
index e536fdf..3302d3f 100644
@@ -158,6 +158,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64
 
 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_MAX_QAT_SESSIONS=200
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
config/common_linuxapp +14 -0
index 1947ce3..458b014 100644
@@ -156,6 +156,20 @@ CONFIG_RTE_CRYPTO_MAX_DEVS=64
 CONFIG_RTE_CRYPTODEV_NAME_LEN=64
 
 #
+# Compile PMD for QuickAssist based devices
+#
+CONFIG_RTE_LIBRTE_PMD_QAT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_INIT=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
+#
+# Number of sessions to create in the session memory pool
+# on a single QuickAssist device.
+#
+CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
+
+#
 # Support NIC bypass logic
 #
 CONFIG_RTE_NIC_BYPASS=n
doc/guides/cryptodevs/index.rst new file +38 -0
new file mode 100644
index 0000000..8ac928c
@@ -0,0 +1,38 @@
+..  BSD LICENSE
+    Copyright(c) 2015 Intel Corporation. All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+    * Neither the name of Intel Corporation nor the names of its
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Crypto Device Drivers
+=====================
+
+
+.. toctree::
+    :maxdepth: 2
+    :numbered:
+
+    qat
doc/guides/cryptodevs/qat.rst new file +219 -0

219 lines not on this page · raw message

doc/guides/index.rst +1 -0
index 439c7e3..c5d7a9f 100644
@@ -42,6 +42,7 @@ Contents:
    xen/index
    prog_guide/index
    nics/index
+   cryptodevs/index
    sample_app_ug/index
    testpmd_app_ug/index
    faq/index
drivers/Makefile +1 -0
index b60eb5e..6ec67f6 100644
@@ -32,5 +32,6 @@
 include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-y += net
+DIRS-y += crypto
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/crypto/Makefile new file +37 -0
new file mode 100644
index 0000000..f6aecea
@@ -0,0 +1,37 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of Intel Corporation nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
+
+include $(RTE_SDK)/mk/rte.sharelib.mk
+include $(RTE_SDK)/mk/rte.subdir.mk
\ No newline at end of file
drivers/crypto/qat/Makefile new file +63 -0

63 lines not on this page · raw message

drivers/crypto/qat/qat_adf/adf_transport_access_macros.h new file +174 -0

174 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_fw.h new file +316 -0

316 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_fw_la.h new file +404 -0

404 lines not on this page · raw message

drivers/crypto/qat/qat_adf/icp_qat_hw.h new file +306 -0

306 lines not on this page · raw message

drivers/crypto/qat/qat_adf/qat_algs.h new file +125 -0

125 lines not on this page · raw message

drivers/crypto/qat/qat_adf/qat_algs_build_desc.c new file +601 -0

601 lines not on this page · raw message

drivers/crypto/qat/qat_crypto.c new file +561 -0

561 lines not on this page · raw message

drivers/crypto/qat/qat_crypto.h new file +124 -0

102 lines not on this page · raw message

drivers/crypto/qat/qat_logs.h new file +78 -0

78 lines not on this page · raw message

drivers/crypto/qat/qat_qp.c new file +429 -0

429 lines not on this page · raw message

drivers/crypto/qat/rte_pmd_qat_version.map new file +3 -0
new file mode 100644
index 0000000..bbaf1c8

Lines of this file are not shown. View the raw message.

drivers/crypto/qat/rte_qat_cryptodev.c new file +137 -0

137 lines not on this page · raw message

mk/rte.app.mk +3 -0
index 2b8ddce..cfcb064 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#111 lore raw

PATCH v8 8/10 aesni_mb_pmd: Initial implementation of multi buffer based crypto device

In reply to Declan Doherty

This patch provides the initial implementation of the AES-NI multi-buffer based crypto poll mode driver using DPDK's new cryptodev framework.

This PMD is dependent on Intel's multibuffer library, see the whitepaper "Fast Multi-buffer IPsec Implementations on Intel® Architecture Processors", see ref 1 for details on the library's design and ref 2 to download the library itself. This initial implementation is limited to supporting the chained operations of "hash then cipher" or "cipher then hash" for the following cipher and hash algorithms:

Cipher algorithms:
- RTE_CRYPTO_CIPHER_AES_CBC (with 128-bit, 192-bit and 256-bit keys supported)

Authentication algorithms:
- RTE_CRYPTO_AUTH_SHA1_HMAC
- RTE_CRYPTO_AUTH_SHA256_HMAC
- RTE_CRYPTO_AUTH_SHA512_HMAC
- RTE_CRYPTO_AUTH_AES_XCBC_MAC

Important Note:
Due to the fact that the multi-buffer library is designed for accelerating IPsec crypto operation, the digest's generated for the HMAC functions are truncated to lengths specified by IPsec RFC's, ie RFC2404 for using HMAC-SHA-1 with IPsec specifies that the digest is truncate from 20 to 12 bytes.

Build instructions:
To build DPKD with the AESNI_MB_PMD the user is required to download (ref 2) and compile the multi-buffer library on there system before building DPDK. The environmental variable AESNI_MULTI_BUFFER_LIB_PATH must be exported with the path where you extracted and built the multi buffer library and finally set CONFIG_RTE_LIBRTE_PMD_AESNI_MB=y in config/common_linuxapp.

Current status: It's doesn't support crypto operation across chained mbufs, or cipher only or hash only operations.

ref 1:
https://www-ssl.intel.com/content/www/us/en/intelligent-systems/intel-technology/fast-multi-buffer-ipsec-implementations-ia-processors-p

ref 2: https://downloadcenter.intel.com/download/22972

---
 MAINTAINERS                                        |   3 +
 config/common_bsdapp                               |   7 +
 config/common_linuxapp                             |   7 +
 doc/guides/cryptodevs/aesni_mb.rst                 |  85 +++
 doc/guides/cryptodevs/index.rst                    |   1 +
 drivers/crypto/Makefile                            |   1 +
 drivers/crypto/aesni_mb/Makefile                   |  63 ++
 drivers/crypto/aesni_mb/aesni_mb_ops.h             | 210 +++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c         | 669 +++++++++++++++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c     | 298 +++++++++
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 229 +++++++
 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map  |   3 +
 mk/rte.app.mk                                      |   4 +
 13 files changed, 1580 insertions(+)
 create mode 100644 doc/guides/cryptodevs/aesni_mb.rst
 create mode 100644 drivers/crypto/aesni_mb/Makefile
 create mode 100644 drivers/crypto/aesni_mb/aesni_mb_ops.h
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
 create mode 100644 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h
 create mode 100644 drivers/crypto/aesni_mb/rte_pmd_aesni_version.map
MAINTAINERS +3 -0
index dd8be0f..a51a660 100644
@@ -305,6 +305,9 @@ Null PMD
 M: Tetsuya Mukawa <[email protected]>
 F: drivers/net/null/
 
+Crypto AES-NI Multi-Buffer PMD
+M: Declan Doherty <[email protected]>
+F: driver/crypto/aesni_mb
 
 Packet processing
 -----------------
config/common_bsdapp +7 -0
index 3302d3f..6f0becb 100644
@@ -171,6 +171,13 @@ CONFIG_RTE_LIBRTE_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_MAX_QAT_SESSIONS=200
 
+
+#
+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_AESNI_MB_DEBUG=n
+
 #
 # Support NIC bypass logic
 #
config/common_linuxapp +7 -0
index 458b014..ca6adc7 100644
@@ -169,6 +169,13 @@ CONFIG_RTE_LIBRTE_PMD_QAT_DEBUG_DRIVER=n
 #
 CONFIG_RTE_QAT_PMD_MAX_NB_SESSIONS=2048
 
+# Compile PMD for AESNI backed device
+#
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n
+CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_QUEUE_PAIRS=8
+CONFIG_RTE_AESNI_MB_PMD_MAX_NB_SESSIONS=2048
+
 #
 # Support NIC bypass logic
 #
doc/guides/cryptodevs/aesni_mb.rst new file +85 -0

85 lines not on this page · raw message

doc/guides/cryptodevs/index.rst +1 -0
index 8ac928c..16a5f4a 100644
@@ -35,4 +35,5 @@ Crypto Device Drivers
     :maxdepth: 2
     :numbered:
 
+    aesni_mb
     qat
drivers/crypto/Makefile +1 -0
index f6aecea..d07ee96 100644
@@ -31,6 +31,7 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
 
 include $(RTE_SDK)/mk/rte.sharelib.mk
drivers/crypto/aesni_mb/Makefile new file +63 -0

63 lines not on this page · raw message

drivers/crypto/aesni_mb/aesni_mb_ops.h new file +210 -0

210 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c new file +669 -0

669 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c new file +298 -0

298 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h new file +229 -0

229 lines not on this page · raw message

drivers/crypto/aesni_mb/rte_pmd_aesni_version.map new file +3 -0
new file mode 100644
index 0000000..ad607bb
@@ -0,0 +1,3 @@
+DPDK_2.2 {
+	local: *;
+};
mk/rte.app.mk +4 -0
index cfcb064..4a660e6 100644
@@ -153,6 +153,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)       += -lrte_pmd_null
 # QAT PMD has a dependency on libcrypto (from openssl) for calculating HMAC precomputes
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT)        += -lrte_pmd_qat -lcrypto
 
+# AESNI MULTI BUFFER is dependent on the IPSec_MB library
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -lrte_pmd_aesni_mb
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)   += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
+
 endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
Signature · 1 line
2.5.0
#112 lore raw

PATCH v8 9/10 app/test: add cryptodev unit and performance tests

In reply to Declan Doherty

unit tests are run by using cryptodev_qat_autotest or cryptodev_aesni_autotest from the test apps interactive console.

performance tests are run by using the cryptodev_qat_perftest or cryptodev_aesni_mb_perftest command from the test apps interactive console.

If you which to run the tests on a QAT device there must be one bound to igb_uio kernel driver.

---
 MAINTAINERS                          |    2 +
 app/test/Makefile                    |    4 +
 app/test/test.c                      |   92 +-
 app/test/test.h                      |   34 +-
 app/test/test_cryptodev.c            | 1986 ++++++++++++++++++++++++++++++++
 app/test/test_cryptodev.h            |   68 ++
 app/test/test_cryptodev_perf.c       | 2062 ++++++++++++++++++++++++++++++++++
 app/test/test_link_bonding.c         |    6 +-
 app/test/test_link_bonding_mode4.c   |    7 +-
 app/test/test_link_bonding_rssconf.c |    7 +-
 10 files changed, 4219 insertions(+), 49 deletions(-)
 create mode 100644 app/test/test_cryptodev.c
 create mode 100644 app/test/test_cryptodev.h
 create mode 100644 app/test/test_cryptodev_perf.c
MAINTAINERS +2 -0
index a51a660..74aa169 100644
@@ -204,6 +204,8 @@ Crypto API
 M: Declan Doherty <[email protected]>
 F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
+F: app/test/test_cryptodev.c
+F: app/test/test_cryptodev_perf.c
 
 Drivers
 -------
app/test/Makefile +4 -0
index de63235..ec33e1a 100644
@@ -149,6 +149,10 @@ endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
+
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
+
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
 
 CFLAGS += -O3
app/test/test.c +61 -31

112 lines not on this page · raw message

app/test/test.h +27 -7
index 62eb51d..a2fba60 100644
@@ -33,7 +33,7 @@
 
 #ifndef _TEST_H_
 #define _TEST_H_
-
+#include <stddef.h>
 #include <sys/queue.h>
 
 #define TEST_SUCCESS  (0)
@@ -64,6 +64,17 @@
 		}                                                        \
 } while (0)
 
+
+#define TEST_ASSERT_BUFFERS_ARE_EQUAL(a, b, len,  msg, ...) do {	\
+	if (memcmp(a, b, len)) {                                        \
+		printf("TestCase %s() line %d failed: "              \
+			msg "\n", __func__, __LINE__, ##__VA_ARGS__);    \
+		TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);    \
+		return TEST_FAILED;                                  \
+	}                                                        \
+} while (0)
+
+
 #define TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do {               \
 		if (!(a != b)) {                                         \
 			printf("TestCase %s() line %d failed: "              \
@@ -113,27 +124,36 @@
 
 struct unit_test_case {
 	int (*setup)(void);
-	int (*teardown)(void);
+	void (*teardown)(void);
 	int (*testcase)(void);
 	const char *success_msg;
 	const char *fail_msg;
+	unsigned enabled;
 };
 
-#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed"}
+#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed", 1 }
 
 #define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name " succeeded", \
-		name " failed"}
+		name " failed", 1 }
 
 #define TEST_CASE_ST(setup, teardown, testcase)         \
 		{ setup, teardown, testcase, #testcase " succeeded",    \
-		#testcase " failed "}
+		#testcase " failed ", 1 }
+
+
+#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn " succeeded", \
+	#fn " failed", 0 }
+
+#define TEST_CASE_ST_DISABLED(setup, teardown, testcase)         \
+		{ setup, teardown, testcase, #testcase " succeeded",    \
+		#testcase " failed ", 0 }
 
-#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL }
+#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 }
 
 struct unit_test_suite {
 	const char *suite_name;
 	int (*setup)(void);
-	int (*teardown)(void);
+	void (*teardown)(void);
 	struct unit_test_case unit_test_cases[];
 };
 
app/test/test_cryptodev.c new file +1986 -0

1,986 lines not on this page · raw message

app/test/test_cryptodev.h new file +68 -0

68 lines not on this page · raw message

app/test/test_cryptodev_perf.c new file +2062 -0

749 lines not on this page · raw message

app/test/test_link_bonding.c +3 -3
index 388cf11..2d98958 100644

Lines of this file are not shown. View the raw message.

app/test/test_link_bonding_mode4.c +3 -4
index 460539d..713368d 100644

Lines of this file are not shown. View the raw message.

app/test/test_link_bonding_rssconf.c +3 -4
index e6714b4..0a3162e 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.5.0

Part of the diff is not shown here. View the raw message.

#113 lore raw

PATCH v8 10/10 l2fwd-crypto: crypto

In reply to Declan Doherty

This patch creates a new sample applicaiton based off the l2fwd application which performs specified crypto operations on IP packet payloads which are forwarding.

---
 MAINTAINERS                    |    1 +
 examples/Makefile              |    1 +
 examples/l2fwd-crypto/Makefile |   50 ++
 examples/l2fwd-crypto/main.c   | 1489 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1541 insertions(+)
 create mode 100644 examples/l2fwd-crypto/Makefile
 create mode 100644 examples/l2fwd-crypto/main.c
MAINTAINERS +1 -0
index 74aa169..0685a56 100644
@@ -206,6 +206,7 @@ F: lib/librte_cryptodev
 F: docs/guides/cryptodevs
 F: app/test/test_cryptodev.c
 F: app/test/test_cryptodev_perf.c
+F: examples/l2fwd-crypto
 
 Drivers
 -------
examples/Makefile +1 -0
index 830e31a..2da9b49 100644
@@ -75,5 +75,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += vhost_xen
 DIRS-y += vmdq
 DIRS-y += vmdq_dcb
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += vm_power_manager
+DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += l2fwd-crypto
 
 include $(RTE_SDK)/mk/rte.extsubdir.mk
examples/l2fwd-crypto/Makefile new file +50 -0

50 lines not on this page · raw message

examples/l2fwd-crypto/main.c new file +1489 -0

1,489 lines not on this page · raw message

Signature · 1 line
2.5.0
#114 lore raw
In reply to Declan Doherty

2015-11-25 13:25, Declan Doherty:

Quoted 5 lines

This series of patches defines a set of application burst oriented APIs for asynchronous symmetric cryptographic functions within DPDK. It also contains a poll mode driver cryptographic device framework for the implementation of crypto devices within DPDK.

Quoted 7 lines

In the patch set we also have included 2 reference implementations of crypto PMDs. Currently both implementations support AES-CBC with HMAC_SHA1/SHA256/SHA512 authentication operations. The first device is a purely software PMD based on Intel's multi-buffer library, which utilises both AES-NI instructions and vector operations to accelerate crypto operations and the second PMD utilises Intel's Quick Assist Technology (on DH895xxC) to provide hardware accelerated crypto operations.

After rebase, small fixes in configs and MAINTAINERS, Applied, thanks

It is marked as experimental in the documentation and configs. The API needs to be more tested, discussed and documented.
So it is not stable and no deprecation process is needed to make some changes.