dpdk.git
4 years agonet/mlx5: rearrange creation of RQ and CQ resources
Michael Baum [Thu, 3 Sep 2020 10:13:39 +0000 (10:13 +0000)]
net/mlx5: rearrange creation of RQ and CQ resources

Rearrangement of RQ and CQ resource handling for DevX Rx queue:
1. Rename the allocation function so that it is understood that it
allocates all resources and not just the CQ or RQ.
2. Move the allocation and release of the doorbell into creation and
release functions.
3. Reduce the number of arguments that the creation functions receive.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: share Rx control code
Michael Baum [Thu, 3 Sep 2020 10:13:38 +0000 (10:13 +0000)]
net/mlx5: share Rx control code

Move Rx object similar resources allocations and debug logs from DevX
and Verbs modules to a shared location.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: separate Rx interrupt handling
Michael Baum [Thu, 3 Sep 2020 10:13:37 +0000 (10:13 +0000)]
net/mlx5: separate Rx interrupt handling

Separate interrupt event handler into both Verbs and DevX modules.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: separate Rx queue object creations
Michael Baum [Thu, 3 Sep 2020 10:13:36 +0000 (10:13 +0000)]
net/mlx5: separate Rx queue object creations

As an arrangement to Windows OS support, the Verbs operations should be
separated to another file.
By this way, the build can easily cut the unsupported Verbs APIs from
the compilation process.

Define operation structure and DevX module in addition to the existing
linux Verbs module.
Separate Rx object creation into the Verbs/DevX modules and update the
operation structure according to the OS support and the user
configuration.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: mitigate Rx queue reference counters
Michael Baum [Thu, 3 Sep 2020 10:13:35 +0000 (10:13 +0000)]
net/mlx5: mitigate Rx queue reference counters

The Rx queue structures manage 2 different reference counter per queue:
rxq_ctrl reference counter and rxq_obj reference counter.

There is no real need to use two different counters, it just complicates
the release functions.
Remove the rxq_obj counter and use only the rxq_ctrl counter.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix types differentiation in Rx queue create
Michael Baum [Thu, 3 Sep 2020 10:13:34 +0000 (10:13 +0000)]
net/mlx5: fix types differentiation in Rx queue create

Rx HW objects can be created by both Verbs and DevX operations.
The management of the 2 types of operations are done directly in the
main flow of the object’s creations.

Some arrangements and validations were wrongly done to the irrelevant
type:

1. LRO related validations were done for Verbs type where LRO is not
supported at all.
2. Verbs allocation arrangements were done for DevX operations where it
is not needed.
3. Doorbell destroy was considered for Verbs types where it is
irrelevant.

Adjust the aforementioned points only for the relevant types.

Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues")
Fixes: 08d1838f645a ("net/mlx5: implement CQ for Rx using DevX API")
Fixes: 17ed314c6c0b ("net/mlx5: allow LRO per Rx queue")
Fixes: dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix Rx queue state update
Michael Baum [Thu, 3 Sep 2020 10:13:33 +0000 (10:13 +0000)]
net/mlx5: fix Rx queue state update

In order to support DevX Rx queue stop and start operations, the state
of the queue should be updated in FW.
The state update PRM command requires to set both the current state and
the new requested state.

The current state and the new requested state fields setting were
wrongly switched.

Switch them back to the correct setting.

Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix Rx hash queue creation error flow
Michael Baum [Thu, 3 Sep 2020 10:13:32 +0000 (10:13 +0000)]
net/mlx5: fix Rx hash queue creation error flow

The mlx5_hrxq_new function allocates several resources and if one of the
allocations fails, the function jumps to an error label where it
releases all the allocated resources.

When the TIR action creation fails, the hrxq memory is not released what
can cause a resource leak.

Add an appropriate release to the hrxq pointer in the error flow.

Fixes: 772dc0eb83d3 ("net/mlx5: convert hrxq to indexed")
Fixes: dc9ceff73c99 ("net/mlx5: create advanced RxQ via DevX")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/ark: remove Tx padding configuration macro
Ed Czeck [Tue, 8 Sep 2020 19:20:18 +0000 (15:20 -0400)]
net/ark: remove Tx padding configuration macro

Replace behavior with RTE_LIBRTE_ARK_MIN_TX_PKTLEN
with a default value of 0.
Update documentation as needed.

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ark: replace compile time log config with runtime
Ed Czeck [Tue, 8 Sep 2020 19:20:17 +0000 (15:20 -0400)]
net/ark: replace compile time log config with runtime

Use ARK_PMD_LOG in place of PMD_DRV_LOG, PMD_DEBUG_LOG, PMD_FUNC_LOG,
PMD_STATS_LOG, PMD_RX_LOG, and PMD_TX_LOG.
Review and adjust log levels and messages as needed.

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ice: fix flow validation for unsupported patterns
Guinan Sun [Tue, 8 Sep 2020 03:15:05 +0000 (03:15 +0000)]
net/ice: fix flow validation for unsupported patterns

When loading the OS default package and the pipeline mode is enabled
by the "pipeline-mode-support=1" operation. In this case, the wrong
parser is selected for processing and it will cause the unsupported
patterns(pppoes/pfcp/l2tpv3/esp/ah) to be validated successfully.
This patch corrects the parser selection issue.

Fixes: 47d460d63233 ("net/ice: rework switch filter")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: refactor RSS
Qi Zhang [Fri, 4 Sep 2020 03:33:12 +0000 (11:33 +0800)]
net/iavf: refactor RSS

Current RSS implementation is not easy to scale and maintain.
The patch refactor the code base on below design:

