Commit Graph

400 Commits

Author SHA1 Message Date
Adrien Mazarguil
30695adbdd net/mlx4: add VLAN filter configuration support
This commit brings back VLAN filter configuration support without any
artificial limitation on the number of simultaneous VLANs that can be
configured (previously 127).

Also thanks to the fact it does not rely on fixed per-queue arrays for
potential Verbs flow handle storage anymore, this version wastes a lot less
memory (previously 128 * 127 * pointer size, i.e. 130 kiB per Rx queue,
only one of which actually had any use for this room: the RSS parent
queue).

The number of internal flow rules generated still depends on the number of
configured MAC addresses times that of configured VLAN filters though.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
1437784b03 net/mlx4: add MAC addresses configuration support
This commit brings back support for configuring up to 128 MAC addresses on
a port through internal flow rules automatically generated on demand.

Unlike its previous incarnation, the necessary extra flow rule for
broadcast traffic does not consume an entry from the MAC array anymore.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
680d5280c2 net/mlx4: refactor flow item validation code
Since flow rule validation and creation have been refactored into a common
two-pass function, having separate callback functions to validate and
convert individual items seems redundant.

The purpose of these item validation functions is to reject partial masks
as those are not supported by hardware, before handing over the item to a
separate function that performs basic sanity checks.

The current approach and related code have the following issues:

- Lack of flow handle context in validation code requires kludges such as
  the special treatment reserved to spec-less Ethernet pattern items.
- Lack of useful error reporting; users need as much help as possible to
  understand what they did wrong, particularly when they hit hardware
  limitations that aren't mentioned by the flow API. Preventing them from
  going berserk after getting a generic "item not supported" message for no
  apparent reason is mandatory.
- Generic checks should be performed by the caller, not by item-specific
  validation functions.
- Mask checks either missing or too lax in some cases (Ethernet, VLAN).

This commit addresses all the above by combining validation and conversion
callbacks as "merge" callbacks that take an additional error context
parameter. Also:

- Support for source MAC address matching is removed as it has no effect.
- Providing an empty mask no longer bypasses the Ethernet specification
  check that causes a rule to become promiscuous-like.
- VLAN VIDs must be matched exactly, as matching all VLAN traffic while
  excluding non-VLAN traffic is not supported.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
fee75e14f3 net/mlx4: simplify trigger code for flow rules
Since flow rules synchronization function mlx4_flow_sync() takes into
account the state of the device (whether it is started), trigger functions
mlx4_flow_start() and mlx4_flow_stop() are redundant. Standardize on
mlx4_flow_sync().

Use this opportunity to enhance this function with better error reporting
as the inability to start the device due to a problem with a flow rule
otherwise results in a nondescript error code.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
fc49cbb768 net/mlx4: generalize flow rule priority support
Since both internal and user-defined flow rules are handled by a common
implementation, flow rule priority overlaps are easier to detect. No need
to restrict their use to isolated mode only.

With this patch, only the lowest priority level remains inaccessible to
users outside isolated mode.

Also, the PMD no longer automatically assigns a fixed priority level to
user-defined flow rules, which means collisions between overlapping rules
matching a different number of protocol layers at a given priority level
won't be avoided anymore (e.g. "eth" vs. "eth / ipv4 / udp").

As a reminder, the outcome of overlapping rules for a given priority level
was, and still is, undefined territory according to API documentation.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
bdcad2f484 net/mlx4: refactor internal flow rules
When not in isolated mode, a flow rule is automatically configured by the
PMD to receive traffic addressed to the MAC address of the device. This
somewhat duplicates flow API functionality.

Remove legacy support for internal flow rules to instead handle them
through the flow API implementation.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
328bf8e5a3 net/mlx4: relax check on missing flow rule target
Creating a flow rule targeting a missing (unconfigured) queue is not
possible. However, nothing really prevents the destruction of a queue with
existing flow rules still pointing at it, except currently the port must be
in a stopped state in order to avoid crashing.

Problem is that the port cannot be restarted if flow rules cannot be
re-applied due to missing queues. This flexibility will be needed by
subsequent work on this PMD.

Given that a PMD cannot decide on its own to remove problematic
user-defined flow rules in order to restart a port, work around this
restriction by making the affected ones drop-like, i.e. rules targeting
nonexistent queues drop packets instead.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
d3a7e09234 net/mlx4: allocate drop flow resources on demand
Verbs QP and CQ resources for drop flow rules do not need to be permanently
allocated, only when at least one rule needs them.

Besides, struct rte_flow_drop is outside the mlx4 PMD name space and should
never have been defined there. struct rte_flow is currently the only
exception to this rule.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
100fe44b81 net/mlx4: merge flow creation and validation code
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>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
f1c9ac9f23 net/mlx4: add iovec-like allocation wrappers
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>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
28daff0785 net/mlx4: compact flow rule error reporting
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>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
267d07dacd net/mlx4: tidy up flow rule handling code
- 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>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
809d8a6cff net/mlx4: clarify flow objects naming scheme
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>
2017-10-13 01:18:48 +01:00
Adrien Mazarguil
a5171594fc net/mlx4: expose support for flow rule priorities
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>
2017-10-13 01:18:47 +01:00
Adrien Mazarguil
ed0cc677ad net/mlx4: enhance header files comments
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>
2017-10-13 01:18:47 +01:00
Adrien Mazarguil
97561113a8 net/mlx4: remove Rx QP initializer function
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>
2017-10-13 01:18:47 +01:00
Adrien Mazarguil
a9cfedf39d net/mlx4: replace bit-field type
Make clear it's 32-bit wide.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-13 01:18:47 +01:00
Adrien Mazarguil
5b4efcc6b9 ethdev: expose flow API error helper
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>
2017-10-13 01:18:47 +01:00
Matan Azrad
d5b0924ba6 ethdev: add return value to stats get dev op
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>
2017-10-12 01:52:49 +01:00
Adrien Mazarguil
d84fb5eba1 net/mlx4: merge interrupt collector function
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
258937a3fd net/mlx4: fix rescheduled link status check
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
ebada48456 net/mlx4: fix unhandled event debug message
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
be65fdcbfb net/mlx4: rely on ethdev for Tx/Rx queue arrays
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
dcafc2a64a net/mlx4: remove isolated mode constraint
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
37491c7f8f net/mlx4: clean up includes and comments
Add missing includes and sort them, then update/remove comments around them
for consistency.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
655588afc8 net/mlx4: separate memory management functions
No impact on functionality.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
686a64eb58 net/mlx4: rename private functions in flow API
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
af745cd60b net/mlx4: group flow API handlers in common file
Only the common filter control operation callback needs to be exposed.

