dpdk.git
4 years agonet/bnxt: support for QinQ insertion and stripping
Somnath Kotur [Wed, 2 Oct 2019 17:17:44 +0000 (10:17 -0700)]
net/bnxt: support for QinQ insertion and stripping

Driver will accelerate only outer/S-VLAN insertion by turning on
the appropriate bits in the Tx Buffer Descriptor when the packet
arrives for transmission.
The TPID to be used for this S-VLAN is conveyed by the vlan_tpid_set
dev_op which will terminate in the driver.
In the Rx path, driver will continue providing the stripped vlan tag
in the mbuf's vlan tci field. This would be the outermost vlan tag
in a double-tagged packet or the vlan tag for a single vlan tagged pkt.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix crash in secondary process
Stephen Hemminger [Wed, 2 Oct 2019 17:17:43 +0000 (10:17 -0700)]
net/bnxt: fix crash in secondary process

The secondary process should not modify device state when
init is called. The pci device information pointed to by
dev_private pointer is not correct in secondary process.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix Rx queue count
Rahul Gupta [Wed, 2 Oct 2019 17:17:42 +0000 (10:17 -0700)]
net/bnxt: fix Rx queue count

Fix Computing of number of used descriptors in an Rx queue.

Fixes: 1b7ceba3e375 ("net/bnxt: support Rx queue count")
Cc: stable@dpdk.org
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: fix accessing variable before null check
Kalesh AP [Wed, 2 Oct 2019 17:17:41 +0000 (10:17 -0700)]
net/bnxt: fix accessing variable before null check

Check input argument "rxq" in bnxt_rx_queue_release_mbufs(), to be sure
variable is not NULL before accessing it.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
4 years agonet/bnxt: remove unnecessary interrupt disable
Kalesh AP [Wed, 2 Oct 2019 17:17:40 +0000 (10:17 -0700)]
net/bnxt: remove unnecessary interrupt disable

Since bnxt_enable_int() is called at start time,
invoke bnxt_disable_int() during stop only.
Remove it from device uninit function.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: remove unused macro
Kalesh AP [Wed, 2 Oct 2019 17:17:39 +0000 (10:17 -0700)]
net/bnxt: remove unused macro

remove MAX_NUM_MAC_ADDR macro

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: remove unnecessary return check
Kalesh AP [Wed, 2 Oct 2019 17:17:38 +0000 (10:17 -0700)]
net/bnxt: remove unnecessary return check

HWRM_CHECK_RESULT_SILENT() returns if the HWRM command fails.
There is no need to check the return value after this call.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: fix deferred start of Tx queues
Kalesh AP [Wed, 2 Oct 2019 17:17:37 +0000 (10:17 -0700)]
net/bnxt: fix deferred start of Tx queues

Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: fix L2 context calculation for Thor
Kalesh AP [Wed, 2 Oct 2019 17:17:36 +0000 (10:17 -0700)]
net/bnxt: fix L2 context calculation for Thor

On Wh+, number of L2 context supported by FW is the sum of number of
EM flow count and number of L2 context count returned in HWRM_FUNC_QCFG.
This is not true for Thor. Restrict this only for Whitney for now.

Fixes: ff9c0ca47e81 ("net/bnxt: save the number of EM flow count")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: fix 40G link for Thor
Santoshkumar Karanappa Rastapur [Wed, 2 Oct 2019 17:17:35 +0000 (10:17 -0700)]
net/bnxt: fix 40G link for Thor

Link auto negotiation for 40G is not supported by Thor.
Hence speed needs to be forced and autoneg disabled to configure 40G
speed.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix async link handling and update
Ajit Khaparde [Wed, 2 Oct 2019 17:17:34 +0000 (10:17 -0700)]
net/bnxt: fix async link handling and update

When updating the link because of an async link notification
there is no need to set wait_for_completion. At this point
the link related information should be available without need to poll.
Use rte_eth_linkstatus_set instead of memcpy to ensure atomicity
while updating the link status.
We force the physical link down as a part of device stop.
But we are not waiting there enough and handling the async notification
before exiting. It just sits in the default CQ till we do a device
start.
Fix it by calling the CQ handler in device stop.

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: subscribe to link speed change notification
Ajit Khaparde [Wed, 2 Oct 2019 17:17:33 +0000 (10:17 -0700)]
net/bnxt: subscribe to link speed change notification

We are not subscribing to link speed change notification.
This patch addresses that.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
4 years agonet/bnxt: fix Rx queue start/stop
Kalesh AP [Wed, 2 Oct 2019 17:17:32 +0000 (10:17 -0700)]
net/bnxt: fix Rx queue start/stop

Driver should not change "deferred_start" state of the rx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet receive
functions to determine whether a stopped rx ring should be polled,
introduced a per-rxq flag to track queue stopped/started state.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix forwarding with higher mbuf size
Santoshkumar Karanappa Rastapur [Wed, 2 Oct 2019 17:17:31 +0000 (10:17 -0700)]
net/bnxt: fix forwarding with higher mbuf size

Maximum frame length supported by hw is 9600 bytes.
When user launches testpmd with --mbuf-size=9729,
we are posting buffer descriptors of size 9601 to the ring.
This was causing packets getting discarded.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: fix flow steering
Santoshkumar Karanappa Rastapur [Wed, 2 Oct 2019 17:17:30 +0000 (10:17 -0700)]
net/bnxt: fix flow steering