1. iavf_pattern_match_item->input_set_mask is the superset of
   ETH_RSS_xxx.
2. iavf_pattern_match_item->meta is the virtchnl_proto_hdrs template.
3. iavf_hash_parse_pattern will generate pattern hint.
4. iavf_hash_parse_action will refine the virtchnl_proto_hdrs base on
   pattern hint and ETH_RSS_xxx.
5. The refine process include
   1) refine field selector of l2, l3, l4.
   2) insert gtpu proto_hdr at the beginning base on pattern hint.
   3) refine field selector for gtpu header.

The patch reduce the code from 4000+ line to less than 1000.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/ice/base: fix outer IPv6 packet type table
Qi Zhang [Sun, 6 Sep 2020 13:01:45 +0000 (21:01 +0800)]
net/ice/base: fix outer IPv6 packet type table

ptype 264, 265, 266, 267, 275 should not be set
in ice_ptypes_ipv6_ofos_all.

Fixes: 88824213be8a ("net/ice/base: enable RSS for PFCP/L2TP/ESP/AH")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/dpaa: support configuring RSS on runtime
Sachin Saxena [Fri, 4 Sep 2020 08:39:30 +0000 (14:09 +0530)]
net/dpaa: support configuring RSS on runtime

With fmlib (FMCLESS) mode now RSS can be modified on runtime.
This patch add support for RSS update functions

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
4 years agonet/dpaa: support FMC parser for VSP
Jun Yang [Fri, 4 Sep 2020 08:39:29 +0000 (14:09 +0530)]
net/dpaa: support FMC parser for VSP

FMC tool generates and saves the setup in a file.
This patch help Parse the /tmp/fmc.bin generated by FMC to
setup RXQs for each port on FMC mode.
The parser gets the fqids and vspids from fmc.bin

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agonet/dpaa: support virtual storage profile
Jun Yang [Fri, 4 Sep 2020 08:39:28 +0000 (14:09 +0530)]
net/dpaa: support virtual storage profile

This patch adds support for Virtual Storage profile (VSP) feature.
With VSP support when memory pool is created, the hw buffer pool id
i.e. bpid is not allocated; the bpid is identified by dpaa flow
create API.
The memory pool of RX queue is attached to specific BMan pool
according to the VSP ID when RX queue is setup.
For fmlib based hash queue, VSP base ID is assigned to each queue.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agobus/dpaa: add virtual storage profile port init
Hemant Agrawal [Fri, 4 Sep 2020 08:39:27 +0000 (14:09 +0530)]
bus/dpaa: add virtual storage profile port init

This patch add support to initialize the VSP ports
in the FMAN library.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agobus/dpaa: support shared MAC
Radu Bulie [Fri, 4 Sep 2020 08:39:26 +0000 (14:09 +0530)]
bus/dpaa: support shared MAC

A shared MAC interface is an interface which can be used
by both kernel and userspace based on classification configuration
It is defined in dts with the compatible string
"fsl,dpa-ethernet-shared" which bpool will be seeded by the dpdk
partition and configured as a netdev by the dpaa Linux eth driver.
User space buffers from the bpool will be kmapped by the kernel.

Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agonet/dpaa: support FMCless mode
Sachin Saxena [Fri, 4 Sep 2020 08:39:25 +0000 (14:09 +0530)]
net/dpaa: support FMCless mode

This patch uses fmlib to configure the FMAN HW for flow
and distribution configuration, thus avoiding the need
for static FMC tool execution optionally.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agonet/dpaa: support VSP in fmlib
Jun Yang [Fri, 4 Sep 2020 08:39:24 +0000 (14:09 +0530)]
net/dpaa: support VSP in fmlib

This patch adds support for VSP (Virtual Storage Profile)
in fmlib routines.
VSP allow a network interface to be divided into physical
and virtual instance(s).
The concept is very similar to SRIOV.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agonet/dpaa: support fmlib
Hemant Agrawal [Fri, 4 Sep 2020 08:39:23 +0000 (14:09 +0530)]
net/dpaa: support fmlib

DPAA platorm MAC interface is known as FMAN i.e. Frame Manager.
There are two ways to control it.
1. Statically configure the queues and classification rules before the
start of the application using FMC tool.
2. Dynamically configure it within application by making API calls of
fmlib.

The fmlib or Frame Manager library provides an API on top of the
Frame Manager driver ioctl calls, that provides a user space application
with a simple way to configure driver parameters and PCD
(parse - classify - distribute) rules.

This patch integrates the base fmlib so that various queue config, RSS
and classification related features can be supported on DPAA platform.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agonet/hns3: fix out of bounds access
Yunjian Wang [Mon, 7 Sep 2020 01:46:33 +0000 (09:46 +0800)]
net/hns3: fix out of bounds access

This patch fixes (out-of-bounds access) coverity issue.

Coverity issue: 349932
Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/iavf: downgrade error log
Steve Yang [Fri, 4 Sep 2020 07:29:07 +0000 (07:29 +0000)]
net/iavf: downgrade error log

When receiving the unsupported AQ messages, it's taken as an
error. It's not appropriate and triggers too much unnecessary print.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: fix setting of MAC address
Steve Yang [Fri, 4 Sep 2020 07:29:05 +0000 (07:29 +0000)]
net/iavf: fix setting of MAC address

When setting the MAC address, the ethdev layer copies the new mac
address in dev->data->mac_addrs[0] before calling the dev_ops.

Therefore, is_same_ether_addr(mac_addr, dev->data->mac_addrs) was
always true, and the MAC was never set. Remove this test to fix the
issue.

