* [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3
@ 2013-07-25 20:39 Thomas Monjalon
2013-07-26 9:02 ` Damien Millescamps
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Monjalon @ 2013-07-25 20:39 UTC (permalink / raw)
To: dev
API changes in DPDK 1.3:
- queue arrays are already allocated by rte_ethdev
- queue could be released for reconfiguration (not supported)
- queue struct becomes an opaque pointer
- vlan_filter_set can return an error
- bit-fields vlan_macip have moved
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
pmd/vmxnet3.c | 43 ++++++++++++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/pmd/vmxnet3.c b/pmd/vmxnet3.c
index 8dc1650..1718f8d 100644
--- a/pmd/vmxnet3.c
+++ b/pmd/vmxnet3.c
@@ -1,5 +1,5 @@
/*
- * Copyright 6WIND 2012-2013, All rights reserved.
+ * Copyright 2012-2013 6WIND S.A.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,13 +47,26 @@
/* 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
@@ -324,7 +337,7 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
buf->pkt.data_len = rcd->len;
buf->pkt.in_port = rq->port_id;
buf->ol_flags = 0; // RSS - FDIR // Error
- buf->pkt.vlan_tci = 0;
+ RTE_MBUF_VLAN_MAC_IP(buf) = 0;
if (unlikely(rep == NULL)) {
/* Can't allocate replacement mbuf, drop packet and
@@ -734,7 +747,11 @@ 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;
@@ -748,7 +765,11 @@ 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) {
@@ -756,6 +777,10 @@ vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
} else {
VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vlan_id);
}
+
+#if DPDK_VERSION_SINCE(1,3)
+ return 0;
+#endif
}
/* Exported Rx function after Rx Queue setup. */
@@ -976,6 +1001,7 @@ 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)
@@ -997,12 +1023,17 @@ pointer_array_alloc(void **pointer_array, uint16_t *size, uint16_t new_size)
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 */
@@ -1020,6 +1051,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev,
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;
@@ -1360,7 +1392,7 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
tq->hthresh = tx_conf->tx_thresh.hthresh;
tq->wthresh = tx_conf->tx_thresh.wthresh;
- dev->data->tx_queues[queue_idx] = (struct igb_tx_queue*)tq;
+ dev->data->tx_queues[queue_idx] = (rte_txq_t*)tq;
dev->tx_pkt_burst = eth_tx_burst;
return 0;
@@ -1392,6 +1424,11 @@ 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.7.10.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3
2013-07-25 20:39 [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3 Thomas Monjalon
@ 2013-07-26 9:02 ` Damien Millescamps
2013-07-26 9:08 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Damien Millescamps @ 2013-07-26 9:02 UTC (permalink / raw)
To: dev
On 07/25/2013 10:39 PM, Thomas Monjalon wrote:
> API changes in DPDK 1.3:
> - queue arrays are already allocated by rte_ethdev
> - queue could be released for reconfiguration (not supported)
> - queue struct becomes an opaque pointer
> - vlan_filter_set can return an error
> - bit-fields vlan_macip have moved
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
ack
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3
2013-07-26 9:02 ` Damien Millescamps
@ 2013-07-26 9:08 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2013-07-26 9:08 UTC (permalink / raw)
To: Damien Millescamps; +Cc: dev
26/07/2013 11:02, Damien Millescamps :
> On 07/25/2013 10:39 PM, Thomas Monjalon wrote:
> > API changes in DPDK 1.3:
> > - queue arrays are already allocated by rte_ethdev
> > - queue could be released for reconfiguration (not supported)
> > - queue struct becomes an opaque pointer
> > - vlan_filter_set can return an error
> > - bit-fields vlan_macip have moved
>
> ack
pushed
--
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-26 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25 20:39 [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3 Thomas Monjalon
2013-07-26 9:02 ` Damien Millescamps
2013-07-26 9:08 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).