No impact on functionality.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
5b4c63bdae net/mlx4: separate Rx configuration functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
a2ce2121c0 net/mlx4: separate Tx configuration functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
61cbdd4194 net/mlx4: separate device control functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
7f45cb82da net/mlx4: separate Rx/Tx functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
3d555728c9 net/mlx4: separate Rx/Tx definitions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
b62579d4ce net/mlx4: separate interrupt handling
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
a6e8b01c3c net/mlx4: compact interrupt functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
635238bb65 net/mlx4: clean up interrupt functions prototypes
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
35d02c543a net/mlx4: refactor interrupt FD settings
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
7446202428 net/mlx4: rename alarm field
Make clear this field is related to interrupt handling.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
63c2f23c85 net/mlx4: use a single interrupt handle
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
76df01ff62 net/mlx4: separate debugging macros
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
4e7367d831 net/mlx4: use standard macro to get array size
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
a0a745b7f7 net/mlx4: remove mbuf macro definitions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
3cf06cea7c net/mlx4: remove unnecessary wrapper functions
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
e4dff4d83d net/mlx4: remove control path locks
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
c76c88e1e0 net/mlx4: clean up coding style inconsistencies
This addresses badly formatted comments and needless empty lines before
refactoring functions into different files.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
9d14b27308 net/mlx4: standardize on negative errno values
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
d8fe7cdcfc net/mlx4: simplify link update function
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
5c5435192c net/mlx4: simplify Rx buffer handling
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
49040046f4 net/mlx4: revert fast verbs interface for Rx
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
fd494d4fee net/mlx4: revert fast verbs interface for Tx
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
ca71a1a4ad net/mlx4: revert multicast echo prevention
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
72ba7fadbf net/mlx4: revert resource domain support
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
fa8551ffa8 net/mlx4: use standard QP attributes
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
056eaf2e6d net/mlx4: drop inline receive support
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
3f75a02719 net/mlx4: drop scatter/gather support
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>
2017-10-06 02:49:48 +02:00
Adrien Mazarguil
4e897255c8 net/mlx4: drop packet type recognition support
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>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
22aadcc696 net/mlx4: drop checksum offloads support
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>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
4bd2aa1198 net/mlx4: drop RSS support
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>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
41f8001be6 net/mlx4: revert RSS parent queue refactoring
This reverts commit ff00a0dc56.

Support for several RSS parent queues was necessary to implement the RSS
flow rule action, dropped in a prior commit.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
56d1cd47ff net/mlx4: revert flow API RSS support
This reverts commit d7769c7c08.

Existing RSS features rely on experimental Verbs provided by Mellanox OFED.

In order to replace this dependency with standard distribution packages,
RSS support must be temporarily removed to be re-implemented using a
different API.

Removing support for the RSS flow rule action is the first step toward this
goal.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
8ca27e24e2 net/mlx4: drop MAC flows affecting all Rx queues
Configuring several Rx queues enables RSS, which causes an additional
special parent queue to be created to manage them.

MAC flows are associated with the queue supposed to receive packets; either
the parent one in case of RSS or the single orphan otherwise.

For historical reasons the current implementation supports another scenario
with multiple orphans, in which case MAC flows are configured on all of
them. This is harmless but useless since it cannot happen.

Removing this feature allows dissociating the remaining MAC flow from Rx
queues and store it inside the private structure where it belongs.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
320dc09f63 net/mlx4: remove MAC address configuration support
Only the default port MAC address remains and is not configurable.
This is done in preparation for a major refactoring.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
3e641ae766 net/mlx4: remove VLAN filter support
This is done in preparation for a major refactoring.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
805170c49c net/mlx4: remove allmulti and promisc support
This is done in preparation for a major refactoring.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
586db08058 net/mlx4: remove Tx inline compilation option
This should be a run-time parameter.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
367b31cd5b net/mlx4: remove scatter mode compilation option
This option both sets the maximum number of segments for Rx/Tx packets and
whether scattered mode is supported at all. This commit removes the latter
as well as configuration file exposure since the most appropriate value
should be decided at run-time.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
31a76ab0df net/mlx4: remove soft counters compilation option
Software counters are mandatory since hardware counters are not
implemented.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
863f34f710 net/mlx4: remove useless code
Less code makes refactoring easier. No impact on functionality.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
44dbb413a0 net/mlx4: remove secondary process support
Current implementation is partial (Tx only), not convenient to use and
not of primary concern.

Remove this feature before refactoring the PMD.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
5d15f04365 net/mlx4: remove useless compilation checks
Verbs support for RSS, inline receive and extended device query calls has
not been optional for a while. Their absence is untested and is therefore
unsupported.

Remove the related compilation checks and assume Mellanox OFED is up to
date, as described in the documentation.

Use this opportunity to remove a few useless data path debugging messages
behind compilation checks on never defined macros.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
8264279967 net/mlx4: check max number of ports dynamically
Use maximum number reported by hardware capabilities as replacement for the
static check on MLX4_PMD_MAX_PHYS_PORTS.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
f2318196c7 net/mlx4: remove limitation on number of instances
The seemingly artificial limitation on the maximum number of instances for
this PMD is an historical leftover that predates its first public release.

It was used as a workaround to support multiple physical ports on a PCI
device exposing a single bus address when mlx4 was implemented directly as
an Ethernet device driver instead of a PCI driver spawning Ethernet
devices.

Getting rid of it simplifies device initialization.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Adrien Mazarguil
3b47f9ac25 net/mlx4: add consistency to copyright notices
Copyright lasts long enough not to require notices to be updated yearly.

The current approach of updating them occasionally while working on
unrelated tasks should be deprecated in favor of dedicated commits updating
all files at once when necessary.

Standardize on a single year per copyright owner.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-10-06 02:49:47 +02:00
Matan Azrad
5f4677c6ad net/mlx4: workaround verbs error after plug-out
Current mlx4 OFED version has bug which returns error to
ibv destroy functions when the device was plugged out, in
spite of the resources were destroyed correctly.

Hence, failsafe PMD was aborted, only in debug mode, when
it tries to remove the device in plug-out process.

The workaround added option to replace all claim_zero
assertions with debugging messages, by the way, this option
affects non ibv destroy assertions.

DPDK 18.02 release should work with Mellanox OFED-4.2 which will
include the verbs fix to this bug, then, this patch can
be removed.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-08-03 23:10:27 +02:00
Matan Azrad
8d0f80167d net/mlx4: fix probe failure report
The corrupted code doesn't return error when probe function
fails due to error in device mac address getting.
By this way, the probe function may return success even if the
ETH dev is not allocated.

Hence, the probe caller, for example failsafe PMD, fails when it
tries to get ETH dev after the device was plugged out while mlx4
was probing it.

The fix adds error report to the probe caller when priv_get_mac fails
and in all other failure options which are missing it.

By this way, it prevents the unexpected behavior to miss ETH device
after the device was probed successfully.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")
Fixes: 001a520e41 ("net/mlx4: add port parameter")
Fixes: 7b06615392 ("mlx4: check if port is configured for ethernet")
Fixes: fec3608673 ("mlx4: query netdevice to get initial MAC address")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-31 19:58:41 +02:00
Matan Azrad
f3b10f1d24 net/mlx4: fix flow creation before start
The corrupted code causes segmentation fault when user creates
flow with drop action before device starting.