Fixes: 538da7a1cad2 ("net: add rte prefix to ether functions")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: fix port start during configuration restore
Steve Yang [Fri, 4 Sep 2020 07:29:04 +0000 (07:29 +0000)]
net/iavf: fix port start during configuration restore

If configuring VF promiscuous mode is not supported,
return -ENOTSUP error code in .promiscuous_enable/disable dev_ops.
This is to fix the port start during configuration restore,
where if .promiscuous_enable/disable dev_ops exists
and return any value other than -ENOTSUP, start will fail.

Same is done for .allmulticast_enable/disable dev_ops.

Fixes: ca041cd44fcc ("ethdev: change allmulticast callbacks to return status")
Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: fix scattered Rx enabling
Steve Yang [Fri, 4 Sep 2020 07:29:02 +0000 (07:29 +0000)]
net/iavf: fix scattered Rx enabling

No need to add additional vlan tag size for max packet size,
the queue's Rx Max Frame Size (rxq->max_pkt_len) already
includes the vlan header size in iavf.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/i40e: fix link status
Guinan Sun [Fri, 4 Sep 2020 06:21:54 +0000 (06:21 +0000)]
net/i40e: fix link status

If the PF driver supports the new speed reporting capabilities
then use link_event_adv instead of link_event to get the speed.

Fixes: 2a73125b7041 ("i40evf: fix link info update")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Jiaqi Min <jiaqix.min@intel.com>
4 years agonet/ice: return unknown speed in status
Ivan Dyukov [Tue, 11 Aug 2020 08:52:25 +0000 (11:52 +0300)]
net/ice: return unknown speed in status

rte_ethdev has declared new NUM_UNKNOWN speed which
could be used in case when no speed information is available and
link is up. NUM_NONE should be returned, if link is down.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/i40e: return unknown speed in status
Ivan Dyukov [Tue, 11 Aug 2020 08:52:24 +0000 (11:52 +0300)]
net/i40e: return unknown speed in status

rte_ethdev has declared new NUM_UNKNOWN speed which
could be used in case when no speed information is available and
link is up. NUM_NONE should be returned, if link is down.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/ixgbe: return unknown speed in status
Ivan Dyukov [Tue, 11 Aug 2020 08:52:23 +0000 (11:52 +0300)]
net/ixgbe: return unknown speed in status

rte_ethdev has declared new NUM_UNKNOWN speed which
could be used in case when no speed information is available

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
4 years agoethdev: allow unknown link speed
Thomas Monjalon [Tue, 11 Aug 2020 08:52:20 +0000 (11:52 +0300)]
ethdev: allow unknown link speed

When querying the link information, the link status is
a mandatory major information.
Other boolean values are supposed to be accurate:
- duplex mode (half/full)
- negotiation (auto/fixed)

This API update is making explicit that the link speed information
is optional.
The value ETH_SPEED_NUM_NONE (0) was already part of the API.
The value ETH_SPEED_NUM_UNKNOWN (infinite) is added to cover
two different cases:
- speed is not known by the driver
- device is virtual

Suggested-by: Morten Brørup <mb@smartsharesystems.com>
Suggested-by: Benoit Ganne <bganne@cisco.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/hns3: fix some incomplete command structures
Huisong Li [Tue, 25 Aug 2020 11:53:05 +0000 (19:53 +0800)]
net/hns3: fix some incomplete command structures

The descriptor of the command between firmware and driver consists of
8-byte header and 24-byte data field. The contents sent to firmware are
packaged into a command structure as the data field of command
descriptor.

There are some command structures in hns3_dcb.h file that are less than
24 byte. So this patch fixes these incomplete command structures.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix default MAC address from firmware
Huisong Li [Tue, 25 Aug 2020 11:53:03 +0000 (19:53 +0800)]
net/hns3: fix default MAC address from firmware

Currently, default MAC address obtained from firmware in PF driver is
directly used by .mac_addr_set ops implementation function when the
rte_eth_dev_start API function is executed. At this moment, if the
default MAC addr isn't an unicast address, it will fail to set default
MAC addr to hardware.

So this patch adds the validity check of default MAC addr in PF driver.
We will use a random unicast address, if the default MAC address
obtained from firmware is not a valid unicast address.

In addition, this patch also adjusts the location of processing default
MAC addr in VF driver so as to increase relevance and readability of the
code.

Fixes: eab21776717e ("net/hns3: support setting VF MAC address by PF driver")
Fixes: d51867db65c1 ("net/hns3: add initialization")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
4 years agonet/hns3: replace max private macro
Huisong Li [Tue, 25 Aug 2020 11:53:01 +0000 (19:53 +0800)]
net/hns3: replace max private macro

This patch uses RTE_MAX function in DPDK lib to replace the private
macro named max_t in driver.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: support maximum 256 flow director counter
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:53:00 +0000 (19:53 +0800)]
net/hns3: support maximum 256 flow director counter

The FDIR counter was used to count the number of FDIR hit, the maximum
number of the counter is 128 based on kunpeng 920, and it was 256 based
on kunpeng 930.

The firmware is responsible to allocate counters for different PF
devices, so the available counter number of one PF may be bigger than
128.

Currently, there are two places using the counter in driver:
1. Configure the counter. Driver uses the command whose opcode is
   HNS3_OPC_FD_AD_OP, now we extend one bit to hold the high bit of
   counter-id in the command format.
2. Query the statistic information of the counter. Driver uses the
   command whose opcode is HNS3_OPC_FD_COUNTER_OP, now the command
   already support 16-bit counter-id.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: add more hardware error types
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:52:59 +0000 (19:52 +0800)]
net/hns3: add more hardware error types

The new firmware adds the hardware error types reported by MSI-x mode.

These errors are defined as RAS errors in hardware and belong to a
different type from the MSI-x errors processed by the driver.

When hardware detects an error which must be handled by the driver for
device to run properly it reports the error information through the
MSI-x interrupt. After receiving the interrupt reported by the hardware,
the driver queries the error information and identifies the error level,
then rectifies the error. All errors will be logged.
In addition, the hardware may be reset at the function or global level
based on the error level. After the reset is complete, the hardware will
recover to the normal status.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: add Tx short frame padding compatibility
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:52:58 +0000 (19:52 +0800)]
net/hns3: add Tx short frame padding compatibility

There are difference about padding ultra-short frame in Tx procession
for different versions of hardware network engine.

If packet length is less than minimum packet length supported by
hardware in Tx direction, driver need to pad it to avoid error. The
minimum packet length in Tx direction is 33 based on kunpeng 920, and 9
based on kunpeng 930.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
4 years agonet/hns3: add Rx interrupts compatibility
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:52:57 +0000 (19:52 +0800)]
net/hns3: add Rx interrupts compatibility

There are difference about queue's interrupt configurations for
different versions of hardware network engine, such as queue's interrupt
mapping mode, coalesce configuration, etc.

The following uses the configuration differences of the interrupt
mapping mode as an example.
1) For some versions of hardware network engine, such as kunpeng 920,
   because of the hardware constraint, we need implement unmmapping
   relationship configurations by binding all queues to the last
   interrupt vector and reserving the last interrupt vector. This
   results in a decrease of the maximum queues when upper applications
   call the rte_eth_dev_configure API function to enable Rx interrupt.
2) And for another versions, such as kunpeng 930, hns3 PMD driver can
   map/unmmap all interrupt vectors with queues when Rx interrupt is
   enabled.

This patch resolves configuration differences about Rx interrupts based
on kunpeng 920 and kunpeng 930.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: get device specifications from firmware
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:52:56 +0000 (19:52 +0800)]
net/hns3: get device specifications from firmware

This patch adds getting PF/VF device specifications from firmware.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
4 years agonet/hns3: get device capability from firmware
Wei Hu (Xavier) [Tue, 25 Aug 2020 11:52:55 +0000 (19:52 +0800)]
net/hns3: get device capability from firmware

This patch adds getting device capabilities from firmware, so driver can
supply different capabilities and specifications to upper level
applications base on different versions of hardware network engine.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agobus/dpaa: remove logically dead code
Yunjian Wang [Mon, 24 Aug 2020 13:02:39 +0000 (21:02 +0800)]
bus/dpaa: remove logically dead code

This patch removes logically dead code reported by coverity.

Coverity issue: 349930
Fixes: b9c94167904f ("bus/dpaa: decouple FQ portal alloc and init")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/iavf: fix mismatch command
Junyu Jiang [Tue, 1 Sep 2020 08:14:36 +0000 (08:14 +0000)]
net/iavf: fix mismatch command

The "command mismatch" warning shouldn't be triggered by
VIRTCHNL_OP_EVENT opcode, because the VIRTCHNL_OP_EVENT
opcode is used by PF notifies status change events to VF.
This patch fixed the issue.

Fixes: 837c2ed86e4c ("net/iavf: return error if opcode is mismatched")
Cc: stable@dpdk.org
Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/i40e: support link status event in VF
Steve Yang [Thu, 3 Sep 2020 07:19:12 +0000 (07:19 +0000)]
net/i40e: support link status event in VF

When PF event VIRTCHNL_EVENT_LINK_CHANGE received, i40evf need update
the link status and issue RTE_ETH_EVENT_INTR_LSC via rte ether device
callback function.

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/bnxt: fix speed setting on certain adapters
Kalesh AP [Fri, 28 Aug 2020 05:01:12 +0000 (10:31 +0530)]
net/bnxt: fix speed setting on certain adapters

On BCM957508-N2100 adapters, FW will not allow any user other
than BMC to shutdown the port. As a result, bnxt_get_hwrm_link_config()
always returns link up.

Because of this, driver will not update the new port configurations
such as speed, autoneg during a port start.

Fixed the condition to invoke bnxt_set_hwrm_link_config() in
bnxt_init_chip().

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix L2 filter allocation
Kalesh AP [Fri, 28 Aug 2020 05:01:11 +0000 (10:31 +0530)]
net/bnxt: fix L2 filter allocation

DPDK does not support RoCE and XDP. The driver should set the
bit 5:4 of the flag to 1 and set bit 6 of the flag in the
HWRM_CFA_L2_FILTER_ALLOC command to disable RoCE and XDP features.

This change will greatly reduce the CFA resource consumption.

Fixes: f92735db1e4c ("net/bnxt: add L2 filter alloc/init/free")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix crash in vector mode Tx
Kalesh AP [Fri, 28 Aug 2020 05:01:10 +0000 (10:31 +0530)]
net/bnxt: fix crash in vector mode Tx

rte_pktmbuf_prefree_seg() can return NULL if the mbuf still
has remaining references on it.

Adding a NULL check to prevent segfault.

Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode")
Fixes: 398358341419 ("net/bnxt: support NEON")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix structure variable initialization
Kalesh AP [Fri, 28 Aug 2020 05:01:09 +0000 (10:31 +0530)]
net/bnxt: fix structure variable initialization

During port start if bnxt_alloc_all_hwrm_stat_ctxs() fails,
in the cleanup path we do see errors like below:

bnxt_hwrm_ring_free(): hwrm_ring_free cp failed. rc:2
bnxt_hwrm_ring_free(): hwrm_ring_free rx failed. rc:2

