Commit Graph

15 Commits

Author SHA1 Message Date
Alexander Matushevsky
2861ea8df0 net/ena/base: initialize memory in the allocation macros
Uninitialized memory could cause memory corruption, by indicating
completion of the invalid mbuf.

Fixes: 3d3edc265f ("net/ena: make coherent memory allocation NUMA-aware")
Cc: stable@dpdk.org

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
2017-07-06 15:00:57 +02:00
Yong Wang
1207f3f722 net/ena: fix return of hash control flushing
In function ena_com_set_hash_ctrl(), the return value is assigned to
"ret" variable, but it is not returned. Fix it by adding the return.

Fixes: 99ecfbf845 ("ena: import communication layer")
Cc: stable@dpdk.org

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Jan Medala <jan@semihalf.com>
2017-04-04 18:59:40 +02:00
Yong Wang
70153557a9 net/ena: remove redundant variable
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: Jan Medala <jan@semihalf.com>
2017-04-04 18:59:39 +02:00
Jakub Palider
201ff2e57a net/ena: fix setting host attributes
The hardware may reject adding host_info in case support for
host_info is missing in the list of supported features. On the
other hand the list of supported features may contain support
for the host_info - typical bootstrap problem.

This patch solves it by removing check against support for
host_info attribute and improves error handling by reacting
only to host attribute write failure to the hardware.

Fixes: 99ecfbf845 ("ena: import communication layer")
Cc: stable@dpdk.org

Signed-off-by: Jakub Palider <jpa@semihalf.com>
2017-02-10 12:25:49 +01:00
Jerin Jacob
fcbf1e14de net/ena: use I/O device memory read/write API
Replace the raw I/O device memory read/write access with eal
abstraction for I/O device memory read/write access to fix
portability issues across different architectures.

Suggested-by: Jan Medala <jan@semihalf.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jan Medala <jan@semihalf.com>
2017-01-18 17:18:27 +01:00
Ferruh Yigit
62e82667fd net/ena: fix icc build
drivers/net/ena/base/ena_com.c(346):
error #3656: variable "dev_node" may be used before its value is set
                ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
                ^

drivers/net/ena/base/ena_com.c(399):
error #3656: variable "prev_node" may be used before its value is set
        ENA_MEM_ALLOC_COHERENT_NODE(ena_dev->dmadev,
        ^

Fixes: 3d3edc265f ("net/ena: make coherent memory allocation NUMA-aware")

Reported-by: Eoin Breen <eoin.breen@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jan Medala <jan@semihalf.com>
2016-07-22 00:42:10 +02:00
Jan Medala
0e72dbf2d3 net/ena: fix freeing memory using correct API
Memory zones should be freed using the proper memzone_free function not
rte_free which is for malloc calls.
After allocating memzone it's required to zeroize memory in it, so do so
before storing the handle for later freeing.

Fixes: 9ba7981ec9 ("ena: add communication layer for DPDK")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
2016-07-08 15:23:01 +02:00
Jan Medala
3d3edc265f net/ena: make coherent memory allocation NUMA-aware
While allocating (coherent) memory, get information about calling node Id
and pass that as parameter when reserving a memzone.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
2016-07-08 15:19:40 +02:00
Jan Medala
6dcee7cde8 net/ena: update ENA comms layer for latest FW
Synchronize ENA communication layer with latest ENA FW version.

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
2016-07-08 15:19:25 +02:00
Thomas Monjalon
50705e8e3c eal: add assert macro for debug
The macro RTE_VERIFY always checks a condition.
It is optimized with "unlikely" hint.
While this macro is well suited for test applications, it is preferred
in libraries and examples to enable such check in debug mode.
That's why the macro RTE_ASSERT is introduced to call RTE_VERIFY only
if built with debug logs enabled.

A lot of assert macros were duplicated and enabled with a specific flag.
Removing these #ifdef allows to test these code branches more easily
and avoid dead code pitfalls.

The ENA_ASSERT is kept (in debug mode only) because it has more
parameters to log.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-05-02 15:31:17 +02:00
Ferruh Yigit
5fe8c8a2ba ena: fix build with icc
With (ICC) 16.0.2 20160204, getting following warnings:

.../drivers/net/ena/base/ena_com.c(492): error #3656: variable
 "flags" may be used before its value is set
 ENA_SPINLOCK_LOCK(admin_queue->q_lock, flags);

.../drivers/net/ena/base/ena_com.c(1971): error #3656: variable
 "mem_handle" may be used before its value is set
 ENA_MEM_ALLOC_COHERENT(ena_dev->dmadev, len,

For both warnings the variable value is ignored, so there is no defect.
To comfort compiler warning, a initial value provided to variables.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-04-06 15:49:17 +02:00
Daniel Mrzyglod
b990c617df ena: fix FreeBSD build
FreeBSD was not defined in ena_plat.h
ETIME is not defined in FreeBSD.

In file included from DPDK/drivers/net/ena/base/ena_com.h:37:0,
                 from DPDK/drivers/net/ena/ena_ethdev.h:39,
                 from DPDK/drivers/net/ena/ena_ethdev.c:41:
DPDK/drivers/net/ena/base/ena_plat.h:48:2: error: #error "Invalid platform"

Fixes: 99ecfbf845 ("ena: import communication layer")
Fixes: 9ba7981ec9 ("ena: add communication layer for DPDK")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-03-30 19:22:17 +02:00
Daniel Mrzyglod
23a707467f ena: fix build with icc
Fix for multiple compilation errors for ICC:
        error #188: enumerated type mixed with another type
        error #592: variable "flags" is used before its value is set

Fixes: 99ecfbf845 ("ena: import communication layer")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
2016-03-30 19:22:17 +02:00
Jan Medala
9ba7981ec9 ena: add communication layer for DPDK
Implementation of platform specific code for ENA communication layer.

Signed-off-by: Evgeny Schemeilin <evgenys@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
2016-03-25 18:56:43 +01:00
Jan Medala
99ecfbf845 ena: import communication layer
Low level common abstraction for ENA device communication.

Signed-off-by: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
2016-03-25 18:56:43 +01:00