For example, failsafe PMD recreates all the flows before calling
dev_start in plug-in sequence and mlx4 allocated its flow drop
queue in dev_start.
Hence, when failsafe created flow with drop action after plug-in
event, mlx4 tried to dereference flow drop queue which was
uninitialized.

The fix added check to the drop qp accessible and conditioned the
ibv_create_flow calling on device starting.

Fixes: 642fe56a1b ("net/mlx4: use a single drop queue for all drop flows")
Fixes: 46d5736a70 ("net/mlx4: support basic flow items and actions")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-31 19:58:41 +02:00
Gaetan Rivet
ac075085c1 net/mlx4: advertise the detach capability
This PMD supports hotplug, it is able to be detached.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-31 14:08:25 +02:00
Vasily Philipov
d7769c7c08 net/mlx4: support flow API RSS action
This commit adds support for the flow API RSS action with the following
limitations:

 - Only supported when isolated mode is enabled.
 - The number of queues specified by the action (rte_flow_action_rss.num)
   must be a power of two.
 - Each queue index can be specified at most once in the configuration
   (rte_flow_action_rss.queue[]).
 - Because a queue can be associated with a single RSS context, it cannot
   be targeted by multiple RSS actions simultaneously.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-06 15:00:57 +02:00
Vasily Philipov
ff00a0dc56 net/mlx4: refactor RSS parent queue allocation
A special "parent" queue must be allocated in addition to a group of
standard Rx queues for RSS to work. This is done automatically outside of
isolated mode by the PMD when applications request several Rx queues.

Since each configured flow rule with the RSS action may target a different
set of queues, the PMD must have the ability to dynamically allocate
several parent queues, one per RSS group.

If isolated mode was requested the default RSS parent queue isn't created
in this case.

Refactor RSS parent queue allocations (currently limited to a single
parent) in preparation for flow API RSS action support.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-06 15:00:57 +02:00
Vasily Philipov
ae7954ddea net/mlx4: implement isolated mode from flow API
The user must request isolated mode before device configuration.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-06 15:00:57 +02:00
Vasily Philipov
4be0621901 net/mlx4: fix mbuf poisoning in debug code
In debug mode, all mbuf ol_flags are temporarily enabled while sitting
in the Rx queue to detect otherwise silent data corruption, however
some of them are special (indirect and control) and must be cleared
before returning mbufs to the pool to avoid crashing.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")
CC: stable@dpdk.org

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-07-06 15:00:57 +02:00
Adrien Mazarguil
3aec2d14d6 net/mlx: update C compliance standard
This commit addresses a compilation issue against Glibc >= 2.25, which
implements assert() through a nonstandard ({ }) construct. Such constructs
can normally not be used without __extension__ keyword when -pedantic is
enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.

While assert.h checks for the compiler ability to support GNU extensions,
Clang, unlike GCC, does not allow the above syntax when combining
-std=gnu99 with -pedantic.

Work around missing keyword by moving these PMDs to a stricter compliance
standard without GNU extensions but properly checked by Glibc. Doing so is
supported on the DPDK side since includes have been cleaned up.

Even in C11, using types other than _Bool or signed/unsigned int for
bit-fields is an extension. Some GCC versions complain about that when
-pedantic checks are enabled.

The RTE_STD_C11 macro correctly prevented this issue with C99 but not with
C11 as it becomes a no-op. Forcing the extension keyword addresses it.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Tested-by: Yongseok Koh <yskoh@mellanox.com>
2017-07-06 15:00:57 +02:00
Adrien Mazarguil
2d449f7c52 net/mlx4: fix assertion failure on link update
The interrupt handler can sometimes be triggered for reasons other than a
link status event. An assertion failure happen when such events occur while
an asynchronous link status update is already scheduled.

Address this issue using the same approach as its mlx5 counterpart,
commit a9f2fbc42f ("net/mlx5: fix inconsistent link status")

Fixes: c4da6caa42 ("mlx4: handle link status interrupts")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-07-06 15:00:56 +02:00
Adrien Mazarguil
0a2ae70319 net/mlx4: fix Rx interrupts management
This commit addresses various issues that may lead to undefined behavior
when configuring Rx interrupts.

While failure to create a Rx queue completion channel in rxq_setup()
prevents that queue from being created, existing queues still have theirs.
Since the error handler disables dev_conf.intr_conf.rxq as well, subsequent
calls to rxq_setup() create Rx queues without interrupts. This leads to a
scenario where not all Rx queues support interrupts; missing checks on the
presence of completion channels may crash the application.

Considering that the PMD is not supposed to disable user-provided
configuration parameters (dev_conf.intr_conf.rxq), and that these can
change for subsequent rxq_setup() calls anyway, properly supporting a mixed
mode where not all Rx queues have interrupts enabled is a better approach.

To do so with a minimum set of changes, priv_intr_efd_enable() and
priv_create_intr_vec() are first refactored as a single
priv_rx_intr_vec_enable() function (same for their "disable" counterparts).
Since they had to be used together, there was no point in keeping them
separate.

Remaining changes:

- Always clean up before reconfiguring interrupts to avoid memory leaks.
- Always clean up when closing the device.
- Use malloc()/free() instead of their rte_*() counterparts since there is
  no need to store the vector in huge pages-backed memory.
- Allow more Rx queues than the size of the event file descriptor array as
  long as Rx interrupts are not requested on all of them.
- Properly clean up interrupt handle when disabling Rx interrupts (nb_efd
  and intr_vec reset to 0).
- Check completion channel presence while toggling Rx interrupts on a given
  queue.

Fixes: 9f05a4b818 ("net/mlx4: support user space Rx interrupt event")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Moti Haimovsky <motih@mellanox.com>
2017-07-06 15:00:56 +02:00
Adrien Mazarguil
3c560ec3ea net/mlx4: fix Rx interrupts with multiple ports
Several Ethernet device structures are allocated on top of a common PCI
device for mlx4 adapters with multiple ports. These inherit a common
interrupt handle from their parent PCI device, which prevents Rx interrupts
from working properly on all ports as their configuration is overwritten.

Use a local interrupt handle to address this issue.

Fixes: 9f05a4b818 ("net/mlx4: support user space Rx interrupt event")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Moti Haimovsky <motih@mellanox.com>
2017-07-06 15:00:56 +02:00
Adrien Mazarguil
1a3e40d5a4 net/mlx4: fix typos from prior commit
Fixes: 9f05a4b818 ("net/mlx4: support user space Rx interrupt event")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Moti Haimovsky <motih@mellanox.com>
2017-07-06 15:00:56 +02:00
Stephen Hemminger
463ced957c pci: increase domain storage to 32 bits
In some environments, the PCI domain can be larger than 16 bits.
For example, a PCI device passed through in Azure gets a synthetic domain
id  which is internally generated based on GUID. The PCI standard does
not restrict domain to be 16 bits.

This change breaks ABI for API's that expose PCI address structure.

