dpdk.git
5 years agocrypto/qat: move to using new device structure
Fiona Trahe [Wed, 13 Jun 2018 12:14:04 +0000 (14:14 +0200)]
crypto/qat: move to using new device structure

Struct qat_pmd_private held the data needed by cryptodev, common code
now gets most data from struct qat_pci_device instead. qat_pmd_private
is trimmed to hold only sym crypto data and renamed qat_sym_private
to reflect its usage.
Specifically
 - remove max_nb_queue_pairs from qat_pmd_private, get from qp_hw_data
 - remove max_nb_sesssions from qat_pmd_private as not needed.
 - remove qat_gen from qat_pmd_private, get from qat_pci_device instead.
 - use qat_pci_device throughout common code instead of qat_pmd_private
 - rename qat_pmd_private to qat_sym_dev_private - this now holds only
   sym-specific data for the cryptodev API
 - extend pci device name to <bdf>_qat for clarity, was just <bdf>
 - update qp mem and cookiepool names to reflect the appropriate device,
   service and qp.
 - rename qat_dev_info_get() to qat_sym_dev_info_get() as mostly sym,
   not enough common info to warrant a generic fn.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: use generic driver name for PCI registration
Fiona Trahe [Wed, 13 Jun 2018 12:14:03 +0000 (14:14 +0200)]
crypto/qat: use generic driver name for PCI registration

The QAT PMD used to register with PCI using the name "crypto_qat".
Keep this name for the driver registered with cryptodev
and use a more generic name "qat" for the PCI registration.
This paves the way for the PCI device to host other services.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: add PCI device struct
Fiona Trahe [Wed, 13 Jun 2018 12:14:02 +0000 (14:14 +0200)]
crypto/qat: add PCI device struct

- Added struct qat_pci_device to use internally in QAT PMD
   to avoid dependencies on rte_cryptodev or rte_compressdev
 - Added a global array of these
 - Restructured probe/release to separate QAT common init/clear
   from crypto pmd create/destroy.
 - In QAT common part allocated a qat_pci_device and populated it
 - Removed meaningless check in probe for RTE_PROC_PRIMARY

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: move sgl related element to appropriate files
Fiona Trahe [Wed, 13 Jun 2018 12:14:01 +0000 (14:14 +0200)]
crypto/qat: move sgl related element to appropriate files

Move SGL (Scatter-Gather List) related functions to common file
Move qat_sym_op_cookie struct to sym header file

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: rename sgl related objects
Fiona Trahe [Wed, 13 Jun 2018 12:14:00 +0000 (14:14 +0200)]
crypto/qat: rename sgl related objects

Change SGL (Scatter-Gather List) related structs and member names

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
5 years agocrypto/qat: create structures to support various generations
Fiona Trahe [Wed, 13 Jun 2018 12:13:59 +0000 (14:13 +0200)]
crypto/qat: create structures to support various generations

Create data structures to support different generations
of qat hardware supplying services through different queue pairs.
 - Add two new structs qat_gen_hw_data and qat_qp_hw_dat
 - Add a qat_service_type enum
An array of qat_qp_hw_data elements is
initialised with constants, these are arranged so that the qp_id used
on the API can be used as an index to pick up the qp data to use.
The constants are common to current generations,
new arrays will be added for future generations.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: move defines from sym to qp header file
Fiona Trahe [Wed, 13 Jun 2018 12:13:58 +0000 (14:13 +0200)]
crypto/qat: move defines from sym to qp header file

Move defines related to coalescing from sym header file to qp header
file as these will be common for all services.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: remove dependencies on cryptodev from common
Fiona Trahe [Wed, 13 Jun 2018 12:13:57 +0000 (14:13 +0200)]
crypto/qat: remove dependencies on cryptodev from common

Remove dependence on rte_cryptodev from common qp code
to facilitate being used by other device types in future.
Transferred required data into qat-specific structures.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: move sym-specific qp code to sym file
Fiona Trahe [Wed, 13 Jun 2018 12:13:56 +0000 (14:13 +0200)]
crypto/qat: move sym-specific qp code to sym file

Move sym qp setup code from qat_qp.c to qat_sym.c

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: separate sym-specific from generic qp setup
Fiona Trahe [Wed, 13 Jun 2018 12:13:55 +0000 (14:13 +0200)]
crypto/qat: separate sym-specific from generic qp setup

Extracted all sym-specific code from qp setup fns, leaving
generic qat_qp_setup fn and helper fns. Created a new
meta-data struct qat_qp_config to hold all the data needed
to create a qp, filled this out in the sym-specific code
and passed to the generic qp_setup fn.
No need now for rx and tx queue_create fns, one generic
queue_create fn replaces these.
Included the service name (e.g. "sym") in the qp memzone
and cookie pool names.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: move generic qp function to qp file
Fiona Trahe [Wed, 13 Jun 2018 12:13:54 +0000 (14:13 +0200)]
crypto/qat: move generic qp function to qp file

