Documents the assumption that 'xstats[i].id == i' and
key=xstats_names[i].name, value=xstats[i].value
xstats[i].id is still used for xstats _by_id() APIs.
This patch reverts some part of the commit 6d52d1d4af ("ethdev:
clarify extended statistics documentation")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
DEV_RX_OFFLOAD_KEEP_CRC offload flag is added. PMDs that support
keeping CRC should advertise this offload capability.
DEV_RX_OFFLOAD_CRC_STRIP flag will remain one more release
default behavior in PMDs are to keep the CRC until this flag removed
Until DEV_RX_OFFLOAD_CRC_STRIP flag is removed:
- Setting both KEEP_CRC & CRC_STRIP is INVALID
- Setting only CRC_STRIP PMD should strip the CRC
- Setting only KEEP_CRC PMD should keep the CRC
- Not setting both PMD should keep the CRC
A helper function rte_eth_dev_is_keep_crc() has been added to be able to
change the no flag behavior with minimal changes in PMDs.
The PMDs that doesn't report the DEV_RX_OFFLOAD_KEEP_CRC offload can
remove rte_eth_dev_is_keep_crc() checks next release, related code
commented to help the maintenance task.
And DEV_RX_OFFLOAD_CRC_STRIP has been added to virtual drivers since
they don't use CRC at all, when an application requires this offload
virtual PMDs should not return error.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Introduce an helper for PMD to expand easily flows items list with RSS
action into multiple flow items lists with priority information.
For instance a user items list being "eth / end" with rss action types
"ipv4-udp ipv6-udp end" needs to be expanded into three items lists:
- eth
- eth / ipv4 / udp
- eth / ipv6 / udp
to match the user request. Some drivers are unable to reach such
request without this expansion, this API is there to help those.
Only PMD should use such API for their internal cooking, the application
will still handle a single flow.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
COUNT action has been modified and has several fields not addressable
though testpmd. In addition, as those fields are not definable testpmd
is providing an empty configuration which is undefined.
Fixes: fb8fd96d42 ("ethdev: add shared counter to flow API")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Replace RTE_PMD_DEBUG_TRACE with RTE_ETHDEV_LOG.
RTE_PMD_DEBUG_TRACE is using hardcoded PMD logtype and ERR log level,
controlled by compile time flags.
RTE_ETHDEV_LOG is using dynamic ethdev_logtype.
Also a few minor cleanups, like
- use %u for unsigned values like port_id which is uint16_t
- use PRIx64 for owner_id
- Join some log lines
- Unify to not have a "." at the end of the log
- Unify log start with uppercase
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Macro moved to header to be able to convert logging usage in header.
And since it has been moved to public header changed naming and added
RTE prefix, ethdev_log -> RTE_ETHDEV_LOG
Also need to add logtype variable to map file since logging macro used
from other libraries.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
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 af7551e2bf ("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>
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>
The rte_tm_get_number_of_leaf_nodes() API function was added in DPDK
17.08. However, it was added to the .map file with the wrong function
name (rte_tm_get_leaf_nodes), which was subsequently removed in commit
3e8ea3d ('lib: remove unused map symbols').
Add it back under the 17.08 release with the correct function name.
Fixes: 5d109deffa ("ethdev: add traffic management API")
Cc: stable@dpdk.org
Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Change adds extra information on name parameter for API
rte_eth_dev_get_name_by_port and rte_eth_dev_get_port_by_name.
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Like original commit mentioned below, this fix synchronizes flow rule copy
function with testpmd's own implementation following "app/testpmd: fix copy
of raw flow item (revisited)".
It addresses a crash that occurs when feeding a RAW pattern item to
rte_flow_copy(). Besides external applications, two PMDs (bonding and
failsafe) rely on this function internally.
Note the scope of this patch is limited to the RAW pattern item and has no
impact on all others.
Fixes: 972bf36106 ("ethdev: fix shallow copy of flow API RSS action")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
eth_dev_last_created_port is used to store port id type and should
be extended to 16bits corresponding to ethdev port id range.
Fixes: f8244c6399 ("ethdev: increase port id range")
Cc: stable@dpdk.org
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
GCC 8.1 warned:
In function 'rte_eth_rx_burst':
rte_ethdev.h:3836:18: warning: conversion to 'int16_t'
{aka 'short int'} from 'uint16_t' {aka 'short unsigned int'}
may change the sign of the result [-Wsign-conversion]
int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
^
rte_ethdev.h:3844:50: warning: conversion to 'uint16_t'
{aka 'short unsigned int'} from 'int16_t' {aka 'short int'}
may change the sign of the result [-Wsign-conversion]
nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
^~~~~
rte_ethdev.h:3844:12: warning: conversion to 'int16_t'
{aka 'short int'} from 'uint16_t' {aka 'short unsigned int'}
may change the sign of the result [-Wsign-conversion]
nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
^~
rte_ethdev.h:3851:9: warning: conversion to 'uint16_t'
{aka 'short unsigned int'} from 'int16_t' {aka 'short int'}
may change the sign of the result [-Wsign-conversion]
return nb_rx;
^~~~~
The second part of the patch is solved by its own basic
block because it is inside a preprocessor conditional.
Bringing the declaration of the var to the top of the
function would require that also being given its own
preprocessor conditional, or a (void)var to avoid an
unused var warning. The basic block is no worse than
those imho.
Fixes: 467465d86d ("ethdev: add packet count parameter to Rx callback")
Fixes: 4dc294158c ("ethdev: support optional Rx and Tx callbacks")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
GCC 8.1 produces a warning:
rte_ethdev.h: In function 'rte_eth_rx_queue_count':
rte_ethdev.h:3882:10: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the result [-Wsign-conversion]
return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: 33cf6be04d ("ethdev: add sanity checks to functions")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Description of rte_eth_dev_get_name_by_port() calls
port ID argument a pointer, which is misleading.
Also, output buffer minimal size is not mentioned.
These points need to be improved.
Fixes: bde516d5a8 ("ethdev: get port by name")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Relax the check for queue setup, since some device
may not update queue states during dev_stop.
Fixes: cac923cfea ("ethdev: support runtime queue setup")
Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
When an ethdev port is released, a destroy event is triggered to notify
the users about the released port.
A bit before the destroy event is triggered, the port becomes invalid
by changing its state to UNUSED and cleaning its data. Therefore, the
port is invalid for the destroy event callback process and the users
may get a wrong information of the port.
Move the destroy event emitting to be called before the port
invalidation.
Fixes: 133b54779a ("ethdev: fix port data reset timing")
Fixes: 29aa41e36d ("ethdev: add notifications for probing and removal")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
The new device was notified as soon as it was allocated.
It leads to use a device which is not yet initialized.
The notification must be published after the initialization is done
by the PMD, but before the state is changed, in order to let
notified entities taking ownership before general availability.
Fixes: 29aa41e36d ("ethdev: add notifications for probing and removal")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
The port was set to the state ATTACHED during allocation.
The consequence was to iterate over ports which are not initialized.
The state ATTACHED is now set as the last step of probing.
The uniqueness of port name is now checked before the availability
of a port id for allocation (order reversed).
As the state is not set on allocation anymore, it is also not checked
in the function telling whether a port is allocated or not.
The name of the port is set on allocation, so it is enough as a check.
Fixes: 5588909af2 ("ethdev: add device iterator")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
When comparing the port name, there can be a race condition with
a thread allocating a new port and writing the name at the same time.
It can lead to match with a partial name by error.
The check of the port is now considered as a critical section
protected with locks.
This fix will be even more required for multi-process when the
port availability will rely only on the name, in a following patch.
Fixes: 84934303a1 ("ethdev: synchronize port allocation")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
When the state will be updated later than in allocation,
we may need to update the ownership of a port which is
still in state unused.
It will be used to take ownership of a port before it is
declared as available for other entities.
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
A new hook function is added and called inside the PMDs at the end
of the device probing:
- in primary process, after allocating, init and config
- in secondary process, after attaching and local init
This new function is almost empty for now.
It will be used later to add some post-initialization processing.
For the PMDs calling the helpers rte_eth_dev_create() or
rte_eth_dev_pci_generic_probe(), the hook rte_eth_dev_probing_finish()
is called from here, and not in the PMD itself.
Note that the helper rte_eth_dev_create() could be used more,
especially for vdevs, avoiding some code duplication in PMDs.
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
The enum rte_eth_dev_state was not properly documented.
Its values did not appear in the doxygen output,
and may be misunderstood.
The state RTE_ETH_DEV_DEFERRED has no interest anymore
since the ownership mechanism brings a more flexible categorization.
This state could be removed later.
Fixes: d52268a8b2 ("ethdev: expose device states")
Fixes: cb894d99ec ("ethdev: add deferred intermediate device state")
Fixes: 5b7ba31148 ("ethdev: add port ownership")
Fixes: 7106edc123 ("ethdev: add devop to check removal status")
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
The owner id is 64-bit.
On 32-bit environment, it must be printed with PRIX64.
Fixes: 5b7ba31148 ("ethdev: add port ownership")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
This patch check if a input requested offloading is valid or not.
Any reuqested offloading must be supported in the device capabilities.
Any offloading is disabled by default if it is not set in the parameter
dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup().
If any offloading is enabled in rte_eth_dev_configure() by application,
it is enabled on all queues no matter whether it is per-queue or
per-port type and no matter whether it is set or cleared in
[rt]x_conf->offloads to rte_eth_[rt]x_queue_setup().
If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(),
it can be enabled or disabled for individual queue in
ret_eth_[rt]x_queue_setup().
A new added offloading is the one which hasn't been enabled in
rte_eth_dev_configure() and is reuqested to be enabled in
rte_eth_[rt]x_queue_setup(), it must be per-queue type,
otherwise trigger an error log.
The underlying PMD must be aware that the requested offloadings
to PMD specific queue_setup() function only carries those
new added offloadings of per-queue type.
This patch can make above such checking in a common way in rte_ethdev
layer to avoid same checking in underlying PMD.
This patch assumes that all PMDs in 18.05-rc2 have already
converted to offload API defined in 17.11 . It also assumes
that all PMDs can return correct offloading capabilities
in rte_eth_dev_infos_get().
In the beginning of [rt]x_queue_setup() of underlying PMD,
add offloads = [rt]xconf->offloads |
dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API
defined in 17.11 to avoid upper application broken due to offload
API change.
PMD can use the info that input [rt]xconf->offloads only carry
the new added per-queue offloads to do some optimization or some
code change on base of this patch.
Signed-off-by: Wei Dai <wei.dai@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Calling dev_infos_get() devops directly in rte_eth_dev_configure cause
random values in uninitialized fields because devops doesn't reset the
dev_info structure.
Call rte_eth_dev_info_get() API instead which memset the struct.
Also remove duplicated dev_infos_get existence check.
Fixes: 3be82f5cc5 ("ethdev: support PMD-tuned Tx/Rx parameters")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Tx offload will be converted to txq_flags automatically during
rte_eth_dev_info_get and rte_eth_tx_queue_info_get. So PMD can
clean the code to get rid of txq_flags at all while keep old APP
not be impacted.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Remove version tag from experimental block in linker version scripts
(.map files).
That label is not used by linker and information only. It is useful
for version blocks but not useful for experimental block but confusing.
Removing those labels.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
In function 'rte_eth_tx_buffer_flush':
rte_ethdev.h:4248:55:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
buffer->error_callback(&buffer->pkts[sent], to_send - sent,
Fixes: d6c99e62c8 ("ethdev: add buffered Tx")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
WRED thresholds can be specified in bytes if the TM leaf
node supports it. Also extend WRED thresholds to 32 bits from 16.
TM capability (port/level/queue) fields cman_wred_packet_mode_supported and
cman_wred_byte_mode_supported, when non-zero, indicate support for WRED
thresholds in packets and bytes respectively.
The packet_mode member of struct rte_tm_wred_params, when non-zero,
indicates that the min and max thresholds are specified in
packets and when zero, indicates that the min and max thresholds
are specified in bytes.
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
The rte_tm_node_wfq_weight_mode_update() API function operates on
non-leaf nodes, not leaf nodes.
Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Many sample applications fail because of
dev_info.flow_type_rss_offloads check in rte_eth_dev_configure()
The sample applications need to be fixed/updated before returning error
on rte_eth_dev_configure() and rte_eth_dev_rss_hash_update().
This patch keeps the error logs but removes returning errors.
Fixes: 8863a1fbfc ("ethdev: add supported hash function check")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Library folder name and output library name are same except a few flaws
including librte_ether.
This library is network device abstraction layer, the name "ethdev" fits
better than "ether", and library & header files already named as ethdev.
Also there is a rte_ether.h in the net library which can cause confusion.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>