The reason for this is in bnxt_free_all_hwrm_rings(), the check
is made against "ring->fw_ring_id != INVALID_HW_RING_ID" which
always return true as ring->fw_ring_id is not set to INVALID_HW_RING_ID
while initialising the ring structs.

Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix LRO configuration
Venkat Duvvuru [Fri, 28 Aug 2020 05:01:08 +0000 (10:31 +0530)]
net/bnxt: fix LRO configuration

The maximum number of TCP segments that can be aggregated & the
maximum number of aggregations the VNIC supports are configured
incorrectly during LRO configuration.

This patch fixes these values.

Fixes: b150a7e7ee66 ("net/bnxt: support LRO on Thor adapters")
Cc: stable@dpdk.org
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix endianness while setting L4 destination port
Kalesh AP [Fri, 28 Aug 2020 05:01:07 +0000 (10:31 +0530)]
net/bnxt: fix endianness while setting L4 destination port

Use "req.tunnel_dst_port_val" in bnxt_hwrm_tunnel_dst_port_alloc()
as big endian since hwrm spec mandates this field in network byte order.

Also, fixed the endianness while parsing the command output.

Fixes: 10d074b2022d ("net/bnxt: support tunneling")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix VF representor port add
Venkat Duvvuru [Wed, 29 Jul 2020 14:04:59 +0000 (19:34 +0530)]
net/bnxt: fix VF representor port add

Fix VF representor port add when it's endpoint interface is down.
While adding vf representor port to a bridge, vnic & svif information of
vf representors endpoint(VF) would be needed to program default flow
rules.
However, if the endpoint interface is down when vf representor port is
added, firmware will return invalid vnic & svif information.