The printf format for PCI remains unchanged, so that on most
systems (with only 16 bit domain) the output format is unchanged
and is 4 characters wide.  For example: 0000:00:01.0
Only on sysetms with higher bits will the domain take up more
space; example: 12000:00:01.0

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-07-06 01:28:02 +02:00
Bernard Iremonger
d6af1a13d7 ethdev: add return values to callback process API
Change the rte_eth_dev_callback_process function to return int,
and add a void *ret_param parameter.
The new parameter is used by ixgbe and i40e instead of abusing
the user data of the callback.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
2017-07-01 17:19:55 +02:00
Moti Haimovsky
9f05a4b818 net/mlx4: support user space Rx interrupt event
Implement rxq interrupt callbacks

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-06-12 10:41:29 +01:00
Ferruh Yigit
c0802544d9 drivers/net: add generic ethdev macro to get PCI device
Instead of many PMD define their own macro, define a generic one in
ethdev and use that in PMDs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2017-06-12 10:41:25 +01:00
Jerin Jacob
c6dfeecb15 eal: introduce macro for no inline
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-06-06 22:31:45 +02:00
Wei Dai
6d01e580ac ethdev: fix adding invalid MAC address
Some customers find adding MAC addr to VF sometimes can fail,
but it is still stored in dev->data->mac_addrs[ ]. So this
can lead to some errors that assumes the non-zero entry in
dev->data->mac_addrs[ ] is valid.
Following acknowledgements are from specific NIC PMD
maintainer for their managing part.

This patch changes the ethdev internal API, it should not be
backported to a stable/LTS release so far.

Fixes: af75078fec ("first public release")

Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
2017-05-05 16:27:11 +02:00
Thomas Monjalon
3dcfe0390c pci: remove eal prefix
The PCI code will move to the bus drivers directory.
Rename functions from rte_eal_pci_ to rte_pci_
to prepare the move of the driver out of EAL.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-05-05 14:38:17 +02:00
Gaetan Rivet
6dd7b7056d net/mlx4: support device removal event
Extend the LSC event handling to support the device removal as well. The
Verbs library will send several related events, that can conflict
with the LSC event itself.

The event handling has thus been made capable of receiving and signaling
several event types at once.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Signed-off-by: Elad Persiko <eladpe@mellanox.com>
2017-04-21 01:01:47 +02:00
Charles Myers
1193edaa82 net/mlx4: fix Rx after mbuf alloc failure
Fixes issue where mlx4 driver stops receiving packets when mbuf
allocation fails in mlx4_rx_burst().

This issue appears to be caused because the code doesn't recycle the
existing mbuf to the sges array when mbuf allocation fails as is done
in the code right above it which handles (wc.status != IBV_WC_SUCCESS).

Copying the code from the above case fixes the issue.

Fixes: acac55f164 ("mlx4: use MOFED 3.0 fast verbs interface for Rx operations")
Cc: stable@dpdk.org

Signed-off-by: Charles Myers <charles.myers@spirent.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.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
Qi Zhang
c23a1a3000 eal: clean up interrupt handle
The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2017-04-06 21:15:55 +02:00
Ferruh Yigit
0c145b7eea drivers/net: remove unused DEPDIRS from makefiles
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-06 20:58:59 +02:00
Vasily Philipov
642fe56a1b net/mlx4: use a single drop queue for all drop flows
Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-04-04 19:03:03 +02:00
Gaetan Rivet
9e09761b43 net/mlx4: fix returned values upon failed probing
Let error messages in place, but return unambiguous values upon
probing errors.

Fixes: 66e1591687 ("mlx4: avoid init errors when kernel modules are not loaded")
Cc: stable@dpdk.org

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-04-04 18:59:51 +02:00
Vasily Philipov
edad38fcd0 net/mlx: enhance Rx scatter mode detection
Toggle Rx scatter mode based on the scatter_enable flag and the maximum
packet size only instead of deriving this information from the jumbo_frame
setting and the MTU configuration.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-04-04 18:59:51 +02:00
Gaetan Rivet
001a520e41 net/mlx4: add port parameter
Most ConnectX-3 adapters expose two physical ports on a single PCI bus
address.

Add a new port parameter allowing the user to choose
either or both physical ports to be used by the application.

This parameter is used as follows:

Selecting only the second port:
   -w 00:00.0,port=1

Selecting both ports:
   -w 00:00.0,port=0,port=1

If no parameter is given, the default behavior is unchanged: all ports
are probed.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-04-04 18:59:51 +02:00
Vasily Philipov
46d5736a70 net/mlx4: support basic flow items and actions
Adding support for the next items: eth, vlan, ipv4, udp, tcp and for the
next actions: queue, drop

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-04-04 18:59:42 +02:00
Vasily Philipov
58610cdde8 net/mlx4: split the definitions to the header file
Make priv_lock/priv_unlock functions and some other structs/defines visible
from different source files by placing them into mlx4.h header.

Signed-off-by: Vasily Philipov <vasilyf@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-04-04 18:59:42 +02:00
Gaetan Rivet
3fca2ab597 net/mlx4: update link status upon probing with LSC
If LSC interrupts are enabled, the application expects the link_update
ops to be executed by the PMD itself.

No link status change event is received upon probing, therefore the link
status update must be forced.

Fixes: c4da6caa42 ("mlx4: handle link status interrupts")
Cc: stable@dpdk.org

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-04-04 18:59:42 +02:00
Olivier Matz
feb9f680cd mk: optimize directory dependencies
Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC without -j).

- for instance, it is possible to express a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Robin Jarry <robin.jarry@6wind.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-03-27 23:28:43 +02:00
Matthieu Ternisien d'Ouville
501505c560 net/mlx: fix IPv4 and IPv6 packet type
Mellanox PMDs do not differentiate IP header with or without options, so
the advertised packet type for an IPv4 should not be RTE_PTYPE_L3_IPV4,
which explicitly means "does not contain any header option".

Change the driver to set
RTE_PTYPE(_INNER)_L3_IPV4_EXT_UNKNOWN or
RTE_PTYPE(_INNER)_L3_IPV6_EXT_UNKNOWN flags for all IPv4/IPv6 packets
received.

Fixes: 429df3803a ("mlx4: replace some offload flags with packet type")
Fixes: 67fa62bc67 ("mlx5: support checksum offload")

Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
Signed-off-by: Matthieu Ternisien d'Ouville <matthieu.tdo@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-01-17 19:41:43 +01:00
Matthieu Ternisien d'Ouville
2c960a5116 net/mlx: remove link update lock
Retrieving link status information through the link update callback should
be quick and non-blocking.

Mellanox PMDs retrieve this information through ioctl() calls on the
related kernel netdevice. This appears to take a long time to
complete and may cause significant slowdowns in applications.

While these system calls cannot be accelerated, removing the lock on the
private structure allows applications to perform other control operations
from separate threads in the meantime. This function remains safe without
locking as it does not write the private structure, it is only used to
retrieve the name of the netdevice.