When user creates a flow similar to an existing flow with just the
destination queue change, we delete the old filter and allocate a new
one with this destination queue change. We were also allocating a new L2
filter matching the same destination mac resulting in 2 L2 filters for the
same destination mac.
This was causing any flow matching the destination mac to be steered to
this queue instead of the default queue.

Fixed it by deleting this stale L2 filter.

Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow")
Cc: stable@dpdk.org
Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@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: enforce IO barrier for doorbell command
Gavin Hu [Mon, 16 Sep 2019 11:27:18 +0000 (19:27 +0800)]
net/bnxt: enforce IO barrier for doorbell command

The doorbell ringing operation requires a rte_io_mb immediately to make
the command complete and visible to the device before reading the
response, otherwise it may read stale or invalid responses.

Fixes: ca241d9a0952 ("net/bnxt: use I/O device memory read/write API")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: replace memory barrier for doorbell response
Gavin Hu [Mon, 16 Sep 2019 11:27:17 +0000 (19:27 +0800)]
net/bnxt: replace memory barrier for doorbell response

To read the doorbell response, which is held in the host CIO memory,
rte_cio_rmb is sufficient.

Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: remove duplicate barrier
Gavin Hu [Mon, 16 Sep 2019 11:27:16 +0000 (19:27 +0800)]
net/bnxt: remove duplicate barrier

As there is an inclusive rte_io_wmb within the following rte_write32()
API who rings the doorbell, this makes the above rte_wmb unnecessary and
remove it.

Fixes: 1cd45aeb3270 ("net/bnxt: support Stratus VF device")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/ice: use relaxed and remove duplicate barrier
Gavin Hu [Mon, 16 Sep 2019 11:27:15 +0000 (19:27 +0800)]
net/ice: use relaxed and remove duplicate barrier

To guarantee the orderings of successive stores to CIO and MMIO memory,
a lighter weight rte_io_wmb [1] can be used instead of rte_wmb, and since
the ICE_PCI_REG_WRITE API already has an inclusive rte_io_wmb, this
explicit call can even be saved.

[1] http://git.dpdk.org/dpdk/tree/lib/librte_eal/common/include/generic/
rte_atomic.h#n98

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/i40e: use relaxed and remove duplicate barrier
Gavin Hu [Mon, 16 Sep 2019 11:27:14 +0000 (19:27 +0800)]
net/i40e: use relaxed and remove duplicate barrier

To guarantee the orderings of successive stores to CIO and MMIO memory,
a lighter weight rte_io_wmb [1] can be used instead of rte_wmb, and since
the I40E_PCI_REG_WRITE API already has an inclusive rte_io_wmb, this
explicit call can be even saved.

[1] http://git.dpdk.org/dpdk/tree/lib/librte_eal/common/include/generic/
rte_atomic.h#n98

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/bnxt: support PTP for Thor
Kalesh AP [Wed, 2 Oct 2019 01:23:35 +0000 (18:23 -0700)]
net/bnxt: support PTP for Thor

On Thor, direct access to PTP registers (via GRC) is not supported.
Driver must use HWRM to access the timestamp information.

Vectorized Rx/Tx cannot be enabled if RTE_LIBRTE_IEEE1588=y.
Remove the PTP flags handling code from the vector Rx path.

Add support to read tx timestamp value and the time from the
timesync clock.

On Thor, Rx timestamps are provided directly in the Rx completion
records to the driver. Only 32 bits of the timestamp is present in
the completion. Driver needs to read the current 48 bit free running
timer using the HWRM_PORT_TS_QUERY command and combine the upper
16 bits from the HWRM response with the lower 32 bits in the
Rx completion to produce the 48 bit timestamp for the Rx packet.

Signed-off-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: use macro for bit definitions
Kalesh AP [Wed, 2 Oct 2019 01:23:34 +0000 (18:23 -0700)]
net/bnxt: use macro for bit definitions

use BIT macro instead of bit fields.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: avoid null pointer dereference
Kalesh AP [Wed, 2 Oct 2019 01:23:33 +0000 (18:23 -0700)]
net/bnxt: avoid null pointer dereference

Commit "bd0a14c99f65" enables the creation of a dedicated completion
ring for asynchronous event handling instead of handling these
events on a receive completion ring on non Stingray Platforms.

This causes a segfault due to NULL pointer dereference in
bnxt_alloc_async_cp_ring() on stingray. Fix this by checking the
pointer validity before accessing it.

Fixes: bd0a14c99f65 ("net/bnxt: use dedicated CPR for async events")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/bnxt: reduce verbosity of logs
Kalesh AP [Wed, 2 Oct 2019 01:23:32 +0000 (18:23 -0700)]
net/bnxt: reduce verbosity of logs

When IOMMU is available, EAL picks IOVA as VA as the default IOVA mode.
This causes the bnxt driver to log warning messages saying
"Memzone physical address same as virtual." and
"Using rte_mem_virt2iova()" during load.