Move the generic enqueue and dequeue fns from
the qat_sym.c file to the qat_qp.c file
Move generic qp structs to a new qat_qp.h file

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: make dequeue function generic
Fiona Trahe [Wed, 13 Jun 2018 12:13:53 +0000 (14:13 +0200)]
crypto/qat: make dequeue function generic

Queue-handling code in dequeue is made generic, so it can
be used by other services in future. This is done by
 - Removing all sym-specific refs in input params - replace with void ptrs.
 - Wrapping this generic dequeue with the sym-specific dequeue
   called through the API.
 - extracting the sym-specific response processing into a new fn.
 - Setting a fn ptr for process_response in qp on qp creation
 - Passing void * params to this, in the service-specific implementation
   qat_sym_process_response cast back to sym structs.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: make enqueue function generic
Fiona Trahe [Wed, 13 Jun 2018 12:13:52 +0000 (14:13 +0200)]
crypto/qat: make enqueue function generic

Queue-handling code in enqueue is made generic, so it can
be used by other services in future. This is done by
 - Removing all sym-specific refs in input params - replace with void ptrs.
 - Wrapping this generic enqueue with the sym-specific enqueue
   called through the API.
 - Setting a fn ptr for build_request in qp on qp creation
 - Passing void * params to this, in the service-specific implementation
   qat_sym_build_request cast back to sym structs.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: rename sym-specific structs
Fiona Trahe [Wed, 13 Jun 2018 12:13:51 +0000 (14:13 +0200)]
crypto/qat: rename sym-specific structs

qat_session           -> qat_sym_session
qat_crypto_proto_flag -> qat_sym_proto_flag
qat_alg_cd            -> qat_sym_cd
qat_crypto_op_cookie  -> qat_sym_op_cookie
qat_gen1_capabilities -> qat_gen1_sym_capabilities
qat_gen2_capabilities -> qat_gen2_sym_capabilities

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: rename functions for consistency
Fiona Trahe [Wed, 13 Jun 2018 12:13:50 +0000 (14:13 +0200)]
crypto/qat: rename functions for consistency

Rename fn names to shorten them, i.e.
  qat_crypto_sym_xxx to qat_sym_xxx
  _content_desc_ to _cd_
Renaming symmetric crypto specific with consistent names:
  qat_crypto_set_session_parameters->qat_sym_set_session_parameters
  qat_write_hw_desc_entry()->qat_sym_build_request()
  qat_alg_xxx ->qat_sym_xxx
  qat_sym_xxx_session_yyy()->qat_sym_session_xxx_yyy()
Removed unused prototypes:
  qat_get_inter_state_size()
  qat_pmd_session_mempool_create()
Removed 2 unnecessary extern declarations

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: change filename crypto to sym
Fiona Trahe [Wed, 13 Jun 2018 12:13:49 +0000 (14:13 +0200)]
crypto/qat: change filename crypto to sym

This commit renames qat_crypto.c/h to qat_sym.c/h
And makes a few whitespace changes to resolve line-length
issues.

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: add symmetric session file
Fiona Trahe [Wed, 13 Jun 2018 12:13:48 +0000 (14:13 +0200)]
crypto/qat: add symmetric session file

This commit adds qat_sym_session.c/h files and moves objects
from qat_algs_build_desc and qat_algs.h

Following objects were moved:
qat_adf/qat_algs_build_desc.c => qat_sym_session.c
- all objects -
qat_adf/qat_algs.h => qat_sym_session.h
- enum qat_crypto_proto_flag
- struct qat_alg_cd
- struct qat_session
- int qat_get_inter_state_size()
- int qat_alg_aead_session_create_content_desc_cipher()
- int qat_alg_aead_session_create_content_desc_auth()
- void qat_alg_init_common_hdr()
- int qat_alg_validate_aes_key()
- int qat_alg_validate_aes_docsisbpi_key()
- int qat_alg_validate_snow3g_key()
- int qat_alg_validate_kasumi_key()
- int qat_alg_validate_3des_key()
- int qat_alg_validate_des_key()
- int qat_cipher_get_block_size()
- int qat_alg_validate_zuc_key()
-- all macros
qat_crypto.h => qat_sym_session.h
int qat_crypto_sym_configure_session()
int qat_crypto_set_session_parameters()
int qat_crypto_sym_configure_session_aead()
int qat_crypto_sym_configure_session_cipher()
int qat_crypto_sym_configure_session_auth()
int qat_alg_aead_session_create_content_desc_cipher()
int qat_alg_aead_session_create_content_desc_auth()
static struct rte_crypto_auth_xform qat_get_auth_xform()
static struct rte_crypto_cipher_xform qat_get_cipher_xform()

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
5 years agocrypto/qat: remove unused includes
Tomasz Jozwiak [Wed, 13 Jun 2018 12:13:47 +0000 (14:13 +0200)]
crypto/qat: remove unused includes