Signed-off-by: Matthieu Ternisien d'Ouville <matthieu.tdo@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-01-17 19:41:43 +01:00
Thomas Monjalon
4ec6960aec scripts: move to buildtools
There is already a directory buildtools for pmdinfogen used by
the build system. The scripts used in makefiles are moved here.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-04 21:17:32 +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
Jan Blunck
75aca7997e ethdev: initialize more fields on allocation
This moves the non-PCI related initialization of the link state interrupt
callback list and the setting of the default MTU to rte_eth_dev_allocate()
so that drivers only need to set non-default values.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-21 17:32:17 +01:00
Jan Blunck
7f95f78a8a ethdev: clear data when allocating device
Lets clear the eth_dev->data when allocating a new rte_eth_dev so that
drivers only need to set non-zero values.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-21 17:30:27 +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
Nelio Laranjeiro
83e9d9a3f5 net/mlx: fix support for new Rx checksum flags
Fixes: 5842289a54 ("mbuf: add new Rx checksum flags")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-11-07 18:42:29 +01:00
Bernard Iremonger
c1ceaf3ad0 ethdev: add an argument to internal callback function
add cb_arg parameter to the _rte_eth_dev_callback_process function.

Adding a parameter to this function allows passing information
to the application when an eth device event occurs such as
a VF to PF message.
This allows the application to decide if a particular function
is permitted.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Signed-off-by: Alex Zelezniak <alexz@att.com>
2016-10-14 02:01:52 +02: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
David Marchand
270524d8b4 net/mlx: align drivers to latest naming convention
Fixes: 2f45703c17 ("drivers: make driver names consistent")

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-10-13 15:30:59 +02:00
Bruce Richardson
fc5b160f3c net/mlx: fix debug build with gcc 6.1
With recent gcc versions, e.g. gcc 6.1, compilation of mlx drivers with
debug enabled produces lots of errors complaining that "pedantic" is
not a warning level that can be ignored.

error: ‘-pedantic’ is not an option that controls warnings [-Werror=pragmas]
 #pragma GCC diagnostic ignored "-pedantic"
                                 ^~~~~~~~~~~

These errors can be removed by changing the "-pedantic" to "-Wpedantic".

Fixes: 7fae69eeff ("mlx4: new poll mode driver")
Fixes: 771fa900b7 ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-30 12:27:18 +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
6751f6deb7 ethdev: get rid of device type
Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-10-03 16:33:39 +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
Shreyansh Jain
af424af840 pci: replace devinit/devuninit with probe/remove
Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.

Only MLX* uses the PCI direct registration, bypassing PMD_* macro.
The callbacks for this too have been updated.

VDEV are left out. For them, init/uninit are more appropriate.

Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-03 16:33:01 +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
Fengtian Guo
b12a4c911a net/mlx4: add link up/down callback functions
Implement dev_set_link_up and dev_set_link_down device
operations. Code is inspired by mlx5 implementations.

Signed-off-by: Fengtian Guo <fengtian.guo@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-07-05 12:53:50 +02:00
Olivier Matz
33242e3e46 net/mlx: fix setting interface flags
According to the documentation, the function
priv_set_flags(priv, keep, flags) should not modify the flags
in "keep" mask.

So 'flags' argument should be masked with '~keep' before ORing
it with the previous flags value.

This avoids messing up the kernel interface flags when calling
priv_set_flags(priv, ~IFF_UP, ~IFF_UP) in priv_set_link():

  $ ip link
  26: eth0: BROADCAST,MULTICAST,NOARP,ALLMULTI,PROMISC,DEBUG,\
      DYNAMIC,AUTOMEDIA,PORTSEL,NOTRAILERS

Fixes: 7fae69eeff ("mlx4: new poll mode driver")
Fixes: 771fa900b7 ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")

Reported-by: Fengtian Guo <fengtian.guo@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-07-05 11:51:10 +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
Thomas Monjalon
54266acc64 drivers: fix build with new register macro
Compilation fails because of some typos.

Fixes: cb6696d220 ("drivers: update registration macro usage")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-07-08 10:27:08 +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
Ferruh Yigit
36351ea34b net/mlx: fix build with icc
Compilation errors:
mlx4:
  drivers/net/mlx4/mlx4.c(5409): error #188:
  enumerated type mixed with another type
          priv->intr_handle.type = 0;
                                 ^
mlx5:
  drivers/net/mlx5/mlx5_rxq.c(282): error #188:
  enumerated type mixed with another type
        enum hash_rxq_type type = 0;
                                  ^
and more same type of error.
Fix these by assigning enum values rather than integer values to the enum
variables

Fixes: c4da6caa42 ("mlx4: handle link status interrupts")
Fixes: 198a3c339a ("mlx5: handle link status interrupts")
Fixes: 0d2186743d ("mlx5: manage all special flow types at once")
Fixes: 612ad38209 ("mlx5: fix hash Rx queue type in RSS mode")
Fixes: 083c2dd317 ("mlx5: refactor special flows handling")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-06-28 11:49:09 +02:00
Nélio Laranjeiro
1d1bc87026 net: fix PCI class id
Use RTE_PCI_DEVICE macro to set all fields rather than explicitly setting
them individually in the code. This shortens the code while helping to
future-proof against future changes to the rte_pci_id structure.

Fixes: 701c8d80c8 ("pci: support class id probing")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2016-06-27 16:17:51 +02:00
Adrien Mazarguil
78d9c95d91 net/mlx: retrieve mbuf size through proper function
No need to allocate a mbuf for that.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-06-20 17:21:49 +02:00
Adrien Mazarguil
f3b492d7b4 net/mlx: ensure MTU update is effective
There is no guarantee that the new MTU is effective after writing its value
to sysfs. Retrieve it to be sure.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-06-20 17:21:49 +02:00
Nélio Laranjeiro
6e0eab3802 net/mlx: remove unused memory region property
Memory regions are always local with raw Ethernet queues, drop the remote
property as it adds extra processing on the hardware side.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-06-20 17:21:49 +02:00
Adrien Mazarguil
80c4e7281e net/mlx: regenerate autoconf file automatically
Mellanox PMDs must be rebuilt if a Verbs update would cause the autoconf
file to differ.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-06-20 17:21:48 +02:00
Adrien Mazarguil
d06c608c01 net/mlx: fix compilation with glibc 2.20
Since _BSD_SOURCE was deprecated in favor of _DEFAULT_SOURCE in Glibc 2.19
and entirely removed in 2.20, various BSD ioctl macros are not exposed
anymore when _XOPEN_SOURCE is defined, and linux/if.h now conflicts with
net/if.h.

Add _DEFAULT_SOURCE and keep _BSD_SOURCE for compatibility with older
versions.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-06-20 17:21:34 +02:00
Olivier Matz
e89880957f mbuf: add prefetch helpers
Some architectures (ex: Power8) have a cache line size of 128 bytes,
so the drivers should not expect that prefetching the second part of
the mbuf with rte_prefetch0(&m->cacheline1) is valid.