Reduce the verbosity of logs to DEBUG. Reduced couple of other
logs level to DEBUG as well.

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: support hot firmware upgrade for Stingray
Kalesh AP [Wed, 2 Oct 2019 01:23:31 +0000 (18:23 -0700)]
net/bnxt: support hot firmware upgrade for Stingray

FW sets HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD
in HWRM_FUNC_QCAPS command, if device requires to invoke
fastboot FW during FW reset.

Driver has to poll for shutdown bit in fw_status register:
1. in case of hot fw upgrade, this bit will be set after all
   function drivers unregistered with fw.
2. in case of fw initiated error recovery, this bit will be
   set after fw has collected the core dump

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support FW reset
Kalesh AP [Wed, 2 Oct 2019 01:23:30 +0000 (18:23 -0700)]
net/bnxt: support FW reset

Added code to perform FW_RESET. When the driver detects error in FW,
it has to initiate the recovery by resetting the cores. FW advertise
the method to do a core reset, reset register offsets and values
to perform reset in response of HWRM_ERROR_RECOVERY_QCFG command.

There are 2 ways to recover from the error.
1. Master function issues core resets to recover from error.
2. Master function detects chimp dead condition and notify the Kong
   processor about the chimp dead case through FW_RESET HWRM command.
   Kong Processor send an RESET_NOTIFY async event with
   REASON_CODE_FW_EXCEPTION_FATAL to all the PF’s/VF’s that
   chimp is dead and it is going to reset the chimp.

Signed-off-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: support periodic FW health monitoring
Kalesh AP [Wed, 2 Oct 2019 01:23:29 +0000 (18:23 -0700)]
net/bnxt: support periodic FW health monitoring

Periodically poll the FW heartbeat register and FW recovery counter
registers to check the FW health. Polling frequency will be
advertised by the FW in HWRM_ERROR_RECOVERY_QCFG response.
Schedule the task upon receiving the async event from FW.

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: handle error recovery FW event
Kalesh AP [Wed, 2 Oct 2019 01:23:28 +0000 (18:23 -0700)]
net/bnxt: handle error recovery FW event

1. Advertise HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_ERROR_RECOVERY_SUPPORT flag
   in the FUNC_DRV_RGTR command.
2. request for the async event ASYNC_EVENT_CMPL_EVENT_ID_ERROR_RECOVERY
   in the FUNC_DRV_RGTR command.
3. handle the async event EVENT_ID_ERROR_RECOVERY from FW.

Error recovery support will be used by firmware only if all the driver
instances support error recovery process.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: map status registers for FW health monitoring
Kalesh AP [Wed, 2 Oct 2019 01:23:27 +0000 (18:23 -0700)]
net/bnxt: map status registers for FW health monitoring

HWRM_ERROR_RECOVERY_QCFG command returns the FW status registers offset
for periodic firmware health check monitoring. Map them to GRC window 2.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: query firmware error recovery capabilities
Kalesh AP [Wed, 2 Oct 2019 01:23:26 +0000 (18:23 -0700)]
net/bnxt: query firmware error recovery capabilities

In Driver initiated error recovery process, driver has to know about
the registers offset and values to initiate FW reset. The HWRM command
HWRM_ERROR_RECOVERY_QCFG is used to obtain all the registers and values
required to initiate FW reset. This command response includes
FW heart_beat register, health status register, Error counter register,
register offsets and values to do chip reset if firmware crashes and
becomes unresponsive.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: handle fatal event from FW
Kalesh AP [Wed, 2 Oct 2019 01:23:25 +0000 (18:23 -0700)]
net/bnxt: handle fatal event from FW

When firmware hit some unrecoverable error conditions, firmware initiate
the recovery by sending an async event EVENT_CMPL_EVENT_ID_RESET_NOTIFY
with data1 set to RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_EXCEPTION_FATAL
to all host drivers and will reset the chip.

The recovery procedure is same sequence as the one for hot FW upgrade.

Signed-off-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: inform firmware about IF state changes
Kalesh AP [Wed, 2 Oct 2019 01:23:24 +0000 (18:23 -0700)]
net/bnxt: inform firmware about IF state changes

Use latest firmware API to inform firmware about IF state changes.
Firmware has the option to clean up resources during IF down and
to require the driver to reserve resources again during IF up.

During port start, HWRM_FUNC_DRV_IF_CHANGE command response
flags indicates that firmware has reset. Add logic to re-probe
the firmware and re-setup resources.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: handle reset notify async event from FW
Kalesh AP [Wed, 2 Oct 2019 01:23:23 +0000 (18:23 -0700)]
net/bnxt: handle reset notify async event from FW

When the FW upgrade is initiated the current instance
of FW issues a HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY
async notification to the driver. On receiving this notification,
the PMD shall quiesce itself and poll on the HWRM_VER_GET FW
command at regular intervals.

Once the VER_GET command succeeds, the driver should go through
the rediscovery process and re-initialize the device.

Also register with FW for the reset notify async event.

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: prevent device access when device is in reset
Kalesh AP [Wed, 2 Oct 2019 01:23:22 +0000 (18:23 -0700)]
net/bnxt: prevent device access when device is in reset

Refactor init and uninit functions so that the driver can fail
the eth_dev_ops callbacks and accessing Tx and Rx queues
when device is in reset or in error state.

Transmit and receive queues are freed during reset cleanup and
reallocated during recovery. So we block all data path handling
in this state. The eth_dev dev_started field is updated depending
on the status of the device.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: add FW reset HWRM command
Kalesh AP [Wed, 2 Oct 2019 01:23:21 +0000 (18:23 -0700)]
net/bnxt: add FW reset HWRM command

This patch adds new FW reset HWRM command.
Code using this command will be added in future patch.

Signed-off-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/mlx5: check sibling device configurations mismatch
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:35 +0000 (07:53 +0000)]
net/mlx5: check sibling device configurations mismatch

The devices backed by mlx5 PMD might share the same multiport
Infiniband device context. It regards representors and slaves
of bonding device. These ports are spawned with devargs.
These patch check whether configuration deduced from these
devargs is compatible with configurations if devices
sharing the same context. It prevents the incorrect
whitelists, like:

-w 82:00.0,representor=0,dv_flow_en=1
-w 82:00.0,representor=1,dv_flow_en=0

The representors with indices [0-1] are supposed to spawned
over the same PCi device, but there is dv_flow_en parameter
mismatch.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update switch port id in bonding configuration
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:34 +0000 (07:53 +0000)]
net/mlx5: update switch port id in bonding configuration

With bonding configuration multiple PFs may represent the
single switching device with multiple ports as representors.
To distinguish representors belonging to different PFs we
should generated unique port ID. It is proposed to use
the PF index in bonding configuration to generate this
unique port IDs.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: extend switch domain searching range
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:33 +0000 (07:53 +0000)]
net/mlx5: extend switch domain searching range

With bonding configurations the switch domain may be shared
between multiple PCI devices, we should search the switch
sibling devices within the entire set of present ethernet
devices backed by the mlx5 PMD.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update source and destination vport translations
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:32 +0000 (07:53 +0000)]
net/mlx5: update source and destination vport translations

There new kernel/rdma_core [1] supports matching on metadata
register instead of vport field to provide operations over
VF LAG bonding configurations. This patch provides correct
translations for flow matchers and destination port actions
if united E-Switch (for VF LAG) is configured and/or new vport
matching mode is engaged.

[1] http://patchwork.ozlabs.org/cover/1122170/
    "Mellanox, mlx5 vport metadata matching"

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: elaborate E-Switch port parameters query
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:31 +0000 (07:53 +0000)]
net/mlx5: elaborate E-Switch port parameters query

The routine mlx5_port_to_eswitch_info() is elaborated
to two ones (get E-Switch port parameters by port and
by device pointer) and simplified to returning structure
containing all parameters instead of copying.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: query vport index match mode and parameters
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:30 +0000 (07:53 +0000)]
net/mlx5: query vport index match mode and parameters

There new kernel/rdma_core [1] supports matching on metadata
register instead of vport field to provide operations over
VF LAG bonding configurations. The patch retrieves parameters
and information about the way is engaged to match vport on E-Switch.

[1] http://patchwork.ozlabs.org/cover/1122170/
    "Mellanox, mlx5 vport metadata matching"

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: check kernel support for VF LAG bonding
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:29 +0000 (07:53 +0000)]
net/mlx5: check kernel support for VF LAG bonding

If bonding Infiniband device is found the unified E-Switch
is supposed and the extra rdma-core/kernel support is needed
to retrieve vport indices. The patch introduces this feature
defines, bonding support check is added to probe routine.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: generate bonding device name
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:28 +0000 (07:53 +0000)]
net/mlx5: generate bonding device name

If device is VF LAG bonding one the port name includes
the bonding Infiniband device name and looks like:

  82:00.0_mlx5_bond_0 - for master device port PF0
  82:00.1_mlx5_bond_0_representor_5 - for representor
                                           VF5 over PF1

where bonding Infiniband device mlx5_bond_0 controls
the 82:00.0 as PF0 and 82:00.1 as PF1 PCI functions.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add VF LAG mode bonding device recognition
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:27 +0000 (07:53 +0000)]
net/mlx5: add VF LAG mode bonding device recognition

The Mellanox NICs starting from ConnectX-5 support LAG over
NIC ports internally, implemented by the NIC firmware and hardware.
The multiport NIC presents multiple physical PCI functions (PF),
with SR-IOV multiple virtual PCI functions (VFs) might be presented.
With switchdev mode the VF representors are engaged and PFs and their
VFs are connected by internal E-Switch feature. Each PF and related VFs
have dedicated E-Switch and belong to dedicated switch domain.

If NIC ports are combined to support NIC the kernel drivers introduce
the single unified Infiniband multiport devices, and all only one
unified E-Switch with single switch domain combines master PF
all all VFs. No extra DPDK bonding device is needed.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: allocate device list explicitly
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:26 +0000 (07:53 +0000)]
net/mlx5: allocate device list explicitly

At device probing the device list to spawn was allocated
as dynamic size local variable. It was no possible to have
one unified exit point from routine due to compiler warnings.
This patch allocates the spawn device list directly with
rte_zmalloc() and it is possible to goto to unified exit
label from anywhere of the routine.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update PCI address retrieving routine
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:25 +0000 (07:53 +0000)]
net/mlx5: update PCI address retrieving routine

