NUMA: Set numa node value for system which not support NUMA.
Subsystems (2)
PATCH 1/5 NUMA: Set numa node value for system which not support NUMA.
The NUMA node information for PCI devices provided through sysfs is invalid for AMD Opteron(TM) Processor 62xx and 63xx on Red Hat Enterprise Linux 6, and VMs on some hypervisors.
--- lib/librte_eal/linuxapp/eal/eal_pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
lib/librte_eal/linuxapp/eal/eal_pci.c +7 -1
@@ -317,7 +317,13 @@free (dev);return -1 ; } - dev->device.numa_node = tmp; +/* The NUMA node information for PCI devices provided through +* sysfs is invalid for AMD Opteron(TM) Processor 62xx and 63xx +* on Red Hat Enterprise Linux 6, and VMs on some hypervisors. +* In the upstream linux kernel, the numa_node is an integer, +* which data type is int, not unsigned long. +*/ + dev->device.numa_node = (int )tmp >0 ? (int )tmp :0 ; }/* parse resources */
Signature · 1 line
1.8.3.1
PATCH 2/5 vmxnet3: Avoid memory leak in vmxnet3_dev_rx_queue_setup.
This patch will check the "nb_desc" parameter for rx queue, release the rxq and re-allocation it soon.
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +18 -12
@@ -926,6 +926,21 @@PMD_INIT_FUNC_TRACE (); +/* Rx vmxnet rings length should be between 128-4096 */ +if (nb_desc <VMXNET3_DEF_RX_RING_SIZE ) { +PMD_INIT_LOG (ERR ,"VMXNET3 Rx Ring Size Min: 128" ); +return -EINVAL ; + }else if (nb_desc >VMXNET3_RX_RING_MAX_SIZE ) { +PMD_INIT_LOG (ERR ,"VMXNET3 Rx Ring Size Max: 4096" ); +return -EINVAL ; + } + +/* Free memory prior to re-allocation if needed. */ +if (dev->data->rx_queues[queue_idx] !=NULL ) { +vmxnet3_dev_rx_queue_release (dev->data->rx_queues[queue_idx]); + dev->data->rx_queues[queue_idx] =NULL ; + } + rxq =rte_zmalloc ("ethdev_rx_queue" ,sizeof (struct vmxnet3_rx_queue ),RTE_CACHE_LINE_SIZE );if (rxq ==NULL ) {
@@ -946,18 +961,9 @@ ring1 = &rxq->cmd_ring[1 ]; comp_ring = &rxq->comp_ring; -/* Rx vmxnet rings length should be between 256-4096 */ -if (nb_desc <VMXNET3_DEF_RX_RING_SIZE ) { -PMD_INIT_LOG (ERR ,"VMXNET3 Rx Ring Size Min: 256" ); -return -EINVAL ; - }else if (nb_desc >VMXNET3_RX_RING_MAX_SIZE ) { -PMD_INIT_LOG (ERR ,"VMXNET3 Rx Ring Size Max: 4096" ); -return -EINVAL ; - }else { - ring0->size = nb_desc; - ring0->size &= ~VMXNET3_RING_SIZE_MASK ; - ring1->size = ring0->size; - } + ring0->size = nb_desc; + ring0->size &= ~VMXNET3_RING_SIZE_MASK ; + ring1->size = ring0->size; comp_ring->size = ring0->size + ring1->size;
Signature · 1 line
1.8.3.1
PATCH 3/5 vmxnet3: Avoid segfault caused by vmxnet3_dev_rx_queue_setup.
In reply to nickcooper-zhangtonghaoWe should allocate RX ring for max possible mumber of hardware descriptors. If we config RX queue with 2048 RX queue size, and 4096 soon, there will be segment fault when calling other ethernet API (e.g. rte_eth_dev_start).
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +5 -2
@@ -977,8 +977,11 @@ comp_ring->next2proc =0 ; comp_ring->gen =VMXNET3_INIT_GEN ; - size =sizeof (struct Vmxnet3_RxDesc ) * (ring0->size + ring1->size); - size +=sizeof (struct Vmxnet3_RxCompDesc ) * comp_ring->size; +/* Allocate RX ring for max possible mumber of hardware descriptors. */ + size =sizeof (struct Vmxnet3_RxDesc ) * + (VMXNET3_RX_RING_MAX_SIZE *VMXNET3_RX_CMDRING_SIZE ); + size +=sizeof (struct Vmxnet3_RxCompDesc ) * + (VMXNET3_RX_RING_MAX_SIZE *VMXNET3_RX_CMDRING_SIZE ); mz =ring_dma_zone_reserve (dev,"rxdesc" , queue_idx, size, socket_id);if (mz ==NULL ) {
Signature · 1 line
1.8.3.1
PATCH 4/5 vmxnet3: Avoid memory leak in vmxnet3_dev_tx_queue_setup.
In reply to nickcooper-zhangtonghaoThis patch will check the "nb_desc" parameter for tx queue, release the txq and re-allocation it soon.
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +19 -13
@@ -828,6 +828,23 @@return -EINVAL ; } +/* Tx vmxnet ring length should be between 512-4096 */ +if (nb_desc <VMXNET3_DEF_TX_RING_SIZE ) { +PMD_INIT_LOG (ERR ,"VMXNET3 Tx Ring Size Min: %u" , +VMXNET3_DEF_TX_RING_SIZE ); +return -EINVAL ; + }else if (nb_desc >VMXNET3_TX_RING_MAX_SIZE ) { +PMD_INIT_LOG (ERR ,"VMXNET3 Tx Ring Size Max: %u" , +VMXNET3_TX_RING_MAX_SIZE ); +return -EINVAL ; + } + +/* Free memory prior to re-allocation if needed... */ +if (dev->data->tx_queues[queue_idx] !=NULL ) { +vmxnet3_dev_tx_queue_release (dev->data->tx_queues[queue_idx]); + dev->data->tx_queues[queue_idx] =NULL ; + } + txq =rte_zmalloc ("ethdev_tx_queue" ,sizeof (struct vmxnet3_tx_queue ),RTE_CACHE_LINE_SIZE );if (txq ==NULL ) {
@@ -846,19 +863,8 @@ comp_ring = &txq->comp_ring; data_ring = &txq->data_ring; -/* Tx vmxnet ring length should be between 512-4096 */ -if (nb_desc <VMXNET3_DEF_TX_RING_SIZE ) { -PMD_INIT_LOG (ERR ,"VMXNET3 Tx Ring Size Min: %u" , -VMXNET3_DEF_TX_RING_SIZE ); -return -EINVAL ; - }else if (nb_desc >VMXNET3_TX_RING_MAX_SIZE ) { -PMD_INIT_LOG (ERR ,"VMXNET3 Tx Ring Size Max: %u" , -VMXNET3_TX_RING_MAX_SIZE ); -return -EINVAL ; - }else { - ring->size = nb_desc; - ring->size &= ~VMXNET3_RING_SIZE_MASK ; - } + ring->size = nb_desc; + ring->size &= ~VMXNET3_RING_SIZE_MASK ; comp_ring->size = data_ring->size = ring->size;/* Tx vmxnet rings structure initialization*/
Signature · 1 line
1.8.3.1
PATCH 5/5 vmxnet3: Avoid segfault caused by vmxnet3_dev_tx_queue_setup.
In reply to nickcooper-zhangtonghaoWe should allocate Tx ring for max possible mumber of hardware descriptors. If we config Tx queue with 2048 Tx queue size, and 4096 soon, there will be segment fault.
--- drivers/net/vmxnet3/vmxnet3_rxtx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/vmxnet3/vmxnet3_rxtx.c +4 -3
@@ -874,9 +874,10 @@ comp_ring->next2proc =0 ; comp_ring->gen =VMXNET3_INIT_GEN ; - size =sizeof (struct Vmxnet3_TxDesc ) * ring->size; - size +=sizeof (struct Vmxnet3_TxCompDesc ) * comp_ring->size; - size +=sizeof (struct Vmxnet3_TxDataDesc ) * data_ring->size; +/* Allocate Tx ring for max possible mumber of hardware descriptors. */ + size =sizeof (struct Vmxnet3_TxDesc ) *VMXNET3_TX_RING_MAX_SIZE ; + size +=sizeof (struct Vmxnet3_TxCompDesc ) *VMXNET3_TX_RING_MAX_SIZE ; + size +=sizeof (struct Vmxnet3_TxDataDesc ) *VMXNET3_TX_RING_MAX_SIZE ; mz =ring_dma_zone_reserve (dev,"txdesc" , queue_idx, size, socket_id);if (mz ==NULL ) {
Signature · 1 line
1.8.3.1