This commit add helpers that can be used by drivers to prefetch the
rx or tx part of the mbuf, whatever the cache line size.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2016-05-24 11:21:14 +02:00
Olivier Matz
d1d914ebbc mempool: allocate in several memory chunks by default
Introduce rte_mempool_populate_default() which allocates
mempool objects in several memzones.

The mempool header is now always allocated in a specific memzone
(not with its objects). Thanks to this modification, we can remove
many specific behavior that was required when hugepages are not
enabled in case we are using rte_mempool_xmem_create().

This change requires to update how kni and mellanox drivers lookup for
mbuf memory. For now, this will only work if there is only one memory
chunk (like today), but we could make use of rte_mempool_mem_iter() to
support more memory chunks.

We can also remove RTE_MEMPOOL_OBJ_NAME that is not required anymore for
the lookup, as memory chunks are referenced by the mempool.

Note that rte_mempool_create() is still broken (it was the case before)
when there is no hugepages support (rte_mempool_create_xmem() has to be
used). This is fixed in next commit.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-19 14:40:13 +02:00
Olivier Matz
84121f1971 mempool: store memory chunks in a list
Do not use paddr table to store the mempool memory chunks.
This will allow to have several chunks with different virtual addresses.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-19 14:40:13 +02:00
Olivier Matz
d86046f0cf mempool: use the list to iterate the elements
Now that the mempool objects are chained into a list, we can use it to
browse them. This implies a rework of rte_mempool_obj_iter() API, that
does not need to take as many arguments as before. The previous function
is kept as a private function, and renamed in this commit. It will be
removed in a next commit of the patch series.

The only internal users of this function are the mellanox drivers. The
code is updated accordingly.

Introducing an API compatibility for this function has been considered,
but it is not easy to do without keeping the old code, as the previous
function could also be used to browse elements that were not added in a
mempool. Moreover, the API is already be broken by other patches in this
version.

The library version was already updated in
commit 213af31e09 ("mempool: reduce structure size if no cache needed")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-19 14:40:13 +02:00
Olivier Matz
c2c66588e2 mempool: remove const qualifier when browsing pools
This commit removes the const qualifier for the mempool in
rte_mempool_walk() callback prototype.

Indeed, most functions that can be done on a mempool require a non-const
mempool pointer, except the dump and the audit. Therefore, the
mempool_walk() is more useful if the mempool pointer is not const.

This is required by next commit where the mellanox drivers use
rte_mempool_walk() to iterate the mempools, then rte_mempool_obj_iter()
to iterate the objects in each mempool.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-19 14:40:13 +02:00
Olivier Matz
fbfd99551c mbuf: add raw allocation function
Many drivers provide their own implementation of rte_mbuf_raw_alloc(),
duplicating the code. Introduce a new public function in rte_mbuf to
allocate a raw mbuf (uninitialized).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-05-17 08:31:33 +02:00
Marc Sune
82113036e4 ethdev: redesign link speed config
This patch redesigns the API to set the link speed/s configuration
of an ethernet port. Specifically:

- it allows to define a set of advertised speeds for
  auto-negociation.
- it allows to disable link auto-negociation (single fixed speed).
- default: auto-negociate all supported speeds.

A flag autoneg in struct rte_eth_link indicates if link speed was a
result of auto-negociation or was fixed by configuration.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
Tested-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Beilei Xing <beilei.xing@intel.com>
Tested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
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
Adrien Mazarguil
b185e63fdf mlx: fix double mbuf free in Tx queue clean up
Once freed, completed mbufs pointers are not set to NULL in the TX queue.
Clean up function must take this into account.

Fixes: 2e22920b85 ("mlx5: support non-scattered Tx and Rx")
Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-31 15:15:10 +02:00
Olivier Matz
2a345a8919 mlx4: use dummy Rx queues when non-pow2 number requested
When using RSS, the number of rxqs has to be a power of two.
This is a problem because there is no API in DPDK that makes
the application aware of that.

A good compromise is to allow the application to request a
number of rxqs that is not a power of 2, but having inactive
queues that will never receive packets. In this configuration,
a warning will be issued to users to let them know that
this is not an optimal configuration.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-25 19:03:48 +01:00
Adrien Mazarguil
7b06615392 mlx4: check if port is configured for ethernet
Notify user otherwise. A similar check has already been added to mlx5 in
commit "mlx5: check port is configured as ethernet device".

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-25 19:02:06 +01:00
Jianfeng Tan
78a38edf66 ethdev: query supported packet types
Add a new API rte_eth_dev_get_supported_ptypes to query what packet types
can be filled by a given device. The device should be already started or
its PMD RX burst function already decided, since the packet types supported
may vary depending on RX function.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-25 18:56:43 +01:00
Adrien Mazarguil
0dc02cca8b mlx: use aligned memory to register regions
The first and last memory pool elements are usually cache-aligned but not
page-aligned, particularly when using huge pages.

Hardware performance can be improved significantly by registering memory
regions starting and ending on page boundaries.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-16 18:52:17 +01:00
David Marchand
b84355e232 mlx4: support setting primary MAC address
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-16 18:52:17 +01:00
Robin Jarry
bda501616c mlx4: ensure number of Rx queues is a power of 2
In the documentation it is specified that the hardware only supports a
number of RX queues if it is a power of 2.

Since ibv_exp_create_qp may not return an error when the number of
queues is unsupported by hardware, sanitize the value in dev_configure.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
2016-03-16 18:52:17 +01:00
Bruce Richardson
3b32a6b417 mlx4: fix unneeded function error with clang 3.6
When compiling with clang 3.6, the mlx4 driver gives the following error
message about an unneeded function.

  CC mlx4.o
.../drivers/net/mlx4/mlx4.c:136:20: fatal error: function
      'wr_id_t_check' is not needed and will not be emitted
[-Wunneeded-internal-declaration]
static inline void wr_id_t_check(void)
                   ^
1 error generated.

The function is to compile-time check the size of wr_id_t, so use
the standard DPDK BUILD_BUG_ON macro to do so in the init function
instead.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-03-16 18:52:17 +01:00
Wenzhuo Lu
1cbe755fef ethdev: rename UDP tunnel port functions
The names of function for tunnel port configuration are not
accurate. They're tunnel_add/del, better change them to
tunnel_port_add/del.
The old functions are directly replaced because the API and ABI
compatibility of ethdev are already broken in 16.04.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2016-03-13 11:44:33 +01:00
Panu Matilainen
948fd64bef mk: replace the combined library with a linker script
The physically linked-together combined library has been an increasing
source of problems, as was predicted when library and symbol versioning
was introduced. Replace the complex and fragile construction with a
simple linker script which achieves the same without all the problems,
remove the related kludges from eg mlx drivers.

Since creating the linker script is practically zero cost, remove the
config option and just create it always.

Based on a patch by Sergio Gonzales Monroy, linker script approach
initially suggested by Neil Horman.

Suggested-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-03-01 14:37:27 +01:00
Thomas Monjalon
50810f095a config: remove useless explicit includes of generated header
The file rte_config.h is automatically generated and included.
No need to #include it.

