Commit Graph

36 Commits

Author SHA1 Message Date
Michal Krawczyk
2732e07ad1 net/ena: cleanup if refilling of Rx descriptors fails
If wrong number of descriptors for refilling was passed to the Rx
repopulate function, there was memory leak which caused memory pool to
run out of resources in longer go.

In case of fail when refilling Rx descriptors, all additional mbufs
have to be released.

Fixes: 1173fca25a ("ena: add polling-mode driver")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Jakub Palider <jpalider@gmail.com>
Acked-by: Jan Medala <jan.medala@outlook.com>
2017-04-19 15:37:37 +02:00
Michal Krawczyk
ec78af6bc0 net/ena: fix delayed cleanup of Rx descriptors
On RX path, after receiving bunch of packets, variable tracking
available descriptors in HW queue was not updated.

To fix this issue, variable tracking used descriptors must be updated
after receiving packets - it must be reduced by the amount of received
descriptors in current batch.

Additionally, variable next_to_clean in rx_ring must be updated before
entering ena_populate_rx_queue() to keep it up to date with the current
ring state.

Fixes: 1daff5260f ("net/ena: use unmasked head and tail")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Jakub Palider <jpalider@gmail.com>
Acked-by: Jan Medala <jan.medala@outlook.com>
2017-04-19 15:37:37 +02:00
Michal Krawczyk
a467e8f37a net/ena: fix Rx descriptors allocation
When application tried to allocate 1024 descriptors, device was not
initializing properly.

This patch solves it by avoiding allocation of all descriptors in the
ring in one attempt. At least one descriptor must remain unused in the
HW ring.

Fixes: 1173fca25a ("ena: add polling-mode driver")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Jakub Palider <jpalider@gmail.com>
Acked-by: Jan Medala <jan.medala@outlook.com>
2017-04-19 15:37:37 +02:00
Jan Blunck
fdf91e0f2f drivers/net: do not use ethdev driver
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-18 19:05:46 +02:00
Olivier Matz
1f88c0a22b mbuf: make raw free function public
Rename __rte_mbuf_raw_free() as rte_mbuf_raw_free() and make
it public. The old function is kept for compat but is marked as
deprecated.

The next commit changes the behavior of rte_mbuf_raw_free() to
make it more consistent with rte_mbuf_raw_alloc().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 11:30:29 +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
Ferruh Yigit
f2462150ec drivers/net: remove redundant new line from logs
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-01-30 22:18:27 +01:00
Ferruh Yigit
28a1fd4fd0 drivers/net: make PCI device id struct const
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-01-30 22:18:26 +01:00
Jakub Palider
83277a7ccc net/ena: prepare TSO offload calculation
While ENA can handle checksum calculations in almost all cases,
it cannot do so when DF bit in IPv4 header is not set,
that is DF=0, and TSO is requested. For that situation pseudo
header must be prepared manually.

Signed-off-by: Jakub Palider <jpa@semihalf.com>
2017-01-30 22:18:26 +01:00
Ferruh Yigit
103ab18c0f net/ena: make ethdev functions struct const
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-17 19:41:43 +01:00
Jakub Palider
4eea092b71 net/ena: use correct field for Rx offload features
Previously the capability bitmap for Rx offloads was mistakenly taken
from Tx capability bitmap field. This patch fixes the problem.

Signed-off-by: Jakub Palider <jpa@semihalf.com>
2017-01-17 19:40:52 +01:00
Konstantin Ananyev
b3fc5a1ae1 net/ena: add Tx preparation
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-04 20:40:26 +01:00
Jan Blunck
eac901ce29 ethdev: decouple from PCI device
This makes struct rte_eth_dev independent of struct rte_pci_device by
replacing it with a pointer to the generic struct rte_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:30:19 +01:00
Jan Blunck
ae34410a8a ethdev: move info filling of PCI into drivers
Only the drivers itself can decide if it could fill PCI information fields
of dev_info.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:25:42 +01:00
Olivier Matz
0880c40113 drivers: advertise kmod dependencies in pmdinfo
Add a new macro RTE_PMD_REGISTER_KMOD_DEP() that allows a driver to
declare the list of kernel modules required to run properly.

Today, most PCI drivers require uio/vfio.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-12-20 18:26:00 +01:00
Jakub Palider
b66b6e72bb net/ena: check for free buffers prior Tx
Signed-off-by: Tal Avraham <talavr@annapurnalabs.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
2016-11-07 17:56:14 +01:00
Jakub Palider
1daff5260f net/ena: use unmasked head and tail
The next_to_clean and next_to_use ring pointers sometimes were kept
wrapped around ring size, sometimes used beyond this limit. From now
on we increment them without regard to ring size limits, but when
reading the values they are wrapped accordingly. Moreover unit16_t
are unsed whenever possible.

Signed-off-by: Tal Avraham <talavr@annapurnalabs.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>
2016-11-07 17:55:41 +01:00
Shreyansh Jain
01f1922786 drivers: rename register macro prefix
All macros related to driver registeration renamed from DRIVER_*
to RTE_PMD_*

This includes:

 DRIVER_REGISTER_PCI -> RTE_PMD_REGISTER_PCI
 DRIVER_REGISTER_PCI_TABLE -> RTE_PMD_REGISTER_PCI_TABLE
 DRIVER_REGISTER_VDEV -> RTE_PMD_REGISTER_VDEV
 DRIVER_REGISTER_PARAM_STRING -> RTE_PMD_REGISTER_PARAM_STRING
 DRIVER_EXPORT_* -> RTE_PMD_EXPORT_*

