[dpdk-dev] [PATCH v1] app/test: fix pmd_perf issue in no NUMA case

Liang, Cunming cunming.liang at intel.com
Tue Jun 23 03:45:43 CEST 2015



> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Tuesday, June 23, 2015 5:02 AM
> To: Liang, Cunming
> Cc: dev at dpdk.org; Jayakumar, Muthurajan
> Subject: Re: [dpdk-dev] [PATCH v1] app/test: fix pmd_perf issue in no NUMA case
> 
> 2015-06-08 14:33, Cunming Liang:
> > Reported-by: Jayakumar, Muthurajan <muthurajan.jayakumar at intel.com>
> > Signed-off-by: Cunming Liang <cunming.liang at intel.com>
> 
> Please explain exactly what you try to fix.
> Is it still needed since this patch?
> 	http://dpdk.org/browse/dpdk/commit/?id=94ef2964148a4540
> 
> > +	socket_id = rte_eth_dev_socket_id(port_id);
> > +	if (socket_id < 0)
> > +		/* enforce using socket 0 when no NUMA support */
> > +		socket_id = 0;

The referred patch 94ef29 fixes eal_cpu_socket_id() for the socket id of a logical core.
It's not for the case here which trying to get socket id of a port.
The original purpose of the patch is to allow the unit test works even without NUMA support.

Now I have a look on the function definition, when socket could not be determined, the default shall be zero instead of -1.
So I think the below change should be made in eal_pci.c

/*
 * Return the NUMA socket to which an Ethernet device is connected
 * @return
 *   The NUMA socket id to which the Ethernet device is connected or
 *   a default of zero if the socket could not be determined.
 *   -1 is returned is the port_id value is out of range.
 */
extern int rte_eth_dev_socket_id(uint8_t port_id);

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index d2adc66..8f9f136 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -317,8 +317,8 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
        snprintf(filename, sizeof(filename), "%s/numa_node",
                 dirname);
        if (access(filename, R_OK) != 0) {
-               /* if no NUMA support just set node to -1 */
-               dev->numa_node = -1;
+               /* if no NUMA support just set node to 0 */
+               dev->numa_node = 0;
        } else {
                if (eal_parse_sysfs_value(filename, &tmp) < 0) {
                        free(dev);

/Steve


More information about the dev mailing list