Commit Graph

202 Commits

Author SHA1 Message Date
Rasesh Mody
36341ac6f3 net/qede/base: retain dcbx config till actually applied
Retain user dcbx configurations till the config is applied to the adapter
i.e. till the negotiation completes. If base driver receives a config
update before negotiation completes, then base driver merges the new config
with the cached config and sends it to management FW.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
3af0c2a203 net/qede/base: catch an init command write failure
In case ecore_init_rt() fails for some reason, catch the failure and
fail the initialization.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
fe0deb21d4 net/qede/base: add feature support for per-PF virtual link
Add per-PF virtual link support.
This feature adds a logical layer over the physical link to reflect the
control of OEM management protocols either thru' sideband or a switch.
For example, a switch could send a link-down tlv for a PF and this will
put down logical link and virtual link in shared mem (SHMEM) for that PF
inspite of physical link being up for that port.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
13c0ec8ae8 net/qede/base: dcbx dscp related extensions
- Add an internal API ecore_dcbx_get_dscp_value() for getting the
dscp value for a given priority.

- Initialize dscp parameters in the dcbx-config cache to be used by
the clients for configuring dcbx parameters.

- Reset NIG_REG_DSCP_TO_TC_MAP_ENABLE register when user disables the dscp.

- Fix to always send "dscp + dcbx" update to FW.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
442fb29b39 net/qede/base: move define to header file
Move FW_MB_PARAM_LOAD_DONE_DID_EFUSE_ERROR to header file

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
f5940e7d0f net/qede/base: support driver attribute repository
Add support for driver attributes repository in MFW and base driver.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
c73d7da71c net/qede/base: support mapped doorbell BARs for VF
Determines whether VF utilizes doorbells via limited register bar or via
the doorbell bar and return the size of the HW doorbell bar via acquire
response. By doing that limit the VF CIDs to an amount that would make sure
doorbells for all CIDs fall within the bar.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
47af701989 net/qede/base: add UFP support
Add support for UFP (Unified Fabric Port) multi-function mode.
It includes new APIs for reading UFP configuration, handling
UFP events, retriving UFP status and UFP ramrod update etc.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
40cf1e753e net/qede/base: update firmware to 8.30.12.0
Upgrade QEDE PMD FW to version 8.30.12.0.

The firmware upgrade change details are as:
 - Add support for steering by IP and UDP destination port.
 - Add source QP field for GSI offload.
 - Add UFP support.
 - Add support for outer IPv4 TX CSO with unknown tunnel type (in addition
   to inner header CSO).
 - Support flow ID in accelerated RFS flow.
 - Allow Doorbell on empty SPQ and LL2 TX queue (for doorbell recovery).
 - Enable PCI Relaxed Ordering for L2 RX data placement.
 - Additional enhancements and bug fixes

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
211507c164 net/qede/base: fix number of app table entries
Configure only the available/requested number of app entries rather
than max entries (DCBX_MAX_APP_PROTOCOL) in ecore_dcbx_get_app_data().
Also, fixed a minor issue where incorrect size value is being passed for
memcpy().

Fixes: 26ae839d06 ("qede: add DCBX support")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
85dfd0c55d net/qede/base: change verbosity
Change verbosity of events related to malicious VFs to DP_NOTICE
from DP_INFO. They are not just informational events.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
c0845c33ff net/qede/base: add new macro for CMT mode
- Add ECORE_IS_CMT macro (CMT: couple mode teaming) and use that in all the
places where there are checks for number of HW functions per device > 1.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
c83cbe7130 net/qede/base: handle the error condition properly
If for some reason the send message from VF to PF times out, don't bail out
right away without taking proper cleanup action. The goto statement calls
ecore_vf_pf_req_end() which will unlock the mutex previously held.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
eafbc6fc52 net/qede/base: semantic changes
- Make ecore_dcbx_set_local_params(), ecore_cm_init_pf()  as static
- Remove src_proto()
- remove reference to PROTOCOLID_TOE when determining whether a a protocol
  requires SRC ILT memory