The example performance-thread needs a makefile fix to avoid
overwriting the default cflags.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-02-10 22:43:38 +01:00
Or Ami
e9d39be873 mlx4: allow operation in secondary processes
Secondary processes are expected to use queues and other resources
allocated by the primary, however Verbs resources can only be shared
between processes when inherited through fork().

This limitation can be worked around for TX by configuring separate queues
from secondary processes.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Nelio Laranjeiro
cacd65c8bb mlx4: fix available entries in Tx rings
The number of available entries in TX rings is taken before performing
completion, effectively making rings smaller than they are and causing
TX performance issues under load.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Olga Shern
40100bfe34 mlx4: fix local protection error when Tx MP to MR cache is full
When MP to MR cache is full, the last (newest) MR is freed instead of the
first (oldest) one, causing local protection errors during TX.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Olga Shern
45d7e38c6f mlx4: fix Tx loss after initialization
Pre-registering mbuf memory pools when creating TX queues avoids costly
registrations later in the data path.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Adrien Mazarguil
2921677f15 mlx4: fix scattered Tx with too many segments
Buffers with too many segments are linearized to overcome
MLX4_PMD_SGE_WR_N, unfortunately the last segment is never sent.

Fixes: be11b35817 ("mlx4: move scattered Tx processing to helper function")

Signed-off-by: Jesper Wramberg <jesper.wramberg@gmail.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Adrien Mazarguil
f4acfd4176 mlx4: fix memory registration for indirect mbuf data
Indirect mbuf data may come from a different mempool which must be
registered separately as another memory region, otherwise such mbufs cannot
be sent.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Jesper Wramberg <jesper.wramberg@gmail.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:49:27 +01:00
Adrien Mazarguil
0f9db82d9f mlx4: fix possible crash when clearing device statistics
A typo causes TX stats indices to be retrieved from RX queues.

Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Reported-by: Nicolas Harnois <nicolas.harnois@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-11-24 17:39:21 +01:00
Bernard Iremonger
eeefe73f0a drivers: copy PCI device info to ethdev data
Use new function rte_eth_copy_pci_info.
Copy device info for the following pdevs:

bnx2x
cxgbe
e1000
enic
fm10k
i40e
ixgbe
mlx4
mlx5
virtio
vmxnet3

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2015-11-03 18:39:26 +01:00
Nelio Laranjeiro
c4da6caa42 mlx4: handle link status interrupts
Add interrupts handler for port status notification.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2015-11-01 11:23:45 +01:00
Adrien Mazarguil
2f9f46587a mlx4: fix missing unlock in case of error
Fixes: 7fae69eeff ("mlx4: new poll mode driver")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-10-31 00:21:58 +01:00
Adrien Mazarguil
9df03dd7d5 mlx4: do not complain about port state
Port is considering inactive when the related netdevice is down. There is no
reason to warn about it (and confuse users) since it's automatically brought
up later by the PMD.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-10-31 00:21:58 +01:00
Nelio Laranjeiro
a21bc2fabc mlx4: improve Rx performance with better prefetching
Prefetching initial bytes of mbuf structures earlier and in two cache lines
instead of one improves performance of mlx4_rx_burst(), which accesses the
mbuf->next field not present in the first 128 bytes.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2015-10-31 00:21:58 +01:00
Didier Pallard
50d86a005e mlx4: do not expose broadcast address in MAC list
Use the last array entry to store the broadcast address and keep it hidden
by not reporting the entire array size.

This is done to prevent DPDK applications from attempting to modify or
remove it.

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
2015-10-20 21:58:16 +02:00
Francesco Santoro
04c6383de9 mlx4: save bound interface
Allows applications to retrieve the name of the related netdevice.

Signed-off-by: Francesco Santoro <francesco.santoro@6wind.com>
2015-10-20 21:50:29 +02:00
Adrien Mazarguil
08c192054b mlx4: fix missing offload flags in scattered Rx
They were dropped by mistake in the commit below.

Fixes: ab351fe1c9 ("mbuf: remove packet type from offload flags")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-10-20 21:49:24 +02:00
Jingjing Wu
a421b86a4a ethdev: remove old flow director API
Old flow director API have been replaced by rte_eth_dev_filter_ctrl
since release 2.0. And no driver in current code support these functions.
All the removed functions are listed below:
  - rte_eth_dev_fdir_add_perfect_filter;
  - rte_eth_dev_fdir_add_signature_filter;
  - rte_eth_dev_fdir_get_infos;
  - rte_eth_dev_fdir_remove_perfect_filter;
  - rte_eth_dev_fdir_remove_signature_filter;
  - rte_eth_dev_fdir_set_masks;
  - rte_eth_dev_fdir_update_perfect_filter;
  - rte_eth_dev_fdir_update_signature_filter;

The library version was already incremented in a previous patch.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
[Thomas: fix mlx4 and update release notes]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-09-30 01:19:19 +02:00
Thomas Monjalon
ab351fe1c9 mbuf: remove packet type from offload flags
The extended unified packet type is now part of the standard ABI.
As mbuf struct is changed, the mbuf library version is incremented.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-09-03 19:22:48 +02:00
Nelio Laranjeiro
113c8e13c4 mlx4: fix shared library dependency
librte_pmd_mlx4.so needs to be linked with libibverbs otherwise, the PMD is
not able to open Mellanox devices and the following message is printed by
testpmd at startup
"librte_pmd_mlx4: cannot access device, is mlx4_ib loaded?".

Applications dependency on libibverbs are moved to be only valid in static
mode, in shared mode, applications do not depend on it anymore,
librte_pmd_mlx4.so keeps this dependency and thus is linked with libibverbs.

MLX4 cannot be supported in combined shared library because there is no clean
way of adding -libverbs to the combined library.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2015-08-03 00:38:26 +02:00
Sergio Gonzalez Monroy
2f9d47013e mem: move librte_malloc to eal/common
Move malloc inside eal and create a new section in MAINTAINERS file for
Memory Allocation in EAL.

Create a dummy malloc library to avoid breaking applications that have
librte_malloc in their DT_NEEDED entries.

This is the first step towards using malloc to allocate memory directly
from memsegs. Thus, memzones would allocate memory through malloc,
allowing to free memzones.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2015-07-16 13:44:48 +02:00
Thomas Monjalon
429df3803a mlx4: replace some offload flags with packet type
The workaround for Tx tunnel offloading can now be replaced with packet
type flag checking.
The ol_flags for IPv4/IPv6 and tunnel Rx offloading are replaced with
packet type flags.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-16 00:57:44 +02:00
Olga Shern
8b3ffe95e7 mlx4: disable multicast echo on PF device
Multicast loopback must be disabled on PF devices to prevent the adapter
from sending frames back. Required with MOFED 3.0.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:30:11 +02:00
Alex Rosenbaum
3e49c148b7 mlx4: add resource domain support for better performance
RDs are a new feature of MOFED 3.0 that makes Verbs aware of how CQ and QP
resources are being used for internal performance tuning.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:30:06 +02:00
Adrien Mazarguil
d22f941a57 mlx4: add VXLAN checksum offload
Depending on adapters features and VXLAN support in the kernel, VXLAN frames
can be automatically recognized, in which case checksum validation and
generation occurs on inner and outer L3 and L4.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:24 +02:00
Gilad Berman
f0fda21d19 mlx4: add L3/L4 checksum offload
Mellanox ConnectX-3 adapters can handle L3 (IPv4) and L4 (TCP, UDP, TCP6,
UDP6) RX checksums validation and TX checksums generation, with and without
802.1Q (VLAN) headers.

