[dpdk-dev] [vmxnet3-usermap PATCH v2 15/17] pmd: remove support of old dpdk versions

Olivier Matz olivier.matz at 6wind.com
Mon May 19 15:56:27 CEST 2014


It's a pain to support many versions of DPDK for external drivers.
Today, it's not required to keep this driver working on older DPDK
versions. If it's required in the future, as the DPDK API is not stable
enough, the correct approach will probably to have several maintenance
branches instead of trying to have a driver that compiles with all
DPDK versions.

Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
---
 pmd/vmxnet3.c | 68 -----------------------------------------------------------
 1 file changed, 68 deletions(-)

diff --git a/pmd/vmxnet3.c b/pmd/vmxnet3.c
index a25ea41..3f3f715 100644
--- a/pmd/vmxnet3.c
+++ b/pmd/vmxnet3.c
@@ -47,26 +47,14 @@
 /* Dependency over DPDK */
 #include <rte_byteorder.h>
 #include <rte_ethdev.h>
-#include <rte_version.h>
-
-#define DPDK_VERSION_BEFORE(x,y) RTE_VERSION <  RTE_VERSION_NUM(x,y,0,0)
-#define DPDK_VERSION_SINCE(x,y)  RTE_VERSION >= RTE_VERSION_NUM(x,y,0,0)
 
 /* Local includes */
 #include "vmxnet3_shm_shared.h"
 #include "vmx_user.h"
 
-#if DPDK_VERSION_BEFORE(1,3)
-/* until dpdk-1.3, queue structs are igb ones */
-typedef struct igb_tx_queue rte_txq_t;
-typedef struct igb_rx_queue rte_rxq_t;
-/* until dpdk-1.3, bit-fields vlan_macip are flat in rte_pktmbuf */
-#define RTE_MBUF_VLAN_MAC_IP(m) (m)->pkt.vlan_tci
-#else /* since dpdk-1.3 */
 typedef void rte_txq_t;
 typedef void rte_rxq_t;
 #define RTE_MBUF_VLAN_MAC_IP(m) (m)->pkt.vlan_macip.f.vlan_tci
-#endif
 
 #define VMXNET3_MAX_MAC_ADDRS 1
 
@@ -747,11 +735,7 @@ vmxnet3_rss_configure(const struct rte_eth_dev *dev)
  * Clear VLAN Filter table and declare VLAN filtering capability,
  * so that we can enable VLAN filtering by simply adding entries in it.
  */
-#if DPDK_VERSION_SINCE(1,3)
 static int
-#else
-static void
-#endif
 vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
 	const struct vmxnet3_adapter *priv;
@@ -765,11 +749,7 @@ vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	if (!(devRead->misc.uptFeatures & UPT1_F_RXVLAN)) {
 		RTE_LOG(WARNING, PMD, "%s(): No VLAN enabled for device\n",
 				__func__);
-#if DPDK_VERSION_SINCE(1,3)
 		return -1;
-#else
-		return;
-#endif
 	}
 
 	if (on) {
@@ -778,9 +758,7 @@ vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 		VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vlan_id);
 	}
 
-#if DPDK_VERSION_SINCE(1,3)
 	return 0;
-#endif
 }
 
 /* Exported Rx function after Rx Queue setup. */
@@ -1001,58 +979,14 @@ vmxnet3_dev_start(struct rte_eth_dev *dev)
 	return ret;
 }
 
-#if DPDK_VERSION_BEFORE(1,3)
-/* Allocate array of pointers to register queues */
-static int
-pointer_array_alloc(void **pointer_array, uint16_t *size, uint16_t new_size)
-{
-	if (*pointer_array == NULL) {
-		*pointer_array = malloc(sizeof(void*) * new_size);
-		if (*pointer_array == NULL) {
-			*size = 0;
-			return -ENOMEM;
-		}
-	} else if (new_size != *size)
-		rte_panic("%s(): cannot change queues number\n", __func__);
-
-	*size = new_size;
-	return 0;
-}
-
-/* Configure VLAN and Flow Director. Flow Director is not supported. */
-static int
-vmxnet3_dev_configure(struct rte_eth_dev *dev,
-                      uint16_t nb_rx_q, uint16_t nb_tx_q)
-#else
 static int
 vmxnet3_dev_configure(struct rte_eth_dev *dev)
-#endif
 {
 	const struct vmxnet3_adapter* priv;
 	struct Vmxnet3_DSDevRead *devRead;
 	unsigned int i;
 	u32 *vfTable;
 
-#if DPDK_VERSION_BEFORE(1,3)
-	int ret;
-
-	/* Allocate array of pointers to RX queues */
-	ret = pointer_array_alloc((void**)&dev->data->rx_queues,
-	                          &dev->data->nb_rx_queues, nb_rx_q);
-	if (ret != 0)
-		rte_panic("%s(): port_id=%d: allocation of array "
-		          "of %d pointers to RX queues failed\n",
-		          __func__, dev->data->port_id, nb_rx_q);
-
-	/* Allocate array of pointers to TX queues */
-	ret = pointer_array_alloc((void**)&dev->data->tx_queues,
-	                          &dev->data->nb_tx_queues, nb_tx_q);
-	if (ret != 0)
-		rte_panic("%s(): port_id=%d: allocation of array "
-		          "of %d pointers to TX queues failed\n",
-		          __func__, dev->data->port_id, nb_tx_q);
-#endif
-
 	priv = (struct vmxnet3_adapter*)dev->data->dev_private;
 
 	devRead = &priv->shared->devRead;
@@ -1424,11 +1358,9 @@ static struct eth_dev_ops vmxnet3_eth_dev_ops = {
 	.vlan_filter_set      = vmxnet3_vlan_filter_set,
 	.rx_queue_setup       = vmxnet3_dev_rx_queue_setup,
 	.tx_queue_setup       = vmxnet3_dev_tx_queue_setup,
-#if DPDK_VERSION_SINCE(1,3)
 	/* Reconfiguration not supported yet */
 	.rx_queue_release     = NULL,
 	.tx_queue_release     = NULL,
-#endif
 	.dev_led_on           = NULL,
 	.dev_led_off          = NULL,
 	.flow_ctrl_set        = NULL,
-- 
1.9.2



More information about the dev mailing list