The routine mlx5_ibv_device_to_pci_addr() takes Infiniband
device list object, takes the device sysfs path from there
and retrieves PCI address. The routine may be implemented
in more generic way by taking sysfs path directly as parameter
and can be used for getting PCI address of netdevs.

The generic routine is renamed to mlx5_dev_to_pci_addr()

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: move backing PCI device to private context
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:53:24 +0000 (07:53 +0000)]
net/mlx5: move backing PCI device to private context

Now all devices created over the same multiport IB device
have shared context containing the backing PCI device field.
For the VF LAG configurations it becomes possible the
representors might be connected to VF created over different
PFs. In this case representors have the different backing
PCI devices and mentioned field should be moved to device
private area.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agodoc: remove deprecated flow director from enic guide
John Daley [Thu, 5 Sep 2019 21:33:18 +0000 (14:33 -0700)]
doc: remove deprecated flow director from enic guide

The legacy filter API "flow director" has been superseded by rte_flow
since 2017. Remove comments in the enic guide regarding the deprecated
feature.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/enic: add PCI id for new virtual function
John Daley [Thu, 5 Sep 2019 21:33:17 +0000 (14:33 -0700)]
net/enic: add PCI id for new virtual function

Probe for the PCI ID of a new mode of VF which will be added to VIC
adapter firmware. When fully implemented, the new mode will operate
independent of the Cisco Virtual Machine Fabric Extender (VM-FEX) and
will not need to be provisioned through libvirt. The new mode is dubbed
"Standalone vNic" mode or "SN" mode.

Also, minor formatting changes.

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
4 years agonet/null: fix multi-process Rx and Tx
Yasufumi Ogawa [Sun, 29 Sep 2019 02:41:41 +0000 (11:41 +0900)]
net/null: fix multi-process Rx and Tx

Packet processing in secondary process cannot work because rx_pkt_burst
and tx_pkt_burst in eth_dev are not initialized while probing device.
This patch is to the initialization.

Fixes: ee27edbe0c10 ("drivers/net: share vdev data to secondary process")
Cc: stable@dpdk.org
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: support symmetric Toeplitz hash
Simei Su [Tue, 1 Oct 2019 09:22:13 +0000 (17:22 +0800)]
app/testpmd: support symmetric Toeplitz hash

This patch adds command line support for Symmetric Toeplitz
hash configuration.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agoethdev: add symmetric Toeplitz hash
Simei Su [Tue, 1 Oct 2019 09:22:12 +0000 (17:22 +0800)]
ethdev: add symmetric Toeplitz hash

Currently, there are DEFAULT,TOEPLITZ and SIMPLE_XOR hash function.
To support symmetric hash by rte_flow RSS action, this patch adds
new hash function "Symmetric Toeplitz" which is supported by some hardware.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoethdev: add PPPoE to flow API
Ying A Wang [Wed, 28 Aug 2019 06:00:38 +0000 (14:00 +0800)]
ethdev: add PPPoE to flow API

- RTE_FLOW_ITEM_TYPE_PPPOES: matches a PPPoE session header.

- RTE_FLOW_ITEM_TYPE_PPPOED: matches a PPPoE discovery header.

- RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: matches a PPPoE session
  protocol identifier.

Signed-off-by: Ying A Wang <ying.a.wang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: add GTP extension header to flow API
Ying A Wang [Wed, 28 Aug 2019 06:00:37 +0000 (14:00 +0800)]
ethdev: add GTP extension header to flow API

- RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP
- RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP
  PDU extension header (PDU session container).

Signed-off-by: Ying A Wang <ying.a.wang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/iavf: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:13 +0000 (08:40 -0700)]
net/iavf: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/i40e: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:12 +0000 (08:40 -0700)]
net/i40e: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ice: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:11 +0000 (08:40 -0700)]
net/ice: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ixgbe: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:10 +0000 (08:40 -0700)]
net/ixgbe: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/fm10k: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:09 +0000 (08:40 -0700)]
net/fm10k: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/e1000: use dynamic log type for Tx/Rx debug
Stephen Hemminger [Tue, 16 Jul 2019 15:40:08 +0000 (08:40 -0700)]
net/e1000: use dynamic log type for Tx/Rx debug

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver should register the logtypes
for itself.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/bonding: fix OOB access in other aggregator modes
Hui Zhao [Thu, 21 Mar 2019 20:28:14 +0000 (21:28 +0100)]
net/bonding: fix OOB access in other aggregator modes

slave aggregator_port_id is in [0, RTE_MAX_ETHPORTS-1] range.
If RTE_MAX_ETHPORTS is > 8, we can hit out of bound accesses on
agg_bandwidth[] and agg_count[] arrays.

Fixes: 6d72657ce379 ("net/bonding: add other aggregator modes")
Cc: stable@dpdk.org
Signed-off-by: Hui Zhao <zhaohui8@huawei.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Chas Williams <chas3@att.com>
4 years agonet/bonding: fix slave id types
Hui Zhao [Thu, 21 Mar 2019 20:28:13 +0000 (21:28 +0100)]
net/bonding: fix slave id types

mode_bond_id and mode_band_id are slave ids, stored on 16bits.

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: stable@dpdk.org
Signed-off-by: Hui Zhao <zhaohui8@huawei.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/i40e: set speed to undefined for default case
Laurent Hardy [Wed, 11 Sep 2019 16:02:51 +0000 (18:02 +0200)]
net/i40e: set speed to undefined for default case

During PF/VF link update, a default speed value of 100M will be set
if get_link_info has failed or speed is unknown.

Consequently if PF is put in no-carrier state, VFs will switch to
"in carrier" state due to a link up + a link speed set to 100M
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, sets default speed to undefined (instead of 100M)
and updates a link status of VF only if link is up and speed is
different from undefined.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org
Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ixgbe: fix X553 speed capability
Xiao Zhang [Wed, 25 Sep 2019 02:49:54 +0000 (10:49 +0800)]
net/ixgbe: fix X553 speed capability

The speed capability of X553 1GbE should be ETH_LINK_SPEED_1G |
ETH_LINK_SPEED_100M | ETH_LINK_SPEED_10M rather than ETH_LINK_SPEED_1G |
ETH_LINK_SPEED_10G. Correct it to fix the issue.

Fixes: e274f5732225 ("ethdev: add speed capabilities")
Cc: stable@dpdk.org
Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/cxgbe: support setting VLAN PCP via flow API
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:12 +0000 (02:00 +0530)]
net/cxgbe: support setting VLAN PCP via flow API

Add support for setting VLAN PCP field via rte_flow API. Hardware
overwrites the entire 16-bit VLAN TCI field. So, both VLAN VID and
PCP actions must be specified.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support matching VLAN via flow API
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:11 +0000 (02:00 +0530)]
net/cxgbe: support matching VLAN via flow API

Add support for matching VLAN fields via rte_flow API.

When matching VLAN pattern, the ethertype field in hardware
filter specification must contain VLAN header's ethertype, and
not Ethernet header's ethertype. The hardware automatically
searches for ethertype 0x8100 in Ethernet header, when
parsing incoming packet against VLAN pattern.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: fetch max Tx coalesce limit from firmware
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:10 +0000 (02:00 +0530)]
net/cxgbe: fetch max Tx coalesce limit from firmware

Query firmware for max number of packets that can be coalesced by
Tx.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: add devarg to control Tx coalescing
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:09 +0000 (02:00 +0530)]
net/cxgbe: add devarg to control Tx coalescing

Remove compile time option to control Tx coalescing Latency vs
Throughput behavior. Add tx_mode_latency devarg instead, to
dynamically control Tx coalescing behavior.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: separate VF only devargs
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:08 +0000 (02:00 +0530)]
net/cxgbe: separate VF only devargs

Rework devargs parsing logic to separate VF only args.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: use dynamic logging for debug prints
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:07 +0000 (02:00 +0530)]
net/cxgbe: use dynamic logging for debug prints

Remove compile time flags and use dynamic logging for debug prints.
Also remove rarely used debug logs in register access and datapath.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: avoid polling link status before device start
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:06 +0000 (02:00 +0530)]
net/cxgbe: avoid polling link status before device start

Link updates come in firmware event queue, which is only created
when device starts. So, don't poll for link status if firmware
event queue is not yet created.

This fixes NULL dereference when accessing non existent firmware
event queue.

Fixes: 265af08e75ba ("net/cxgbe: add link up and down ops")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: fix prefetch for non-coalesced Tx packets
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:05 +0000 (02:00 +0530)]
net/cxgbe: fix prefetch for non-coalesced Tx packets

Move prefetch code out of Tx coalesce path to allow prefetching for
non-coalesced Tx packets, as well.

Fixes: bf89cbedd2d9 ("cxgbe: optimize forwarding performance for 40G")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: fix parsing VLAN ID rewrite action
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:04 +0000 (02:00 +0530)]
net/cxgbe: fix parsing VLAN ID rewrite action

Set VLAN action mode to VLAN_REWRITE only if VLAN_INSERT has not been
set yet. Otherwise, the resulting VLAN packets will have their VLAN
header rewritten, instead of pushing a new outer VLAN header.

Also fix the VLAN ID extraction logic and endianness issues.

Fixes: 1decc62b1cbe ("net/cxgbe: add flow operations to offload VLAN actions")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: fix slot allocation for IPv6 flows
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:03 +0000 (02:00 +0530)]
net/cxgbe: fix slot allocation for IPv6 flows

IPv6 flows occupy only 2 slots on Chelsio T6 NICs. Fix the slot
calculation logic to return correct number of slots.

Fixes: ee61f5113b17 ("net/cxgbe: parse and validate flows")
Fixes: 9eb2c9a48072 ("net/cxgbe: implement flow create operation")
Fixes: 3f2c1e209cfc ("net/cxgbe: add Compressed Local IP region")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: fix null access when allocating CLIP entry
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:02 +0000 (02:00 +0530)]
net/cxgbe: fix null access when allocating CLIP entry

Pass correct arguments to CLIP allocation code to avoid NULL pointer
dereference.

Fixes: 3f2c1e209cfc ("net/cxgbe: add Compressed Local IP region")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: add prefix to global functions
Rahul Lakkireddy [Fri, 27 Sep 2019 20:30:01 +0000 (02:00 +0530)]
net/cxgbe: add prefix to global functions

To avoid name collisions, add cxgbe_ prefix to some global functions.
Also, make some local functions static in cxgbe_filter.c.

Fixes: ee61f5113b17 ("net/cxgbe: parse and validate flows")
Fixes: 9eb2c9a48072 ("net/cxgbe: implement flow create operation")
Fixes: 3a381a4116ed ("net/cxgbe: query firmware for HASH filter resources")
Fixes: af44a577988b ("net/cxgbe: support to offload flows to HASH region")
Fixes: 41dc98b0827a ("net/cxgbe: support to delete flows in HASH region")
Fixes: 23af667f1507 ("net/cxgbe: add API to program hardware layer 2 table")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/mlx5: fix ConnectX-6 VF type recognition
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:31:53 +0000 (07:31 +0000)]
net/mlx5: fix ConnectX-6 VF type recognition

The PCI virtual function type was not recognized correctly
for ConnectX-6 VF.

Fixes: f0354d842344 ("net/mlx5: add ConnectX-6 device IDs")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix BlueField VF type recognition
Viacheslav Ovsiienko [Wed, 25 Sep 2019 07:31:18 +0000 (07:31 +0000)]
net/mlx5: fix BlueField VF type recognition

The PCI virtual function type was not recognized correctly
for BlueField VF.

Fixes: f38c54571d62 ("net/mlx5: split PCI from generic probing")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix vectorized Rx burst error handling
Dekel Peled [Sun, 22 Sep 2019 07:47:13 +0000 (10:47 +0300)]
net/mlx5: fix vectorized Rx burst error handling

In the process of recovery from error CQE, when using vectorized Rx
burst, the initialization of data length in mbufs was not done.
As a result the wrong length was left written in mbuf, causing
memory overwrite or wrong error report.

This patch fixes the initialization of mbuf data length during
recovery from error CQE, when using vectorized Rx burst,

Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix UAR remap initialization for 32-bit systems
Viacheslav Ovsiienko [Wed, 18 Sep 2019 06:54:11 +0000 (06:54 +0000)]
net/mlx5: fix UAR remap initialization for 32-bit systems

The txq_uar_init() routine uses the uninitialized uar_mmap_offset
field in 32-bit configurations due to this field is initialized
after txq_uar_init() call.

Fixes: 120dc4a7dcd3 ("net/mlx5: remove device register remap")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/vhost: support TSO disabling
Noa Ezra [Wed, 19 Jun 2019 06:13:44 +0000 (06:13 +0000)]
net/vhost: support TSO disabling

TSO (TCP Segmentation Offload) is enabled by default on vhost.
Add the ability to disable TSO on vhost.
The user should also disable the feature on the virtual machine's xml.

Signed-off-by: Noa Ezra <noae@mellanox.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
4 years agomaintainers: update for ena
Michal Krawczyk [Thu, 26 Sep 2019 10:45:27 +0000 (12:45 +0200)]
maintainers: update for ena

Add Igor Chauskin from the Amazon as another maintainer of the driver.
Igor is another person from the Amazon team that is responsible for the
ENA DPDK driver.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
4 years agodoc: clarify MAC/VLAN filtering in virtio guide
Tiwei Bie [Wed, 18 Sep 2019 05:00:50 +0000 (13:00 +0800)]
doc: clarify MAC/VLAN filtering in virtio guide

Explicitly document that the MAC/VLAN filtering in virtio
is best effort to help users understand why unwanted packets
could still arrive.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: fix mbuf data and packet length mismatch
Marvin Liu [Mon, 23 Sep 2019 14:05:11 +0000 (22:05 +0800)]
net/virtio: fix mbuf data and packet length mismatch

If reserve virtio header room by function rte_pktmbuf_prepend, both
segment data length and packet length of mbuf will be increased.
Data length will be equal to descriptor length, while packet length
should be decreased as virtio-net header won't be taken into packet.
Thus will cause mismatch in mbuf structure. Fix this issue by access
mbuf data directly and increase descriptor length if it is needed.

Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
Fixes: 892dc798fa9c ("net/virtio: implement Tx path for packed queues")
Fixes: 4905ed3a523f ("net/virtio: optimize Tx enqueue for packed ring")
Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: get all pending Rx packets in vectorized paths
Thibaut Collet [Wed, 11 Sep 2019 16:04:09 +0000 (18:04 +0200)]
net/virtio: get all pending Rx packets in vectorized paths

The loop to read packets does not take all packets as the number of
available packets (nb_used) is decremented in the loop.
Take all available packets provides a performance improvement of 3%.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: fix Rx stats with vectorized functions
Thibaut Collet [Wed, 11 Sep 2019 16:04:08 +0000 (18:04 +0200)]
net/virtio: fix Rx stats with vectorized functions

With vectorized functions, only the rx stats for number of packets is
incremented.
Update also the other statistics.
Performance impact is about 2%

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix vring memory partially mapped
Adrian Moreno [Fri, 6 Sep 2019 12:50:20 +0000 (14:50 +0200)]
vhost: fix vring memory partially mapped

Only the mapping of the vring addresses is being ensured. This causes
errors when the vring size is larger than the IOTLB page size. E.g:
queue sizes > 256 for 4K IOTLB pages

Ensure the entire vring memory range gets mapped. Refactor duplicated
code for for IOTLB UPDATE and IOTLB INVALIDATE and add packed virtqueue
support.

Fixes: 09927b524969 ("vhost: translate ring addresses when IOMMU enabled")
Cc: stable@dpdk.org
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: cleanup on demand when in-order Tx
Marvin Liu [Wed, 18 Sep 2019 17:06:55 +0000 (01:06 +0800)]
net/virtio: cleanup on demand when in-order Tx

Check whether space are enough before burst enqueue operation. If more
space is needed, will try to clean up used descriptors for space on
demand. It can give more chances to free used descriptors, thus will
help RFC2544 performance. Also deduct failed xmit packets from total
xmit number.

Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: update stats when in-order Tx done
Marvin Liu [Wed, 18 Sep 2019 17:06:54 +0000 (01:06 +0800)]
net/virtio: update stats when in-order Tx done

When doing xmit in-order enqueue, packets are buffered and then flushed
into avail ring. Buffered packets can be dropped due to insufficient
space. Moving stats update action just after successful avail ring
updates can guarantee correctness.

Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/vhost: fix redundant queue state event
Noa Ezra [Thu, 20 Jun 2019 06:33:03 +0000 (06:33 +0000)]
net/vhost: fix redundant queue state event

In some situations, when a virtual machine is starting,
vring_state_changed can be called while there was no change in the
queue state. This fix makes sure that there was really a change in the
queue state before calling the callback for EVENT_QUEUE_STATE.

Fixes: ee584e9710b9 ("vhost: add driver on top of the library")
Cc: stable@dpdk.org
Signed-off-by: Noa Ezra <noae@mellanox.com>
Reviewed-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: protect vring access done by application
Tiwei Bie [Mon, 19 Aug 2019 11:34:57 +0000 (19:34 +0800)]
vhost: protect vring access done by application

Besides the enqueue/dequeue API, other APIs of the builtin net
backend should also be protected.

Fixes: a3688046995f ("vhost: protect active rings from async ring changes")
Cc: stable@dpdk.org
Reported-by: Peng He <xnhp0320@icloud.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix vring address handling during live migration
Tiwei Bie [Mon, 19 Aug 2019 11:34:56 +0000 (19:34 +0800)]
vhost: fix vring address handling during live migration

When live migration starts, QEMU will set ring addrs again for
each virtqueue. In this case, we should try to translate ring
addrs after we invalidating the ring, otherwise virtqueues can
be enabled with the addrs untranslated. Besides, also leverage
the access_ok flag in non-IOMMU case to prevent the data path
accessing invalidated virtqueues.

Fixes: 5a4933e56be4 ("vhost: postpone ring address translations at kick time only")
Cc: stable@dpdk.org
Reported-by: Yilong Lv <lvyilong.lyl@alibaba-inc.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: forbid reallocation when running
Tiwei Bie [Mon, 19 Aug 2019 11:34:55 +0000 (19:34 +0800)]
vhost: forbid reallocation when running

When the device has been started, don't do the reallocation anymore.
Otherwise the pointers used in application threads can be invalidated
without proper protection. Instead of introducing a global lock to
protect the change of device pointers which will hurt the performance,
let's just do the reallocation during setup.

Fixes: af295ad4698c ("vhost: realloc device and queues to same numa node as vring desc")
Cc: stable@dpdk.org
Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: add missing experimental flag
Jim Harris [Tue, 24 Sep 2019 09:23:34 +0000 (02:23 -0700)]
vhost: add missing experimental flag

This function is listed under EXPERIMENTAL in the
rte_vhost_version.map, so it needs to be marked
with __rte_experimental in the header file as well.

Found by check-experimental-syms.sh when trying to compile
DPDK with -finstrument-functions.  This script didn't
catch this in the normal case, since the function is
declared __rte_always_inline.

This also requires updating the vhost_scsi example to allow
use of this newly marked experimental API.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/ixgbe: release port upon close
Chenxu Di [Fri, 27 Sep 2019 09:09:48 +0000 (09:09 +0000)]
net/ixgbe: 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: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/ice: release port upon close
Chenxu Di [Fri, 27 Sep 2019 09:09:47 +0000 (09:09 +0000)]
net/ice: 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: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/i40e: release port upon close
Chenxu Di [Fri, 27 Sep 2019 09:09:46 +0000 (09:09 +0000)]
net/i40e: 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: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/fm10k: release port upon close
Chenxu Di [Fri, 27 Sep 2019 09:09:45 +0000 (09:09 +0000)]
net/fm10k: 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: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/e1000: release port upon close
Chenxu Di [Fri, 27 Sep 2019 09:09:44 +0000 (09:09 +0000)]
net/e1000: 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: Chenxu Di <chenxux.di@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/hns3: support multiple process
Wei Hu (Xavier) [Thu, 26 Sep 2019 14:02:08 +0000 (22:02 +0800)]
net/hns3: support multiple process

This patch adds multiple process support for hns3 PMD driver.
Multi-process support selection queue by configuring RSS or
flow director. The primary process supports various management
ops, and the secondary process only supports queries ops.
The primary process notifies the secondary processes to start
or stop tranceiver.

Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Signed-off-by: Min Wang (Jushui) <wangmin3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Hao Chen <chenhao164@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>