Commit Graph

21930 Commits

Author SHA1 Message Date
Qi Zhang
c5dccda9f2 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
e0b977dddb 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
f3202a097f 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
ac882a0eda 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
2a28af0217 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
0aa1ab2fb4 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
bbed2226fd 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
9f041a7214 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
2516684aed 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
84551c9565 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
87e1f7f3d8 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
1d6cf7df2a 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
6cfacf7d71 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>
2020-04-21 13:57:05 +02:00
Qi Zhang
486d29fda5 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
6cad4aa1a5 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
762e946d59 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
ceb2f4c387 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
701f7ba619 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
88ea6b3b7a 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
795604170a 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
71fbaee92d 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
4a3c620f61 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
3a98d6cbdb 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
76ac9d771c 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: 453d087cca ("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>
2020-04-21 13:57:04 +02:00
Qi Zhang
a1f5c1c27c 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: c7dd159311 ("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>
2020-04-21 13:57:04 +02:00
Qi Zhang
eb433cb20d 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>
2020-04-21 13:57:04 +02:00
Qi Zhang
cdfa0dc170 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: fed0c5ca5f ("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>
2020-04-21 13:57:04 +02:00
Chengwen Feng
e7f4213c30 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: a5475d61fa ("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>
2020-04-21 13:57:04 +02:00
Min Hu (Connor)
7c9f68872d 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: 463e748964 ("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>
2020-04-21 13:57:04 +02:00
Lijun Ou
5e782bc257 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: c37ca66f2b ("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>
2020-04-21 13:57:04 +02:00
Lijun Ou
920be799db 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: c37ca66f2b ("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>
2020-04-21 13:57:04 +02:00
Muhammad Ahmad
476ec8e278 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>
2020-04-21 13:57:04 +02:00
Andy Pei
e579172633 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: 70d6b7f550 ("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>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
ef6f2f5cdb 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>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
4f1af3cb5a net/hinic: clean up logs
The patch optimizes log files without "\n".

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
1fe89aa37f 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>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
ac4acfa3c2 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>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
62d2083dd7 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>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
0194313b2d 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: d9ce191794 ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
2020-04-21 13:57:04 +02:00
Xiaoyun Wang
9d02f40d65 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: 9d4878ef08 ("net/hinic: support LRO offload")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
2020-04-21 13:57:04 +02:00
Wei Hu (Xavier)
25d257facd 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: 2790c64647 ("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>
2020-04-21 13:57:04 +02:00
Min Hu (Connor)
d33fb7f939 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: 411d23b9ea ("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>
2020-04-21 13:57:04 +02:00
Chengwen Feng
c064f6918c 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: c37ca66f2b ("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>
2020-04-21 13:57:04 +02:00
Chengwen Feng
4f4ee5b79b 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: 737f30e1c3 ("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>
2020-04-21 13:57:04 +02:00
Chengwen Feng
af531efa4b 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: bba6366983 ("net/hns3: support Rx/Tx and related operations")
Fixes: ad7cf94823 ("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>
2020-04-21 13:57:04 +02:00
Chengchang Tang
a90f557def 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>
2020-04-21 13:57:04 +02:00
Chengchang Tang
e579435fac 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>
2020-04-21 13:57:04 +02:00
Jerin Jacob
9f8e1810f6 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>
2020-04-23 15:40:12 +02:00
Sunil Kumar Kori
40b75c73d1 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>
2020-04-23 15:40:11 +02:00
Sunil Kumar Kori
4cf30e3f3c 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>
2020-04-23 15:40:09 +02:00