This patch fixes the problem by registering to DEFAULT_VNIC_CHANGE
async event and once the async event is received, use the endpoint
information(VF's fid) to fetch it's vnic & svif information and
program the default flow rules.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: cleanup and check ULP context allocation
Somnath Kotur [Wed, 29 Jul 2020 14:04:58 +0000 (19:34 +0530)]
net/bnxt: cleanup and check ULP context allocation

Set ulp_ctx explicitly to NULL in ulp_ctx_deinit() so that representor
init is aborted if parent ulp context is not initialized.
Also check for the same before creation of port default rules.
Additional checks added in VF rep dev ops for proper parent dev
initialization, to avoid null pointer dereference.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Fixes: 313ac35ac701 ("net/bnxt: support ULP session manager init")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: lookup default action record PARIF
Kishore Padmanabha [Wed, 29 Jul 2020 14:04:57 +0000 (19:34 +0530)]
net/bnxt: lookup default action record PARIF

The lookup default action record parif table is updated to catch
the miss path for the entries in the exact match table.
PARIF is handler to a partition of the physical port. The lookup
parif table contains entries for each incoming interface the default
action for the miss entries that do not match the configured rules in
the exact match table. This fix configures those entries in that table.

Fixes: fe82f3e02701 ("net/bnxt: support exact match templates")
Cc: stable@dpdk.org
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: configure loopback PARIF for egress flows
Kishore Padmanabha [Wed, 29 Jul 2020 14:04:56 +0000 (19:34 +0530)]
net/bnxt: configure loopback PARIF for egress flows

Configure loopback parif for full offload egress flows.
PARIF is handler to a partition of the physical port.
The full offload egress flows for the VF rep interface must
use loopback parif to offload missed flows. The miss
flow path for the VF rep interface has to be loopback interface
parif entry and for the non-VF rep interface it has to be the
interface's parif entry.

Fixes: fe82f3e02701 ("net/bnxt: support exact match templates")
Cc: stable@dpdk.org
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: remove redundant null check
Gaurav Singh [Thu, 6 Aug 2020 03:52:13 +0000 (23:52 -0400)]
net/bnxt: remove redundant null check

In bnxt_validate_and_parse_flow_type
vxlan_spec cannot be NULL since its already being accessed
before. Remove the redundant NULL check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add memory allocation check in VF info init
Yunjian Wang [Fri, 31 Jul 2020 12:09:06 +0000 (20:09 +0800)]
net/bnxt: add memory allocation check in VF info init

The function rte_malloc() could return NULL, the return
value need to be checked.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix memory leak when freeing VF info
Yunjian Wang [Fri, 31 Jul 2020 12:08:55 +0000 (20:08 +0800)]
net/bnxt: fix memory leak when freeing VF info

When freeing a vf_info, we should free the 'vlan_as_table'
and 'vlan_table' for the vf_info.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/af_xdp: change return value from Rx to unsigned
Ciara Loftus [Fri, 7 Aug 2020 09:32:48 +0000 (09:32 +0000)]
net/af_xdp: change return value from Rx to unsigned

The af_xdp rx function was returning a negative value on error, when an
unsigned value is expected. Fix this.

Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
Cc: stable@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/fm10k: use inclusive engineering terminology
Yuying Zhang [Wed, 26 Aug 2020 07:45:21 +0000 (07:45 +0000)]
net/fm10k: use inclusive engineering terminology

Offensive terms should be replaced with more inclusive engineering
terms.
Deprecated terms include "master/slave" and "blacklist/whitelist".

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: fix flow director GTPU rule creation
Wei Zhao [Mon, 31 Aug 2020 06:58:17 +0000 (14:58 +0800)]
net/ice: fix flow director GTPU rule creation

For GTPU rule without extend header the training packet
for FDIR is different. This patch enable these case.

Fixes: 934fd00c9389 ("net/ice/base: fix GTPU IP hash")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Zhimin Huang <zhiminx.huang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: fix hash parser
Jeff Guo [Mon, 31 Aug 2020 05:50:45 +0000 (13:50 +0800)]
net/ice: fix hash parser

GTPU TEID hash should only be enabled when ETH_RSS_GTPU is required.
And the hash parser should not restrict the combined usage of protocol.

Fixes: e7cc68c70736 ("net/ice: fix GTPU TEID hash")
Cc: stable@dpdk.org
Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: update ice production information
Haiyue Wang [Wed, 26 Aug 2020 00:55:51 +0000 (08:55 +0800)]
doc: update ice production information

The E810 (ice) has been shipping to customers, not just for evaluation
any more.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: support auxiliary IP offset Rx descriptor
Junfeng Guo [Wed, 26 Aug 2020 03:21:41 +0000 (11:21 +0800)]
net/ice: support auxiliary IP offset Rx descriptor

Add RXDID #25 to support Auxiliary IP Offset Rx descriptor, including
FlexiMD.4: Outer/Single IPv4 Header offset
FlexiMD.5: Outer/Single IPv6 Header offset
And parse the valid IP Offset into mbuf by flexible descriptor
section via devargs "proto_xtr" with "proto_xtr=ip_offset".

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
4 years agocommon/iavf: mark internal symbols
Haiyue Wang [Fri, 14 Aug 2020 16:30:55 +0000 (00:30 +0800)]
common/iavf: mark internal symbols

According to ABI policy, the internal functions should have the new tag
__rte_internal and linked into INTERNAL sessions.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ice: fix VF index check for DCF
Wei Zhao [Thu, 13 Aug 2020 02:14:41 +0000 (10:14 +0800)]
net/ice: fix VF index check for DCF

The vf index in rte_flow command need to check in order that not larger
than actual vf number. Also change some error log for wrong action.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Nannan Lu <nannan.lu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/i40e/base: update version
Guinan Sun [Mon, 27 Jul 2020 05:34:51 +0000 (05:34 +0000)]
net/i40e/base: update version

Update base code version in readme.

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: replace AQ command for NVM update
Guinan Sun [Mon, 27 Jul 2020 05:34:50 +0000 (05:34 +0000)]
net/i40e/base: replace AQ command for NVM update

Add AQ command "NVM update in process"
to replace the original AQ command "NVM progress".

Signed-off-by: Jaroslaw Ilgiewicz <jaroslaw.ilgiewicz@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: support disabling unused ports
Guinan Sun [Mon, 27 Jul 2020 05:34:49 +0000 (05:34 +0000)]
net/i40e/base: support disabling unused ports

This patch adds support for disabling unused ports.

Signed-off-by: Damian Milosek <damian.milosek@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: fix possible uninitialized variable
Guinan Sun [Mon, 27 Jul 2020 05:34:48 +0000 (05:34 +0000)]
net/i40e/base: fix possible uninitialized variable

Fix possible uninitialized variable in i40e in the i40e_get_lpi_counters
function.

Fixes: 429bdc0cd967 ("net/i40e/base: add function to read LPI counters")
Cc: stable@dpdk.org
Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: update FW API version to 1.11
Guinan Sun [Mon, 27 Jul 2020 05:34:47 +0000 (05:34 +0000)]
net/i40e/base: update FW API version to 1.11

Upcoming FW increment API version to 1.11 due to new bit and new
fields in the Replace Cloud Filters AQ command.

Signed-off-by: Jacek Naczyk <jacek.naczyk@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: add custom cloud filter types
Guinan Sun [Mon, 27 Jul 2020 05:34:46 +0000 (05:34 +0000)]
net/i40e/base: add custom cloud filter types

This patch adds the new filter types needed for custom cloud filters.
These custom cloud filters will route traffic to VFs based on the
dst IP for both tunneled and non-tunneled packets.

Signed-off-by: Harshitha Ramamurthy <harshitha.ramamurthy@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: add aborted packet type definition
Guinan Sun [Mon, 27 Jul 2020 05:34:45 +0000 (05:34 +0000)]
net/i40e/base: add aborted packet type definition

Add I40E_RX_PTYPE_PARSER_ABORTED definition, so i40e driver will know
opcode for parser aborted packets.
Without this definition driver would have to rely on magic numbers.

Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/i40e/base: enable FEC on/off flag setting for X722
Guinan Sun [Mon, 27 Jul 2020 05:34:44 +0000 (05:34 +0000)]
net/i40e/base: enable FEC on/off flag setting for X722

Starting with API version 1.10 firmware for X722 devices has ability
to change FEC settings in PHY. Code added in this patch
checks API version and sets appropriate capability flag.

Signed-off-by: Dawid Lukwinski <dawid.lukwinski@intel.com>
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/ice: optimize FlexiMD hardware check
Haiyue Wang [Wed, 12 Aug 2020 00:57:53 +0000 (08:57 +0800)]
net/ice: optimize FlexiMD hardware check

The Flexible Metadata #4 and #5 in the Rx Flex Descriptor are defined to
extract the protocol specified fields or its offset. Its function relays
on the DDP package support in hardware.

Optimize to only check the hardware support when the user specifies the
'proto_xtr' devargs. And not require all the types need to be support in
hardware, otherwise if new protocol extraction type is introduced, it is
hard to maintain the compatibility. Just check the type support in need.

And the protocol IDs are 8 bits length, so the uint8_t is the right type
to be used. Also introduce the 'opcode' variable to specify the metadata
extraction type: it can be protocol fields or offset report.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: release port upon close
Steve Yang [Tue, 11 Aug 2020 07:27:52 +0000 (07:27 +0000)]
net/iavf: release port upon close

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

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support multicast configuration
Wei Zhao [Mon, 13 Jul 2020 07:48:11 +0000 (15:48 +0800)]
net/iavf: support multicast configuration

This patch enable add multicast address for iavf.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/mlx5/linux: refactor VLAN
Ophir Munk [Tue, 25 Aug 2020 09:31:16 +0000 (09:31 +0000)]
net/mlx5/linux: refactor VLAN

File mlx5_vlan.c contains Netlink APIs (Linux dependent) as part of VM
workaround implementation. Move this implementation to file
linux/mlx5_vlan_os.c.  To remove Netlink dependency in header files
change pointer of type 'struct mlx5_nl_vlan_vmwa_context *' to 'void *'.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: separate VLAN strip modification
Ophir Munk [Tue, 25 Aug 2020 09:31:15 +0000 (09:31 +0000)]
net/mlx5: separate VLAN strip modification

When updating a queue vlan stripping offload - either the WQ is modified
in Verbs or the RQ is modified in DevX.  Add a vlan stripping modify
callback to 'struct mlx5_obj_ops' and assign it with the specific Verbs
and DevX implementations: 'rxq_obj_modify_wq_vlan_strip' and
'rxq_obj_modify_rq_vlan_strip' respectively.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: remove Verbs dependency in Rx/Tx objects
Ophir Munk [Tue, 25 Aug 2020 09:31:14 +0000 (09:31 +0000)]
net/mlx5: remove Verbs dependency in Rx/Tx objects

Replace pointers to ibv structs with pointers to void (file
mlx5_rxtx.h).  Specifically the following pointers were replaced:
'struct ibv_cq *', 'struct ibv_wq *', 'struct ibv_comp_channel *',
'struct ibv_rwq_ind_table *a', 'struct ibv_qp *'.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: remove more Direct Verbs dependencies
Ophir Munk [Tue, 25 Aug 2020 09:31:13 +0000 (09:31 +0000)]
net/mlx5: remove more Direct Verbs dependencies

Several DV-based structs of type 'struct mlx5dv_devx_XXX' are replaced
with 'void *' to enable compilation under non-Linux operating systems.
New getter functions were added to retrieve the specific fields that
were previously accessed directly.

Replaced structs:
'struct mlx5dv_pp *'
'struct mlx5dv_devx_event_channel *'
'struct mlx5dv_devx_umem *'
'struct mlx5dv_devx_uar *'

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: call meter detach only if DR is supported
Ophir Munk [Tue, 25 Aug 2020 09:31:11 +0000 (09:31 +0000)]
net/mlx5: call meter detach only if DR is supported

Flow metering is supported only in direct rules (DR). Currently the APIs
of meter actions create and modify are under #ifdef
HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER, while detaching the meter action
is executed unconditionally. This commit adds the same ifdef to API
mlx5_flow_meter_detach().
This commit avoids compilation failure of non-Linux operating systems
which do not support DR.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: remove unused log macros
Ophir Munk [Tue, 25 Aug 2020 09:31:10 +0000 (09:31 +0000)]
net/mlx5: remove unused log macros

Remove utility macros INFO, WARN, ERROR. They are not in use and
conflict with identical definitions when compiled under Windows.

Fixes: 80f2d0ed7ff9 ("net/mlx5: add hardware flow debug dump")
Cc: stable@dpdk.org
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: remove netlink dependency in shared code
Ophir Munk [Tue, 25 Aug 2020 09:31:09 +0000 (09:31 +0000)]
net/mlx5: remove netlink dependency in shared code

This commit adds Linux implementation of routine mlx5_os_mac_addr_flush
as wrapper to Netlink API to avoid direct calls under non-Linux
operating systems.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: remove unused includes
Ophir Munk [Tue, 25 Aug 2020 09:31:08 +0000 (09:31 +0000)]
net/mlx5: remove unused includes

Remove unused Linux included files:

<sys/ioctl.h>, <arpa/inet.h> from file net/mlx5/mlx5_mac.c
<sys/mman.h> from file net/mlx5/mlx5.c

Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters")
Cc: stable@dpdk.org
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: move Linux ifname function
Ophir Munk [Tue, 25 Aug 2020 09:31:07 +0000 (09:31 +0000)]
net/mlx5: move Linux ifname function

mlx5_get_ifname() prototype includes 'IF_NAMESIZE' definition from Linux
file net/if.h. Since this API is only used under Linux and to enable
compilation under non-Linux OS - move this prototype from shared file
mlx5.h to file linux/mlx5_os.h.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: rename constant conflicting with Windows
Ophir Munk [Tue, 25 Aug 2020 09:31:06 +0000 (09:31 +0000)]
net/mlx5: rename constant conflicting with Windows

Enumerated variable REG_NONE (defined in mlx5_prm.h) is in conflict with
Windows definition (winnt.h): #define REG_NONE ( 0ul ) // No value type
To enable mlx5 PMD Windows compilation - rename REG_NONE as REG_NON.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: use common endian types
Ophir Munk [Tue, 25 Aug 2020 09:31:05 +0000 (09:31 +0000)]
common/mlx5: use common endian types

Replace Linux specific int types with their corresponding DPDK typedefs.
__be16 ==> rte_be16_t
__be32 ==> rte_be32_t
__be64 ==> rte_be64_t

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: replace strsep with strtok_r
Ophir Munk [Tue, 25 Aug 2020 09:31:04 +0000 (09:31 +0000)]
common/mlx5: replace strsep with strtok_r

strsep() is a non-standardized API (by C or POSIX) and thus it is
non-portable between different operating systems. Replace it with
strtok_r() which is standardized by the C standard, and hence also by
POSIX.
The replacement occurs in the code that extracts individual PCI class
names (e.g. class=net:vdpa:foo:bar).

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/tap: avoid using SIGIO
Stephen Hemminger [Tue, 14 Jul 2020 23:58:10 +0000 (16:58 -0700)]
net/tap: avoid using SIGIO

SIGIO maybe used by application, instead choose another rt-signal.
Linux allows any signal to be used for signal based IO.
Search for an unused signal in the available rt-signal range.

Add more error checking for fcntl and signal handling.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet: optimize ethernet address functions
Morten Brørup [Fri, 26 Jun 2020 16:51:35 +0000 (18:51 +0200)]
net: optimize ethernet address functions

* rte_is_broadcast_ether_addr():
Use binary logic instead of comparisons and boolean logic, thus reducing
the number of branches.
It now resembles rte_is_zero_ether_addr().

* rte_ether_addr_copy():
The source code modifications were discussed on the mailing list:
http://mails.dpdk.org/archives/dev/2020-June/171584.html
Remove obsolete ICC-specific code and related comment.
Restrict pointer aliasing (suggested by Jerin Jacob).
Remove superfluous "Fast" from function description headline; all DPDK
data plane functions are supposed to be fast.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
4 years agonet/hinic: fix negative array index read
Yunjian Wang [Mon, 24 Aug 2020 12:43:46 +0000 (20:43 +0800)]
net/hinic: fix negative array index read

Negative array index read using variable 'i' as an index to array
'filter_info->pkt_filters'. Fixed by add return value check.

Coverity issue: 350364
Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: check if queue setup when getting queue info
Wei Hu (Xavier) [Mon, 24 Aug 2020 11:01:30 +0000 (19:01 +0800)]
ethdev: check if queue setup when getting queue info

This patch adds checking whether the related Tx or Rx queue has been
setup in the rte_eth_rx_queue_info_get and rte_eth_tx_queue_info_get
API function to avoid illegal address access.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/hns3: support getting queue information
Huisong Li [Mon, 24 Aug 2020 11:01:29 +0000 (19:01 +0800)]
net/hns3: support getting queue information

This patch adds support for querying Rx/Tx queue information.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: report Rx drop packets enable configuration
Wei Hu (Xavier) [Mon, 24 Aug 2020 11:01:28 +0000 (19:01 +0800)]
net/hns3: report Rx drop packets enable configuration

Currently, if there are not available Rx buffer descriptors in receiving
direction based on hns3 network engine, incoming packets will always be
dropped by hardware. This patch reports the '.rx_drop_en' information to
DPDK framework in the '.dev_infos_get', '.rxq_info_get' and
'.rx_queue_setup' ops implementation function.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/mlx5: manage modify actions with hashed list
Suanming Mou [Fri, 31 Jul 2020 03:34:18 +0000 (11:34 +0800)]
net/mlx5: manage modify actions with hashed list

To manage header modify actions mlx5 PMD used the single linked list and
lookup and insertion operations took too long times if there were
millions of objects and this impacted the flow insertion/deletion rate.

In order to optimize the performance the hashed list is engaged. The
list implementation is updated to support non-unique keys with few
collisions.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add hash list extended lookup and insert
Suanming Mou [Fri, 31 Jul 2020 03:34:17 +0000 (11:34 +0800)]
net/mlx5: add hash list extended lookup and insert

The mlx5 PMD hashed list was designed in approach to contain the items
with unique keys only. Now there is the need to store the objects with
possible key collisions. It is not expected to have many collisions
(very likely to have a few ones), but keys become not unique.

This commit adds the hash list extended functions in order to support
insertion and lookup for the lists with non-unique keys.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/netvsc: check for overflow on packet info from host
Stephen Hemminger [Tue, 11 Aug 2020 02:33:14 +0000 (19:33 -0700)]
net/netvsc: check for overflow on packet info from host

The data from the host is trusted but checked by the driver.
One check that is missing is that the packet offset and length
might cause wraparound.

Cc: stable@dpdk.org
Reported-by: Nan Chen <whutchennan@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Long Li <longli@microsoft.com>
4 years agonet/netvsc: fix stale value after free
Long Li [Tue, 11 Aug 2020 02:33:13 +0000 (19:33 -0700)]
net/netvsc: fix stale value after free

chim_index could potentially be used in other hn_txdesc when re-allocated.
Mark it as invalid to prevent stale value being used.

Fixes: cc0251813277 ("net/netvsc: split send buffers from Tx descriptors")
Cc: stable@dpdk.org
Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agobus/vmbus: remove sending interrupts via INT bit
Long Li [Tue, 11 Aug 2020 02:33:12 +0000 (19:33 -0700)]
bus/vmbus: remove sending interrupts via INT bit

netvsc is a high speed VMBus device that uses monitor bit to signal the
host. It's not necessary to send interrupts via INT bit.

Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/netvsc: fix multiple channel Rx
Long Li [Tue, 11 Aug 2020 02:33:11 +0000 (19:33 -0700)]
net/netvsc: fix multiple channel Rx

netvsc uses rxbuf_info buffer to track received packets attached via
rte_pktmbuf_attach_extbuf() and ack the host based on usage count. It
uses the transaction_id in the VMBus packet to locate where to use
memory in the rxbuf_info.

This is not correct in multiple channel setup, as different channels may
return identical transaction_ids at a time, and may corrupt the
rxbuf_info buffer.

Fix this by defining rxbuf_info for each queue.

Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/failsafe: fix double space in warning log
Stephen Hemminger [Fri, 14 Aug 2020 17:39:33 +0000 (10:39 -0700)]
net/failsafe: fix double space in warning log

Already get a newline from WARN() macro call.

Fixes: 9dda3e3393c2 ("net/failsafe: add timestamp to stats snapshot")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <grive@u256.net>