- Add auxiliary variables in various places
- All other changes are simple semantic corrections

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
10409fabfc net/qede/base: fix API return types
- Turn ecore_ptt_get_hw_addr() into static
- Convert ecore_dcbx_get_operational_params() to void since we don't
  care about the return value

Fixes: 26ae839d06 ("qede: add DCBX support")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
7f47458874 net/qede/base: use function pointers for spq async callback
Change spq async callback to use function pointers instead of switch case
on protocolid.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
6844eac8a0 net/qede/base: use available macro
- Use OSAL_PAGE_SIZE instead of assuming it to be 4096.
 - While at it make sure the minimum number of doorbells that can be issued
   is 4.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
32e15079fa net/qede/base: use proper units for rate limiting
Change module parameter semantics to standard units (Rate limiting is used
for DCQCN feature).

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
dd7b6aadaa net/qede/base: refactor device's number of ports logic
- Avoid having num_of_ports as 0 [to prevent a division by 0 via
   MFW_PORT()]. Also fix the MFW_PORT() macro for CMT.
 - Read the device's number of ports from shmem.
 - Rename num_ports_in_engines to num_ports_in_engine.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
823a84aa6b net/qede/base: read per queue coalescing from HW
Add base driver API to read per queue coalescing from hardware.
Move ecore_set_rxq|txq_coalesce() declarations to ecore_l2.h.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
3b212853e4 net/qede/base: fix macros to check chip revision/metal
Fix the ECORE_IS_[AB]0() macros to check both the chip revision and the
chip metal. Realign defines in the struct ecore_dev.

