dpdk.git
4 years agonet/octeontx: fix user supplied MAC address index
Sunil Kumar Kori [Wed, 29 Jan 2020 06:42:42 +0000 (12:12 +0530)]
net/octeontx: fix user supplied MAC address index

Earlier after a successful mac_addr_add operation, index was returned
by underlying layer which was unused but same as provided by DPDK API.

So API is enhanced to use application provided index location to add
MAC address entry.

Fixes: e4373bf1b3f5 ("net/octeontx: add unicast MAC filter")

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Harman Kalra <hkalra@marvell.com>
4 years agonet/octeontx: fix memory leak of MAC address table
Sunil Kumar Kori [Wed, 29 Jan 2020 09:17:04 +0000 (14:47 +0530)]
net/octeontx: fix memory leak of MAC address table

MAC address table is allocated during octeontx device create and
same is used to maintain list of MAC address associated to port.
This table is not getting freed niether in case of error nor during
graceful shutdown of port.

Patch fixes memory required memory for both the cases as mentioned.

Fixes: f18b146c498d ("net/octeontx: create ethdev ports")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Harman Kalra <hkalra@marvell.com>
4 years agonet/octeontx2: fix Tx flow control for HIGIG
Kiran Kumar K [Thu, 30 Jan 2020 16:23:24 +0000 (21:53 +0530)]
net/octeontx2: fix Tx flow control for HIGIG

Tx flow controlled is disabled in the Ax silicon version due to an errata.
This errata is not applicable for HIGIG Tx flow control, therefore
not enabling in HIGIG case.

Fixes: 602009ee2dfb ("net/octeontx2: support HIGIG2")
Cc: stable@dpdk.org
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/i40e: fix multi-queue Rx interrupt for VF
Lunyuan Cui [Fri, 17 Jan 2020 08:22:58 +0000 (08:22 +0000)]
net/i40e: fix multi-queue Rx interrupt for VF

The interrupt vector which bind to queues should not be larger than
the max available vector. It will cause port start failed. This patch
changed the judgement condition of the limited vector id. It can
effectively avoid vector id out of range.

Fixes: 6a6cf5f88b4a ("net/i40e: enable multi-queue Rx interrupt for VF")

Signed-off-by: Lunyuan Cui <lunyuanx.cui@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice: fix GTP-U rule conflict
Qi Zhang [Wed, 22 Jan 2020 05:28:24 +0000 (13:28 +0800)]
net/ice: fix GTP-U rule conflict

The patch distinguishes fdir rules for GTPU with or without
extend header, so flow to match below patterns can be created
correctly.

1. eth / ipv4 / udp / gtpu teid is 10 / ...
2. eth / ipv4 / udp / gtpu teid is 10 / gtp_psc / ...
3. eth / ipv4 / udp / gtpu / gtp_psc qfi is 10 / ...
4. eth / ipv4 / udp / gtpu teid is 10 / gtp_psc is 10 / ...

Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/e1000: use macro for PCI log format
Yunjian Wang [Mon, 13 Jan 2020 12:20:28 +0000 (20:20 +0800)]
net/e1000: use macro for PCI log format

Use PCI_PRI_FMT instead of "%04d:%02d:%02d:%d" print format.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/mlx5: fix VXLAN-GPE item translation
Raslan Darawsheh [Mon, 27 Jan 2020 15:34:12 +0000 (17:34 +0200)]
net/mlx5: fix VXLAN-GPE item translation

Currently, when using VXLAN-GPE or VXLAN item in the flow
both are being treated the same with flags 0x8 in VXLAN
header. Which mean the matching of the item VXLAN-GPE
will match any VXLAN packet.

This fixes the translation of VXLAN GPE item into PMD flow
item. Which will by default set the flags to VXLAN-GPE
to be 0xc.

Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agodoc: add secondary VF details in thunderx guide
Krzysztof Kanas [Tue, 28 Jan 2020 13:31:47 +0000 (14:31 +0100)]
doc: add secondary VF details in thunderx guide

thunderx-nic uses secondary VF's to provide more queues to DPDK.
Current instructions explain the concept but don't show an easy way to
find which PCI id is primary and which is secondary VF's.

This patch extending the documentation of secondary VF w.r.t
the enumeration details.

Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/octeontx2: change default RSS hash calculation
Jerin Jacob [Wed, 29 Jan 2020 17:24:12 +0000 (22:54 +0530)]
net/octeontx2: change default RSS hash calculation

Before C0 HW revision, The RSS adder was computed based the following
static formula.

rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^
flow_tag<23:16> ^ flow_tag<31:24>

The above scheme has the following drawbacks:
1) It is not in line with other standard NIC behavior.
2) There can be an SW use case where SW can compute the hash
upfront using Toeplitz function and predict the queue selection
to optimize some packet lookup function. The nonstandard
way of doing XOR makes the consumer to not predict the queue selection.

C0 HW revision onward, The HW can configure the
rss_adder<7:0> as flow_tag<7:0> to align with standard NICs.

This patch adds an option to select legacy RSS adder mode
using tag_as_xor=1 devargs option while keeping the standard NIC
behavior as default.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/ionic: fix packet type mask
Alfredo Cardigliano [Thu, 30 Jan 2020 17:26:49 +0000 (18:26 +0100)]
net/ionic: fix packet type mask

Fix the IONIC_RXQ_COMP_PKT_TYPE_MASK define.

Coverity issue: 353608
Fixes: 01489e5d79a7 ("net/ionic: add hardware structures definitions")

Signed-off-by: Alfredo Cardigliano <cardigliano@ntop.org>
4 years agonet/bnxt: remove spurious warning in Rx handler
Somnath Kotur [Fri, 31 Jan 2020 06:16:58 +0000 (11:46 +0530)]
net/bnxt: remove spurious warning in Rx handler

HW seems to populate the cfa code in the Rx descriptor even
if an explicit flow rule is not configured via application as
there might be a default rule configured in HW even for promisc
mode.

Fixes: 94eb699bc82e ("net/bnxt: support flow mark action")

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agocommon/mlx5: improve assert control
Alexander Kozyrev [Thu, 30 Jan 2020 16:14:40 +0000 (18:14 +0200)]
common/mlx5: improve assert control