This commit removes unused includes from qat_crypto.c

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
5 years agocrypto/qat: add device files
Fiona Trahe [Wed, 13 Jun 2018 12:13:46 +0000 (14:13 +0200)]
crypto/qat: add device files

This commit adds new qat_device file.
Following objects were moved:

qat_crypto.h => qat_device.h
- struct qat_pmd_private
- uint8_t cryptodev_qat_driver_id
- int qat_crypto_sym_qp_release (EXTERN)
- int qat_dev_config()
- int qat_dev_start()
- void qat_dev_stop()
- int qat_dev_close()
- void qat_dev_info_get()
qat_crypto.c => qat_device.c
- int qat_dev_config()
- int qat_dev_start()
- void qat_dev_stop()
- int qat_dev_close()
- void qat_dev_info_get()

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agocrypto/qat: add common header
Fiona Trahe [Wed, 13 Jun 2018 12:13:45 +0000 (14:13 +0200)]
crypto/qat: add common header

This commit adds qat_common.h header file.
Following objects were moved to it:

qat_algs.h =>. qat_common.h
- struct qat_alg_buf
- struct qat_alg_buf_list
- struct qat_crypto_op_cookie
- QAT_SGL_MAX_NUMBER
qat_crypto.h => qat_common.h
- CRYPTODEV_NAME_QAT_SYM_PMD

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
5 years agonet: rename u16 to fix shadowed declaration
Gage Eads [Mon, 4 Jun 2018 19:40:00 +0000 (14:40 -0500)]
net: rename u16 to fix shadowed declaration

This patch renames u16 to u16_buf. u16 as a variable name causes a shadowed
declaration warning if, for example, the application also typedefs u16
(e.g. by including a header containing "typedef unsigned short u16") and
the application is built with -Wshadow.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
5 years agobus/pci: remove unused function to detach by address
Rami Rosen [Sun, 20 May 2018 19:52:58 +0000 (22:52 +0300)]
bus/pci: remove unused function to detach by address

The function rte_pci_detach() is private to PCI and is
not used anywhere in current code base. Remove dead code.

Signed-off-by: Rami Rosen <rami.rosen@intel.com>
5 years agobus/pci: remove unused function to probe by address
Stephen Hemminger [Thu, 17 May 2018 23:44:58 +0000 (16:44 -0700)]
bus/pci: remove unused function to probe by address

The function rte_pci_probe_one is private to PCI and is
not used anywhere in current code base. Remove dead code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
5 years agobus/pci: remove unused unbind function prototype
Stephen Hemminger [Mon, 21 May 2018 16:41:50 +0000 (09:41 -0700)]
bus/pci: remove unused unbind function prototype

Prototype for pci_unbind_kernel_driver exists but no code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
5 years agobus/pci: make remove function static
Stephen Hemminger [Mon, 21 May 2018 16:41:49 +0000 (09:41 -0700)]
bus/pci: make remove function static

Only used in one file, and therefore can be made static.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
5 years agocmdline: remove useless intermediate buffer
David Marchand [Thu, 31 May 2018 08:03:28 +0000 (10:03 +0200)]
cmdline: remove useless intermediate buffer

Rather than copy the string, we can use a precision in the format string
given to printf.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
5 years agolog: remove useless intermediate buffer
David Marchand [Thu, 31 May 2018 08:03:27 +0000 (10:03 +0200)]
log: remove useless intermediate buffer

Rather than copy the log message, we can use a precision in the format
string given to syslog.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
5 years agoigb_uio: fail and log if kernel lock down is enabled
Ferruh Yigit [Wed, 16 May 2018 14:42:20 +0000 (15:42 +0100)]
igb_uio: fail and log if kernel lock down is enabled

When EFI secure boot is enabled, it is possible to lock down kernel and
prevent accessing device BARs and this makes igb_uio unusable.

Lock down patches are not part of the vanilla kernel but they are
applied and used by some distros already [1].

It is not possible to fix this issue, but intention of this patch is to
detect and log if kernel lock down enabled and don't insert the module
for that case.

The challenge is since this feature enabled by distros, they have
different config options and APIs for it. This patch is done based on
Fedora and Ubuntu kernel source, may needs to add more distro specific
support.

[1]
kernel.ubuntu.com/git/ubuntu/ubuntu-artful.git/commit/?id=99f9ef18d5b6
And a few more patches too.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
5 years agokni: fix build with gcc 8.1
Ferruh Yigit [Tue, 26 Jun 2018 11:38:07 +0000 (12:38 +0100)]
kni: fix build with gcc 8.1

Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is
enabled.

build error:
In function ‘strncpy’,
    inlined from ‘igb_get_drvinfo’ at
    kernel/linux/kni/igb_ethtool.c:814:2:
    include/linux/string.h:246:9: error: ‘__builtin_strncpy’ output
    may be truncated copying 31 bytes from a string of length 42
    [-Werror=stringop-truncation]
      return __builtin_strncpy(p, q, size);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixed by using strlcpy instead of strncpy.

