These functions share a significant amount of code and require extra
internal objects to parse and build flow rule handles.
All this can be simplified by relying directly on the internal rte_flow
structure definition, whose QP pointer (destination Verbs queue) is
replaced by a DPDK queue ID and other properties, making it more versatile
without increasing its size (at least on 64-bit platforms).
This commit also gets rid of a few unnecessary debugging messages.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
These wrappers implement the ability to allocate room for several disparate
objects as a single contiguous allocation while complying with their
respective alignment constraints.
This is usually more efficient than allocating and freeing them
individually if they are not expected to be reallocated with rte_realloc().
A typical use case is when several objects that cannot be dissociated must
be allocated together, as shown in the following example:
struct b {
...
struct d *d;
}
struct a {
...
struct b *b;
struct c *c;
}
struct mlx4_malloc_vec vec[] = {
{ .size = sizeof(struct a), .addr = &ptr_a, },
{ .size = sizeof(struct b), .addr = &ptr_b, },
{ .size = sizeof(struct c), .addr = &ptr_c, },
{ .size = sizeof(struct d), .addr = &ptr_d, },
};
if (!mlx4_mallocv(NULL, vec, RTE_DIM(vec)))
goto error;
struct a *a = ptr_a;
a->b = ptr_b;
a->c = ptr_c;
a->b->d = ptr_d;
...
rte_free(a);
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Relying on rte_errno is not necessary where the return value of
rte_flow_error_set() can be used directly.
A related minor change is switching from RTE_FLOW_ERROR_TYPE_HANDLE to
RTE_FLOW_ERROR_TYPE_UNSPECIFIED when no rte_flow handle is involved in the
error, specifically when none is allocated yet.
This commit does not cause any functional change.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
- Remove unnecessary casts.
- Replace consecutive if/else blocks with switch statements.
- Use proper big endian definitions for mask values.
- Make end marker checks of item and action lists less verbose since they
are explicitly documented as being equal to 0.
- Remove unnecessary NULL check on action configuration structure.
This commit does not cause any functional change.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
In several instances, "items" refers either to a flow pattern or a single
item, and "actions" either to the entire list of actions or only one of
them.
The fact the target of a rule (struct mlx4_flow_action) is also named
"action" and item-processing objects (struct mlx4_flow_items) as "cur_item"
("token" in one instance) contributes to the confusion.
Use this opportunity to clarify related comments and remove the unused
valid_actions[] global, whose sole purpose is to be referred by
item-processing objects as "actions".
This commit does not cause any functional change.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
This PMD supports up to 4096 flow rule priority levels (0 to 4095).
Applications were not allowed to use them until now due to overlaps with
the default flows (e.g. MAC address, promiscuous mode).
This is not an issue in isolated mode when such flows do not exist.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Add missing comments and fix those not Doxygen-friendly.
Since the private structure definition is modified, use this opportunity to
add one remaining missing include required by one of its fields
(sys/queue.h for LIST_HEAD()).
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
There is no benefit in having this as a separate function.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
rte_flow_error_set() is a convenient helper to initialize error objects.
Since there is no fundamental reason to prevent applications from using it,
expose it through the public interface after modifying its return value
from positive to negative. This is done for consistency with the rest of
the public interface.
Documentation is updated accordingly.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
The stats_get dev op API doesn't include return value, so PMD cannot
return an error in case of failure at stats getting process time.
Since PCI devices can be removed and there is a time between the
physical removal to the RMV interrupt, the user may get invalid stats
without any indication.
This patch changes the stats_get API return value to be int instead of
void.
All the net PMDs stats_get dev ops are adjusted by this patch.
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Since interrupt handler is the only function relying on it, merging them
simplifies the code as there is no need for an API to return collected
events.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Link status is sometimes inconsistent during a LSC event. When it occurs,
the PMD refrains from immediately notifying the application; instead, an
alarm is scheduled to check link status later and notify the application
once it has settled.
The problem is that subsequent link status checks are only performed if
additional LSC events occur in the meantime, which is not always the case.
Worse, since support for removal events was added, rescheduled link status
checks may consume them as well without notifying the application. With the
right timing, a link loss occurring just before a device removal event may
hide it from the application.
Fixes: 6dd7b7056d ("net/mlx4: support device removal event")
Fixes: 2d449f7c52 ("net/mlx4: fix assertion failure on link update")
Cc: stable@dpdk.org
Reported-by: Matan Azrad <matan@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
When LSC or RMV events are received by the PMD but are not requested by the
application, a misleading debugging message implying the PMD does not
support them is shown.
Fixes: 6dd7b7056d ("net/mlx4: support device removal event")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Allocation and management of Tx/Rx queue arrays is done by wrappers at the
ethdev level. The resulting information is copied to the private structure
while configuring the device, where it is managed separately by the PMD.
This is redundant and consumes space in the private structure.
Relying more on ethdev also means there is no need to protect the PMD
against burst function calls while closing the device anymore.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Considering the remaining functionality, the only difference between
isolated and non-isolated mode is that a default MAC flow rule is present
with the latter.
The restriction on enabling isolated mode before creating any queues can
therefore be lifted.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Add missing includes and sort them, then update/remove comments around them
for consistency.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
While internal static functions do not cause link time conflicts, this
differentiates them from their mlx5 PMD counterparts while debugging.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Only the common filter control operation callback needs to be exposed.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Private functions are now prefixed with "mlx4_" to prevent them from
conflicting with their mlx5 PMD counterparts at link time.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Private functions are now prefixed with "mlx4_" to prevent them from
conflicting with their mlx5 PMD counterparts at link time.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Private functions are now prefixed with "mlx4_" to prevent them from
conflicting with their mlx5 PMD counterparts at link time.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit groups all data plane functions (Rx/Tx) into a separate file
and adjusts header files accordingly.
Private functions are now prefixed with "mlx4_" to prevent them from
conflicting with their mlx5 PMD counterparts at link time.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Except for a minor documentation update on internal structure definitions
to make them more Doxygen-friendly, there is no impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Private functions are now prefixed with "mlx4_" to prevent them from
conflicting with their mlx5 PMD counterparts at link time.
No impact on functionality.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Link status (LSC) and removal (RMV) interrupts share a common handler and
are toggled simultaneously from common install/uninstall functions.
Four additional wrapper functions (two for each interrupt type) are
currently necessary because the PMD maintains an internal configuration
state for interrupts (priv->intr_conf).
This complexity can be avoided entirely since the PMD does not disable
interrupts configuration parameters in case of error anymore.
With this commit, only two functions are necessary to toggle interrupts
(including Rx) during start/stop cycles.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The naming scheme for these functions is overly verbose and not accurate
enough, with too many "handler" functions that are difficult to
differentiate (e.g. mlx4_dev_link_status_handler(),
mlx4_dev_interrupt_handler() and priv_dev_status_handler()).
This commit renames them and removes the unnecessary dev argument which can
be retrieved through the private structure where needed. Documentation is
updated accordingly.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
File descriptors used for interrupts processing must be made non-blocking.
Doing so as soon as they are opened instead of waiting until they are
needed is more efficient as it avoids performing redundant system calls and
run through their associated error-handling code later on.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The reason one interrupt handle is currently used for RMV/LSC events and
another one for Rx traffic is because these come from distinct file
descriptors.
This can be simplified however as Rx interrupt file descriptors are stored
elsewhere and are registered separately.
Modifying the interrupt handle type to RTE_INTR_HANDLE_UNKNOWN has never
been necessary as disabling interrupts is actually done by unregistering
the associated callback (RMV/LSC) or emptying the EFD array (Rx). Instead,
make clear that the base handle file descriptor is invalid by setting it to
-1 when disabled.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The new definitions also rely on the existing DPDK logging subsystem
instead of using fprintf() directly.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
These were originally used for compatibility between DPDK releases when
this PMD was built out of tree.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Wrapper functions whose main purpose was to take a lock on the private
structure are no longer needed since this lock does not exist anymore.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Concurrent use of various control path functions (e.g. configuring a queue
and destroying it simultaneously) may lead to undefined behavior.
PMD are not supposed to protect themselves from misbehaving applications,
and mlx4 is one of the few with internal locks on most control path
operations. This adds unnecessary complexity.
Leave this role to wrapper functions in ethdev.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This addresses badly formatted comments and needless empty lines before
refactoring functions into different files.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Due to its reliance on system calls, the mlx4 PMD uses positive errno
values internally and negative ones at the ethdev API border. Although most
internal functions are documented, this mixed design is unusual and prone
to mistakes (e.g. flow API implementation uses negative values
exclusively).
Standardize on negative errno values and rely on rte_errno instead of
errno in all functions.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Returning a different value when the current link status differs from the
previous one was probably useful at some point in the past but is now
meaningless; this value is ignored both internally (mlx4 PMD) and
externally (ethdev wrapper).
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Thanks to the fact the PMD temporarily uses a slower interface for Rx,
removing the WR ID hack to instead store mbuf pointers directly makes the
code simpler at no extra cost.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This reverts commit acac55f164.
"Fast Verbs" is a nonstandard experimental interface that must be reverted
for compatibility reasons. Its replacement is slower but temporary,
performance will be restored by a subsequent commit through an enhanced
data path implementation. This one focuses on maintaining basic
functionality in the meantime.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This reverts commit 9980f81dc2.
"Fast Verbs" is a nonstandard experimental interface that must be reverted
for compatibility reasons. Its replacement is slower but temporary,
performance will be restored by a subsequent commit through an enhanced
data path implementation. This one focuses on maintaining basic
functionality in the meantime.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This reverts commit 8b3ffe95e7.
Multicast loopback prevention is not part of the standard Verbs interface.
Remove it temporarily.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This reverts commit 3e49c148b7.
Resource domains are not part of the standard Verbs interface. The
performance improvement they bring will be restored later through a
different data path implementation.
This commit makes the PMD not rely on the non-standard QP allocation
interface.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs API used to set QP attributes is deprecated. Revert to the
standard API since it actually supports the remaining ones.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs API used to implement inline receive is deprecated.
Support will be added back after refactoring the PMD.
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs API used to implement Tx and Rx burst functions is deprecated.
Drop scatter/gather support to ease refactoring while maintaining basic
single-segment Rx/Tx functionality in the meantime.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs API used to implement packet type recognition is deprecated.
Support will be added back after refactoring the PMD.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs API used to implement Tx and Rx checksum offloads is deprecated.
Support for these will be added back after refactoring the PMD.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The Verbs RSS API used in this PMD is now obsolete. It is superseded by an
enhanced API with fewer constraints already used in the mlx5 PMD.
Drop RSS support in preparation for a major refactoring. The ability to
configure several Rx queues is retained, these can be targeted directly by
creating specific flow rules.
There is no need for "ignored" Rx queues anymore since their number is no
longer limited to powers of two.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>