On 18/06/2018 12:20, Eelco Chaudron wrote: > > > On 11 Jun 2018, at 18:21, Tiago Lam wrote: >
[snip] >> >> @@ -626,13 +622,31 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu) >> netdev_name, n_mbufs, socket_id, >> dev->requested_n_rxq, dev->requested_n_txq); >> >> + mbuf_priv_data_len = sizeof(struct dp_packet) - >> + sizeof(struct rte_mbuf); >> + /* The size of the entire mbuf. */ >> + mbuf_size = sizeof (struct dp_packet) + >> + mbuf_pkt_data_len + >> RTE_PKTMBUF_HEADROOM; >> + /* mbuf size, rounded up to cacheline size. */ >> + aligned_mbuf_size = ROUND_UP(mbuf_size, RTE_CACHE_LINE_SIZE); >> + /* If there is a size discrepancy, add padding to >> mbuf_priv_data_len. >> + * This maintains mbuf size cache alignment, while also >> honoring RX >> + * buffer alignment in the data portion of the mbuf. If this >> adjustment >> + * is not made, there is a possiblity later on that for an >> element of >> + * the mempool, buf, buf->data_len < (buf->buf_len - >> buf->data_off). >> + * This is problematic in the case of multi-segment mbufs, >> particularly >> + * when an mbuf segment needs to be resized (when >> [push|popp]ing a VLAN >> + * header, for example. >> + */ >> + mbuf_priv_data_len += (aligned_mbuf_size - mbuf_size); >> + >> mp = rte_pktmbuf_pool_create(mp_name, n_mbufs, MP_CACHE_SZ, >> - sizeof (struct dp_packet) - sizeof (struct >> rte_mbuf), >> - MBUF_SIZE(mtu) - sizeof(struct dp_packet), >> socket_id); >> + mbuf_priv_data_len, >> + mbuf_pkt_data_len + RTE_PKTMBUF_HEADROOM, socket_id); >> >> if (mp) { >> VLOG_DBG("Allocated \"%s\" mempool with %u mbufs", >> - mp_name, n_mbufs); >> + mp_name, n_mbufs); > > While you are at it, can we add some info on the cache line alignment > size, might be useful for debugging. Sure. I'll add it to the next iteration. Tiago. _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev