dpdk.git
5 years agonet/hinic/base: support cmdq mechanism
Ziyang Xuan [Thu, 27 Jun 2019 08:14:12 +0000 (16:14 +0800)]
net/hinic/base: support cmdq mechanism

Microcode is named ucode in Hi1822. Its main responsibility is data
transmission and reception. But it can also handle some administration
works. It uses cmdq mechanism. This patch introduces data structures,
initialization, interfaces, and commands sending functions of cmdq.

Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/hinic/base: add API command channel
Ziyang Xuan [Thu, 27 Jun 2019 08:13:26 +0000 (16:13 +0800)]
net/hinic/base: add API command channel

API command channel is for communicating with mgmt module of chip.
This patch introduces data structures, initialization, interfaces,
and commands sending functions of API command channel.

Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/hinic/base: add HW interfaces of BAR operation
Ziyang Xuan [Thu, 27 Jun 2019 08:12:36 +0000 (16:12 +0800)]
net/hinic/base: add HW interfaces of BAR operation

This patch adds some HW interfaces for bar operation interfaces,
including: mapped bar address getting, HW attributes getting,
msi-x reg operation, function type getting and so on.

Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/hinic/base: add HW registers definition
Ziyang Xuan [Thu, 27 Jun 2019 08:11:47 +0000 (16:11 +0800)]
net/hinic/base: add HW registers definition

Add HW registers definition header file for Hi1822 NIC.

Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodrivers/net: fix double free on init failure
David Marchand [Mon, 17 Jun 2019 15:05:24 +0000 (17:05 +0200)]
drivers/net: fix double free on init failure

If we don't clear mac_addrs, ethdev will double free it on cleanup.

Fixes: e16adf08e54d ("ethdev: free all common data when releasing port")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/bnx2x: fix invalid free on unplug
David Marchand [Mon, 17 Jun 2019 15:05:23 +0000 (17:05 +0200)]
net/bnx2x: fix invalid free on unplug

mac_addrs points to a field in dev_private.
We can't let ethdev free it.

Fixes: e16adf08e54d ("ethdev: free all common data when releasing port")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/nfb: avoid memory leak on unplug
David Marchand [Mon, 17 Jun 2019 15:05:22 +0000 (17:05 +0200)]
net/nfb: avoid memory leak on unplug

Clearing mac_addrs on remove will prevent ethdev from freeing it.

Fixes: 6435f9a0ac22 ("net/nfb: add new netcope driver")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/avp: remove resources when port is closed
Allain Legacy [Tue, 18 Jun 2019 19:18:59 +0000 (14:18 -0500)]
net/avp: remove resources when port is closed

The rte_eth_dev_close() function now handles freeing resources for
devices (e.g., mac_addrs).  To conform with the new close() behaviour we
are asserting the RTE_ETH_DEV_CLOSE_REMOVE flag so that
rte_eth_dev_close() releases all device level dynamic memory.

Second level memory allocated to each individual rx/tx queue is now
freed as part of the close() operation therefore making it safe for the
rte_eth_dev_close() function to free the device private data without
orphaning the rx/tx queue pointers.

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Matt Peters <matt.peters@windriver.com>
5 years agonet/softnic: remove trace of legacy linuxapp
David Marchand [Mon, 17 Jun 2019 07:54:27 +0000 (09:54 +0200)]
net/softnic: remove trace of legacy linuxapp

This check on Linux environment has been added at a time when we already
had switched to using the boolean RTE_EXEC_ENV_LINUXAPP.
It was then missed when converting to RTE_EXEC_ENV_LINUX.

Fixes: 7709a63bf178 ("net/softnic: add connection agent")
Fixes: 742bde12f3bd ("build/linux: rename macro from LINUXAPP to LINUX")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/ice/base: update Tx context struct
Leyi Rong [Wed, 19 Jun 2019 15:18:45 +0000 (23:18 +0800)]
net/ice/base: update Tx context struct

Add internal usage flag, bit 91 as described in spec.
Update width of internal queue state to 122 also as described in spec.

Signed-off-by: Ashish Shah <ashish.n.shah@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: change flow and profile removal
Leyi Rong [Wed, 19 Jun 2019 15:18:44 +0000 (23:18 +0800)]
net/ice/base: change flow and profile removal

- Add function to remove ES profile map as it is now being used in
clearing and freeing HW tables.
- Locks were initially not used for releasing ES profile maps and
flow profiles as the sequence is part of driver unload. Adding
calls to acquire and release locks to ensure that any calls made
by the VF VSI during VFR or unload do not result in memory
access violations.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: update driver unloading field
Leyi Rong [Wed, 19 Jun 2019 15:18:42 +0000 (23:18 +0800)]
net/ice/base: update driver unloading field

According to recent specification versions, the field in the Queue
Shutdown AdminQ command consisting of the "driver unloading" indication
is not a 4 byte field (it is byte.bit 16.0). Change it to a byte and
remove the unnecessary endian conversion.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: reduce calls to get profile associations
Leyi Rong [Wed, 19 Jun 2019 15:18:40 +0000 (23:18 +0800)]
net/ice/base: reduce calls to get profile associations

Added refresh_required flag to determine if we need to update the
recipe to profile mapping cache. This will reduce the number of
calls made to refresh the profile map.

Signed-off-by: Shivanshu Shukla <shivanshu.shukla@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix NVGRE header structure
Leyi Rong [Wed, 19 Jun 2019 15:18:39 +0000 (23:18 +0800)]
net/ice/base: fix NVGRE header structure

Correct NVGRE header structure and its field offsets.

Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines")
Cc: stable@dpdk.org
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: refactor zeroing bitmap size
Leyi Rong [Wed, 19 Jun 2019 15:18:38 +0000 (23:18 +0800)]
net/ice/base: refactor zeroing bitmap size

A couple of places in the code use a 'sizeof(bitmap) * BITS_PER_BYTE'
construction to calculate the size of the bitmap when calling
ice_zero_bitmap. Instead of doing this, just use the same value as in
the ice_declare_bitmap declaration.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: refactor zeroing bitmap
Leyi Rong [Wed, 19 Jun 2019 15:18:37 +0000 (23:18 +0800)]
net/ice/base: refactor zeroing bitmap

A few places in the code used ice_memset instead of ice_zero_bitmap to
initialize a bitmap to zeros.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix copying bitmap
Leyi Rong [Wed, 19 Jun 2019 15:18:36 +0000 (23:18 +0800)]
net/ice/base: fix copying bitmap

Fix ice_cp_bitmap to copy the entire storage.

Fixes: c9e37832c95f ("net/ice/base: rework on bit ops")
Cc: stable@dpdk.org
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix zeroing bitmap
Leyi Rong [Wed, 19 Jun 2019 15:18:35 +0000 (23:18 +0800)]
net/ice/base: fix zeroing bitmap

Fix ice_zero_bitmap to zero the entire storage.

Fixes: c9e37832c95f ("net/ice/base: rework on bit ops")
Cc: stable@dpdk.org
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: deduce TSA value in the CEE mode
Leyi Rong [Wed, 19 Jun 2019 15:18:34 +0000 (23:18 +0800)]
net/ice/base: deduce TSA value in the CEE mode

In CEE mode, the TSA information can be derived from the reported
priority value.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: reduce adding advanced rule time
Leyi Rong [Wed, 19 Jun 2019 15:18:33 +0000 (23:18 +0800)]
net/ice/base: reduce adding advanced rule time

While calling ice_find_recp we were calling ice_get_recp_to_prof_map
every time we called ice_find_recp. ice_get_recp_to_prof_map is a very
expensive operation and we should try to reduce the number of times we
call this function. So moved it into ice_get_recp_frm_fw since we only
need to have fresh recp_to_profile mapping when we we check FW to see if
the recipe we are trying to add already exists in FW.

Signed-off-by: Shivanshu Shukla <shivanshu.shukla@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: allow forward to Q groups in switch rule
Leyi Rong [Wed, 19 Jun 2019 15:18:32 +0000 (23:18 +0800)]
net/ice/base: allow forward to Q groups in switch rule

Enable forward to Q group action in ice_add_adv_rule.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: enable additional switch rules
Leyi Rong [Wed, 19 Jun 2019 15:18:31 +0000 (23:18 +0800)]
net/ice/base: enable additional switch rules

Add capability to create inner IP and inner TCP switch recipes and
rules. Change UDP tunnel dummy packet to accommodate the training of
these new rules.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add VXLAN/generic tunnel management
Leyi Rong [Wed, 19 Jun 2019 15:18:30 +0000 (23:18 +0800)]
net/ice/base: add VXLAN/generic tunnel management

Added routines for handling tunnel management:
- ice_tunnel_port_in_use()
- ice_tunnel_get_type()
- ice_find_free_tunnel_entry()
- ice_create_tunnel()
- ice_destroy_tunnel()

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add some minor new defines
Leyi Rong [Wed, 19 Jun 2019 15:18:29 +0000 (23:18 +0800)]
net/ice/base: add some minor new defines

1. Add defines for Link Topology Netlist Section.
2. Add missing Read MAC command response bits.
3. Adds AQ error 29.

Signed-off-by: Jacek Naczyk <jacek.naczyk@intel.com>
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: refactor VSI node scheduler
Leyi Rong [Wed, 19 Jun 2019 15:18:28 +0000 (23:18 +0800)]
net/ice/base: refactor VSI node scheduler

Refactored VSI node sched code to use port_info ptr as call arg.

The declaration of VSI node getter function has been modified to use
pointer to ice_port_info structure instead of pointer to hw structure.
This way suitable port_info structure is used to find VSI node.

Signed-off-by: Grzegorz Nitka <grzegorz.nitka@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: cleanup flex pipe files
Leyi Rong [Wed, 19 Jun 2019 15:18:27 +0000 (23:18 +0800)]
net/ice/base: cleanup flex pipe files

Make functions that can be, static. Remove some code that is not
currently called.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: cleanup unused code
Leyi Rong [Wed, 19 Jun 2019 15:18:26 +0000 (23:18 +0800)]
net/ice/base: cleanup unused code

Cleanup the useless code.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: update marker to mark unused func parameters
Leyi Rong [Wed, 19 Jun 2019 15:18:25 +0000 (23:18 +0800)]
net/ice/base: update marker to mark unused func parameters

use __ALWAYS_UNUSED to mark function parameters unused to replace
__always_unused marker.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: introduce some new macros
Leyi Rong [Wed, 19 Jun 2019 15:18:24 +0000 (23:18 +0800)]
net/ice/base: introduce some new macros

Introduce some more new macros, like ICE_VSI_LB and the like.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix Rx functionality for ethertype filters
Leyi Rong [Wed, 19 Jun 2019 15:18:23 +0000 (23:18 +0800)]
net/ice/base: fix Rx functionality for ethertype filters

In the function ice_add_eth_mac(), there is a line that
hard-codes the filter info flag to TX. This is redundant
and inaccurate. That flag will be set by the calling
function that built the list of filters to add, and
hard-coding it eliminates the Rx functionality of this
code. The paired function ice_remove_eth_mac() does not
do this, making a mis-matched pair.

Fixes: 157d00901f97 ("net/ice/base: add functions for ethertype filter")
Cc: stable@dpdk.org
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: protect list add with lock
Leyi Rong [Wed, 19 Jun 2019 15:18:22 +0000 (23:18 +0800)]
net/ice/base: protect list add with lock

Function ice_add_rule_internal needs to call ice_create_pkt_fwd_rule
with lock held because it uses the LIST_ADD to modify the filter
rule list. It needs to be protected when modified.

Signed-off-by: Tarun Singh <tarun.k.singh@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: check RSS flow profile list
Leyi Rong [Wed, 19 Jun 2019 15:18:21 +0000 (23:18 +0800)]
net/ice/base: check RSS flow profile list

Minor change to check if there are any RSS flow profiles to remove.
This will avoid flow profile lock acquisition and release
if the list is empty.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add function to deallocate flow entry
Leyi Rong [Wed, 19 Jun 2019 15:18:20 +0000 (23:18 +0800)]
net/ice/base: add function to deallocate flow entry

Decouple ice_dealloc_flow_entry from ice_flow_rem_entry_sync.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix signed package download
Leyi Rong [Wed, 19 Jun 2019 15:18:19 +0000 (23:18 +0800)]
net/ice/base: fix signed package download

In order to properly support signed packages, we always have
to send the complete buffer to firmware, regardless of any
unused space at the end. This is because the SHA hash value
is computed over the entire buffer.

Fixes: 51d04e4933e3 ("net/ice/base: add flexible pipeline module")
Cc: stable@dpdk.org
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: eliminate semantic parser warnings
Leyi Rong [Wed, 19 Jun 2019 15:18:18 +0000 (23:18 +0800)]
net/ice/base: eliminate semantic parser warnings

Eliminate some semantic warnings, static analysis warnings.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: optimize data structures
Leyi Rong [Wed, 19 Jun 2019 15:18:17 +0000 (23:18 +0800)]
net/ice/base: optimize data structures

Move a bunch of members around to make more efficient use of
memory, eliminating holes where possible. None of these members
are hot path so cache line alignment is not very important here.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix flow director VSI count
Leyi Rong [Wed, 19 Jun 2019 15:18:16 +0000 (23:18 +0800)]
net/ice/base: fix flow director VSI count

Flow director keeps a list of VSIs for each flow type (TCP4, UDP6, etc.)
This list varies in length depending on the number of traffic classes
(ADQ). This patch uses the define of max TCs to calculate the size of
the VSI array.

Fixes: bd984f155f49 ("net/ice/base: support FDIR")
Cc: stable@dpdk.org
Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix rate limit burst size calculation
Leyi Rong [Wed, 19 Jun 2019 15:18:15 +0000 (23:18 +0800)]
net/ice/base: fix rate limit burst size calculation

When the MSB is not set, the lower 11 bits do not represent bytes, but
chunks of 64 bytes. Adjust the rate limit burst size calculation
accordingly, and update the comments to indicate the way the hardware
actually works.

Fixes: 93e84b1bfc92 ("net/ice/base: add basic Tx scheduler")
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: correct UDP/TCP packet types
Leyi Rong [Wed, 19 Jun 2019 15:18:14 +0000 (23:18 +0800)]
net/ice/base: correct UDP/TCP packet types

1. Using the UDP-IL PTYPEs when processing packet segments as it
contains all PTYPEs with UDP and allow packets to be forwarded to
associated VSIs as switch rules are based on outer IPs.
2. Add PTYPE 0x088 to TCP PTYPE bitmap list.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: check new FD filter duplication
Leyi Rong [Wed, 19 Jun 2019 15:18:13 +0000 (23:18 +0800)]
net/ice/base: check new FD filter duplication

Function ice_fdir_is_dup_fltr tests if new Flow Director rule
is not a duplicate.

Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: implement LLDP persistent settings
Leyi Rong [Wed, 19 Jun 2019 15:18:12 +0000 (23:18 +0800)]
net/ice/base: implement LLDP persistent settings

This patch implements persistent, across reboots, start and stop
of LLDP agent. Added additional function parameter to
ice_aq_start_lldp and ice_aq_stop_lldp.

Signed-off-by: Jaroslaw Ilgiewicz <jaroslaw.ilgiewicz@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: track HW stat registers past rollover
Leyi Rong [Wed, 19 Jun 2019 15:18:11 +0000 (23:18 +0800)]
net/ice/base: track HW stat registers past rollover

Modify ice_stat_update40 to use rd64 instead of two calls to rd32.
Additionally, drop the now unnecessary hireg function parameter.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: support 64-bit read
Leyi Rong [Wed, 19 Jun 2019 15:18:10 +0000 (23:18 +0800)]
net/ice/base: support 64-bit read

Add function support for rd64.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: cleanup update link info
Leyi Rong [Wed, 19 Jun 2019 15:18:09 +0000 (23:18 +0800)]
net/ice/base: cleanup update link info

1. Do not unnecessarily initialize local variable.
2. Cleanup ice_update_link_info.
3. Don't clear auto_fec bit in ice_cfg_phy_fec.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: do not reuse result index already in use
Leyi Rong [Wed, 19 Jun 2019 15:18:08 +0000 (23:18 +0800)]
net/ice/base: do not reuse result index already in use

To make sure that we don't reuse the same result index
which is already in use, for chaining some other recipe.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: disable Tx pacing option
Leyi Rong [Wed, 19 Jun 2019 15:18:07 +0000 (23:18 +0800)]
net/ice/base: disable Tx pacing option

With the current NVM, after GLOBR, before the first link up event, FW
will return to base driver, the pacing value of 20 percents for some
reason, in the get-link-status AQ command. We then use this value as
the pacing param for the set-mac-info AQ command. As result, we are
limited to 20 percents of the available bandwidth until the first
set-mac-info AQ call after the link up event.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: enable HW to prefetch Rx descriptors
Leyi Rong [Wed, 19 Jun 2019 15:18:06 +0000 (23:18 +0800)]
net/ice/base: enable HW to prefetch Rx descriptors

Currently we are always setting prefena to 0. This is causing the
hardware to only fetch descriptors when there are none free in the cache
for a received packet instead of prefetching when it has used the last
descriptor regardless of incoming packets.

Fix this by allowing the hardware to prefetch Rx descriptors.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: use a different log type for FW
Leyi Rong [Wed, 19 Jun 2019 15:18:05 +0000 (23:18 +0800)]
net/ice/base: use a different log type for FW

Replace the use of the ICE_DBG_AQ_MSG bit when dumping firmware logging
messages with a separate distinct type ICE_DBG_FW_LOG. This is useful
so that developers may enable ICE_DBG_FW_LOG and get firmware logging
messages, without also dumping AdminQ messages at the same time.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: make FDID available for flex descriptor
Leyi Rong [Wed, 19 Jun 2019 15:18:04 +0000 (23:18 +0800)]
net/ice/base: make FDID available for flex descriptor

The FDID (flow director filter ID) was not inserted into Flex Descriptor
writebacks. The data for FDID is always 0xffffffff when FDID-priority is
0 in the flow director programming descriptor.

This patch changes the FDID-priority to 1 so the FDID is available for
the Flex Descriptor. With this patch the FDID is placed into the Flex
Descriptor.

Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: set max number of TCs per port to 4
Leyi Rong [Wed, 19 Jun 2019 15:18:03 +0000 (23:18 +0800)]
net/ice/base: set max number of TCs per port to 4

On devices with more than 4 ports, the maximum number of TCs per port is
limited to 4.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: prefix capability logs for func and dev
Leyi Rong [Wed, 19 Jun 2019 15:18:02 +0000 (23:18 +0800)]
net/ice/base: prefix capability logs for func and dev

This patch makes a change to add a "func cap" prefix when printing
function capabilities, and a "dev cap" prefix when printing device
capabilities.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: support 32-bit hamming weight
Leyi Rong [Wed, 19 Jun 2019 15:18:01 +0000 (23:18 +0800)]
net/ice/base: support 32-bit hamming weight

Add function support for hweight32.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: update some defines
Leyi Rong [Wed, 19 Jun 2019 15:18:00 +0000 (23:18 +0800)]
net/ice/base: update some defines

Update the defines for ice_aqc_manage_mac_read,
ice_aqc_manage_mac_write, ice_aqc_get_phy_caps_data.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: forbid VSI to remove unassociated ucast filter
Leyi Rong [Wed, 19 Jun 2019 15:17:59 +0000 (23:17 +0800)]
net/ice/base: forbid VSI to remove unassociated ucast filter

If a VSI is not using a unicast filter or did not configure that
particular unicast filter, driver should not allow it to be removed
by the VSI.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add and fix debug logs
Leyi Rong [Wed, 19 Jun 2019 15:17:58 +0000 (23:17 +0800)]
net/ice/base: add and fix debug logs

Adding missing debug logs and fixing existing debug logs.

Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add sibling head to parse nodes
Leyi Rong [Wed, 19 Jun 2019 15:17:57 +0000 (23:17 +0800)]
net/ice/base: add sibling head to parse nodes

There was a bug in the previous code which never traverses all the
children to get the first node of the requested layer.

Added a sibling head pointer to point the first node of each layer
per TC. This helps the traverse easy and quicker and also removed the
recursive, complexity of the code.

Signed-off-by: Victor Raj <victor.raj@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: separate out control queue lock creation
Leyi Rong [Wed, 19 Jun 2019 15:17:56 +0000 (23:17 +0800)]
net/ice/base: separate out control queue lock creation

The ice_init_all_ctrlq and ice_shutdown_all_ctrlq functions create and
destroy the locks used to protect the send and receive process of each
control queue.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: move and redefine debug cq function
Leyi Rong [Wed, 19 Jun 2019 15:17:55 +0000 (23:17 +0800)]
net/ice/base: move and redefine debug cq function

The ice_debug_cq function is only called from ice_controlq.c, and has no
other callers outside of that file. Move it and mark it static to avoid
namespace pollution.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: use macro instead of magic 8
Leyi Rong [Wed, 19 Jun 2019 15:17:54 +0000 (23:17 +0800)]
net/ice/base: use macro instead of magic 8

Replace the use of the magic number 8 by BITS_PER_BYTE when calculating
the number of bits from the number of bytes.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add functions to initialize FW logging
Leyi Rong [Wed, 19 Jun 2019 15:17:53 +0000 (23:17 +0800)]
net/ice/base: add functions to initialize FW logging

In order to initialize the current status of the FW logging,
the api ice_get_fw_log_cfg is added. The function retrieves
the current setting of the FW logging from HW and updates the
ice_hw structure accordingly.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add compatibility check for package version
Leyi Rong [Wed, 19 Jun 2019 15:17:52 +0000 (23:17 +0800)]
net/ice/base: add compatibility check for package version

1. Perform a check against the package version to make sure that
it will be compatible with the shared code implementation. There
will be points in time when the shared code and package will need
to be changed in lock step; the mechanism added here is meant to
deal with those situations.
2. Support package tunnel labels owned by PF. VXLAN and GENEVE
tunnel labels names in the package are changing to incorporate
the PF that owns them.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: protect profile map list with locks
Leyi Rong [Wed, 19 Jun 2019 15:17:51 +0000 (23:17 +0800)]
net/ice/base: protect profile map list with locks

Add locking mechanism around profile map list.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: refactor HW table init function
Leyi Rong [Wed, 19 Jun 2019 15:17:50 +0000 (23:17 +0800)]
net/ice/base: refactor HW table init function

1. Separated the calls to initialize and allocate the HW XLT tables
from call to fill table. This is to allow the ice_init_hw_tbls call
to be made prior to package download so that all HW structures are
correctly initialized. This will avoid any invalid memory references
if package download fails on unloading the driver.
2. Fill HW tables with package content after successful package download.
3. Free HW table and flow profile allocations when unloading driver.
4. Add flag in block structure to check if lists in block are
initialized. This is to avoid any NULL reference in releasing flow
profiles that may have been freed in previous calls to free tables.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: save user provided PHY config
Leyi Rong [Wed, 19 Jun 2019 15:17:49 +0000 (23:17 +0800)]
net/ice/base: save user provided PHY config

After the transition from cable-unplug to cable-plug events, FW will
clear the set-phy-cfg data, sent by user. Thus, we will need to
cache these info.
1. The submitted data when set-phy-cfg is called. This info will be used
later to check if FW clears out the PHY info, requested by user.
2. The FC, FEC and LinkSpeed, requested by user. This info will be used
later, by device driver, to construct the new input data for the
set-phy-cfg AQ command.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: move RSS replay list
Leyi Rong [Wed, 19 Jun 2019 15:17:48 +0000 (23:17 +0800)]
net/ice/base: move RSS replay list

1. Move the RSS list pointer and lock from the VSI context to the ice_hw
structure. This is to ensure that the RSS configurations added to the
list prior to reset and maintained until the PF is unloaded. This will
ensure that the configuration list is unaffected by VFRs that would
destroy the VSI context. This will allow the replay of RSS entries for
VF VSI, as against current method of re-adding default configurations
and also eliminates the need to re-allocate the RSS list and lock post-VFR.
2. Align RSS flow functions to the new position of the RSS list and lock.
3. Adding bitmap for flow type status.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: rollback AVF RSS configurations
Leyi Rong [Wed, 19 Jun 2019 15:17:47 +0000 (23:17 +0800)]
net/ice/base: rollback AVF RSS configurations

Adding support to remove RSS configurations added
prior to failing case in AVF.

Signed-off-by: Vignesh Sridhar <vignesh.sridhar@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: save queue bandwidth for replay after reset
Leyi Rong [Wed, 19 Jun 2019 15:17:46 +0000 (23:17 +0800)]
net/ice/base: save queue bandwidth for replay after reset

Added code to save the queue bandwidth information when it is applied
and it is replayed when queue is re-enabled again. Earlier saved value
is used for replay purpose.
Added vsi_handle, tc, and q_handle argument to the ice_cfg_q_bw_lmt,
ice_cfg_q_bw_dflt_lmt.

Signed-off-by: Tarun Singh <tarun.k.singh@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: support removing advanced rule
Leyi Rong [Wed, 19 Jun 2019 15:17:45 +0000 (23:17 +0800)]
net/ice/base: support removing advanced rule

This patch also contains ice_remove_adv_rule function to remove existing
advanced rules. It also handles the case when we have multiple VSI using
the same rule using the following helper functions:

ice_adv_rem_update_vsi_list - function to remove VS from VSI list for
advanced rules.

Signed-off-by: Shivanshu Shukla <shivanshu.shukla@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: replay advanced rule after reset
Leyi Rong [Wed, 19 Jun 2019 15:17:44 +0000 (23:17 +0800)]
net/ice/base: replay advanced rule after reset

Code added to replay the advanced rule per VSI basis and remove the
advanced rule information from shared code recipe list.

Signed-off-by: Victor Raj <victor.raj@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: support programming a new switch recipe
Leyi Rong [Wed, 19 Jun 2019 15:17:43 +0000 (23:17 +0800)]
net/ice/base: support programming a new switch recipe

1. Added an interface to support adding advanced switch rules.
2. Advanced rules are provided in a form of protocol headers and values
to match in addition to actions (limited actions are current supported).
3. Retrieve field vectors for ICE configuration package to determine
extracted fields and extracted locations for recipe creation.
4. Chain multiple recipes together to match multiple protocol headers.
5. Add structure to manage the dynamic recipes.

Signed-off-by: Grishma Kotecha <grishma.kotecha@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add functions to create new switch recipe
Leyi Rong [Wed, 19 Jun 2019 15:17:42 +0000 (23:17 +0800)]
net/ice/base: add functions to create new switch recipe

Add functions to support following admin queue commands:
1. 0x0208: allocate resource to hold a switch recipe. This is needed
when a new switch recipe needs to be created.
2. 0x0290: create a recipe with protocol header information and
other details that determine how this recipe filter work.
3. 0x0292: get details of an existing recipe.
4. 0x0291: associate a switch recipe to a profile.

Signed-off-by: Grishma Kotecha <grishma.kotecha@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add more recipe commands
Leyi Rong [Wed, 19 Jun 2019 15:17:41 +0000 (23:17 +0800)]
net/ice/base: add more recipe commands

Add the Add Recipe (0x0290), Recipe to Profile (0x0291), Get Recipe
(0x0292) and Get Recipe to Profile (0x0293) Commands.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: fix DCBx initialization
Leyi Rong [Wed, 19 Jun 2019 15:17:40 +0000 (23:17 +0800)]
net/ice/base: fix DCBx initialization

When a port is not cabled, but DCBx is enabled in the firmware, the
status of DCBx will be NOT_STARTED. This is a valid state for FW
enabled and should not be treated as a is_fw_lldp true automatically.

Add the code to treat NOT_STARTED as another valid state.

Fixes: 1082f786547e ("net/ice/base: support DCB")
Cc: stable@dpdk.org
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: add function to configure MIB
Leyi Rong [Wed, 19 Jun 2019 15:17:39 +0000 (23:17 +0800)]
net/ice/base: add function to configure MIB

Decouple ice_cfg_lldp_mib_change from the ice_init_dcb function call.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ice/base: include DIR flag in extraction sequence
Leyi Rong [Wed, 19 Jun 2019 15:17:38 +0000 (23:17 +0800)]
net/ice/base: include DIR flag in extraction sequence

Once upon a time, the ice_flow_create_xtrct_seq() function in ice_flow.c
extracted only protocol fields explicitly specified by the caller of the
ice_flow_add_prof() function via its struct ice_flow_seg_info instances.

However, to support different ingress and egress flow profiles with the
same matching criteria, it would be necessary to also match on the
packet Direction metadata. The primary reason was because there could
not be more than one HW profile with the same CDID, PTG, and VSIG. The
Direction metadata was not a parameter used to select HW profile IDs.

Thus, for ACL, the direction flag would need to be added to the
extraction sequence. This information will be use later as one criteria
for ACL scenario entry matching.

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: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agoeal: fix positive error codes from probe/remove
Ilya Maximets [Thu, 6 Jun 2019 10:02:28 +0000 (13:02 +0300)]
eal: fix positive error codes from probe/remove

According to API, 'rte_dev_probe()' and 'rte_dev_remove()' must
return 0 or negative error code. Bus code returns positive values
if device wasn't recognized by any driver, so the result of
'bus->plug/unplug()' must be converted. 'local_dev_probe()' and
'local_dev_remove()' also has their internal API, so the conversion
should be done there.

Positive on remove means that device not found by driver.
Positive on probe means that there are no suitable buses/drivers,
i.e. device is not supported.

Users of these API fixed to provide a good example by respecting
DPDK API. This also will allow to catch such issues in the future.

Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agoenforce experimental tag at beginning of declarations
David Marchand [Sat, 29 Jun 2019 11:58:53 +0000 (13:58 +0200)]
enforce experimental tag at beginning of declarations

Putting a '__attribute__((deprecated))' in the middle of a function
prototype does not result in the expected result with gcc (while clang
is fine with this syntax).

$ cat deprecated.c
void * __attribute__((deprecated)) incorrect() { return 0; }
__attribute__((deprecated)) void *correct(void) { return 0; }
int main(int argc, char *argv[]) { incorrect(); correct(); return 0; }
$ gcc -o deprecated.o -c deprecated.c
deprecated.c: In function ‘main’:
deprecated.c:3:1: warning: ‘correct’ is deprecated (declared at
deprecated.c:2) [-Wdeprecated-declarations]
 int main(int argc, char *argv[]) { incorrect(); correct(); return 0; }
 ^

Move the tag on a separate line and make it the first thing of function
prototypes.
This is not perfect but we will trust reviewers to catch the other not
so easy to detect patterns.

sed -i \
     -e '/^\([^#].*\)\?__rte_experimental */{' \
     -e 's//\1/; s/ *$//; i\' \
     -e __rte_experimental \
     -e '/^$/d}' \
     $(git grep -l __rte_experimental -- '*.h')

Special mention for rte_mbuf_data_addr_default():

There is either a bug or a (not yet understood) issue with gcc.
gcc won't drop this inline when unused and rte_mbuf_data_addr_default()
calls rte_mbuf_buf_addr() which itself is experimental.
This results in a build warning when not accepting experimental apis
from sources just including rte_mbuf.h.

For this specific case, we hide the call to rte_mbuf_buf_addr() under
the ALLOW_EXPERIMENTAL_API flag.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
5 years agoremove experimental tags from all symbol definitions
David Marchand [Sat, 29 Jun 2019 11:58:52 +0000 (13:58 +0200)]
remove experimental tags from all symbol definitions

We had some inconsistencies between functions prototypes and actual
definitions.
Let's avoid this by only adding the experimental tag to the prototypes.
Tests with gcc and clang show it is enough.

git grep -l __rte_experimental |grep \.c$ |while read file; do
sed -i -e '/^__rte_experimental$/d' $file;
sed -i -e 's/  *__rte_experimental//' $file;
sed -i -e 's/__rte_experimental  *//' $file;
done

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agotelemetry: add missing header include
David Marchand [Sat, 29 Jun 2019 11:58:51 +0000 (13:58 +0200)]
telemetry: add missing header include

Fixes: 1b756087db93 ("telemetry: add parser for client socket messages")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
5 years agomem: remove incorrect experimental tag on static symbol
David Marchand [Sat, 29 Jun 2019 11:58:50 +0000 (13:58 +0200)]
mem: remove incorrect experimental tag on static symbol

This function is not visible from outside this code unit.

Fixes: 84e7477e10b1 ("mem: add thread unsafe version for DMA mask check")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agonet/atlantic: add missing experimental API tags
David Marchand [Sat, 29 Jun 2019 11:58:49 +0000 (13:58 +0200)]
net/atlantic: add missing experimental API tags

Those symbols are declared in the library map but the prototypes are
missing the experimental tag.
Without it, existing users won't notice it is experimental.

Fixes: ec0dec44ecb9 ("net/atlantic: enable MACsec configuration")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agobuildtools: detect discrepancies for experimental symbols
David Marchand [Sat, 29 Jun 2019 11:58:48 +0000 (13:58 +0200)]
buildtools: detect discrepancies for experimental symbols

When promoting those symbols as stable, there is no check to ensure that
the final result is consistent.

Add a little script to get the symbols per section from the library map
files.
Validate that all experimental symbols in object files are referenced by
library map files.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agoraw/dpaa2_qdma: remove incorrect experimental tag
David Marchand [Sat, 29 Jun 2019 11:58:47 +0000 (13:58 +0200)]
raw/dpaa2_qdma: remove incorrect experimental tag

The incriminated commit promoted this symbol as stable but the
prototype still has the tag.

Fixes: fb1a20331d70 ("raw/dpaa2_qdma: remove experimental tag from APIs")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agovfio: remove incorrect experimental tag
David Marchand [Sat, 29 Jun 2019 11:58:46 +0000 (13:58 +0200)]
vfio: remove incorrect experimental tag

The incriminated commit promoted this symbol as stable but the
definition still has the tag.

Fixes: 787ae736a3d9 ("vfio: remove experimental tag")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agodevargs: remove incorrect experimental tags
David Marchand [Sat, 29 Jun 2019 11:58:45 +0000 (13:58 +0200)]
devargs: remove incorrect experimental tags

The incriminated commit promoted those symbols as stable but the
prototypes still have the tag.

Fixes: 73eca2f77f4c ("devargs: promote experimental API as stable")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agoeal: hide internal hotplug function
David Marchand [Sat, 29 Jun 2019 11:58:44 +0000 (13:58 +0200)]
eal: hide internal hotplug function

This API was experimental and not properly marked in the map file.
But looking more closely, this is just an internal wrapper for EAL init.
Hide it in the hotplug code.

Fixes: 244d5130719c ("eal: enable hotplug on multi-process")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agotest/rcu: fix test case
Honnappa Nagarahalli [Fri, 28 Jun 2019 18:43:42 +0000 (13:43 -0500)]
test/rcu: fix test case

Test case for rte_rcu_qsbr_get_memsize is written specifically
for 128 threads. Do not use RTE_MAX_LCORE as it changes for
different configurations.

Fixes: e6a14121f4ae ("test/rcu: remove arbitrary limit on max core count")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agotest/rcu: increase size of core numbers
Honnappa Nagarahalli [Fri, 28 Jun 2019 18:43:41 +0000 (13:43 -0500)]
test/rcu: increase size of core numbers

num_cores is of type uint8_t. This results in the following
compilation error.

test_rcu_qsbr_perf.c:649:16: error: comparison is always false
due to limited range of data type [-Werror=type-limits]
  if (num_cores >= RTE_MAX_LCORE) {
                ^~

RTE_MAX_LCORE is set to 256 for armv8 config.

Fixes: e6a14121f4ae ("test/rcu: remove arbitrary limit on max core count")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agoexamples/l3fwd-power: fix build with gcc 4
Thomas Monjalon [Sat, 29 Jun 2019 08:45:50 +0000 (10:45 +0200)]
examples/l3fwd-power: fix build with gcc 4

error: ‘for’ loop initial declarations are only allowed in C99 mode

Fixes: 609e79841fcf ("examples/l3fwd-power: add telemetry mode")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
5 years agoeal: use 32-bit RDSEED to allow 32-bit x86 usage
Mattias Rönnblom [Fri, 28 Jun 2019 21:08:46 +0000 (23:08 +0200)]
eal: use 32-bit RDSEED to allow 32-bit x86 usage

When seeding the pseudo-random number generator, replace the 64-bit
RDSEED with two 32-bit RDSEED instructions to allow building and
running on 32-bit x86.

Fixes: faf8fd252785 ("eal: improve entropy for initial PRNG seed")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
5 years agoeal: introduce random generator with upper bound
Mattias Rönnblom [Fri, 28 Jun 2019 09:01:23 +0000 (11:01 +0200)]
eal: introduce random generator with upper bound

Add a function rte_rand_max() which generates an uniformly distributed
pseudo-random number less than a user-specified upper bound.

The commonly used pattern rte_rand() % SOME_VALUE creates biased
results (as in some values in the range are more frequently occurring
than others) if SOME_VALUE is not a power of 2.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agoeal: improve entropy for initial PRNG seed
Mattias Rönnblom [Fri, 28 Jun 2019 09:01:22 +0000 (11:01 +0200)]
eal: improve entropy for initial PRNG seed

Replace the use of rte_get_timer_cycles() with getentropy() for
seeding the pseudo-random number generator. getentropy() provides a
more truly random value.

getentropy() requires glibc 2.25 and Linux kernel 3.17. In case
getentropy() is not found at compile time, or the relevant syscall
fails in runtime, the rdseed machine instruction will be used as a
fallback.

rdseed is only available on x86 (Broadwell or later). In case it is
not present, rte_get_timer_cycles() will be used as a second fallback.

On non-Meson builds, getentropy() will not be used.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agoeal: replace libc-based random generation with LFSR
Mattias Rönnblom [Fri, 28 Jun 2019 09:01:20 +0000 (11:01 +0200)]
eal: replace libc-based random generation with LFSR

This commit replaces rte_rand()'s use of lrand48() with a DPDK-native
combined Linear Feedback Shift Register (LFSR) (also known as
Tausworthe) pseudo-random number generator.

This generator is faster and produces better-quality random numbers
than the linear congruential generator (LCG) of lib's lrand48(). The
implementation, as opposed to lrand48(), is multi-thread safe in
regards to concurrent rte_rand() calls from different lcore threads.
A LCG is still used, but only to seed the five per-lcore LFSR
sequences.

In addition, this patch also addresses the issue of the legacy
implementation only producing 62 bits of pseudo randomness, while the
API requires all 64 bits to be random.

This pseudo-random number generator is not cryptographically secure -
just like lrand48().

Bugzilla ID: 114
Bugzilla ID: 276

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agoexamples/l3fwd-power: add telemetry mode
Reshma Pattan [Mon, 24 Jun 2019 16:45:51 +0000 (17:45 +0100)]
examples/l3fwd-power: add telemetry mode

Add new telemetry mode support for l3fwd-power.
This is a standalone mode, in this mode l3fwd-power
does simple l3fwding along with calculating
empty polls, full polls, and busy percentage for
each forwarding core. The aggregation of these
values of all cores is reported as application
level telemetry to metric library for every 500ms from the
master core.

The busy percentage is calculated by recording the poll_count
and when the count reaches a defined value the total
cycles it took is measured and compared with minimum and maximum
reference cycles and busy rate is set according to either 0% or
50% or 100%.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
5 years agotelemetry: fix build
Ferruh Yigit [Thu, 27 Jun 2019 19:51:44 +0000 (20:51 +0100)]
telemetry: fix build

Build error:
../lib/librte_telemetry/rte_telemetry.c:558:28:
  error: comparison of unsigned expression < 0 is always false
  [-Werror,-Wtautological-compare]

Build error not observed in default make build because telemetry library
disabled by default but easier to reproduce via meson.

Fixing by converting unsigned variables to signed.

Fixes: 0fe3a37924d4 ("telemetry: format json response when sending stats")
Fixes: 4080e46c8078 ("telemetry: support global metrics")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
5 years agobpf: fix check array size
Konstantin Ananyev [Fri, 21 Jun 2019 14:26:49 +0000 (15:26 +0100)]
bpf: fix check array size

Array ins_chk in lib/librte_bpf/bpf_validate.c has 255 entries.
So the instruction with opcode == 255 will reading beyond array
boundaries.
For more details please refer to:
https://bugs.dpdk.org/show_bug.cgi?id=283

Fixes: 6e12ec4c4d6d ("bpf: add more checks")
Cc: stable@dpdk.org
Reported-by: Michel Machado <michel@digirati.com.br>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
5 years agobus/vmbus: skip non-network devices
Stephen Hemminger [Thu, 6 Jun 2019 00:37:46 +0000 (17:37 -0700)]
bus/vmbus: skip non-network devices

The vmbus scan code can just skip non-network devices.
More importantly, this fixes the bug where some vmbus devices
don't have all the attributes (like monitor_id) and a single
failure would cause the scan to break the loop.

Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
5 years agotest: skip tests when missing requirements
David Marchand [Sat, 15 Jun 2019 06:42:30 +0000 (08:42 +0200)]
test: skip tests when missing requirements

Let's mark as skipped the tests when they are missing some requirements
like a number of used cores or specific hardware availability, like
compress, crypto or eventdev devices.

Signed-off-by: David Marchand <david.marchand@redhat.com>
5 years agotest: do not start tests in parallel
David Marchand [Sat, 15 Jun 2019 06:42:29 +0000 (08:42 +0200)]
test: do not start tests in parallel

Running the tests in parallel has two drawbacks:
- the tests are racing on the hugepages allocations,
- the tests are sharing the cores to run their checks which results in
  undeterministic execution time,

This results in random failures.
For better reproducibility in CI, start them all in a serialised way.

Signed-off-by: David Marchand <david.marchand@redhat.com>
5 years agotest: split into shorter subtests
David Marchand [Sat, 15 Jun 2019 06:42:28 +0000 (08:42 +0200)]
test: split into shorter subtests

Based on Michael initial idea of separating the file-prefix subtest in
the eal flags test.

Let's split the biggest tests into their subparts.
It is then easier to have them fit in the 10s timeout we have configured
in Travis.
We also get a better idea of which part fails in the previously big tests
we had.

Those new subtests are called from the meson testsuite.
The autotest tool is left untouched.

Note: we still have an issue with test_hash_readwrite_lf.c, any help from
the original authors would be appreciated.

Signed-off-by: David Marchand <david.marchand@redhat.com>