Fix PMDINFOGEN tool to look for matches of RTE_PMD_REGISTER_*.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-10-14 01:49:32 +02:00
John W. Linville
103bb1cc29 net/ena: improve safety of string handling
Use sizeof dest rather than sizeof src for limiting copy length,
and replace strncpy with snprintf to ensure NULL termination.

Coverity issue: 127795
Fixes: 372c1af5ed ("net/ena: add dedicated memory area for extra device info")

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 15:30:59 +02:00
Jan Viktorin
2f3193cf0f pci: inherit common driver in PCI driver
Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.

Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-03 16:33:55 +02:00
David Marchand
c830cb2954 drivers: use PCI registration macro
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.

Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
  steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.

Update documentation for replacing an example referring to
PMD_REGISTER_DRIVER.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-10-03 16:33:23 +02:00
David Marchand
c76a6d356f drivers: align PCI driver definitions
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-10-03 16:33:09 +02:00
Pablo de Lara
2f45703c17 drivers: make driver names consistent
As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.

Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".

For example:
- Crypto null driver       -> "crypto_null"
- Network IXGBE VF driver  -> "net_ixgbe_vf"

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-09-16 11:55:59 +02:00
David Marchand
cb99057168 net/ena: remove unneeded PCI macro
I suppose this is a remnant of rte_pci_dev_ids.h, just remove this.

Signed-off-by: David Marchand <david.marchand@6wind.com>
2016-07-11 17:48:49 +02:00
Jan Medala
5e02e19eb1 net/ena: fix unneeded doorbell submission
Avoid submitting doorbell when:
* no packets have been submitted to TX
* no free resources have been submitted while RX

Sending doorbell without actual work to be performed by device
violates ENA specification and can lead to unpredictable behavior.

Fixes: 1173fca25a ("ena: add polling-mode driver")

Signed-off-by: Alexander Matushevsky <matua@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
2016-07-08 23:03:59 +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
c414455701 net/ena: disable readless communication when no HW support
Depending on HW revision readless communcation between host and device
may be unavailable. In that case prevent PMD from setting up readless
communication mechanism.

"readless" refers to ability to read ENA registers without actually
issuing read request from host (x86). Instead, host programs 2 registers
on the device that triggers a DMA from device to host and reports a
register value. However, this functionality is not going to be available
in all types of devices. The decision if this mode is supported or not,
is taken from revision_id in pci configuration space.

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
372c1af5ed net/ena: add dedicated memory area for extra device info
Increase maintenance and debug potentiality with dedicated areas of memory
where additional information can be stored by the ENA device.

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
Pablo de Lara
bae696ebd4 drivers: remove static driver names
Since now the PMD_REGISTER_DRIVER macro sets the driver names,
there is no need to have the rte_driver structure setting it
statically, as it will get overridden.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2016-07-10 14:51:09 +02:00
Neil Horman
cb6696d220 drivers: update registration macro usage
Modify the PMD_REGISTER_DRIVER macro, adding a name argument to it.  The
addition of a name argument creates a token that can be used for subsequent
macros in the creation of unique symbol names to export additional bits of
information for use by the pmdinfogen tool.  For example:

PMD_REGISTER_DRIVER(ena_driver, ena);

registers the ena_driver struct as it always did, and creates a symbol
const char this_pmd_name0[] __attribute__((used)) = "ena";

which pmdinfogen can search for and extract.  The subsequent macro

DRIVER_REGISTER_PCI_TABLE(ena, ena_pci_id_map);

creates a symbol const char ena_pci_tbl_export[] __attribute__((used)) =
"ena_pci_id_map";

Which allows pmdinfogen to find the pci table of this driver

Using this pattern, we can export arbitrary bits of information.

pmdinfo uses this information to extract hardware support from an object
file and create a json string to make hardware support info discoverable
later.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2016-07-06 23:21:40 +02:00
Thomas Monjalon
a61dc000d5 ethdev: remove deprecated statistics
Some statistics were deprecated since release 2.1 (49f386542a).
The last deprecated counter to be used was imcasts.

The VF loopback statistics are also removed as they are used only
in igb and duplicated in extended statistics.

The new counters should be added to extended statistics.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2016-04-20 13:49:31 +02:00
Thomas Monjalon
b2feed01d6 ethdev: add 100G link speed
The link speed configuration is now done with bitmaps so 100G speed
requires only a new bit flag.
The actual link speed is a number so its size must be increased from
16-bit to 32-bit.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Tested-by: Matej Vido <vido@cesnet.cz>
2016-04-01 21:38:34 +02:00
Marc Sune
e274f57322 ethdev: add speed capabilities
The speed capabilities of a device can be retrieved with
rte_eth_dev_info_get().

The new field speed_capa is initialized in the drivers without
taking care of device characteristics in this patch.
When the capabilities of a driver are accurate, the table in
overview.rst must be filled.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
2016-04-01 21:38:34 +02:00
Marc Sune
39fd068a27 ethdev: rename link speed constants
The speed numbers ETH_LINK_SPEED_ are renamed ETH_SPEED_NUM_.
The prefix ETH_LINK_SPEED_ is kept for AUTONEG and will be used
for bit flags in next patch.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
2016-04-01 21:38:34 +02:00
Jan Medala
1173fca25a ena: add polling-mode driver
This is a PMD for the Amazon ethernet ENA (Elastic Network Adapters)
family.
The driver operates variety of ENA adapters through feature negotiation
with the adapter and upgradable commands set.
ENA driver handles PCI Physical and Virtual ENA functions.

Signed-off-by: Evgeny Schemeilin <evgenys@amazon.com>
Signed-off-by: Jan Medala <jan@semihalf.com>
Signed-off-by: Jakub Palider <jpa@semihalf.com>

Release Note addition:
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2016-03-25 18:56:43 +01:00