adapter->fw_version size kept same because of
c3698192940c ("kni: fix build with gcc 7.1")

Also next line strncpy usage replaced with strlcpy while arround.

Fixes: c3698192940c ("kni: fix build with gcc 7.1")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
5 years agomaintainers: update for tep_termination example
Helin Zhang [Fri, 22 Jun 2018 09:13:59 +0000 (17:13 +0800)]
maintainers: update for tep_termination example

Xiaoyun Li has agreed to take over the maintainership of example
application tep_termination, as Jijiang Liu is no longer working
on that.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agomaintainers: update Intel sub-tree committers
Helin Zhang [Wed, 20 Jun 2018 10:37:02 +0000 (11:37 +0100)]
maintainers: update Intel sub-tree committers

For subtree of dpdk-next-net-intel, Qi Zhang has agreed to take
the committer role, to replace Helin Zhang. Also Beilei Xing has
agreed to be the backup committer of the subtree.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agobus/dpaa: fix build
Thomas Monjalon [Wed, 20 Jun 2018 10:38:06 +0000 (12:38 +0200)]
bus/dpaa: fix build

The DPAA bus driver is defining some macros without prefix.
So it can conflict with other libraries like libbsd:

drivers/bus/dpaa/include/compat.h:53:
error: "__packed" redefined
/usr/include/bsd/sys/cdefs.h:120:
note: this is the location of the previous definition

Fixes: 39f373cf015a ("bus/dpaa: add compatibility and helper macros")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
5 years agonet/ena: fix FreeBSD build
Michal Krawczyk [Tue, 19 Jun 2018 07:58:20 +0000 (09:58 +0200)]
net/ena: fix FreeBSD build

The FreeBSD define was removed from platform file when HAL was upgraded
to newer version.

In file included from drivers/net/ena/ena_ethdev.c:45:
from drivers/net/ena/ena_ethdev.h:42:
from drivers/net/ena/base/ena_com.h:37:
drivers/net/ena/base/ena_plat.h:48:2: error: "Invalid platform"

Fixes: 3adcba9a8987 ("net/ena: update HAL to the newer version")

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agoeventdev: fix Rx SW adapter stop
Nikhil Rao [Mon, 4 Jun 2018 12:55:17 +0000 (18:25 +0530)]
eventdev: fix Rx SW adapter stop

The Rx adapter stop call does not guarantee that the
SW service function will not execute after the
rte_event_eth_rx_adapter_stop() call.

Add a "started" flag to prevent the adapter from executing
if stop has been called.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
5 years agoeventdev: fix internal port logic in Rx adapter
Nikhil Rao [Sun, 3 Jun 2018 14:10:46 +0000 (19:40 +0530)]
eventdev: fix internal port logic in Rx adapter

Set the internal_event_port flag when the ethdev-eventdev
packet transfer is implemented in hardware and add a check
for the flag to ignore the connection when setting up the
WRR polling sequence.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
5 years agoeventdev: add event buffer flush in Rx adapter
Nikhil Rao [Sun, 3 Jun 2018 12:42:25 +0000 (18:12 +0530)]
eventdev: add event buffer flush in Rx adapter

Add an event buffer flush when the current invocation
of the Rx adapter is completed.

This patch provides lower latency in case there is a
BATCH_SIZE of events in the event buffer.

Cc: stable@dpdk.org
Suggested-by: Narender Vangati <narender.vangati@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
5 years agoeventdev: fix missing update to Rx adaper WRR position
Nikhil Rao [Sun, 3 Jun 2018 11:41:08 +0000 (17:11 +0530)]
eventdev: fix missing update to Rx adaper WRR position

After dequeuing Rx packets and enqueueing them to the
temporary buffer towards eventdev, the packet Rx loop exits
if the temporary buffer is full but the current WRR position
is not saved.

Save away the current value of the WRR position, so packets
are dequeued from the correct Rx queue in the next invocation.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Suggested-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
5 years agotest/eventdev: add multi-ports test
Vipin Varghese [Mon, 21 May 2018 13:53:55 +0000 (19:23 +0530)]
test/eventdev: add multi-ports test

Add a new test to enhance the test suite, to allow multiple eth ports
rx queue to be added to rx bridge adapter. Update the test function to
reflect change of port index from 8 to 16 bit

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
5 years agodoc: fix octeontx eventdev selftest argument
Jerin Jacob [Fri, 8 Jun 2018 03:32:27 +0000 (09:02 +0530)]
doc: fix octeontx eventdev selftest argument

Fixes: 3516327e00fd ("event/octeontx: add selftest to device arguments")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
5 years agodoc: improve eventdev library guide
Honnappa Nagarahalli [Wed, 6 Jun 2018 20:30:01 +0000 (15:30 -0500)]
doc: improve eventdev library guide

