app/testpmd: reserve NUMA node per port and per ring
authorPhil Yang <phil.yang@arm.com>
Thu, 18 Oct 2018 10:39:25 +0000 (18:39 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 26 Oct 2018 20:14:05 +0000 (22:14 +0200)
If user explicitly requested memory to be allocated from a socket via
`port-numa-config` and `ring-numa-config`, and if that socket is
valid, add that socket into socket_ids[] so that mempool allocated for
that socket.

Fixes: dbfb8ec7094c ("app/testpmd: optimize mbuf pool allocation")
Cc: stable@dpdk.org
Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
app/test-pmd/parameters.c

index 4a4debb..38b4197 100644 (file)
@@ -416,8 +416,11 @@ parse_portnuma_config(const char *q_arg)
                }
                socket_id = (uint8_t)int_fld[FLD_SOCKET];
                if (new_socket_id(socket_id)) {
-                       print_invalid_socket_id_error();
-                       return -1;
+                       if (num_sockets >= RTE_MAX_NUMA_NODES) {
+                               print_invalid_socket_id_error();
+                               return -1;
+                       }
+                       socket_ids[num_sockets++] = socket_id;
                }
                port_numa[port_id] = socket_id;
        }
@@ -473,8 +476,11 @@ parse_ringnuma_config(const char *q_arg)
                }
                socket_id = (uint8_t)int_fld[FLD_SOCKET];
                if (new_socket_id(socket_id)) {
-                       print_invalid_socket_id_error();
-                       return -1;
+                       if (num_sockets >= RTE_MAX_NUMA_NODES) {
+                               print_invalid_socket_id_error();
+                               return -1;
+                       }
+                       socket_ids[num_sockets++] = socket_id;
                }
                ring_flag = (uint8_t)int_fld[FLD_FLAG];
                if ((ring_flag < RX_RING_ONLY) || (ring_flag > RXTX_RING)) {