dpdk.git
4 years agonet/mlx5: fix validation of VXLAN/VXLAN-GPE specs
Raslan Darawsheh [Mon, 23 Mar 2020 14:21:33 +0000 (16:21 +0200)]
net/mlx5: fix validation of VXLAN/VXLAN-GPE specs

Trying to create zero spec for vni wasn't allowed, to
avoid matching all packets from previous layer (udp).
This behavior is incorrect, since VXLAN is being identified
through the outer UDP destination port.

Currently, if the user didn't specify outer UDP destination
port the PMD will automatically match only on  outer
UDP port of 4798, and if the user want to match on some none
standard port he need to specify it explicitly in the rule.

This removes the limitation of vni spec to be able to match any
vni.

Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")
Cc: stable@dpdk.org
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/ixgbe: fix e-tag definition
Wei Zhao [Mon, 30 Mar 2020 06:33:23 +0000 (14:33 +0800)]
net/ixgbe: fix e-tag definition

e_tag_ether_type has been wrongly defined as bool type which introduces
a bug for etag/etag_strip for x550 NIC. Fixes it by defining it as
uint16_t.

Fixes: ad43b7bce95b ("net/ixgbe: avoid multiple definitions of bool")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/ixgbe: fix link status inconsistencies
Tao Zhu [Wed, 26 Feb 2020 12:06:37 +0000 (20:06 +0800)]
net/ixgbe: fix link status inconsistencies

Setting LINK UP or LINK DOWN is divided into two parts, with
the main task done in a separate thread, which can take up
to 9 seconds. If cancel the thread in execution, may cause state
inconsistencies. Therefore, must wait for the previous setting
to exit normally before setting the new state.

Note: before using threads, use alarm to handle main tasks.
When canceling alarm, the execution of alarm will not be interrupted.

Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")
Cc: stable@dpdk.org
Signed-off-by: Tao Zhu <taox.zhu@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
4 years agonet/ice: get VF hardware index in DCF
Haiyue Wang [Fri, 27 Mar 2020 02:56:41 +0000 (10:56 +0800)]
net/ice: get VF hardware index in DCF

The DCF (Device Config Function) needs the hardware index of the VFs to
control the flow setting. And also if the VF resets, the index may be
changed, so it should handle this in VF reset event.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: handle PF initialization by DCF
Haiyue Wang [Fri, 27 Mar 2020 02:56:40 +0000 (10:56 +0800)]
net/ice: handle PF initialization by DCF

The DCF (Device Config Function) works at the user PF level, it can't
access the real PF hardware directly. So it will pass through the PF's
AdminQ command by the DCF's mailbox.

And the DCF is mainly used to control the flow setting of other VFs, so
it only needs to initialize some core functions related to the flow.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: export DDP definition symbols
Haiyue Wang [Fri, 27 Mar 2020 02:56:39 +0000 (10:56 +0800)]
net/ice: export DDP definition symbols

A new DCF PMD will be introduced, which runs on Intel VF hardware, and
it is a pure software design to control the advance functionality (such
as switch, ACL) for rest of the VFs.

The DCF (Device Config Function) feature shares the core functions of
the ICE PMD, like it needs to export the DDP definition symbols for the
new DCF PMD use.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: handle AdminQ command by DCF
Haiyue Wang [Fri, 27 Mar 2020 02:56:38 +0000 (10:56 +0800)]
net/ice: handle AdminQ command by DCF

The DCF (Device Config Function) splits the AdminQ command into two
parts: one is the descriptor of AdminQ command, the other is the buffer
of AdminQ command (the descriptor has BUF flag set). When both of them
are received by the PF, the PF will handle them as one command.

And also, the filled descriptor and buffer of the response will be sent
back to DCF one by one through the virtchnl from PF.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: acquire and disable DCF capability
Haiyue Wang [Fri, 27 Mar 2020 02:56:37 +0000 (10:56 +0800)]
net/ice: acquire and disable DCF capability

Since the DCF (Device Config Function) controls the flow setting of
other VFs by the mailbox with PF, for security, it needs to acquire
the DCF capability from PF when starts, and disable it when exits.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: add DCF hardware initialization
Haiyue Wang [Fri, 27 Mar 2020 02:56:36 +0000 (10:56 +0800)]
net/ice: add DCF hardware initialization

Introduce the DCF (Device Config Function) feature in the ice PMD, it
works as a standalone PMD which doesn't handle the packet Rx/Tx related
things. Its hardware entity is the VF.

Add the basic DCF hardware initialization, this is specified by devarg
'cap=dcf'.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: stop PCI probe in DCF mode
Haiyue Wang [Fri, 27 Mar 2020 02:56:35 +0000 (10:56 +0800)]
net/iavf: stop PCI probe in DCF mode

A new DCF PMD will be introduced, which runs on Intel VF hardware, and
it is a pure software design to control the advance functionality (such
as switch, ACL) for rest of the VFs.

So if the DCF (Device Config Function) mode is specified by the devarg
'cap=dcf', then it will stop the PCI probe in the iavf PMD.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: unify Rx packet type table
Shougang Wang [Fri, 6 Mar 2020 02:24:19 +0000 (02:24 +0000)]
net/iavf: unify Rx packet type table

This patch unified the Rx ptype table.

Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Acked-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
4 years agocommon/iavf: support VSI mapping table
Qi Zhang [Tue, 10 Mar 2020 00:37:11 +0000 (08:37 +0800)]
common/iavf: support VSI mapping table

Add an opcode for getting VSI mapping table.
Add an virtchnl event code for VF reset done.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: support DCF capability negotiation
Qi Zhang [Tue, 10 Mar 2020 00:37:10 +0000 (08:37 +0800)]
common/iavf: support DCF capability negotiation

Add DCF capability flag for VF.
Add an opcode for disabling DCF capability.
Add an virtchnl event code for AVF resetting completion.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: add two opcodes to send AdminQ command
Qi Zhang [Tue, 10 Mar 2020 00:37:09 +0000 (08:37 +0800)]
common/iavf: add two opcodes to send AdminQ command

Add two virtchnl opcodes to send the AdminQ command, one is used to
send the descriptor, the other is used to send the buffer payload if
the AdminQ command has BUF flag set.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agocommon/iavf: update copyright date
Qi Zhang [Tue, 10 Mar 2020 00:37:08 +0000 (08:37 +0800)]
common/iavf: update copyright date

Update copyright date to 2020.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/ice/base: add PPPoE IPv6 dummy packet
Qi Zhang [Mon, 23 Mar 2020 07:17:59 +0000 (15:17 +0800)]
net/ice/base: add PPPoE IPv6 dummy packet

In order to support switch rule for PPPOE packet
with ipv6 payload, it has to use a new dummy packet
with ipv6 format.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add reference count to tunnels
Qi Zhang [Mon, 23 Mar 2020 07:17:58 +0000 (15:17 +0800)]
net/ice/base: add reference count to tunnels

Add a lock for protecting the tunnel table while adding, removing
and searching tunnels.

Add reference counting to tunnels so that multiple instances
of the same tunnel port can be created. Only physically
destroy the tunnel when all instances of that tunnel have been
destroyed.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add check to IPv4 next protocol
Qi Zhang [Mon, 23 Mar 2020 07:17:57 +0000 (15:17 +0800)]
net/ice/base: add check to IPv4 next protocol

In order to support switch rule for NVGRE packets,
it need to check ipv4 next protocol number, if it is 0x2F,
which means next payload is NVGRE, we need to use NVGRE
format dummy packet.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: cleanup flow director functions
Qi Zhang [Mon, 23 Mar 2020 07:17:56 +0000 (15:17 +0800)]
net/ice/base: cleanup flow director functions

Cleanup some things found while doing code review:

- Remove unnecessary initializations, parenthesis, and braces
- Fix a couple of function headers

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: fix MAC write command
Qi Zhang [Mon, 23 Mar 2020 07:17:55 +0000 (15:17 +0800)]
net/ice/base: fix MAC write command

The manage MAC write command was implemented in an overly complex way
that actually didn't work, as it wasn't symmetric to the manage MAC
read command, and was feeding bytes out of order to the firmware. Fix
the implementation by just using a simple array to represent the MAC
address when it is being written via firmware command.

Fixes: a90fae1d0755 ("net/ice/base: add admin queue structures and commands")
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: check DDP package compatibility
Qi Zhang [Mon, 23 Mar 2020 07:17:54 +0000 (15:17 +0800)]
net/ice/base: check DDP package compatibility

Check the OS and NVM package versions before downloading the package.
If the OS package version is not compatible with NVM then return an
appropriate error.

Split the 32-byte segment name into a 28-byte segment name and
a 4-byte Track-ID. Older packages will still work with this change
because no package has a name that will take up more than 28 bytes;
in this case the Track-ID will be 0.

Note that the driver will store the segment name as 32-bytes in the
ice_hw structure, in order to normalize the length of the various
package name strings that it uses.

Also add section ID and structure for the segment metadata section.

Signed-off-by: Victor Raj <victor.raj@intel.com>
Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: discover and store size of available flash
Qi Zhang [Mon, 23 Mar 2020 07:17:53 +0000 (15:17 +0800)]
net/ice/base: discover and store size of available flash

When reading from the NVM using a flat address, it is useful to know the
upper bound on the size of the flash contents. This value is not stored
within the NVM.

We can determine the size by performing a bisection between upper and
lower bounds. It is known that the size cannot exceed 16 MB (offset of
0xFFFFFF).

Use a while loop to bisect the upper and lower bounds by reading one
byte at a time. On a failed read, lower the maximum bound. On
a successful read, increase the lower bound.

Save this as the flash_size in the ice_nvm_info structure that contains
data related to the NVM.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: move functions from common to NVM module
Qi Zhang [Mon, 23 Mar 2020 07:17:52 +0000 (15:17 +0800)]
net/ice/base: move functions from common to NVM module

The ice_get_pfa_module_tlv and ice_read_pba_string functions primarily
deal with reading from the Shadow RAM portion of the NVM contents. As
these functions are NVM focused, move them into the ice_nvm.c file.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: do not access some hardware registers in DCF
Qi Zhang [Mon, 23 Mar 2020 07:17:51 +0000 (15:17 +0800)]
net/ice/base: do not access some hardware registers in DCF

DCF runs as a VF so it can't access PF registers. And export the filter
management list static functions as public for make DCF initialization.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add hook to send AdminQ command
Qi Zhang [Mon, 23 Mar 2020 07:17:50 +0000 (15:17 +0800)]
net/ice/base: add hook to send AdminQ command

Add the hook to send the PF's AdminQ command in another path, like not
directly to the firmware.

If the AdminQ command is sent through the hook path, it needs to save
the AQ error codes from firmware as the last status for admin control
queue, so that the AdminQ command function can use it to do exception
handling like the buffer size is not enough according to error ENOMEM.

And convert explicitly the hook path result to the ice_status type.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: update copyright date
Qi Zhang [Mon, 23 Mar 2020 07:17:49 +0000 (15:17 +0800)]
net/ice/base: update copyright date

Update copyright date to 2020.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add ACL module
Qi Zhang [Mon, 23 Mar 2020 07:17:48 +0000 (15:17 +0800)]
net/ice/base: add ACL module

Add all ACL related code.

Signed-off-by: Real Valiquette <real.valiquette@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: store NVM version in extracted format
Qi Zhang [Mon, 23 Mar 2020 07:17:47 +0000 (15:17 +0800)]
net/ice/base: store NVM version in extracted format

Currently the NVM and Option ROM version information is stored in
a minimal format. The ice_get_nvm_version function exists to extract
this information for display.

This needlessly complicates using these fields as the extraction
function must be called to parse the NVM and Option ROM data. Further
confusion occurs because the prefix of "oem_" is used for the Option
ROM version. This appears to have been done because the Option ROM data
was requested for display by OEMs.

Refactor this code so that the NVM version and Option ROM version
components are extracted immediately.

Introduce a new struct ice_orom_info which will store the Option ROM
major, build, and patch numbers. Introduce the new major_ver and
minor_ver fields to store the NVM version in its high and low byte
components.

Remove the ice_get_nvm_version function. Instead, use the same logic to
convert the fields read from the NVM into the extracted format.

This simplifies use of these fields as they will be stored already
parsed, without needing to use the bit masks or call
ice_get_nvm_version.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: support PHY persistent feature
Qi Zhang [Mon, 23 Mar 2020 07:17:46 +0000 (15:17 +0800)]
net/ice/base: support PHY persistent feature

In this patch, we will modify the ice_copy_phy_caps_to_cfg(...) function
to conditionally fill up the
ice_aqc_set_phy_cfg_data.module_compliance_enforcement with correct
value, based on the PHY persistent feature.

Apply the ice_copy_phy_caps_to_cfg() function inside ice_set_fc()

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: fix a couple of casting
Qi Zhang [Mon, 23 Mar 2020 07:17:45 +0000 (15:17 +0800)]
net/ice/base: fix a couple of casting

Adjust variable size between u8 and u16 to fix casting issues
Also fix couple coding style issues

Karol Kolacinski <karol.kolacinski@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: implement new shadow RAM read
Qi Zhang [Mon, 23 Mar 2020 07:17:44 +0000 (15:17 +0800)]
net/ice/base: implement new shadow RAM read

Remove the ice_read_sr_aq function and implement ice_read_sr_word_aq
directly in terms of the new ice_read_flat_nvm function. This simplifies
the code by reducing a now unnecessary reading function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add macro specifying max NVM offset
Qi Zhang [Mon, 23 Mar 2020 07:17:43 +0000 (15:17 +0800)]
net/ice/base: add macro specifying max NVM offset

The ice_aq_read_nvm function uses a somewhat weird construction for
verifying that the incoming offset is valid. Replace this construction
with a simple greater-than expression, and define the maximum value
(24bits) in the ice_adminq_cmd.h

By providing a macro, the check becomes more clear. Additionally the
maximum offset can be used in other locations.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: extract logic of flat NVM read to function
Qi Zhang [Mon, 23 Mar 2020 07:17:42 +0000 (15:17 +0800)]
net/ice/base: extract logic of flat NVM read to function

The ice_read_sr_buf_aq function implements logic to correctly break
apart NVM reads into 4Kb chunks. Additionally, it ensures that each read
never crosses a Shadow RAM sector boundary. This logic is useful when
reading the flat NVM as a byte-addressable stream.

Extract that logic in terms of bytes and implement it as
ice_read_flat_nvm. Use this new function to implement ice_read_sr_buf_aq
function.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add AN masks to get PHY capabilities
Qi Zhang [Mon, 23 Mar 2020 07:17:41 +0000 (15:17 +0800)]
net/ice/base: add AN masks to get PHY capabilities

Adds masks indicating AN clauses to the Get PHY Capabilities
command. Changes the name of the low_power_ctrl field to be
properly descriptive of it being an AN field.

Signed-off-by: Lev Faerman <lev.faerman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add shared driver parameter command
Qi Zhang [Mon, 23 Mar 2020 07:17:40 +0000 (15:17 +0800)]
net/ice/base: add shared driver parameter command

Adds the Driver Shared Parameters (0x0C90) AQ command.

Signed-off-by: Lev Faerman <lev.faerman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add PHY number definition values
Qi Zhang [Mon, 23 Mar 2020 07:17:39 +0000 (15:17 +0800)]
net/ice/base: add PHY number definition values

As title.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: capitalize abbreviations
Qi Zhang [Mon, 23 Mar 2020 07:17:38 +0000 (15:17 +0800)]
net/ice/base: capitalize abbreviations

Fix abbreviations as found by abbrevcheck

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add dedicate MAC type for E810
Qi Zhang [Mon, 23 Mar 2020 07:17:37 +0000 (15:17 +0800)]
net/ice/base: add dedicate MAC type for E810

Add a new MAC type ICE_MAC_E810 to distinguish E810 devices from other
devices. MAC types for all other devices will be ICE_MAC_GENERIC till
there's a need to distinguish further between devices.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: support link default override
Qi Zhang [Mon, 23 Mar 2020 07:17:36 +0000 (15:17 +0800)]
net/ice/base: support link default override

Adds functions to check for link override firmware support and get
the override settings for a port. Link override allows a user to force
link settings that are not normally supported.

Firmware support is version dependent so a function to check support has
been added.

The link FC settings will use the override if available.

Signed-off-by: Evan Swanson <evan.swanson@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: support GTPU uplink and downlink
Qi Zhang [Mon, 23 Mar 2020 07:17:35 +0000 (15:17 +0800)]
net/ice/base: support GTPU uplink and downlink

Enable GTPU uplink and downlink flag usage.
TCAM with different GTPU extend header flag can be separated.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: minor fixes
Qi Zhang [Mon, 23 Mar 2020 07:17:34 +0000 (15:17 +0800)]
net/ice/base: minor fixes

This is a collection of minor fixes that were found during code review.
Changes are:
- Call ice_hweight8() instead of calculating it ourselves in
  ice_bits_max_set().
- Call ice_test_and_clear_bit() over calling ice_is_bit_set() then
  ice_clear_bit() in ice_rem_vsi_rss_list().
- Remove 'chrs' variable in ice_add_prof_id_flow() as it's not being
  used for anything.
- Return result directly instead of assigning to variable then
  returning the variable in ice_rem_vsig().
- Reduce scope, and don't initialize, 'or_vsig' in
  ice_add_prof_id_flow().
- Return error immediately in ice_add_prof_id_vsig(). Since the memory
  wasn't allocated, there is no need to goto and attempt to free memory.
- Show that values 37-38 are reserved in ice_flow_avf_hdr_field as the
  other reserved values are shown.
- Fix RCT ordering
- Remove initialization of values that aren't needed
- Fix function headers to match function names
- Use offsetof instead of calculating ourselves in ice_pkg_buf_alloc()
- In ice_rem_prof(), do not set status to ICE_SUCCESS as, due to code
  flow, this will always be ICE_SUCCESS.
- Remove unnecessary semicolon in ice_prof_gen_key()
- Remove unnecessary initializations
- correct bw_alloc type in ice_sched_add_root_node

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add NVM netlist macros
Qi Zhang [Mon, 23 Mar 2020 07:17:33 +0000 (15:17 +0800)]
net/ice/base: add NVM netlist macros

As title, these macros are added for future use.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: refactor a function
Qi Zhang [Mon, 23 Mar 2020 07:17:32 +0000 (15:17 +0800)]
net/ice/base: refactor a function

Refactor function ice_prof_bld_xlt2, a switch statement is better suited
for this situation and eliminates the need for the "found" variable.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: use descriptive variable name than type
Qi Zhang [Mon, 23 Mar 2020 07:17:31 +0000 (15:17 +0800)]
net/ice/base: use descriptive variable name than type

The variable name 'type' is not very descriptive. Replace instances of
those with a variable name that is more descriptive or replace it if not
needed.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: use struct size helper
Qi Zhang [Mon, 23 Mar 2020 07:17:30 +0000 (15:17 +0800)]
net/ice/base: use struct size helper

For structures using the common C "struct hack" technique to create a
flexible length structure member at the end of the structure, use the
ice_struct_size macro to determine the length of the structure instead
of open coding the calculation.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: replace u16 with enum
Qi Zhang [Mon, 23 Mar 2020 07:17:29 +0000 (15:17 +0800)]
net/ice/base: replace u16 with enum

Use enum ice_flow_field directly so no need to be converted
from u16 for ice_flow_xtract_fld

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: allow VLAN and ethertype filter for port
Qi Zhang [Mon, 23 Mar 2020 07:17:28 +0000 (15:17 +0800)]
net/ice/base: allow VLAN and ethertype filter for port

Add new API function which allow user to choose port on which
VLAN and ethertype rule going to be added.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: read PSM clock frequency from register
Qi Zhang [Mon, 23 Mar 2020 07:17:27 +0000 (15:17 +0800)]
net/ice/base: read PSM clock frequency from register

Read the GLGEN_CLKSTAT_SRC register to determine which PSM clock
frequency is selected.  This ensures that the rate limiter profile
calculations will be correct.

Fixes: 453d087ccaff ("net/ice/base: add common functions")
Cc: stable@dpdk.org
Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: fix removing MAC rule
Qi Zhang [Mon, 23 Mar 2020 07:17:26 +0000 (15:17 +0800)]
net/ice/base: fix removing MAC rule

Send correct recp_list to ice_remove_mac_rule. ICE_SW_LKUP_ETHERTYPE
rule list was sent instead of ICE_SW_LKUP_MAC. That caused problem
with adding new mac rule on VF, because rule wasn't removed correctly.

Fixes: c7dd15931183 ("net/ice/base: add virtual switch code")
Cc: stable@dpdk.org
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: add and update E822 device IDs
Qi Zhang [Mon, 23 Mar 2020 07:17:25 +0000 (15:17 +0800)]
net/ice/base: add and update E822 device IDs

Add the device IDs for the Intel(R) Ethernet Connection E822-L and
E822-X SKUs. Update the codenames and branding strings for the previous
C822N device IDs which should be using E822-C.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice/base: fix uninitialized stack variables
Qi Zhang [Mon, 23 Mar 2020 07:17:24 +0000 (15:17 +0800)]
net/ice/base: fix uninitialized stack variables

Via code inspection, I found that some partially initialized
stack variables were being passed along to called functions,
which could eventually result in those uninitialized members
being used.  To fix this, make sure the local variables are
zeroed out before partially initializing them.  This should
prevent any unintended consequences from using stack memory that
might have junk in it.

In addition to the memsets, this patch also initializes one
member in one function, that needed to be initialized to non-zero.

Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/hns3: fix return value of setting VLAN offload
Chengwen Feng [Thu, 26 Mar 2020 07:14:33 +0000 (15:14 +0800)]
net/hns3: fix return value of setting VLAN offload

Currently, the '.vlan_offload_set' ops implementation function named
hns3vf_vlan_offload_set always return 0 in hns3 VF PMD driver.

This patch fixes it with the following modification in the function
named hns3vf_vlan_offload_set.
1. Avoid setting hardware configuration and return -EIO during resetting.
2. Add the return value detection process for calling internal static
   function named hns3vf_en_hw_strip_rxvtag.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix mailbox opcode data type
Min Hu (Connor) [Thu, 26 Mar 2020 07:14:32 +0000 (15:14 +0800)]
net/hns3: fix mailbox opcode data type

The mailbox opcode is defined as one byte in datasheet which is not
compatible with that in the current hns3 PMD driver.

This patch fixes the data type of the local variable for mailbox opcode
in driver, changing from uint16_t to uint8_t.

Fixes: 463e748964f5 ("net/hns3: support mailbox")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
4 years agonet/hns3: fix configuring RSS hash when rules are flushed
Lijun Ou [Thu, 26 Mar 2020 07:14:31 +0000 (15:14 +0800)]
net/hns3: fix configuring RSS hash when rules are flushed

Currently, when performing test case as follow:
1. Run testpmd application based on hns3 network engine with multiple
   receive queues(--rxq=N --txq=N, N>1).
2. Create the special RSS rules by "create flow ..." command in the
   command prompt of the testpmd application.
3. Flush the RSS rules created in step 2 by "flow flush ..." command.
4. Enable RSS by "port config all rss all" command.
In step 4, the command exeuctes successfully. This phenomenon is
inconsistent with the expectation. The API function named
rte_eth_dev_rss_hash_update called in the command should return error
and the command should fail.

This patch fixes it by adding a flag for disabling RSS in the driver.
When RSS rules is flushed, we set the the flag with true, and the
'.rss_hash_update' ops implementation function named
hns3_dev_rss_hash_update return -EINVAL.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix RSS indirection table configuration
Lijun Ou [Thu, 26 Mar 2020 07:14:30 +0000 (15:14 +0800)]
net/hns3: fix RSS indirection table configuration

For the current hns3 PMD driver, there are some RSS related bugs at
the following scenes:
1. Start the application with the number of Rx queues equals 1(--rxq=1),
   modify the number of Rx queue to some number greater than 1 during
   normal operation. As a result, upper application can't receive packets
   from multiple rx queues.
2. Start testpmd application with the option disable-rss and the number
   of Rx queue is greater than 1(--disable-rss --rxq=N, N>1). As a result,
   upper application still can receive packets from multiple rx queues.

The root cause as below:
There are some error configuration in the RSS indirection table of hns3
network engine.

This patch fixes them with the following modification.
1. When RSS size is changed, we need to update RSS redirection table
   maintained by driver and configure them to hardware. Besides, during
   the entire reset process, we need to ensure that the RSS table
   information are not overwritten and configured directly to the hardware
   in the RESET_STAGE_RESTORE stage of the reset process.
2. When sarting testpmd application with the options disable-rss, it
   doesn't need to configure RSS redirection table to hardware.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agoapp/testpmd: add FW version in port info
Muhammad Ahmad [Fri, 20 Mar 2020 06:46:00 +0000 (11:46 +0500)]
app/testpmd: add FW version in port info

rte_eth_dev_fw_version_get() was not called in test PMD.
Added rte_eth_dev_fw_version_get() in testpmd under
"show port info <port no>"

Bugzilla ID: 225

Reported-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Muhammad Ahmad <muhammad.ahmad@emumba.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ipn3ke: use control thread to check link status
Andy Pei [Mon, 16 Mar 2020 06:07:17 +0000 (14:07 +0800)]
net/ipn3ke: use control thread to check link status

ipn3ke driver creates a thread to check link status.

Before this patch, pthread_create() is used to create
thread, leaving the new thread unrestrained wrt cpu
affinity.

After this patch, rte_ctrl_thread_create() is used to
create thread. The affinity of the new thread is based
on the CPU affinity retrieved at the time rte_eal_init()
was called, the dataplane and service lcores are then
excluded.

Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor")
Cc: stable@dpdk.org
Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
4 years agonet/hinic: support flow control
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:17 +0000 (23:01 +0800)]
net/hinic: support flow control

The patch supports pause flow control, including getting or
setting rx_pasue, tx_pause and auto_neg, auto_neg is just
for Electric port type.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic: clean up logs
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:16 +0000 (23:01 +0800)]
net/hinic: clean up logs

The patch optimizes log files without "\n".

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic: add flow director filter
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:15 +0000 (23:01 +0800)]
net/hinic: add flow director filter

The patch supports filter type of inner VXLAN or non vxlan dport,
and use TCAM method to config these rules.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic: remove 40G mezzanine card
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:14 +0000 (23:01 +0800)]
net/hinic: remove 40G mezzanine card

The 40GE Mezz card is not support, so remove it from the PMD driver.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic/base: optimize doorbell area initialization
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:13 +0000 (23:01 +0800)]
net/hinic/base: optimize doorbell area initialization

The maximum doorbell area is initialized from hardware param, and not
uses const macro param.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic/base: fix port start during FW hot update
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:12 +0000 (23:01 +0800)]
net/hinic/base: fix port start during FW hot update

When repeatedly hotupdate firmware and start/stop port at the same time,
port start may be failed when cmdq reinit failed at the FW active phase,
so if cmdq fails, then reinit the cmdq when port start.

Fixes: d9ce1917941c ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hinic: fix LRO
Xiaoyun Wang [Tue, 17 Mar 2020 15:01:11 +0000 (23:01 +0800)]
net/hinic: fix LRO

PMD driver should change the max_lro_pkt_size parameter into lro_wqe_num
that used for hardware, and when packets are coalesced by hardware,
PKT_RX_LRO flag should be set in the RX mbuf.

Fixes: 9d4878ef0897 ("net/hinic: support LRO offload")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/hns3: fix status after repeated resets
Wei Hu (Xavier) [Tue, 17 Mar 2020 09:12:06 +0000 (17:12 +0800)]
net/hns3: fix status after repeated resets

Currently, when performing the following test case:
1. Run testpmd application based on hns3 PF device.
2. Inject reset(global/IMP reset) repeatedly.
After the reset, the network port can't link up.

In the RESET_STAGE_DEV_INIT stage of the reset process, the driver will
reinitialize the hardware. If global/IMP reset occurs at this time
again, the operation of reinitialize the hardware will fail because that
firmware don't respond to the configuration commands issued by driver.
In current driver, when failed to reinitialize the hardware, rollback
operation is done, such as clearing the relevant configuration of the
command queue registers.

If firmware detects that the function's command queue register is not
configured correctly, it will not complete the reset related hardware
configuration for this function, resulting in that driver can't detect
that the hardware reset has been completed. And then the reset process
of the driver exit abnormally, the hardware can not work normally after
reset.

This patch fixes it by avoid clearing the command queue related
registers when failed to reinitialize the hardware in the
RESET_STAGE_DEV_INIT stage of the reset process.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
4 years agonet/hns3: fix configuring illegal VLAN PVID
Min Hu (Connor) [Tue, 17 Mar 2020 09:12:05 +0000 (17:12 +0800)]
net/hns3: fix configuring illegal VLAN PVID

The VLAN pvid ranges from 0 to 4095. The hns3 PMD driver does not
support this situation that the VLAN pvid is larger than Maximum VLAN
ID(4095).

Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix crash when flushing RSS flow rules with FLR
Chengwen Feng [Tue, 17 Mar 2020 09:12:04 +0000 (17:12 +0800)]
net/hns3: fix crash when flushing RSS flow rules with FLR

Currently, we encounter segmentation fault when performing the following
test case:
1. Run testpmd application, config the flow filter rules then flush them
   repeatedly.
2. Inject FLR concurrently every 5 second.
The calltrace info:

This GDB was configured as "aarch64-linux-gnu".
Reading symbols from ./testpmd...(no debugging symbols found)...done.
[New LWP 322]
[New LWP 325]
[New LWP 324]
[New LWP 326]
[New LWP 323]
[New LWP 327]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/
libthread_db.so.1".
Core was generated by `/home/root/app/testpmd -w 0000:00:01.0 -w
0000:00:02.0 -w 0000:00:03.0 -l 0-3 -'.
Program terminated with signal SIGSEGV, Segmentation fault.
libc.so.6
[Current thread is 1 (Thread 0xffff8bb35110 (LWP 322))]
(gdb) bt
 #0  0x0000ffff8b936a90 in strlen () from /lib/aarch64-linux-gnu/
 libc.so.6
 #1  0x0000ffff8b905ccc in vfprintf () from /lib/aarch64-linux-gnu/
 libc.so.6
 #2  0x0000ffff8b993d04 in __printf_chk () from /lib/aarch64-linux-gnu/
 libc.so.6
 #3  0x0000000000754828 in port_flow_flush ()
 #4  0x0000000000870f3c in cmdline_parse ()

The root cause as follows:
In the '.flush' ops implementation function named hns3_flow_flush, By
the way the '.flush' ops is defined in the struct rte_flow_ops, if
failed to call hns3_clear_rss_filter, the out parameter error is not
set, and then the member variable name message in the struct error is
invalid(filled with 0x44444444 in port_flow_flush function of the
testpmd application), it leads to segmentation fault when format the
message.

We fixes it by filling error parameter when failure in calling static
function named hns3_clear_rss_filter in the the '.flush' ops
implementation function named hns3_flow_flush.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix default error code of command interface
Chengwen Feng [Tue, 17 Mar 2020 09:12:03 +0000 (17:12 +0800)]
net/hns3: fix default error code of command interface

Currently, the hns3 PMD driver can interact with firmware through
command to complete hardware configuration. The driver calls internal
interface function named hns3_cmd_send to issues command to the
firmware, and check the execution result of the command through desc_ret
returned by firmware to driver.

As the design of error code, when device is resetting hns3_cmd_send will
only return -EBUSY or -EIO. But we found that if desc_ret is in
[12,65535], for example the item doesn't exist when issuing the command
to query some table item, hns3_cmd_send also return -EIO. This
phenomenon will affect the processing logic for the return value.

The root cause as below:
When desc_ret is in [12,65535], in the static function named
hns3_cmd_convert_err_code called by hns3_cmd_send, matches the default
case and return -EIO. And then hns3_cmd_send return -EIO.

This patch fixes it with the following modification.
1. Change the return value of the default case in the static function
   named hns3_cmd_convert_err_code from -EIO to -EREMOTEIO.
2. Modify the comment add errcode description of the internal interface
   function named hns3_cmd_send.

Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix packets offload features flags in Rx
Chengwen Feng [Tue, 17 Mar 2020 09:12:02 +0000 (17:12 +0800)]
net/hns3: fix packets offload features flags in Rx

Currently there is a certain probability of the unexpected ol_flag of
the Rx packets's rte_mbuf when receiving packets.

The root cause as below:
1. The member variable named ol_flag of the structure named rte_mbuf is
   not properly initialized to zero in the '.rx_pkt_burst' ops
   implementation function named hns3_recv_pkts.
2. When multi-segment rte_mbufs are needed for long packet in Rx
   operation, the driver should assign value to the ol_flag of the first
   segment, not to the ol_flag of the last segment.

This patch fixes it with the following modification in the
'.rx_pkt_burst' ops implementation function named hns3_recv_pkts.
1. Where the first write operation in the '.rx_pkt_burst' ops
   implementation function, assign PKT_RX_RSS_HASH to ol_flags directly
   using '=' operation instead of '|=' operation.
2. In the static function named hns3_rx_set_cksum_flag, the last
   rte_mbuf's ol_flags should be assigned when processing multi-segment.
   We fix it by passing first_seg variable to the function instead of
   rxm(the last segment's address).

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Fixes: ad7cf94823e8 ("net/hns3: fix offload flag for RSS hash")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: modify inappropriate names
Chengchang Tang [Tue, 17 Mar 2020 09:12:01 +0000 (17:12 +0800)]
net/hns3: modify inappropriate names

This patch modifies the name of some macro and local variable to avoid
devil number and increase code readability in the internal interface
function named hns3_set_port_vlan_filter.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: remove redundant check when setting MAC
Chengchang Tang [Tue, 17 Mar 2020 09:12:00 +0000 (17:12 +0800)]
net/hns3: remove redundant check when setting MAC

This patch removes unnecessary MAC address validity check operation in
the .mac_addr_set ops implementation function named
hns3_set_default_mac_addr and hns3vf_set_default_mac_addr, because it
has been guaranteed that input parameter named mac_addr is valid address
in the rte layer of DPDK framework.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agodoc: add trace library guide
Jerin Jacob [Wed, 22 Apr 2020 19:03:49 +0000 (00:33 +0530)]
doc: add trace library guide

Add programmer's guide for trace library support.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agomempool: add tracepoints
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:48 +0000 (00:33 +0530)]
mempool: add tracepoints

Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agocryptodev: add tracepoints
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:47 +0000 (00:33 +0530)]
cryptodev: add tracepoints

Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeventdev: add tracepoints
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:46 +0000 (00:33 +0530)]
eventdev: add tracepoints

Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoethdev: add tracepoints
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:45 +0000 (00:33 +0530)]
ethdev: add tracepoints

Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotest/trace: add performance test cases
Jerin Jacob [Wed, 22 Apr 2020 19:03:44 +0000 (00:33 +0530)]
test/trace: add performance test cases

This test case shall be used to measure the trace overhead.

Example command to run the performance test case.

echo "trace_perf_autotest" | ./build/app/test/dpdk-test -c 0x3 --trace=.*

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotest/trace: add functional test cases
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:43 +0000 (00:33 +0530)]
test/trace: add functional test cases

Example commands to run UT and check the traces with babeltrace viewer.

- Delete the existing /root/dpdk-traces/ directory if needed.
> sudo rm -rf /root/dpdk-traces/

- Start the dpdk-test
> sudo ./build/app/test/dpdk-test  -c 0x3 - --trace=.*

- Run trace_autotest
> trace_autotest

- View the traces with babletrace viewer.
> sudo babeltrace /root/dpdk-traces/

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add trace mode configuration parameter
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:42 +0000 (00:33 +0530)]
trace: add trace mode configuration parameter

Trace library exposes --trace-mode eal parameter to configure
event record mode when ring buffers are full.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add trace bufsize configuration parameter
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:41 +0000 (00:33 +0530)]
trace: add trace bufsize configuration parameter

Trace library exposes --trace-bufsz EAL parameter to configure
maximum size of ring buffer where events are to be stored.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add trace directory configuration parameter
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:40 +0000 (00:33 +0530)]
trace: add trace directory configuration parameter

Trace library exposes --trace-dir EAL parameter to configure
directory where traces will be generated.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add trace configuration parameter
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:39 +0000 (00:33 +0530)]
trace: add trace configuration parameter

Trace library exposes --trace EAL parameter to enable trace points.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add interrupt tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:38 +0000 (00:33 +0530)]
trace: add interrupt tracepoints

Add the following interrupt related tracepoints.

- rte_eal_trace_intr_callback_register()
- rte_eal_trace_intr_callback_unregister()
- rte_eal_trace_intr_enable()
- rte_eal_trace_intr_disable()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add thread tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:37 +0000 (00:33 +0530)]
trace: add thread tracepoints

Add the following thread related tracepoints.

- rte_eal_trace_thread_remote_launch()
- rte_eal_trace_thread_lcore_ready()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add memzone tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:36 +0000 (00:33 +0530)]
trace: add memzone tracepoints

Add the following memzone related tracepoints.

- rte_eal_trace_memzone_reserve()
- rte_eal_trace_memzone_lookup()
- rte_eal_trace_memzone_free()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add memory tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:35 +0000 (00:33 +0530)]
trace: add memory tracepoints

Add the following memory-related tracepoints.

- rte_eal_trace_mem_zmalloc()
- rte_eal_trace_mem_malloc()
- rte_eal_trace_mem_realloc()
- rte_eal_trace_mem_free()

rte_malloc() and rte_free() has been used in the trace implementation,
in order to avoid tracing implementation specific events, added
an internal no trace version rte_malloc() and rte_free().

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add alarm tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:34 +0000 (00:33 +0530)]
trace: add alarm tracepoints

Add following alarm related trace points.

- rte_eal_trace_alarm_set()
- rte_eal_trace_alarm_cancel()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add generic tracepoints
Jerin Jacob [Wed, 22 Apr 2020 19:03:33 +0000 (00:33 +0530)]
trace: add generic tracepoints

This patch creates the following generic tracepoint for
generic tracing when there is no dedicated tracepoint is
available.

- rte_eal_trace_generic_void()
- rte_eal_trace_generic_u64()
- rte_eal_trace_generic_u32()
- rte_eal_trace_generic_u16()
- rte_eal_trace_generic_u8()
- rte_eal_trace_generic_i64()
- rte_eal_trace_generic_i32()
- rte_eal_trace_generic_i16()
- rte_eal_trace_generic_i8()
- rte_eal_trace_generic_int()
- rte_eal_trace_generic_long()
- rte_eal_trace_generic_float()
- rte_eal_trace_generic_double()
- rte_eal_trace_generic_ptr()
- rte_eal_trace_generic_str()

For example, if an application wishes to emit an int datatype,
it can call rte_eal_trace_generic_int(val) to emit the trace.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: hook subsystem to FreeBSD
Jerin Jacob [Wed, 22 Apr 2020 19:03:32 +0000 (00:33 +0530)]
trace: hook subsystem to FreeBSD

Connect the internal trace interface API to FreeBSD EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: hook subsystem to Linux
Jerin Jacob [Wed, 22 Apr 2020 19:03:31 +0000 (00:33 +0530)]
trace: hook subsystem to Linux

Connect the internal trace interface API to Linux EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement provider payload
Jerin Jacob [Wed, 22 Apr 2020 19:03:30 +0000 (00:33 +0530)]
trace: implement provider payload

The trace function payloads such as rte_trace_point_emit_* have
dual functions. The first to emit the payload for the registration
function and the second one to act as trace mem emitters a.k.a
provider payload.

When it is used as provider payload, those function copy the trace
field to trace memory based on the tracing mode.

Added payload definitions under ALLOW_EXPERIMENTAL_API define
to allow the existing applications to compile without enabling
experimental APIs.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement registration payload
Jerin Jacob [Wed, 22 Apr 2020 19:03:29 +0000 (00:33 +0530)]
trace: implement registration payload

The trace function payloads such as rte_trace_point_emit_* have
dual functions. The first to emit the payload for the registration
function and the second one to act as trace memory emitters.

When it is used as registration payload, it will do the following to
fulfill the registration job.
- Find out the size of the event,
- Generate metadata field string using __rte_trace_point_emit_field().

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement trace save
Jerin Jacob [Wed, 22 Apr 2020 19:03:28 +0000 (00:33 +0530)]
trace: implement trace save

Implement rte_trace_save(), which will save the metadata
file and trace memory snapshot to the trace directory.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement debug dump
Jerin Jacob [Wed, 22 Apr 2020 19:03:27 +0000 (00:33 +0530)]
trace: implement debug dump

Implement rte_trace_metadata_dump() and rte_trace_dump()
functions. Former one used to dump the CTF metadata file and
the latter one to dump all the registered events and its status.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement memory allocation
Jerin Jacob [Wed, 22 Apr 2020 19:03:26 +0000 (00:33 +0530)]
trace: implement memory allocation

Trace memory will be allocated per thread to enable lockless trace
events updates to the memory. The allocator will first attempt to
allocate from hugepage, then if not available from hugepage or
finally fallback to malloc memory.

Later in the patches series, this API will be hooked to DPDK fast path
and control plane thread creation API. It is possible for non
DPDK thread to use trace events. In that case, trace memory
will be allocated on the first event emission.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: handle CTF keyword collision
Sunil Kumar Kori [Wed, 22 Apr 2020 19:03:25 +0000 (00:33 +0530)]
trace: handle CTF keyword collision

Some of the keyword like align, event, "." and "->" etc will be
used in CTF metadata syntax. This patch support for handling
those keywords with DPDK events name.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: create CTF TDSL metadata in memory
Jerin Jacob [Wed, 22 Apr 2020 19:03:24 +0000 (00:33 +0530)]
trace: create CTF TDSL metadata in memory

Common trace format(CTF) defines the metadata[1][2] for trace events,
This patch creates the metadata for the DPDK events in memory and
later this will be saved to trace directory on rte_trace_save()
invocation.

[1] https://diamon.org/ctf/#specification
[2] https://diamon.org/ctf/#examples

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: save bootup timestamp
Jerin Jacob [Wed, 22 Apr 2020 19:03:23 +0000 (00:33 +0530)]
trace: save bootup timestamp

Find epoch_sec, epoch_nsec and uptime_ticks time information
on eal_trace_init()/bootup to derive the time in the trace.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: add internal init and fini interface
Jerin Jacob [Wed, 22 Apr 2020 19:03:22 +0000 (00:33 +0530)]
trace: add internal init and fini interface

Define eal_trace_init() and eal_trace_fini() EAL interface
functions that rte_eal_init() and rte_eal_cleanup() function can
use to initialize and finalize the trace subsystem.
eal_trace_init() function will add the following functionality if
trace is enabled through EAL command line param.

- Test for trace registration failure.
- Test for duplicate trace name registration.
- Generate UUID ver 4.
- Create a trace directory.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: implement operation APIs
Jerin Jacob [Wed, 22 Apr 2020 19:03:21 +0000 (00:33 +0530)]
trace: implement operation APIs

This patch implements the following public trace APIs.

- rte_trace_is_enabled()
- rte_trace_mode_get()
- rte_trace_mode_set()
- rte_trace_pattern()
- rte_trace_point_disable()
- rte_trace_point_enable()
- rte_trace_point_is_enabled()
- rte_trace_point_lookup()
- rte_trace_regexp()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>