Add small amount of additional code, use consistent variable names
across code blocks, change the image to represent queues and
CPU cores intuitively. These help improve the eventdev library
documentation.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agoeventdev: fix port in Rx adapter internal function
Nikhil Rao [Tue, 22 May 2018 21:06:42 +0000 (02:36 +0530)]
eventdev: fix port in Rx adapter internal function

The dev_id parameter to fill_event_buffer() should be 16 bit,
also rename to to eth_dev_id to avoid confusion with event device
id elsewhere in the file.

Fixes: c2189c907dd1 ("eventdev: make ethdev port identifiers 16-bit")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
5 years agonet/mlx5: fix log initialization
Stephen Hemminger [Wed, 13 Jun 2018 18:46:26 +0000 (11:46 -0700)]
net/mlx5: fix log initialization

The mlx5 driver had two init functions, but this could
cause log initialization to be done after the
other initialization. Also, the name of the function does
not match convention (cut/paste error?).

Fix by initializing log type first at start of the pmd_init.
This also gets rid of having two constructor functions.

Fixes: a170a30d22a8 ("net/mlx5: use dynamic logging")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
5 years agonet/mlx5: fix crash in device probe
Xueming Li [Tue, 12 Jun 2018 11:38:11 +0000 (19:38 +0800)]
net/mlx5: fix crash in device probe

This patch initializes counter descriptor struct before invoking Verbs
api to avoid segmentation fault.

Fixes: 9a761de8ea14 ("net/mlx5: flow counter support")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
5 years agonet/mlx5: fix error message in probe function
Adrien Mazarguil [Fri, 25 May 2018 16:15:36 +0000 (18:15 +0200)]
net/mlx5: fix error message in probe function

Error values passed to strerror() must be positive.

Fixes: 012ad9944dfc ("net/mlx5: fix probe return value polarity")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
5 years agonet/mlx5: fix missing errno in probe function
Adrien Mazarguil [Thu, 24 May 2018 12:17:57 +0000 (14:17 +0200)]
net/mlx5: fix missing errno in probe function

Fixes: b43802b4bdfe ("net/mlx5: support 16 hardware priorities")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
5 years agonet/mlx5: fix errno object in probe function
Adrien Mazarguil [Thu, 24 May 2018 12:17:55 +0000 (14:17 +0200)]
net/mlx5: fix errno object in probe function

Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
5 years agonet/mlx5: remove limitation on number of instances
Adrien Mazarguil [Tue, 22 May 2018 15:37:01 +0000 (17:37 +0200)]
net/mlx5: remove limitation on number of instances

This artificial limitation was inherited from the mlx4 code base and has no
purpose other than adding unnecessary noise.

