+static void
+__rte_pktmbuf_init(struct rte_mempool *mp,
+ void *opaque_arg OVS_UNUSED,
+ void *_m,
+ unsigned i OVS_UNUSED)
+{
+ struct rte_mbuf *m = _m;
+ uint32_t buf_len = mp->elt_size - sizeof(struct ofpbuf);
+
+ RTE_MBUF_ASSERT(mp->elt_size >= sizeof(struct ofpbuf));
+
+ memset(m, 0, mp->elt_size);
+
+ /* start of buffer is just after mbuf structure */
+ m->buf_addr = (char *)m + sizeof(struct ofpbuf);
+ m->buf_physaddr = rte_mempool_virt2phy(mp, m) +
+ sizeof(struct ofpbuf);
+ 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);
+
+ /* init some constant fields */
+ m->type = RTE_MBUF_PKT;
+ m->pool = mp;
+ m->pkt.nb_segs = 1;
+ m->pkt.in_port = 0xff;
+}
+
+static void
+ovs_rte_pktmbuf_init(struct rte_mempool *mp,
+ void *opaque_arg OVS_UNUSED,
+ void *_m,
+ unsigned i OVS_UNUSED)
+{
+ struct rte_mbuf *m = _m;
+
+ __rte_pktmbuf_init(mp, opaque_arg, _m, i);
+
+ ofpbuf_init_dpdk((struct ofpbuf *) m, m->buf_len);
+}
+