Use the MLX5_ASSERT macros instead of the standard assert clause.
Depends on the RTE_LIBRTE_MLX5_DEBUG configuration option to define it.
If RTE_LIBRTE_MLX5_DEBUG is enabled MLX5_ASSERT is equal to RTE_VERIFY
to bypass the global CONFIG_RTE_ENABLE_ASSERT option.
If RTE_LIBRTE_MLX5_DEBUG is disabled, the global CONFIG_RTE_ENABLE_ASSERT
can still make this assert active by calling RTE_VERIFY inside RTE_ASSERT.

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: remove NDEBUG
Alexander Kozyrev [Thu, 30 Jan 2020 16:14:39 +0000 (18:14 +0200)]
common/mlx5: remove NDEBUG

Use the RTE_LIBRTE_MLX5_DEBUG configuration flag to get rid of dependency
on the NDEBUG definition. This is a preparation step to switch
from standard assert clauses to DPDK RTE_ASSERT ones in MLX5 driver.

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx4: improve assert control
Alexander Kozyrev [Thu, 30 Jan 2020 16:14:38 +0000 (18:14 +0200)]
net/mlx4: improve assert control

Use the MLX4_ASSERT macros instead of the standard assert clause.
Depends on the RTE_LIBRTE_MLX4_DEBUG configuration option to define it.
If RTE_LIBRTE_MLX4_DEBUG is enabled MLX4_ASSERT is equal to RTE_VERIFY
to bypass the global CONFIG_RTE_ENABLE_ASSERT option.
If RTE_LIBRTE_MLX4_DEBUG is disabled, the global CONFIG_RTE_ENABLE_ASSERT
can still make this assert active by calling RTE_VERIFY inside RTE_ASSERT.

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx4: remove NDEBUG flag
Alexander Kozyrev [Thu, 30 Jan 2020 16:14:37 +0000 (18:14 +0200)]
net/mlx4: remove NDEBUG flag

Use the RTE_LIBRTE_MLX4_DEBUG compilation flag to get rid of dependency
on the NDEBUG definition. This is a preparation step to switch
from standard assert clauses to DPDK RTE_ASSERT ones in MLX4 driver.

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agomk: remove promotion of icc warnings as errors
Alexander Kozyrev [Thu, 30 Jan 2020 16:14:36 +0000 (18:14 +0200)]
mk: remove promotion of icc warnings as errors

Remove -Werror-all flag in ICC configuration file to stop treating ICC
warnings as errors in DPDK due to many false positives. We are using
GCC and Clang as a benchmark for warnings anyway for simplification.

Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agonet/mlx5: add no-inline Tx flag
Viacheslav Ovsiienko [Wed, 29 Jan 2020 12:21:07 +0000 (12:21 +0000)]
net/mlx5: add no-inline Tx flag

This patch adds support for dynamic flag that hints transmit
datapath do not copy data to the descriptors. This flag is
useful when data are located in the memory of another (not NIC)
physical device and copying to the host memory is undesirable.

This hint flag is per mbuf for multi-segment packets.

This hint flag might be partially ignored if:

- hardware requires minimal data header to be inline into
  descriptor, it depends on the hardware type and its configuration.
  In this case PMD copies the minimal required number of bytes to
  the descriptor, ignoring the no inline hint flag, the rest of data
  is not copied.

- VLAN tag insertion offload is requested and hardware does not
  support this options. In this case the VLAN tag is inserted by
  software means and at least 18B are copied to descriptor.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support fine grain dynamic flag
Ori Kam [Wed, 29 Jan 2020 12:21:06 +0000 (12:21 +0000)]
net/mlx5: support fine grain dynamic flag

The inline feature is designed to save PCI bandwidth by copying some
of the data to the wqe. This feature if enabled works for all packets.

In some cases when using external memory, the PCI bandwidth is not
relevant since the memory can be accessed by other means.

This commit introduce the ability to control the inline with mbuf
granularity.

In order to use this feature the application should register the field
name, and restart the port.

Signed-off-by: Ori Kam <orika@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: make FDB default rule optional
Matan Azrad [Tue, 28 Jan 2020 17:06:43 +0000 (17:06 +0000)]
net/mlx5: make FDB default rule optional

There are RDMA-CORE versions which are not supported multi-table for
some Mellanox mlx5 devices.

Hence, the optimization added in commit [1] which forwards all the FDB
traffic to table 1 cannot be configured.

Make the above optimization optional:
Do not fail when either table 1 cannot be created or the jump rule
(all =>jump to table 1) is not configured successfully.
In this case, all the flows will be configured to table 0.

