[dpdk-dev] [PATCH 08/10] ip_fragmentation: small fixes

Anatoly Burakov anatoly.burakov at intel.com
Wed Jun 18 16:50:35 CEST 2014


Adding check for non-existent ports in portmask.

Also, making everything NUMA-related depend on lcore sockets, not device
sockets. This is because the init_mem() function allocates all data
structures based on NUMA nodes of the lcores in the coremask. Therefore,
when no cores are on socket 0, but there are devices on socket 0, it may
lead to segmentation faults.

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 examples/ip_fragmentation/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 02e40a1..3172ad5 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -886,6 +886,10 @@ MAIN(int argc, char **argv)
 	if (init_mem() < 0)
 		rte_panic("Cannot initialize memory structures!\n");
 
+	/* check if portmask has non-existent ports */
+	if (enabled_port_mask & ~(RTE_LEN2MASK(nb_ports, unsigned)))
+		rte_exit(EXIT_FAILURE, "Non-existent ports in portmask!\n");
+
 	/* initialize all ports */
 	for (portid = 0; portid < nb_ports; portid++) {
 		/* skip ports that are not enabled */
@@ -907,7 +911,7 @@ MAIN(int argc, char **argv)
 			qconf = &lcore_queue_conf[rx_lcore_id];
 		}
 
-		socket = rte_eth_dev_socket_id(portid);
+		socket = (int) rte_lcore_to_socket_id(rx_lcore_id);
 		if (socket == SOCKET_ID_ANY)
 			socket = 0;
 
-- 
1.8.1.4



More information about the dev mailing list