2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

lib: upgrade to DPDK v1.8.0

DPDK v1.8.0 makes significant changes to struct rte_mbuf, including
removal of the 'pkt' and 'data' fields. The latter, formally a
pointer, is now calculated via an offset from the start of the
segment buffer.  So now dp_packet data is also stored as offset
from base pointer.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Signed-off-by: Kevin Traynor <kevin.traynor@intel.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
Mark Kavanagh
2015-02-17 13:20:04 -08:00
committed by Pravin B Shelar
parent 09c28fa321
commit b8e57534ec
4 changed files with 72 additions and 56 deletions

View File

@@ -47,6 +47,9 @@
#include "unixctl.h"
#include "openvswitch/vlog.h"
#include "rte_config.h"
#include "rte_mbuf.h"
VLOG_DEFINE_THIS_MODULE(dpdk);
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
@@ -264,13 +267,12 @@ __rte_pktmbuf_init(struct rte_mempool *mp,
m->buf_len = (uint16_t)buf_len;
/* keep some headroom between start of buffer and data */
m->pkt.data = (char*) m->buf_addr + RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, m->buf_len);
/* init some constant fields */
m->type = RTE_MBUF_PKT;
m->pool = mp;
m->pkt.nb_segs = 1;
m->pkt.in_port = 0xff;
m->nb_segs = 1;
m->port = 0xff;
}
static void
@@ -824,7 +826,7 @@ dpdk_do_tx_copy(struct netdev *netdev, int qid, struct dp_packet ** pkts,
}
/* We have to do a copy for now */
memcpy(mbufs[newcnt]->pkt.data, dp_packet_data(pkts[i]), size);
memcpy(rte_pktmbuf_mtod(mbufs[newcnt], void *), dp_packet_data(pkts[i]), size);
rte_pktmbuf_data_len(mbufs[newcnt]) = size;
rte_pktmbuf_pkt_len(mbufs[newcnt]) = size;
@@ -1269,22 +1271,6 @@ dpdk_common_init(void)
ovs_thread_create("dpdk_watchdog", dpdk_watchdog, NULL);
}
static int
dpdk_class_init(void)
{
int result;
result = rte_eal_pci_probe();
if (result) {
VLOG_ERR("Cannot probe PCI");
return -result;
}
VLOG_INFO("Ethernet Device Count: %d", (int)rte_eth_dev_count());
return 0;
}
/* Client Rings */
static int
@@ -1509,7 +1495,7 @@ dpdk_init(int argc, char **argv)
const struct netdev_class dpdk_class =
NETDEV_DPDK_CLASS(
"dpdk",
dpdk_class_init,
NULL,
netdev_dpdk_construct,
netdev_dpdk_set_multiq,
netdev_dpdk_eth_send);