This patch is a port of commit f2318196c71a ("net/mlx4: remove limitation
on number of instances").

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
5 years agonet/mlx4: fix minor resource leak during init
Adrien Mazarguil [Tue, 22 May 2018 15:36:59 +0000 (17:36 +0200)]
net/mlx4: fix minor resource leak during init

Temporary IB device context and list are not freed in case of a successful
initialization of the device.

This issue is caused by the two following commits, the first of which
causes initialization to return early, while the second one goes a bit
overboard while switching to negative errno values; an internal variable
(err) is needed to tell success from failure at the end of the function
since rte_errno is not reliable enough.

Fixes: f2318196c71a ("net/mlx4: remove limitation on number of instances")
Fixes: 9d14b27308a0 ("net/mlx4: standardize on negative errno values")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
5 years agombuf: fix typo in IPv6 macro comment
Haiyue Wang [Thu, 14 Jun 2018 03:09:49 +0000 (11:09 +0800)]
mbuf: fix typo in IPv6 macro comment

Comment should mention IPv6, not IPv4.

Fixes: f295a00a2b44 ("mbuf: add definitions of unified packet types")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/bonding: fix MAC address reset
Kiran Kumar [Wed, 23 May 2018 09:11:21 +0000 (14:41 +0530)]
net/bonding: fix MAC address reset

Currently when resetting bond mac address, we are getting the
persisted mac address from slave info considering primary port
as index. But we need to compare the port id from slave info
with the primary port to get the primary slave index and get
the persisted mac address. Without this fix, persisted mac addr
will be zero and rte_eth_dev_default_mac_addr_set will fail.

Fixes: a45b288ef21a ("bond: support link status polling")
Cc: stable@dpdk.org
Signed-off-by: Kiran Kumar <kiran.kokkilagadda@caviumnetworks.com>
5 years agovhost: use SMP memory barrier before kicking guest
Maxime Coquelin [Thu, 7 Jun 2018 14:38:26 +0000 (16:38 +0200)]
vhost: use SMP memory barrier before kicking guest

vhost_vring_call() used rte_mb(), which translates into
mfence instruction on x86.

This patch changes to use rte_smp_mb(), which changed recently
to translate into a locked ADD instruction for performance
reason.

The measured gain is up to 3% with the testpmd benchmarks.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
5 years agovhost: introduce new function helper
Tonghao Zhang [Wed, 13 Jun 2018 11:54:18 +0000 (04:54 -0700)]
vhost: introduce new function helper

Introduce an new common helper to avoid redundancy.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agonet/ifc: enable the host notifier support
Tiwei Bie [Fri, 8 Jun 2018 03:22:24 +0000 (11:22 +0800)]
net/ifc: enable the host notifier support

The necessary vDPA ops have already been implemented
in ifcvf driver. So just need to announce the necessary
protocol features to enable the host notifier support.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost: support host notifier
Tiwei Bie [Fri, 8 Jun 2018 03:22:23 +0000 (11:22 +0800)]
vhost: support host notifier

When a vDPA device is attached, vhost user will try to
register host notifiers to QEMU to allow notifications
to be delivered between the driver in the guest and the
vDPA device in the host directly.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost: refine new device function
Tonghao Zhang [Fri, 8 Jun 2018 09:18:04 +0000 (02:18 -0700)]
vhost: refine new device function

Make sure find avalid device id before allocating
virtio_net, if not, return directly. It may avoid
allocating and freeing virtio_net when there is
not valid device id.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agonet/bonding: always update bonding link status
Chas Williams [Thu, 17 May 2018 23:22:52 +0000 (19:22 -0400)]
net/bonding: always update bonding link status

When the first ETH_LINK_UP slave is added to a bonding device, it is
immediately activated.  If these are polling slaves, there will be a
later link state event, when last_link_status doesn't match link_status.
But because this slave is already activated, the bonding device's link
status isn't updated.

To fix this, we always attempt to update the bonding device's link status
in the link state change callback.

Fixes: 46fb43683679 ("bond: add mode 4")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <chas3@att.com>
5 years agoapp/testpmd: fix crash when attaching a device
Adrien Mazarguil [Wed, 13 Jun 2018 16:27:43 +0000 (18:27 +0200)]
app/testpmd: fix crash when attaching a device

Below commit checks global device information to determine if a port uses
the softnic driver once initialized. Problem is that this information is
not available at this point when a port is initialized interactively
through a "port attach XXX" command, crashing testpmd.

This patch systematically initializes global device information to address
this issue.

Fixes: 5b590fbe09b6 ("app/testpmd: add traffic management forwarding mode")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agonet/vhost: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:48 +0000 (22:20 +0100)]
net/vhost: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/szedata2: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:47 +0000 (22:20 +0100)]
net/szedata2: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/softnic: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:46 +0000 (22:20 +0100)]
net/softnic: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/nfp: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:45 +0000 (22:20 +0100)]
net/nfp: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/liquidio: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:44 +0000 (22:20 +0100)]
net/liquidio: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
5 years agonet/kni: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:43 +0000 (22:20 +0100)]
net/kni: add to meson build

Since the kni library is an optional library, we need to add a check
here to ensure that the kni wrapper PMD is only built when the main kni
lib is being built.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/failsafe: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:40 +0000 (22:20 +0100)]
net/failsafe: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/ena: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:39 +0000 (22:20 +0100)]
net/ena: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/cxgbe: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:38 +0000 (22:20 +0100)]
net/cxgbe: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/bnxt: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:37 +0000 (22:20 +0100)]
net/bnxt: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/bnx2x: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:36 +0000 (22:20 +0100)]
net/bnx2x: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/avp: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:35 +0000 (22:20 +0100)]
net/avp: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
5 years agonet/ark: add to meson build
Bruce Richardson [Fri, 8 Jun 2018 21:20:34 +0000 (22:20 +0100)]
net/ark: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/ifc: add to meson build
Xiao Wang [Wed, 13 Jun 2018 11:32:46 +0000 (19:32 +0800)]
net/ifc: add to meson build

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
5 years agonet/ifc: make driver name consistent
Xiao Wang [Wed, 13 Jun 2018 11:32:45 +0000 (19:32 +0800)]
net/ifc: make driver name consistent

Make the compiler switch name and document name consistent as ``ifc`` to
avoid confusion. Also rename the map file to standard name for meson
build in the process.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agoethdev: force RSS offload rules again
Ferruh Yigit [Thu, 31 May 2018 13:22:45 +0000 (14:22 +0100)]
ethdev: force RSS offload rules again

PMDs should provide supported RSS hash functions via
dev_info.flow_type_rss_offloads variable.

There is a check in ethdev if requested RSS hash function is supported
by PMD or not.
This check has been relaxed in previous release to not return an error
when a non supported has function requested [1], this has been done to
not break the applications.

Adding the error return back.
PMDs need to provide correct list of supported hash functions and
applications need to take care this information before configuring
the RSS otherwise they will get an error from APIs:
rte_eth_dev_rss_hash_update()
rte_eth_dev_configure()

