[ovs-dev,1/3] support for large mpool.
diff mbox series

Message ID 20190923141510.10303-1-fbl@sysclose.org
State New
Headers show
Series
  • [ovs-dev,1/3] support for large mpool.
Related show

Commit Message

Flavio Leitner Sept. 23, 2019, 2:15 p.m. UTC
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 lib/netdev-dpdk.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Comments

0-day Robot Sept. 23, 2019, 2:59 p.m. UTC | #1
Bleep bloop.  Greetings Flavio Leitner, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 80 characters long (recommended limit is 79)
#55 FILE: lib/netdev-dpdk.c:634:
        VLOG_ERR("mp_64k: size: %d entries: %d (%d bytes)", mbuf_size * n_mbufs,

Lines checked: 98, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot

Patch
diff mbox series

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 48057835f..7eb294366 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -323,8 +323,11 @@  static struct ovs_mutex dpdk_mp_mutex OVS_ACQ_AFTER(dpdk_mutex)
 static struct ovs_list dpdk_mp_list OVS_GUARDED_BY(dpdk_mp_mutex)
     = OVS_LIST_INITIALIZER(&dpdk_mp_list);
 
+static struct rte_mempool *shared_mp64k = NULL;
+
 struct dpdk_mp {
      struct rte_mempool *mp;
+     struct rte_mempool *mp64k;
      int mtu;
      int socket_id;
      int refcount;
@@ -637,6 +640,40 @@  dpdk_calculate_mbufs(struct netdev_dpdk *dev, int mtu, bool per_port_mp)
     return n_mbufs;
 }
 
+static struct dpdk_mp *
+dpdk_mp64k_create(uint32_t socket_id)
+{
+    struct rte_mempool *mp;
+    char name[] = "64k";
+    uint32_t n_mbufs;
+    uint32_t mbuf_priv_data_len;
+    uint32_t mbuf_size;
+    uint32_t aligned_mbuf_size = 0;
+    uint32_t pkt_size = 0;
+
+
+    /* 64k */
+    mbuf_size = 0xffff;
+    mbuf_priv_data_len = 584;
+    n_mbufs = 337;
+    mp = rte_pktmbuf_pool_create(name, n_mbufs, 0,
+                                          mbuf_priv_data_len,
+                                          mbuf_size,
+                                          socket_id);
+    if (mp) {
+        rte_mempool_obj_iter(mp, ovs_rte_pktmbuf_init, NULL);
+        VLOG_INFO("mempool of 64k mbufs allocated");
+    } else {
+        VLOG_ERR("Failed to create mempool mp_64k");
+        VLOG_ERR("mp_64k: size: %d entries: %d (%d bytes)", mbuf_size * n_mbufs,
+                 n_mbufs, mbuf_size);
+        VLOG_ERR("mp_64k: rte_errno=%d mbuf_priv_data_len=%d", rte_errno,
+                 mbuf_priv_data_len);
+    }
+
+    return mp;
+}
+
 static struct dpdk_mp *
 dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool per_port_mp)
 {
@@ -755,6 +792,11 @@  dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool per_port_mp)
     bool reuse = false;
 
     ovs_mutex_lock(&dpdk_mp_mutex);
+
+    if (!shared_mp64k) {
+        shared_mp64k = dpdk_mp64k_create(dev->requested_socket_id);
+    }
+
     /* Check if shared memory is being used, if so check existing mempools
      * to see if reuse is possible. */
     if (!per_port_mp) {
@@ -859,6 +901,7 @@  netdev_dpdk_mempool_configure(struct netdev_dpdk *dev)
             dpdk_mp_put(dev->dpdk_mp);
         }
         dev->dpdk_mp = dmp;
+        dev->dpdk_mp->mp64k = shared_mp64k;
         dev->mtu = dev->requested_mtu;
         dev->socket_id = dev->requested_socket_id;
         dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
@@ -2214,6 +2257,7 @@  netdev_dpdk_vhost_rxq_recv(struct netdev_rxq *rxq,
     }
 
     nb_rx = rte_vhost_dequeue_burst(vid, qid, dev->dpdk_mp->mp,
+                                    dev->dpdk_mp->mp64k,
                                     (struct rte_mbuf **) batch->packets,
                                     NETDEV_MAX_BURST);
     if (!nb_rx) {