Signed-off-by: Gilad Berman <giladb@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:23 +02:00
Alex Rosenbaum
9755174d3a mlx4: prefetch completed Tx mbufs before releasing them
Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:23 +02:00
Alex Rosenbaum
b8bc1241d1 mlx4: shrink Tx queue elements for better performance
TX queue elements (struct txq_elt) contain WR and SGE structures required by
ibv_post_send(). This commit replaces them with a single pointer to the
related TX mbuf considering that:

- There is no need to keep these structures around forever since the
  hardware doesn't access them after ibv_post_send() and send_pending*()
  have returned.

- The TX queue index stored in the WR ID field is not used for completions
  anymore since they use a separate counter (elts_comp_cd).

- The WR structure itself was only useful for ibv_post_send(), it is
  currently only used to store the mbuf data address and an offset to the
  mbuf structure in the WR ID field. send_pending*() callbacks only require
  SGEs or buffer pointers.

Therefore for single segment mbufs, send_pending() or send_pending_inline()
can be used directly without involving SGEs. For scattered mbufs, SGEs are
allocated on the stack and passed to send_pending_sg_list().

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:23 +02:00
Adrien Mazarguil
be11b35817 mlx4: move scattered Tx processing to helper function
This commit makes scattered TX support entirely optional by moving it to a
separate function that is only available when MLX4_PMD_SGE_WR_N > 1.

Improves performance when scattered support is not needed.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:23 +02:00
Adrien Mazarguil
9980f81dc2 mlx4: use MOFED 3.0 fast verbs interface for Tx operations
The "raw" post send interface was experimental and has been deprecated. This
commit replaces it with a new low level interface that dissociates post and
flush (doorbell) operations for improved QP performance.

The CQ polling function is updated as well.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:29:23 +02:00
Alex Rosenbaum
034378216e mlx4: avoid requesting Tx completion events to improve performance
Instead of requesting a completion event for each TX burst, request it on a
fixed schedule once every MLX4_PMD_TX_PER_COMP_REQ (currently 64) packets to
improve performance.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:28:42 +02:00
Alex Rosenbaum
acac55f164 mlx4: use MOFED 3.0 fast verbs interface for Rx operations
This commit replaces the CQ polling and QP posting functions
(mlx4_rx_burst() only) with a new low level interface to improve
performance.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Gilad Berman <giladb@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:04:40 +02:00
Or Ami
fec3608673 mlx4: query netdevice to get initial MAC address
Querying the netdevice instead of deriving the port's MAC address from its
GID is less prone to errors. There is no guarantee that the GID will always
contain it nor that the algorithm won't change.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:04:00 +02:00
Olga Shern
1c214ab7f0 mlx4: fix support for multiple vlan filters
This commit fixes the "Multiple RX VLAN filters can be configured, but only
the first one works" bug. Since a single flow specification cannot contain
several VLAN definitions, the flows table is extended with MLX4_MAX_VLAN_IDS
possible specifications per configured MAC address.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:02:51 +02:00
Or Ami
2d402df262 mlx4: remove provision for flow creation failure in DMFS A0 mode
Starting from MLNX_OFED 3.0 FW 2.34.5000 when working with optimized
steering mode (-7) QPs can be attached to the port's MAC, therefore no need
for the check.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 11:02:26 +02:00
Or Ami
0ab6626beb mlx4: fix error message for invalid number of descriptors
The number of descriptors must be a multiple of MLX4_PMD_SGE_WR_N.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:58:52 +02:00
Alex Rosenbaum
baf036766f mlx4: use MOFED 3.0 extended flow steering API
This commit drops "exp" from related function and type names to stop using
the experimental API.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:58:24 +02:00
Olga Shern
e947d2ec8b mlx4: improve accuracy of link status information
Query interface properties using the ethtool API instead of Verbs
through ibv_query_port(). The returned information is more accurate for
Ethernet links since several link speeds cannot be mapped to Verbs
semantics.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:58:11 +02:00
Olga Shern
643777a171 mlx4: allow application to partially fork
Although using the PMD from a forked process is still unsupported, this
commit makes Verbs safe enough for applications to call fork() for other
purposes.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:55:40 +02:00
Alex Rosenbaum
decb879408 mlx4: merge Rx queue setup functions
Make rxq_setup_qp() handle inline support like rxq_setup_qp_rss() instead of
having two separate functions.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:55:16 +02:00
Alex Rosenbaum
c3f2341582 mlx4: avoid looking up work request id to improve Rx performance
This is done by storing the current index in the RX queue structure.

Signed-off-by: Alex Rosenbaum <alexr@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:49:17 +02:00
Olga Shern
aad569e437 mlx4: make sure experimental device query is implemented
HAVE_EXP_QUERY_DEVICE is used to check whether ibv_exp_query_device() can be
used. RSS and inline receive features depend on it.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:48:17 +02:00
Adrien Mazarguil
68a60cee2f mlx4: add MOFED 3.0 compatibility to interface name retrieval
Since Mellanox OFED 3.0 and Linux 3.15, interface port numbers are stored
in dev_port instead of dev_id sysfs files.

Signed-off-by: Or Ami <ora@mellanox.com>
Signed-off-by: Nitzan Weller <nitzanwe@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:45:59 +02:00
Adrien Mazarguil
53bbf5afbd mlx4: fix possible crash on scattered mbuf allocation failure
When failing to allocate a segment, mlx4_rx_burst_sp() may call
rte_pktmbuf_free() on an incomplete scattered mbuf whose next pointer
in the last segment is not set.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-07-01 10:17:31 +02:00
Cyril Chemparathy
82be8d5442 mbuf: use offset macro
This patch simply applies the transform previously committed in
scripts/cocci/mtod-offset.cocci.  No other modifications have been
made here.

Signed-off-by: Cyril Chemparathy <cchemparathy@ezchip.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2015-06-24 12:01:14 +02:00
Nelio Laranjeiro
d6145abec4 mlx4: fix 32-bit build
Fix warning messages "cast to pointer from integer of different size" when
compiling DPDK in 32 bit with Mellanox PMD.

SGE addresses are 64 bit integers, converting them to pointers must be done
through uintptr_t to avoid compilation warnings when those have a different
size.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2015-06-12 17:38:14 +02:00
Bruce Richardson
98a1f3776f mlx4: move to drivers/net/
move mlx4 PMD to drivers/net directory

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-05-22 16:06:22 +02:00