[1] commit b67b4ecbde22 ("net/mlx5: skip table zero to improve
insertion rate")

Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: support ROCE disable through Netlink
Matan Azrad [Wed, 29 Jan 2020 12:38:50 +0000 (12:38 +0000)]
common/mlx5: support ROCE disable through Netlink

Add new 4 Netlink commands to support enable/disable ROCE:
        1. mlx5_nl_devlink_family_id_get to get the Devlink family ID of
           Netlink general command.
        2. mlx5_nl_enable_roce_get to get the ROCE current status.
        3. mlx5_nl_driver_reload - to reload the device kernel driver.
        4. mlx5_nl_enable_roce_set - to set the ROCE status.

When the user changes the ROCE status, the IB device may disappear and
appear again, so DPDK driver should wait for it and to restart itself.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: share Netlink commands
Matan Azrad [Wed, 29 Jan 2020 12:38:49 +0000 (12:38 +0000)]
common/mlx5: share Netlink commands

Move Netlink mechanism and its dependencies from net/mlx5 to
common/mlx5 in order to be ready to use by other mlx5 drivers.

The dependencies are BITFIELD defines, the ppc64 compilation workaround
for bool type and the function mlx5_translate_port_name.

Update build mechanism accordingly.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reduce Netlink commands dependencies
Matan Azrad [Wed, 29 Jan 2020 12:38:48 +0000 (12:38 +0000)]
net/mlx5: reduce Netlink commands dependencies

As an arrangment for Netlink command moving to the common library,
reduce the net/mlx5 dependencies.

Replace ethdev class command parameters.

Improve Netlink sequence number mechanism to be controlled by the
mlx5 Netlink mechanism.

Move mlx5_nl_check_switch_info to mlx5_nl.c since it is the only one
which uses it.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: separate Netlink command interface
Matan Azrad [Wed, 29 Jan 2020 12:38:47 +0000 (12:38 +0000)]
net/mlx5: separate Netlink command interface

The Netlink commands interfaces is included in the mlx5.h file with a
lot of other PMD interfaces.

As an arrangement to make the Netlink commands shared with different
PMDs, this patch moves the Netlink interface to a new file called
mlx5_nl.h.

Move non Netlink pure vlan commands from mlx5_nl.c to the
mlx5_vlan.c.

Rename Netlink commands and structures to use prefix mlx5_nl.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: select driver by class device argument
Matan Azrad [Wed, 29 Jan 2020 12:38:46 +0000 (12:38 +0000)]
net/mlx5: select driver by class device argument

There might be a case that one Mellanox device can be probed by
multiple mlx5 drivers.

One case is that any mlx5 vDPA device can be probed by both net/mlx5
and vdpa/mlx5.

Add a new mlx5 common API to get the requested driver by devargs:
class=[net/vdpa].

Skip net/mlx5 PMD probing while the device is selected to be probed by
the vDPA driver.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: get DevX capability for max RQT size
Matan Azrad [Wed, 29 Jan 2020 12:38:45 +0000 (12:38 +0000)]
common/mlx5: get DevX capability for max RQT size

In order to allow RQT size configuration which is limited to the
correct maximum value, add log_max_rqt_size for DevX capability
structure.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: add DevX command to modify RQT
Matan Azrad [Wed, 29 Jan 2020 12:38:44 +0000 (12:38 +0000)]
common/mlx5: add DevX command to modify RQT

RQ table can be changed to support different list of queues.

Add DevX command to modify DevX RQT object to point on new RQ list.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: add TIR field constants
Matan Azrad [Wed, 29 Jan 2020 12:38:43 +0000 (12:38 +0000)]
common/mlx5: add TIR field constants

The DevX TIR object configuration should get L3 and L4 protocols
expected to be forwarded by the TIR.

Add the PRM constant values needed to configure the L3 and L4 protocols.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: allow type configuration for DevX RQT
Matan Azrad [Wed, 29 Jan 2020 12:38:42 +0000 (12:38 +0000)]
common/mlx5: allow type configuration for DevX RQT

Allow virtio queue type configuration in the RQ table.
The needed fields and configuration was added.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: support DevX QP operations
Matan Azrad [Wed, 29 Jan 2020 12:38:41 +0000 (12:38 +0000)]
common/mlx5: support DevX QP operations

QP creation is needed for vDPA virtq support.

Add 2 DevX commands to create QP and to modify QP state.

The support is for RC QP only in force loopback address mode.

By this way, the packets can be sent to other inernal destinations in
the nic. For example: other QPs or virtqs.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: add DevX virtq commands
Matan Azrad [Wed, 29 Jan 2020 12:38:40 +0000 (12:38 +0000)]
common/mlx5: add DevX virtq commands

Virtio emulation offload allows SW to offload the I/O operations of a
virtio virtqueue, using the device, allowing an improved performance
for its users.
While supplying all the relevant Virtqueue information (type, size,
memory location, doorbell information, etc.). The device can then
offload the I/O operation of this queue, according to its device type
characteristics.

Some of the virtio features can be supported according to the device
capability, for example, TSO and checksum.

Add virtio queue create, modify and query DevX commands.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: glue VAR allocation
Matan Azrad [Wed, 29 Jan 2020 12:38:39 +0000 (12:38 +0000)]
common/mlx5: glue VAR allocation

Virtio access region(VAR) is the UAR that allocated for virtio emulation
access.

Add rdma-core operations to allocate and free VAR.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: add DevX command to create CQ
Matan Azrad [Wed, 29 Jan 2020 12:38:38 +0000 (12:38 +0000)]
common/mlx5: add DevX command to create CQ

HW implements completion queues(CQ) used to post completion reports upon
completion of work request.

Used for Rx and Tx datapath.

Add DevX command to create a CQ.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: glue UAR allocation
Matan Azrad [Wed, 29 Jan 2020 12:38:37 +0000 (12:38 +0000)]
common/mlx5: glue UAR allocation

The isolated, protected and independent direct access to the HW by
multiple processes is implemented via User Access Region (UAR)
mechanism.
The UAR is part of PCI address space that is mapped for direct access to
the HW from the CPU.
UAR is comprised of multiple pages, each page containing registers that
control the HW operation.
UAR mechanism is used to post execution or control requests to the HW.
It is used by the HW to enforce protection and isolation between
different processes.

Add a glue command to allocate and free an UAR.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: glue event interrupt commands
Matan Azrad [Wed, 29 Jan 2020 12:38:36 +0000 (12:38 +0000)]
common/mlx5: glue event interrupt commands

Add the next commands to glue in order to support interrupt event
channel operations associated to events in the EQ:
devx_create_event_channel,
devx_destroy_event_channel,
devx_subscribe_devx_event,
devx_subscribe_devx_event_fd,
devx_get_event.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: glue event queue query
Matan Azrad [Wed, 29 Jan 2020 12:38:35 +0000 (12:38 +0000)]
common/mlx5: glue event queue query

The event queue is managed only by the kernel.

Add the rdma-core command in glue to query the kernel event queue
details.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: support DevX indirect mkey creation
Matan Azrad [Wed, 29 Jan 2020 12:38:34 +0000 (12:38 +0000)]
common/mlx5: support DevX indirect mkey creation

Add option to create an indirect mkey by the current
mlx5_devx_cmd_mkey_create command.

Indirect mkey points to set of direct mkeys.
By this way, the HW\SW can reference fragmented memory by one object.

Align the net/mlx5 driver usage in the above command.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: glue null memory region allocation
Matan Azrad [Wed, 29 Jan 2020 12:38:33 +0000 (12:38 +0000)]
common/mlx5: glue null memory region allocation

Add support for rdma-core API to allocate NULL MR.

When the device HW get a NULL MR address, it will do nothing with the
address, no read and no write.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: query vDPA DevX capabilities
Matan Azrad [Wed, 29 Jan 2020 12:38:32 +0000 (12:38 +0000)]
common/mlx5: query vDPA DevX capabilities

Add the DevX capabilities for vDPA configuration and information of
Mellanox devices.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: share CQ entry check
Matan Azrad [Wed, 29 Jan 2020 12:38:31 +0000 (12:38 +0000)]
common/mlx5: share CQ entry check

The CQE has owner bit to indicate if it is in SW control or HW.

Share a CQE check for all the mlx5 drivers.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: share devices information
Matan Azrad [Wed, 29 Jan 2020 12:38:30 +0000 (12:38 +0000)]
common/mlx5: share devices information

Move the vendor information, vendor ID and device IDs from net/mlx5 PMD
to the common mlx5 file.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: share PCI device detection
Matan Azrad [Wed, 29 Jan 2020 12:38:29 +0000 (12:38 +0000)]
common/mlx5: share PCI device detection

Move PCI detection by IB device from mlx5 PMD to the common code.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: introduce common library
Matan Azrad [Wed, 29 Jan 2020 12:38:27 +0000 (12:38 +0000)]
common/mlx5: introduce common library

A new Mellanox vdpa PMD will be added to support vdpa operations by
Mellanox adapters.

This vdpa PMD design includes mlx5_glue and mlx5_devx operations and
large parts of them are shared with the net/mlx5 PMD.

Create a new common library in drivers/common for mlx5 PMDs.
Move mlx5_glue, mlx5_devx_cmds and their dependencies to the new mlx5
common library in drivers/common.

The files mlx5_devx_cmds.c, mlx5_devx_cmds.h, mlx5_glue.c,
mlx5_glue.h and mlx5_prm.h are moved as is from drivers/net/mlx5 to
drivers/common/mlx5.

Share the log mechanism macros.
Separate also the log mechanism to allow different log level control to
the common library.

Build files and version files are adjusted accordingly.
Include lines are adjusted accordingly.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: separate DevX commands interface
Matan Azrad [Wed, 29 Jan 2020 12:38:26 +0000 (12:38 +0000)]
net/mlx5: separate DevX commands interface

The DevX commands interface is included in the mlx5.h file with a lot
of other PMD interfaces.

As an arrangement to make the DevX commands shared with different PMDs,
this patch moves the DevX interface to a new file called mlx5_devx_cmds.h.

Also remove shared device structure dependency on DevX commands.

Replace the DevX commands log mechanism from the mlx5 driver log
mechanism to the EAL log mechanism.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/bnx2x: fix VLAN stripped flag
Rasesh Mody [Wed, 29 Jan 2020 01:43:13 +0000 (17:43 -0800)]
net/bnx2x: fix VLAN stripped flag

For VLAN packet the tci is saved in rx_mb->vlan_tci, however the
STRIPPED offload flag is not set along with PKT_RX_VLAN flag.
Set the PKT_RX_VLAN_STRIPPED flag as well.

Fixes: 380a7aab1ae2 ("mbuf: rename deprecated VLAN flags")
Fixes: b37b528d957c ("mbuf: add new Rx flags for stripped VLAN")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rmody@marvell.com>
4 years agonet/bnxt: fix return code handling in VLAN config
Kalesh AP [Tue, 28 Jan 2020 07:29:23 +0000 (12:59 +0530)]
net/bnxt: fix return code handling in VLAN config

return value stored in "ret" but it has been overwritten before use.

Coverity issue: 353621
Fixes: 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix supporting zero mark ID with RSS action
Somnath Kotur [Tue, 28 Jan 2020 07:29:22 +0000 (12:59 +0530)]
net/bnxt: fix supporting zero mark ID with RSS action

Certain applications(Ex: OVS-DPDK) can issue rte_flow_create with mark
id set to 0. The mark table entry creation in the driver was assuming
non-zero mark ids. Fix it to have a valid flag for each entry.
Also, it is possible that both RSS flags and cfa_code/ mark id are set
as part of the Rx packet completion descriptor if the 'action' for a
flow is MARK + RSS.

Fix Rx completion processing to look for both fields as opposed to only
either.

Fixes: 94eb699bc82e ("net/bnxt: support flow mark action")

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: remove a redundant variable
Kalesh AP [Tue, 28 Jan 2020 07:29:21 +0000 (12:59 +0530)]
net/bnxt: remove a redundant variable

Use "dev->data->dev_started" state, instead of local "dev_stopped"
to check whether port has been started or not.

Fixes: 316e412299fd ("net/bnxt: fix crash when closing")
Cc: stable@dpdk.org
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
4 years agonet/bnxt: remove unnecessary structure variable
Kalesh AP [Tue, 28 Jan 2020 07:29:20 +0000 (12:59 +0530)]
net/bnxt: remove unnecessary structure variable

This change could help in reducing the size of bnxt PMD private
data structure by converting a uint8_t variable to use bit map flag.

Fixes: 5cd0e2889c43 ("net/bnxt: support NIC Partitioning")
Cc: stable@dpdk.org
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
4 years agonet/bnxt: remove redundant macro
Kalesh AP [Tue, 28 Jan 2020 07:29:19 +0000 (12:59 +0530)]
net/bnxt: remove redundant macro

Use "dev->data->dev_started" state, instead of local BNXT_FLAG_INIT_DONE
to check whether device has been initialised or not.

Fixes: ed2ced6fe927 ("net/bnxt: check initialization before accessing stats")
Cc: stable@dpdk.org
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
4 years agonet/bnxt: remove redundant if statement
Kalesh AP [Tue, 28 Jan 2020 07:29:18 +0000 (12:59 +0530)]
net/bnxt: remove redundant if statement

Since "eth_dev->data->dev_started" has been assigned to 0 at the
beginning of bnxt_dev_stop_op() routine, the code inside the if()
condition is redundant. Remove it.

Anyways "eth_dev->data->dev_link.link_status" will be set to 0 in
bnxt_dev_set_link_down_op() later in the routine.

Fixes: 316e412299fd ("net/bnxt: fix crash when closing")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: allow group ID 0 for RSS action
Somnath Kotur [Tue, 28 Jan 2020 07:29:17 +0000 (12:59 +0530)]
net/bnxt: allow group ID 0 for RSS action

Allow RSS action with group ID 0. The RSS match check will ensure if
requested RSS action configuration parameters should be allowed as per
the VNIC's RSS configuration or not and if it does match as it is
by design in OVS-DPDK use case, the default vnic can be used to create
the filter. As part of this ensure that rx_queue_cnt for the default
vnic is setup during init as this field was being set only for non-zero
vnics while handling RSS action for flow create.
Check for out of bounds error while accessing the vnic array.

Fixes: adc0f81c6552 ("net/bnxt: support RSS action")
Cc: stable@dpdk.org
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix bumping of L2 filter reference count
Somnath Kotur [Tue, 28 Jan 2020 07:29:16 +0000 (12:59 +0530)]
net/bnxt: fix bumping of L2 filter reference count

Now that the L2 filter reference count is bumped up in all cases
including bnxt_alloc_filter() which is issued in init, just move this
ref count bump inside the routine issuing the HWRM cmd so that it is
bumped up only if the cmd is successful.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Cc: stable@dpdk.org
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix alloc filter to use a common routine
Somnath Kotur [Tue, 28 Jan 2020 07:29:15 +0000 (12:59 +0530)]
net/bnxt: fix alloc filter to use a common routine

Invoke bnxt_get_unused_filter() inside bnxt_alloc_filter() so that
all filters are allocated from one common routine.

Fixes: f92735db1e4c ("net/bnxt: add L2 filter alloc/init/free")
Cc: stable@dpdk.org
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/octeontx2: disable HIGIG on port stop
Kiran Kumar K [Fri, 24 Jan 2020 13:54:26 +0000 (19:24 +0530)]
net/octeontx2: disable HIGIG on port stop

If HIGIG mode is enabled on configure, This needs to be disabled
on port stop. Adding support to send mbox message on port stop
to configure the port to default.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/octeontx2: extend RSS supported offload types
Kiran Kumar K [Fri, 24 Jan 2020 03:46:02 +0000 (09:16 +0530)]
net/octeontx2: extend RSS supported offload types

Extend RSS offload types for octeontx2. Add support to select
L3 SRC, L3 DST, L4 SRC and L4 DST for RSS calculation.

Add support to select L3 SRC or DST only, L4 SRC or DST only for RSS
calculation.

With this requirement there will be following combinations,
IPV[4,6]_SRC_ONLY, IPV[4,6]_DST_ONLY, [TCP,UDP,SCTP]_SRC_ONLY,
[TCP,UDP,SCTP]_DST_ONLY. So, instead of creating a bit for each
combination, we are using upper 4 bits (31:28) in the flow_key_cfg
to represent the SRC, DST selection. 31 => L3_SRC, 30 => L3_DST,
29 => L4_SRC, 28 => L4_DST. These won't be part of flow_cfg, so that
we don't need to change the existing ABI.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/bnx2x: fix to sync fastpath Rx queue access
Rasesh Mody [Sun, 26 Jan 2020 22:54:19 +0000 (14:54 -0800)]
net/bnx2x: fix to sync fastpath Rx queue access

PMD handles fast path completions in the Rx handler and control path
completions in the interrupt handler. They both are processing
completions from the same fastpath completion queue. There is a
potential for race condition when these two paths are processing
the completions from the same queue and trying to updating Rx Producer.

Add a fastpath Rx lock between these two paths to close this race.

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rmody@marvell.com>
4 years agonet/bnx2x: fix reset of scan FP flag
Rasesh Mody [Sun, 26 Jan 2020 22:54:18 +0000 (14:54 -0800)]
net/bnx2x: fix reset of scan FP flag

The fastpath task queue handler resets the fastpath scan flag
unconditionally, this patch changes that to reset the flag
only if it was set.

Fixes: 08a6e472c3d7 ("net/bnx2x: fix packet drop")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rmody@marvell.com>
4 years agoapp/testpmd: fix RFC addresses for Tx only
Stephen Hemminger [Mon, 27 Jan 2020 03:34:58 +0000 (19:34 -0800)]
app/testpmd: fix RFC addresses for Tx only

The previous patch to change default IP addresses for tx only
mode got the wrong values (typo).

Fixes: bf5b2126bf44 ("app/testpmd: add ability to set Tx IP and UDP parameters")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/mlx5: fix register usage in meter
Suanming Mou [Thu, 23 Jan 2020 06:01:02 +0000 (08:01 +0200)]
net/mlx5: fix register usage in meter

Flow with meter will split to three subflows, the prefix subflow with
meter action do the color, the meter subflow  filter the packets, the
suffix subflow do all the left actions for packets pass the filter.
Both the color and the subflow match between prefix and suffix use the
register to store the tag.

For some of the NICs with meter color register share capability, it
only uses 8 LSB of the register for color, the left 24 MSB can be used
for flow id match between meter prefix subflow and suffix subflow.

Currently, one entire register is allocated for flow matching which
causes the NICs with limited registers don't have enough register for
other matching.

Add the meter color share capability checking to fix lacking of
registers issue.

Fixes: 9ea9b049a960 ("net/mlx5: split meter flow")
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: support maximum flow id allocation
Suanming Mou [Thu, 23 Jan 2020 06:01:01 +0000 (08:01 +0200)]
net/mlx5: support maximum flow id allocation

The id allocated is for the register unique id match. Some registers may
not use the full 32 bits. Add the maximum id to avoid allocate id over
the register restriction.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix ICMPv6 header rewrite actions
Shiri Kuzin [Wed, 22 Jan 2020 14:37:54 +0000 (14:37 +0000)]
net/mlx5: fix ICMPv6 header rewrite actions

The ConnectX-5 HW cannot calculate the checksum for ICMPv6,
therefore flows with pattern 'ipv6 proto is 58' with actions that change
the header should be rejected. the actions that change the header
in this type of flow are 'set_ipv6_src' and 'set_ipv6_dst'.

Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: stable@dpdk.org
Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix setting of port ID for egress rules
Dekel Peled [Wed, 22 Jan 2020 12:33:06 +0000 (14:33 +0200)]
net/mlx5: fix setting of port ID for egress rules

Previous patch fixed the setting of port-id for eswitch rules, which
are ingress only.
This patch expands the fix, to support NIC rules as well, which can
be ingress or egress.

Fixes: ce777b147bf8 ("net/mlx5: fix E-Switch flow without port item")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agonet/mlx5: fix zero out UDP checksum in encap data
Eli Britstein [Wed, 22 Jan 2020 15:03:58 +0000 (15:03 +0000)]
net/mlx5: fix zero out UDP checksum in encap data

The cited commit zeroed the UDP checksum for raw-encap case.
Add the same handling for vxlan-encap case.

Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")
Cc: stable@dpdk.org
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix build with clang 3.4.2
Matan Azrad [Wed, 22 Jan 2020 14:36:10 +0000 (14:36 +0000)]
net/mlx5: fix build with clang 3.4.2

Compilation massage example:
"dpdk/drivers/net/mlx5/mlx5_flow_dv.c:1087:10: error: comparison of
unsigned enum expression < 0 is always false
[-Werror,-Wtautological-compare]
        if (reg < 0)
            ~~~ ^ ~
"

enum modify_reg holds only non-negative integers and in some places in
the code it was used to be compared with negative value, hence
compilation was failed.

Change all thus places to use integer instead of enum modify_reg.

Fixes: 3e8edd0ef848 ("net/mlx5: update metadata register ID query")
Fixes: 55deee1715f0 ("net/mlx5: extend flow mark support")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
4 years agodoc: update supported hardware offloads in mlx5 guide
Dekel Peled [Wed, 22 Jan 2020 14:27:23 +0000 (16:27 +0200)]
doc: update supported hardware offloads in mlx5 guide

Function of_set_vlan_vid is wrongly listed twice in table
"Supported hardware offloads".

This patch removes the listing of of_set_vlan_vid under
"Header rewrite", and leaves the listing of of_set_vlan_vid
under "VLAN".

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: update description of validation functions
Dekel Peled [Wed, 22 Jan 2020 14:27:22 +0000 (16:27 +0200)]
net/mlx5: update description of validation functions

Description of several functions is not accurate.
This patch updates the description, parameter names etc.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix VLAN VID action validation
Dekel Peled [Wed, 22 Jan 2020 14:27:21 +0000 (16:27 +0200)]
net/mlx5: fix VLAN VID action validation

Validation function of 'set VLAN VID' action checks twice for existing
same action in flow rule.

This patch updates the validation function logic, to check the same
restrictions more efficiently.

Fixes: 5f163d520cff ("net/mlx5: support modify VLAN ID on existing VLAN header")
Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix pop VLAN action validation
Dekel Peled [Wed, 22 Jan 2020 14:27:20 +0000 (16:27 +0200)]
net/mlx5: fix pop VLAN action validation

Validation function of 'POP VLAN' action includes check for other
'POP VLAN' actions present in flow.
It doesn't check for 'PUSH VLAN' actions present in flow.

This patch adds check for 'PUSH VLAN' actions present in flow.

Fixes: b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: block pop VLAN action on Tx
Dekel Peled [Wed, 22 Jan 2020 14:27:19 +0000 (16:27 +0200)]
net/mlx5: block pop VLAN action on Tx

Add missing check in validation function of 'pop VLAN' action.
Action is not allowed for egress flow rules.

Fixes: b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: block push VLAN action on Rx
Dekel Peled [Wed, 22 Jan 2020 14:27:18 +0000 (16:27 +0200)]
net/mlx5: block push VLAN action on Rx

Add missing check in validation function of 'push VLAN' action.
Action is not allowed for ingress flow rules.

Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: unify validation of drop action
Dekel Peled [Wed, 22 Jan 2020 14:27:17 +0000 (16:27 +0200)]
net/mlx5: unify validation of drop action

According to PRM: "Drop action is mutually-exclusive with any other
action, except for Count action".
In current code this limitation is checked separately in validation
function of each action.

This patch removes the discrete checks, and adds a single check common
for all actions.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allow push VLAN without VID
Dekel Peled [Wed, 22 Jan 2020 14:27:16 +0000 (16:27 +0200)]
net/mlx5: allow push VLAN without VID

Currently the push VLAN action requires a VID value, either from
existing VLAN item, or from following 'set VLAN vid' action.

This patch removes this limitation, allowing a push VLAN action with
vid value 0.

Fixes: b8c0372bc5ac ("net/mlx5: fix set VLAN ID/PCP in new header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix bit mask to validate push VLAN
Dekel Peled [Wed, 22 Jan 2020 14:27:15 +0000 (16:27 +0200)]
net/mlx5: fix bit mask to validate push VLAN

Validation function of 'push VLAN' action uses (POP_VLAN or PUSH_VLAN)
actions flags, instead of using a mask of both flags.

This patch replaces it to use existing VLAN_ACTIONS mask.

Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix check for VLAN actions
Dekel Peled [Wed, 22 Jan 2020 14:27:14 +0000 (16:27 +0200)]
net/mlx5: fix check for VLAN actions

Flow validation function includes, after all items and actions are
validated discretely, a check for VLAN and VXLAN actions.
This check is incorrect and redundant.

This patch removes the invalid check from validation function.
Check is incorrect, action_flags bit map is checked against
items mask MLX5_FLOW_LAYER_TUNNEL.
Check is also redundant, because VLAN push/pop actions can be used
together with packet reformat actions.

Fixes: b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix masks of encap and decap actions
Dekel Peled [Wed, 22 Jan 2020 14:27:13 +0000 (16:27 +0200)]
net/mlx5: fix masks of encap and decap actions

PUSH_VLAN and POP_VLAN actions flags were added to ENCAP_ACTIONS
and DECAP_ACTIONS bit masks, respectively.
This is incorrect, because VLAN actions are considered as 'modify
header' actions, not as 'packet reformat' actions.

This patch removes the PUSH_VLAN and POP_VLAN actions flags from
ENCAP_ACTIONS and DECAP_ACTIONS bit masks.

Fixes: 9aee7a8418d4 ("net/mlx5: support push flow action on VLAN header")
Fixes: b41e47da2592 ("net/mlx5: support pop flow action on VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/ice: add outer IPv4 matching for GTP-U flow
Chenmin Sun [Tue, 21 Jan 2020 11:56:53 +0000 (19:56 +0800)]
net/ice: add outer IPv4 matching for GTP-U flow

This patch adds the capability of matching the outer IPv4
headers for GTPU flows.

Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel")
Cc: stable@dpdk.org
Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/ice: fix flow director GTP-U pattern
Qi Zhang [Tue, 21 Jan 2020 01:30:48 +0000 (09:30 +0800)]
net/ice: fix flow director GTP-U pattern

Based on current FDIR implementation for GTP-U, inner specification is
not supported, issue a rule for eth/ipv4/gtpu/ipv4 will also match
eth/ipv4/gtpu/ipv6, the patch adds new pattern list to align with
existed implementation.

Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/tap: fix memory leak when unregister intr handler
Yunjian Wang [Tue, 21 Jan 2020 02:12:43 +0000 (10:12 +0800)]
net/tap: fix memory leak when unregister intr handler

The return check of function tap_lsc_intr_handle_set() is wrong, it should
be 0 or a positive number if success. So the intr_handle->intr_vec was not
been freed when tap_lsc_intr_handle_set() returned a positive number.

Fixes: 4870a8cdd968 ("net/tap: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/enic: use common min and max macros
John Daley [Tue, 21 Jan 2020 20:35:07 +0000 (12:35 -0800)]
net/enic: use common min and max macros

Use the RTE_MIN and RTE_MAX macros instead of private macros.

Fixes: aae7dd40cda4 ("net/enic: move min/max macros")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/bnxt: remove unnecessary memset
Stephen Hemminger [Wed, 22 Jan 2020 17:55:14 +0000 (09:55 -0800)]
net/bnxt: remove unnecessary memset

The rte_ethdev layer already zeros statistics before calling
the device.

Fixes: 57d5e5bc86e4 ("net/bnxt: add statistics")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: do not log error if stats queried before start
Stephen Hemminger [Wed, 22 Jan 2020 17:55:13 +0000 (09:55 -0800)]
net/bnxt: do not log error if stats queried before start

When using pktgen lots of unnecessary errors are printed
because pktgen queries statistics before device is started.

Fixes: 3e92fd4e4ec0 ("net/bnxt: use dynamic log type")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix VLAN strip flags in SSE Rx
Stephen Hemminger [Wed, 22 Jan 2020 00:47:33 +0000 (16:47 -0800)]
net/bnxt: fix VLAN strip flags in SSE Rx

When the VLAN is stripped from the packet on receive the
driver must set the PKT_RX_VLAN_STRIPPED flag in the mbuf.
This is done correctly for normal receive in the bnxt driver
but was not being handled correctly in the new SSE code.

Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/ice: fix flow FDIR/switch memory leak
Tao Zhu [Thu, 16 Jan 2020 16:38:36 +0000 (16:38 +0000)]
net/ice: fix flow FDIR/switch memory leak

1. Fix ice FDIR and hash flow memory leak.
2. Fix the ice definition of LIST_FOR_EACH_ENTRY_SAFE not
   save tmp which cause list deletion incompletely.

Fixes: 5f0978e96220 ("net/ice/base: add OS specific implementation")
Fixes: f5cafa961fae ("net/ice: add flow director create and destroy")
Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
Cc: stable@dpdk.org
Signed-off-by: Tao Zhu <taox.zhu@intel.com>
Reviewed-by: Simei Su <simei.su@intel.com>
Reviewed-by: Yahui Cao <yahui.cao@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/i40e/base: skip further adminq init for VF
Xiaolong Ye [Wed, 22 Jan 2020 03:58:10 +0000 (11:58 +0800)]
net/i40e/base: skip further adminq init for VF

Since VF has no need of firmware, we can skip further adminq init which
involves firmware operation, this patch fixes the testpmd segfault issue
when starting with i40e VF.

Fixes: d5e1a149362e ("net/i40e/base: check MAC type")

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/ice: fix flow director flag
Beilei Xing [Tue, 21 Jan 2020 11:42:11 +0000 (19:42 +0800)]
net/ice: fix flow director flag

If there's no mark action when creating a FDIR rule,
there shouldn't be FDIR flags in mbuf.

Fixes: f5cafa961fae ("net/ice: add flow director create and destroy")
Fixes: bd984f155f49 ("net/ice/base: support FDIR")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/bnxt: fix max rings calculation
Somnath Kotur [Thu, 16 Jan 2020 13:04:55 +0000 (18:34 +0530)]
net/bnxt: fix max rings calculation

Max Tx rings count could be lesser than max Rx rings in some
cases, so take this into account as well.

Account for stat contexts available(one for each ring) along with
no: of completion rings(one for each ring) to cap the max no: of
Tx /Rx rings that can be possibly created.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: release port upon close
Somnath Kotur [Thu, 16 Jan 2020 13:04:54 +0000 (18:34 +0530)]
net/bnxt: release port upon close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close().

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: use macro for PCI log format
Kalesh AP [Thu, 16 Jan 2020 13:04:53 +0000 (18:34 +0530)]
net/bnxt: use macro for PCI log format

Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix a memory leak in port stop
Kalesh AP [Thu, 16 Jan 2020 13:04:52 +0000 (18:34 +0530)]
net/bnxt: fix a memory leak in port stop

The memory for mark table is allocated during port start.
But the allocated memory is freed only during port close
or driver unload which in turn causes a memory leakage
on each port start/stop.

Fixed it by moving the memory free to port stop.

Fixes: 94eb699bc82e ("net/bnxt: support flow mark action")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: handle HW filter setting when port is stopped
Kalesh AP [Thu, 16 Jan 2020 13:04:51 +0000 (18:34 +0530)]
net/bnxt: handle HW filter setting when port is stopped

Driver destroy the VNIC when the port is brought down.
Port HW filter setting such as promiscuos, allmulti and
VLAN filtering will be applied when port is started.

Fixed to return success silently for these callbacks
when port is stopped. Also fixed to clear "bp->dev_stopped"
before invoking bnxt_vlan_offload_set_op() in bnxt_dev_start_op().

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: fix VLAN strip
Kalesh AP [Thu, 16 Jan 2020 13:04:50 +0000 (18:34 +0530)]
net/bnxt: fix VLAN strip

HWRM_VNIC_CFG command to configure VNIC dynamically with
traffic running is not working. Driver has to free and
recreate the VNIC and then reconfigure the VNIC filters.

Fixes: 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix enable/disable VLAN filtering
Kalesh AP [Thu, 16 Jan 2020 13:04:49 +0000 (18:34 +0530)]
net/bnxt: fix enable/disable VLAN filtering

There is no condition check for the user requested operation
for VLAN filtering. As a result, VLAN filtering is getting disabled
when the user enables/disables VLAN stripping on same port.

The function bnxt_hwrm_clear_l2_filter() didn't actually free
L2 filter in HW if the reference count of filter is zero.

Fixed it by incrementing the reference count of filter in
bnxt_alloc_filter() routine.

Because of the recent changes in bnxt_hwrm_clear_l2_filter(),
change was needed in the routine bnxt_set_default_mac_addr_op()
to destroy and re-create the default filter when the user
changes the default MAC of the port.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Fixes: 6118503d8071 ("net/bnxt: fix VLAN filtering")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix IOVA mapping
Kalesh AP [Thu, 16 Jan 2020 13:04:48 +0000 (18:34 +0530)]
net/bnxt: fix IOVA mapping

Use rte_malloc_virt2iova() to obtain the IO address of a
virtual address obtained through rte_malloc().

Fixed to use the iova address returned by rte_memzone_reserve_aligned()
as the call always returns with populating "mz->iova" with
rte_malloc_virt2iova(mz->addr).

Removed redundant rte_mem_lock_page() call to lock the pages.

Fixes: f55e12f33416 ("net/bnxt: support extended port counters")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix probe in FreeBSD
Kalesh AP [Thu, 16 Jan 2020 13:04:47 +0000 (18:34 +0530)]
net/bnxt: fix probe in FreeBSD

In FreeBSD environment, nic_uio driver does not support interrupts
and rte_intr_callback_register() will fail to register interrupts
which in turn causes bnxt driver probe failure.

Fixed driver to ignore interrupt callback failures in FreeBSD.
Also fixed to not use a dedicated completion ring for async events
from FW and process these events on RXQ0 in FreeBSD.

Fixes: 6de4c538b393 ("net/bnxt: fix error handling in port start")
Fixes: 43f78b380f89 ("net/bnxt: retry IRQ callback deregistration")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
4 years agonet/bnxt: fix flow creation
Kalesh AP [Thu, 16 Jan 2020 13:04:46 +0000 (18:34 +0530)]
net/bnxt: fix flow creation

If flow create fails due to not enough filter resources,
driver does not populate the rte_flow_error using
rte_flow_error_set().

Since "rte_errno" could have garbage value and is not reliable,
it could cause a segfault in the stack in port_flow_complain().

Fix it to set rte_flow_error using rte_flow_error_set()
when flow create fails due to not enough filter resources.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agovfio: fix mapping failures in ppc64le
Takeshi Yoshimura [Fri, 17 Jan 2020 04:25:55 +0000 (13:25 +0900)]
vfio: fix mapping failures in ppc64le

ppc64le failed when using large physical memory. I found problems in my two
commits in the past.

In commit e072d16f8920 ("vfio: fix expanding DMA area in ppc64le"), I added
a sanity check using a mapped address to resolve an issue around expanding
IOMMU window, but this was not enough, since memory allocation can return
memory anywhere dependent on memory fragmentation. DPDK may still skip DMA
mapping and attempts to unmap non-mapped DMA during expanding IOMMU window.
As a result, SPDK apps using large physical memory frequently failed to
proceed the communication with NVMe and/or went into an infinite loop.

The root cause of the bug was in a gap between memory segments managed by
DPDK and firmware-level DMA mapping. DPDK's memory segments don't contain
the state of DMA mapping, and so, the memesg_walk cannot determine if an
iterated memory segment is mapped or not. This resulted in incorrect DMA
maps and unmaps.

At this time, I added the code to avoid iterating non-mapped memory
segments during DMA mapping. The memseg_walk iterates over memory segments
marked as "used", and so, the code sets memory segments that will be
mapped or unmapped as "free" transiently.

The commit db90b4969e2e ("vfio: retry creating sPAPR DMA window") allows
retring different page levels and sizes to create DMA window. However, this
allows page sizes different from hugepage sizes. This inconsistency caused
failures at the time of DMA mapping after the window creation. This patch
fixes to retry only different page levels.

Fixes: e072d16f8920 ("vfio: fix expanding DMA area in ppc64le")
Fixes: db90b4969e2e ("vfio: retry creating sPAPR DMA window")
Cc: stable@dpdk.org
Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agobuild: remove unneeded function versioning
Andrzej Ostruszka [Thu, 30 Jan 2020 09:25:30 +0000 (10:25 +0100)]
build: remove unneeded function versioning

Timer, LPM and Distributor libraries no longer use function versioning
and therefore do not need separate build for static and shared version
of libraries.

This patch removes use_function_versioning from their meson build files
and corresponding include from the sources.

Fixes: f2fb215843a9 ("timer: remove deprecated code")
Fixes: 6e5b51676176 ("distributor: remove deprecated code")
Fixes: c381a8d554b7 ("lpm: remove deprecated code")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agopdump: use dynamic log type
Stephen Hemminger [Fri, 8 Nov 2019 16:47:17 +0000 (08:47 -0800)]
pdump: use dynamic log type

The logtype USER1 should not be overloaded for library function.
Instead use a dynamic log type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
4 years agopdump: use mbuf copy function
Stephen Hemminger [Fri, 8 Nov 2019 16:47:16 +0000 (08:47 -0800)]
pdump: use mbuf copy function

The rte_pktmbuf_copy handles varying size mbuf pools correctly.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
4 years agohash: fix lock-free flag doxygen
Honnappa Nagarahalli [Mon, 3 Feb 2020 19:49:12 +0000 (13:49 -0600)]
hash: fix lock-free flag doxygen

Lock-free extendable table is supported. Correct the comments.

Fixes: f401363d984a ("hash: support lock-free extendable bucket")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>