/* use master core for command line ? */
uint8_t interactive = 0;
+uint8_t auto_start = 0;
/*
* NUMA support configuration.
&io_fwd_engine,
&mac_fwd_engine,
&mac_retry_fwd_engine,
+ &mac_swap_engine,
+ &flow_gen_engine,
&rx_only_engine,
&tx_only_engine,
&csum_fwd_engine,
}
}
+/*
+ * Check given socket id is valid or not with NUMA mode,
+ * if valid, return 0, else return -1
+ */
+static int
+check_socket_id(const unsigned int socket_id)
+{
+ static int warning_once = 0;
+
+ if (socket_id >= MAX_SOCKET) {
+ if (!warning_once && numa_support)
+ printf("Warning: NUMA should be configured manually by"
+ " using --port-numa-config and"
+ " --ring-numa-config parameters along with"
+ " --numa.\n");
+ warning_once = 1;
+ return -1;
+ }
+ return 0;
+}
+
static void
init_config(void)
{
mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool,
socket_num);
}
- /*
- * Records which Mbuf pool to use by each logical core, if needed.
- */
- for (lc_id = 0; lc_id < nb_lcores; lc_id++) {
- mbp = mbuf_pool_find(rte_lcore_to_socket_id(lc_id));
- if (mbp == NULL)
- mbp = mbuf_pool_find(0);
- fwd_lcores[lc_id]->mbp = mbp;
- }
/* Configuration of Ethernet ports. */
ports = rte_zmalloc("testpmd: ports",
port_per_socket[port_numa[pid]]++;
else {
uint32_t socket_id = rte_eth_dev_socket_id(pid);
+
+ /* if socket_id is invalid, set to 0 */
+ if (check_socket_id(socket_id) < 0)
+ socket_id = 0;
port_per_socket[socket_id]++;
}
}
}
}
init_port_config();
+
+ /*
+ * Records which Mbuf pool to use by each logical core, if needed.
+ */
+ for (lc_id = 0; lc_id < nb_lcores; lc_id++) {
+ mbp = mbuf_pool_find(rte_lcore_to_socket_id(lc_id));
+ if (mbp == NULL)
+ mbp = mbuf_pool_find(0);
+ fwd_lcores[lc_id]->mbp = mbp;
+ }
+
/* Configuration of packet forwarding streams. */
if (init_fwd_streams() < 0)
rte_exit(EXIT_FAILURE, "FAIL from init_fwd_streams()\n");
port->dev_info.max_tx_queues);
return -1;
}
- if (numa_support)
- port->socket_id = rte_eth_dev_socket_id(pid);
+ if (numa_support) {
+ if (port_numa[pid] != NUMA_NO_CONFIG)
+ port->socket_id = port_numa[pid];
+ else {
+ port->socket_id = rte_eth_dev_socket_id(pid);
+
+ /* if socket_id is invalid, set to 0 */
+ if (check_socket_id(port->socket_id) < 0)
+ port->socket_id = 0;
+ }
+ }
else {
if (socket_num == UMA_NO_CONFIG)
port->socket_id = 0;
if (port->need_reconfig > 0) {
port->need_reconfig = 0;
- printf("Configuring Port %d (socket %d)\n", pi,
- rte_eth_dev_socket_id(pi));
+ printf("Configuring Port %d (socket %u)\n", pi,
+ port->socket_id);
/* configure port */
diag = rte_eth_dev_configure(pi, nb_rxq, nb_txq,
&(port->dev_conf));
rte_eth_promiscuous_enable(port_id);
#ifdef RTE_LIBRTE_CMDLINE
- if (interactive == 1)
+ if (interactive == 1) {
+ if (auto_start) {
+ printf("Start automatic packet forwarding\n");
+ start_packet_forwarding(0);
+ }
prompt();
- else
+ } else
#endif
{
char c;