Fixes: ec94dbc573 ("qede: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
30ecf67308 net/qede/base: remove unused parameters
This is an attempt to clean up many unused API parameters across the base
code. Most of the changes are related to removing unused p_hwfn or p_ptt
handlers. The warnings are generated using 'unused-parameter' cflags.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
c1454460c4 net/qede/base: prevent stop vport assert by malicious VF
PF checks upon stop-vport from VF whether it's legal, but if it's not it
would STILL send the request to FW, which might cause it to assert.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
a474d1c1e7 net/qede/base: block mbox command to unresponsive MFW
Block sending of mailbox command to the management FW if it is not
responsive. Use MCP_REG_CPU_STATE_SOFT_HALTED register to verify the MCP
is actually halted after sending the halt command and before proceeding
further.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
e916697f8e net/qede/base: support doorbell overflow recovery
Add support for doorbell overflow recovery mechanism:
The doorbell recovery mechanism consists of a list of entries which
represent doorbelling entities (l2 queues, roce sq/rq/cqs, the slowpath
spq, etc). Each entity needs to register with the mechanism and provide
the parameters describing it's doorbell, including a location where last
used doorbell data can be found. The doorbell execute function will
traverse the list and doorbell all of the registered entries.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
2a0c610bd8 net/qede/base: add API to send STAG config update to FW
Send updated STAG configuration to the Firmware.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
cb051eb251 net/qede/base: allow clients to override VF MSI-X table size
For chip variant CHIP_NUM_AH_xxx, MSI-x configuration for VFs is controlled
per-PF [for all of its child VFs] instead of on a per-VF basis. A flag
called "dont_override_vf_msix" is added that allows the caller/client to
specify the mode they want to operate. If dont_override_vf_msix is false as
in the case of VF of CHIP_NUM_AH_xxx, first a check is made as to what is
currently configured number. Management FW will be asked to configure the
requested number only if its bigger than the currently configured value.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
04b0004980 net/qede/base: rename MFW get/set field defines
Changes for management FW, change of _SHIFT defines to _OFFSET.
Accordingly, rename and fix the ECORE_MFW_GET_FIELD() and
ECORE_MFW_SET_FIELD() macros and update wherever used.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
40a373fcc7 net/qede/base: initialize resc lock/unlock params
Add a function that provides default initialization to resc lock/unlock
parameters. Change acquire flow that use resources into using this
function.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
2292589a68 net/qede/base: remove helper functions/structures
- Remove an additional wrapper function ecore_mcp_nvm_command and
   instead
   use ecore_mcp_nvm_wr_cmd, ecore_mcp_nvm_rd_cmd or ecore_mcp_cmd APIs
   directly as appropriate.
 - Remove struct ecore_mcp_nvm_params
 - Add new NVM command ECORE_EXT_PHY_FW_UPGRADE and fix the expected
   management FW responses in ecore_mcp_nvm_write()
 - Fail the NVM write process on any failing partial write

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
22c996968b net/qede/base: revise management FW mbox access scheme
Revise the manamgement FW mbox access locking scheme for the access to the
MFW mailbox:
 - add a new linked list called cmd_list to ecore_mcp_info that tracks all
   the mailbox commands sent to management FW and ones waiting for
   response.
 - add a mutex lock called cmd_lock to ecore_mcp_info, a spinlock used to
   serialize the access to this cmd_list and makes sure that the mbox is
   not a pending one before sending a new mbox request. It protects the
   access to the mailbox commands list and sending of the commands.
 - add ecore_mcp_cmd_add|del|get_elem() APIs for new access scheme
 - remove ecore_mcp_mb_lock() and ecore_mcp_mb_unlock()
 - add a mutex lock called link_lock to ecore_mcp_info, a spinlock used for
   syncing SW link-changes and link-changes originating from attention
   context. This locking scheme prevents possible race conditions that may
   occur, such as during link status reporting.
 - Surround OSAL_{MUTEX,SPIN_LOCK}_{ALLOC,DEALLOC} with
   '#ifdef CONFIG_ECORE_LOCK_ALLOC'. In case memory has to be allocated for
   lock primitives, then compile driver with CONFIG_ECORE_LOCK_ALLOC flag.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
4be18885d1 net/qede/base: avoid possible race condition
There's a possible race in multiple VF scenarios for base driver users
that use the optional APIs ecore_iov_pf_get_and_clear_pending_events,
ecore_iov_pf_add_pending_events. If the client doesn't synchronize the two
calls, it's possible for the PF to clear a VF pending message indication
without ever getting it [as 'get & clear' isn't atomic], leading to VF
timeout on the command.

The solution is to switch into a per-VF indication rather than having a
bitfield for the various VFs with pending events. As part of the solution,
the setting/clearing of the indications is done internally by base driver.
As a result, ecore_iov_pf_add_pending_events is no longer needed and
ecore_iov_pf_get_and_clear_pending_events loses the 'and_clear' from its
name as its now a proper getter.

A VF would be considered 'pending' [I.e., get_pending_events() should
have '1' for it in its bitfield] beginning with the PF's base driver
recognizing a message sent by that VF [in SP_DPC] and ending only when
that VF message is processed.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
e4782d3089 net/qede/base: prevent re-assertions of parity errors
Prevent parity errors from being re-asserted. Mask any parity error, even
if it is not associated with a HW block.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
739a5b2f2b net/qede/base: use passed ptt handler
Use the ptt[PF translation table] handler that is passed rather than using
main ptt from the HW function.
In ecore_hw_get_resc()'s error flow, release the MFW generic resource lock
only if needed.
Change the verbosity level of GRC timeout from DP_INFO() to DP_NOTICE().
Reduce verbosity of print in ecore_hw_bar_size().

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
3c6a3cf607 net/qede/base: add EEE support
- Base driver EEE (Energy efficient ethernet) support.
 - Provide supported-speed mask to driver though shared memory.
 - Read/use eee-supported capabilities value from the shared memory.
 - Update qed_fill_link() to advertise the EEE capabilities.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
a064d7d28b net/qede/base: add mdump sub-commands
- Add support to retain/clear data for crash dump by introducing the mdump
   GET_RETAIN/CLR_RETAIN sub commands, new APIs
   ecore_mcp_mdump_get_retain() and ecore_mcp_mdump_clr_retain()
 - Avoid checking for mdump logs and data in case of an emulator
 - Fix "deadbeaf" returned value in case of pcie status command read
   fails (prevent false detection)

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
c5e1108920 net/qede/base: alter driver's force load behavior
- Add an option to override the default force load behavior.
 - PMD will set the override force load parameter to
   ECORE_OVERRIDE_FORCE_LOAD_ALWAYS.
 - Modify the printout when a force load is required to include the loaded
   value
 - No need for 'default' when switching over enums and covering all the
   values.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
652ee28ab0 net/qede/base: add SmartAN support
Add SmartAN feature that automatically detects peer switch capabilities
which relieves users from fumbling with adapter and switch configuration
Add new cmd DRV_MSG_CODE_GET_MFW_FEATURE_SUPPORT. Add new SmartLinQ config
method using NVM cfg options 239.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:49 +02:00
Rasesh Mody
5f88553bcd net/qede/base: add a sanity check
Add a sanity check that the offset being used to access the runtime array
is not greater/equal than/to RUNTIME_ARRAY_SIZE

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
544927f9a4 net/qede/base: fix to use a passed ptt handle
Fix ecore_configure_vp_wfq_on_link_change() to use a provided ptt[PF
translation table] handle instead of directly using p_dpc_ptt

Fixes: ec94dbc573 ("qede: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
ab6bf1d77a net/qede/base: restrict cache line size register padding
Add a restriction on the pad to cache line size register.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
be9737699c net/qede/base: add API to configure coalescing for VF queues
Add API for PF to configure coalescing for VF queues.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
6e4fcea92f net/qede/base: interchangeably use SB between PF and VF
Status Block reallocation - allow a PF and its child VF to change SB
between them using new base driver APIs.

The changes that are inside base driver flows are:

New APIs ecore_int_igu_reset_cam() and ecore_int_igu_reset_cam_default()
added to reset IGU CAM.
 a. During hw_prepare(), driver would re-initialize the IGU CAM.
 b. During hw_stop(), driver would initialize the IGU CAM to default.

Use igu_sb_id instead of sb_idx [protocol index] to allow setting of
the timer-resolution in CAU[coalescing algorithm unit] for all SBs,
sb_idx could limit SBs 0-11 only to be able change their timer-resolution.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
a90c566f43 net/qede/base: changes for VF queue zone
Allow opening Multiple Tx queues on a single qzone for VFs.
This is supported by Rx/Tx TLVs now having an additional extended TLV that
passes the `qid_usage_idx', a unique number per each queue-cid that was
opened for a given queue-zone.

Fix to overcome TX timeout issue due to more than 16 CIDs by adding an
additional VF legacy mode. This will detach the CIDs from the original
only-existing legacy mode suited for older releases.
Following this change, only VFs that would publish VFPF_ACQUIRE_CAP_QIDS
would have the new CIDs scheme applied. I.e., the new 'legacy' mode is
actually whether this capability is published or not.

Changed the logic to clear doorbells for legacy and non-legacy VFs, so
the PF is cleaning the doorbells for both cases.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
dc8eba81f0 net/qede/base: convert device type to enum
Add a new enum for device type and device type details to device info.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
e41266b57c net/qede/base: allocate VF queues before PF
Change the order by which we allocate the resources to align with
management FW by first allocating the VF l2 queues and only
afterwards use what's left for the PF.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
03637634ef net/qede/base: use crc32 OSAL macro
Move ecore_crc32() macro to within base driver to qede_crc32() and use
OSAL_CRC32() where required.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
318741211b net/qede/base: update management FW supported features
- Add transceivers temperature monitoring/reporting feature
 - Add new mbox command DRV_MSG_CODE_FEATURE_SUPPORT to exchange info
   between drivers and management FW regarding features supported
 - Add EEE to Link Flap Avoidance check, etc.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
25646c6282 net/qede/base: add NVM config options
Add new NVM configuration options like
 - enabling Preboot Debug Mode,
 - 20G ethernet backplane support,
 - add RDMA to NPAR protocol list,
 - PHY module temperature thresholds, etc.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-10-06 02:49:48 +02:00
Rasesh Mody
9c1aa3e1c2 net/qede/base: fix for adapter specific stats
Handle different MAC statistic fields between two chip variants by
reading the MAC counters from the adapter suitable statistics bins.

Fixes: ec94dbc573 ("qede: add base driver")
Cc: stable@dpdk.org

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
2017-07-31 19:58:41 +02:00