[1] commit af7551e2bfce ("ethdev: remove error return on RSS hash check")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
5 years agoethdev: force offloading API rules
Ferruh Yigit [Thu, 31 May 2018 12:44:30 +0000 (13:44 +0100)]
ethdev: force offloading API rules

The error path was disabled in previous release to let apps to be more
flexible.

But this release they are enabled, applications have to obey offload API
rules otherwise they will get errors from following APIs:
rte_eth_dev_configure
rte_eth_rx_queue_setup
rte_eth_tx_queue_setup

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
5 years agonet/nfp: fix field initialization in Tx descriptor
Alejandro Lucero [Mon, 11 Jun 2018 09:50:37 +0000 (10:50 +0100)]
net/nfp: fix field initialization in Tx descriptor

TX descriptor eop_offset field is not initialized and it could
contain garbage. This patch fixes the potential problem setting
EOP as the only subfield. The other subfield, data offset, is
not used by now.

Fixes: b812daadad0d ("nfp: add Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
5 years agonet/cxgbe: implement flow flush operation
Shagun Agrawal [Fri, 8 Jun 2018 17:58:17 +0000 (23:28 +0530)]
net/cxgbe: implement flow flush operation

Add API to flush all the filters under specified port.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: implement flow query operation
Shagun Agrawal [Fri, 8 Jun 2018 17:58:16 +0000 (23:28 +0530)]
net/cxgbe: implement flow query operation

Add API to query filter hit and byte counts from hardware.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: implement flow destroy operation
Shagun Agrawal [Fri, 8 Jun 2018 17:58:15 +0000 (23:28 +0530)]
net/cxgbe: implement flow destroy operation

Add API to construct delete filter work request to remove filter
at specified index in LE-TCAM (maskfull) region.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: implement flow create operation
Shagun Agrawal [Fri, 8 Jun 2018 17:58:14 +0000 (23:28 +0530)]
net/cxgbe: implement flow create operation

Define filter work request API used to construct filter operations
to be communicated with firmware. These requests are sent via
control queue and completions come asynchronously in firmware event
queue.

Implement flow create operation to create filters in LE-TCAM
(maskfull) region at specified index.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: add control queue to communicate filter requests
Shagun Agrawal [Fri, 8 Jun 2018 17:58:13 +0000 (23:28 +0530)]
net/cxgbe: add control queue to communicate filter requests

Add control queue to communicate filter creation/deletion requests
with firmware. This API will be used by subsequent patches.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: parse and validate flows
Shagun Agrawal [Fri, 8 Jun 2018 17:58:12 +0000 (23:28 +0530)]
net/cxgbe: parse and validate flows

Introduce rte_flow skeleton and implement validate operation.

Parse and convert <item>, <action>, <attributes> into hardware
specification. Perform validation, including basic sanity tests
and underlying device's supported filter capability checks.

Currently add support for:
<item>: IPv4, IPv6, TCP, and UDP.
<action>: Drop, Queue, and Count.

Also add sanity checks to ensure filters are created at specified
index in LE-TCAM region. The index in LE-TCAM region indicates
the filter rule's priority with index 0 having the highest priority.
If no index is specified, filters are created at closest available
free index.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/cxgbe: query firmware for filter resources
Shagun Agrawal [Fri, 8 Jun 2018 17:58:11 +0000 (23:28 +0530)]
net/cxgbe: query firmware for filter resources

Fetch available filter resources from firmware and allocate table for
book-keeping and managing filters in hardware. Also define the hardware
filter specification (ch_filter_specification) used to describe each
filter rule.

Signed-off-by: Shagun Agrawal <shaguna@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
5 years agonet/nfp: fix unused header reference
Alejandro Lucero [Mon, 11 Jun 2018 11:20:46 +0000 (12:20 +0100)]
net/nfp: fix unused header reference

Apart from not being used, this is causing problem when compiling
DPDK with the musl library as reported by bugzilla.

Bugzilla ID: 40
Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Cc: stable@dpdk.org
Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
5 years agonet/ena: set link speed as none
Rafal Kozik [Thu, 7 Jun 2018 09:43:22 +0000 (11:43 +0200)]
net/ena: set link speed as none

Link speed should is not limited to 10Gb/s and it shouldn't be hardcoded.

They link speed is set to none instead and the applications shouldn't
rely on this value when using ENA PMD.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: store handle after memory allocation
Michal Krawczyk [Thu, 7 Jun 2018 09:43:21 +0000 (11:43 +0200)]
net/ena: store handle after memory allocation

The pointer received from rte_memzone_reserve from macro
ENA_MEM_ALLOC_COHERENT_NODE was not stored anywhere, and as a result
memory allocated by this macro could not been released.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: fix GENMASK_ULL macro
Rafal Kozik [Thu, 7 Jun 2018 09:43:20 +0000 (11:43 +0200)]
net/ena: fix GENMASK_ULL macro

When use GENMASK_ULL(63,0) left shift by 64 bits is performed.
Shifting by number greater or equal then word length
is undefined operation and failed on some platforms.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: change memory type
Rafal Kozik [Thu, 7 Jun 2018 09:43:19 +0000 (11:43 +0200)]
net/ena: change memory type

ENA_MEM_ALLOC_NODE not need to use contiguous physical memory.
Also using memset without checking if allocation succeed can cause
segmentation fault.

To avoid both issue use rte_zmalloc_socket.

Fixes: 3d3edc265fc8 ("net/ena: make coherent memory allocation NUMA-aware")
Cc: stable@dpdk.org
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: check pointer before memset
Rafal Kozik [Thu, 7 Jun 2018 09:43:18 +0000 (11:43 +0200)]
net/ena: check pointer before memset

Need to check if memory allocation succeed before using it.
Using memset on NULL pointer cause segfault.

Fixes: 9ba7981ec992 ("ena: add communication layer for DPDK")
Cc: stable@dpdk.org
Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: update NUMA node
Rafal Kozik [Thu, 7 Jun 2018 09:43:17 +0000 (11:43 +0200)]
net/ena: update NUMA node

During initializing Tx queues update Non-Uniform Memory Access
configuration in NIC firmware.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: adjust error checking and cleaning
Rafal Kozik [Thu, 7 Jun 2018 09:43:16 +0000 (11:43 +0200)]
net/ena: adjust error checking and cleaning

Adjust error checking and cleaning to Linux driver:
 * add checking if MTU is to small,
 * fix error messages (mismatched Rx and Tx),
 * return error received from base driver or proper error
   code instead of -1,
 * in case of error release occupied resources,
 * in case of Rx error trigger NIC reset.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: add (un)likely statements
Rafal Kozik [Thu, 7 Jun 2018 09:43:15 +0000 (11:43 +0200)]
net/ena: add (un)likely statements

Add likely and unlikely statements to increase performance.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: validate Tx req id
Rafal Kozik [Thu, 7 Jun 2018 09:43:14 +0000 (11:43 +0200)]
net/ena: validate Tx req id

Validate Tx req id during clearing completed packets.
If id is wrong, trigger NIC reset.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: rework configuration of IO queue numbers
Rafal Kozik [Thu, 7 Jun 2018 09:43:13 +0000 (11:43 +0200)]
net/ena: rework configuration of IO queue numbers

Move configuration of IO queue numbers to separate function and take
into consideration max number of IO completion queues.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: log unimplemented handler error
Rafal Kozik [Thu, 7 Jun 2018 09:43:12 +0000 (11:43 +0200)]
net/ena: log unimplemented handler error

Enable AENQ FATAL_ERROR and WARNING callbacks by setting flags
in aenq_groups. They are handled by "unimplemented handler".

If unimplemented handler is called, error is logged.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: add info about max number of Tx/Rx descriptors
Rafal Kozik [Thu, 7 Jun 2018 09:43:11 +0000 (11:43 +0200)]
net/ena: add info about max number of Tx/Rx descriptors

In function ena_infos_get driver provides information about minimal
and maximal number of Rx and Tx descriptors.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: linearize Tx mbuf
Rafal Kozik [Thu, 7 Jun 2018 09:43:10 +0000 (11:43 +0200)]
net/ena: linearize Tx mbuf

Function ena_check_and_linearize_mbuf check Tx mbuf for number of
segments and linearize (defragment) it if necessary. It is called
before sending each packet.

Information about maximum number of segments is stored per each ring.

Maximum number of segments supported by NIC is taken from ENA COM in
ena_calc_queue_size function and stored in adapter structure.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: add Rx out of order completion
Michal Krawczyk [Thu, 7 Jun 2018 09:43:09 +0000 (11:43 +0200)]
net/ena: add Rx out of order completion

This feature allows Rx packets to be cleaned up out of order.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: make watchdog configurable
Rafal Kozik [Thu, 7 Jun 2018 09:43:08 +0000 (11:43 +0200)]
net/ena: make watchdog configurable

Add variable wd_state to make driver functional without keep alive
AENQ handler.
The watchdog will be executed only if the aenq group has keep alive
enabled.

Signed-off-by: Rafal Kozik <rk@semihalf.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: check for admin queue state
Michal Krawczyk [Thu, 7 Jun 2018 09:43:07 +0000 (11:43 +0200)]
net/ena: check for admin queue state

The admin queue can stop responding or became inactive due to unexpected
behaviour of the device. In that case, the whole device should be
restarted.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: add watchdog and keep alive AENQ handler
Michal Krawczyk [Thu, 7 Jun 2018 09:43:06 +0000 (11:43 +0200)]
net/ena: add watchdog and keep alive AENQ handler

Keep alive is executing AENQ interrupt periodically. It allows to check
health of the device and trigger reset event if the device will stop
responding.

To check for the state of the device, the DPDK application must call
rte_timer_manage().

Signed-off-by: Michal Krawczyk <mk@semihalf.com>