dpdk.git
6 years agoapp/testpmd: fix flow completion for RSS queues
Adrien Mazarguil [Thu, 19 Apr 2018 10:07:33 +0000 (12:07 +0200)]
app/testpmd: fix flow completion for RSS queues

The lack of a working completion for RSS queues was overlooked during
development; until now only "end" was displayed as a valid token.

Fixes: 05d34c6e9d2c ("app/testpmd: add queue actions to flow command")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/bnxt: fix matching of flow API item masks
Adrien Mazarguil [Thu, 19 Apr 2018 10:07:31 +0000 (12:07 +0200)]
net/bnxt: fix matching of flow API item masks

Some values are interpreted without endian conversion and/or without
taking the proper mask into account.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mlx5: fix RSS flow action bounds check
Adrien Mazarguil [Thu, 19 Apr 2018 10:07:29 +0000 (12:07 +0200)]
net/mlx5: fix RSS flow action bounds check

The number of queues provided by the application is not checked against
parser's supported maximum.

Fixes: 3d821d6fea40 ("net/mlx5: support RSS action flow rule")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mlx4: fix ignored RSS hash types
Adrien Mazarguil [Thu, 19 Apr 2018 10:07:27 +0000 (12:07 +0200)]
net/mlx4: fix ignored RSS hash types

When an unsupported hash type is part of a RSS configuration structure, it
is silently ignored instead of triggering an error. This may lead
applications to assume that such types are accepted, while they are in fact
not part of the resulting flow rules.

Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mlx4: fix RSS resource leak in case of error
Adrien Mazarguil [Thu, 19 Apr 2018 10:07:25 +0000 (12:07 +0200)]
net/mlx4: fix RSS resource leak in case of error

When memory cannot be allocated for a flow rule, its RSS context reference
is not dropped.

Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ixgbe: enable vector PMD for icc 32 bits
Pablo de Lara [Tue, 17 Apr 2018 13:39:04 +0000 (14:39 +0100)]
net/ixgbe: enable vector PMD for icc 32 bits

IXGBE vector PMD was re-enabled for 32 bits, but only for gcc.
This commit enables it for icc too.

Fixes: e6672d2f0f88 ("net/ixgbe: enable ixgbe vector PMD for i686")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/axgbe: fix incorrect cache alignment macro
Pavan Nikhilesh [Tue, 17 Apr 2018 20:04:58 +0000 (01:34 +0530)]
net/axgbe: fix incorrect cache alignment macro

Due to missing ____cacheline_aligned definition compiler treats it as a
global variable replace it with proper cache alignment macro.

Fixes: 9e890103267e ("net/axgbe: add Rx/Tx setup")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/enic: fix uninitialized variable
John Daley [Wed, 18 Apr 2018 00:00:20 +0000 (17:00 -0700)]
net/enic: fix uninitialized variable

A local variable was used without initialization and triggered a
coverity issue.

Is is fixed here, but there is no ill effect of not initializing
the variable in this case. 'rxq_interrupt_offset' is irrelevant
if 'rxq_interrupt_enable' is not set (the condition caught by
coverity).

Coverity issue: 268314
Fixes: fc2c8c0668fd ("net/enic: use Tx completion index instead of messages")
Cc: stable@dpdk.org
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
6 years agonet/thunderx: fix MTU configuration for jumbo packets
Nitin Saxena [Mon, 16 Apr 2018 10:44:47 +0000 (10:44 +0000)]
net/thunderx: fix MTU configuration for jumbo packets

thunderx pmd driver passes dev_info.max_rx_pktlen as
9200 (via rte_eth_dev_info_get()) to application.
But, when application tries to set MTU as
(9200 - sizeof(ethernet_header_t)) the operation fails
because of missing CRC and VLAN additions.

This patch fixes the following for thunderx pmd driver:
 - Sets NIC_HW_MAX_FRS to 9216 (instead of 9200)
 - Sets NIC_HW_MAX_MTU to 9190 (NIC_HW_MAX_FRS - ETH_HLEN
   - ETHER_CRC_LEN - 2*VLAN_HLEN)
 - Sets dev_info->max_rx_pkt_len to NIC_HW_MAX_MTU +
   ETH_HLEN (instead of 9200)
 - Allows rte_eth_dev_set_mtu() to pass if application
   (like VPP) calls rte_eth_dev_set_mtu() before
   rte_eth_dev_start() by putting appropriate check for
   dev->data->dev_started

Fixes: 65d9804edc05 ("net/thunderx: support MTU configuration")
Cc: stable@dpdk.org
Signed-off-by: Nitin Saxena <nitin.saxena@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agonet/ixgbe: fix segfault in configuring VF VLAN strip
Wei Dai [Mon, 16 Apr 2018 08:14:25 +0000 (16:14 +0800)]
net/ixgbe: fix segfault in configuring VF VLAN strip

This patch fixes a segment fault in ixgbevf_vlan_offload_set( )
when a Rx queue with index < max_rx_queues is not setup.
For such queue, rxq = dev->data->rx_queues[i] is null pointer.

Fixes: 860a94d3c692 ("net/ixgbe: support VLAN strip per queue offloading in VF")

Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Xueqin Lin <xueqin.lin@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/ixgbe: fix missing support of multi-segs offloading
Wei Dai [Tue, 17 Apr 2018 07:43:50 +0000 (15:43 +0800)]
net/ixgbe: fix missing support of multi-segs offloading

This patch adds missing supported Tx multi-segs offloading.

Fixes: 51215925a32f ("net/ixgbe: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
6 years agonet/ixgbe: add access and locking APIs for MDIO
Helin Zhang [Mon, 16 Apr 2018 07:30:05 +0000 (03:30 -0400)]
net/ixgbe: add access and locking APIs for MDIO

Add ixgbe MDIO lock/unlock and access APIs to read and write registers
using specific device address. This provides MDIO access to any devices
that are not associated with the autoprobed PHY.Export these APIs via
the map file

Signed-off-by: Shweta Choudaha <shweta.choudaha@att.com>
Reviewed-by: Chas Williams <chas3@att.com>
Reviewed-by: Luca Boccassi <bluca@debian.org>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/bnxt: add device ID for Stratus VF
Somnath Kotur [Tue, 17 Apr 2018 01:11:26 +0000 (18:11 -0700)]
net/bnxt: add device ID for Stratus VF

Fixes: 1cd45aeb3270 ("net/bnxt: support Stratus VF device")

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
6 years agonet/bnxt: avoid freeing memzone multiple times
Ajit Khaparde [Tue, 17 Apr 2018 01:11:25 +0000 (18:11 -0700)]
net/bnxt: avoid freeing memzone multiple times

Since we are storing the mem_zone address for each ring created,
we are freeing the same address multiple times.
For example the memory zone created for Rx is being freed during
Rx ring cleanup, AGG ring cleanup and CQ cleanup.
Avoid this by storing the memory zone address in RXQ instead and
free it as a part of queue_release dev_op.
In the same way do the same for TX queues as well.

Fixes: 51c87ebafc7d ("net/bnxt: add Tx queue create/destroy")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: use UINT64_MAX to initialize filter ids
Ajit Khaparde [Tue, 17 Apr 2018 01:11:24 +0000 (18:11 -0700)]
net/bnxt: use UINT64_MAX to initialize filter ids

Use UINT64_MAX to initialize l2, ntuple, em filter_id fields
instead of hardcoded -1;

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: free memory allocated for VF filters
Ajit Khaparde [Tue, 17 Apr 2018 01:11:23 +0000 (18:11 -0700)]
net/bnxt: free memory allocated for VF filters

Memory allocated to hold VF filter info is not being freed currently.
This can cause potential memory leak.

Fixes: 7a5b0874440e ("net/bnxt: support to add a VF MAC address")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: reset L2 filter id once filter is freed
Ajit Khaparde [Tue, 17 Apr 2018 01:11:22 +0000 (18:11 -0700)]
net/bnxt: reset L2 filter id once filter is freed

The fw_l2_filter_id for a ntuple filter is needed only for the lifetime
of the ntuple filter. Once the filter is free, reset the field.
The associated l2_filter will be freed as a part of its own cleanup.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: maintain mbuf alloc failure counter per queue
Ajit Khaparde [Tue, 17 Apr 2018 01:11:21 +0000 (18:11 -0700)]
net/bnxt: maintain mbuf alloc failure counter per queue

Currently we have a single counter for mbuf alloc failure.
Make it per RxQ instead.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: add code to determine the Tx COS queue
Ajit Khaparde [Tue, 17 Apr 2018 01:11:20 +0000 (18:11 -0700)]
net/bnxt: add code to determine the Tx COS queue

The hwrm_queue_qportcfg command has been extended to determine
the COS queue that a Tx ring needs to use. This patch adds code
to determine the information from the FW and use it while
creating the Tx rings.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: fix flow destroy
Ajit Khaparde [Tue, 17 Apr 2018 01:11:19 +0000 (18:11 -0700)]
net/bnxt: fix flow destroy

bnxt_hwrm_clear_l2_filter needs to be called only if the filter type
is L2 and not otherwise.
Also check for the return value of bnxt_hwrm_clear_l2_filter().

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: fix L2 filter cleanup
Ajit Khaparde [Tue, 17 Apr 2018 01:11:18 +0000 (18:11 -0700)]
net/bnxt: fix L2 filter cleanup

We are wrongly freeing up a filter in the driver while it is still
configured in the HW. This can cause incorrect L2 filter id to be
used for filters created subsequently.

This filter will be cleared on cleanup anyway.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: fix Rx checksum flags for tunnel frames
Ajit Khaparde [Tue, 17 Apr 2018 01:11:17 +0000 (18:11 -0700)]
net/bnxt: fix Rx checksum flags for tunnel frames

Fix Rx checksum status for tunnel frames as seen by hardware.
Current code does not handle cases for tunnel frames correctly.

Fixes: 7ec39d8c524b ("net/bnxt: update status of Rx IP/L4 CKSUM")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: fix incorrect ntuple flag setting
Ajit Khaparde [Tue, 17 Apr 2018 01:11:16 +0000 (18:11 -0700)]
net/bnxt: fix incorrect ntuple flag setting

We are wrongly setting the Rx path flag while creating the ntuple filter.
It needs to be set for L2 or Exact Match filters only.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: fix endianness of flag
Ajit Khaparde [Tue, 17 Apr 2018 01:11:15 +0000 (18:11 -0700)]
net/bnxt: fix endianness of flag

In bnxt_hwrm_vnic_alloc, use rte_cpu_to_le_32 while setting the flags.

Fixes: 2691827e82c0 ("net/bnxt: add HWRM VNIC alloc")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: set padding flags in Rx descriptor
Ajit Khaparde [Tue, 17 Apr 2018 01:11:14 +0000 (18:11 -0700)]
net/bnxt: set padding flags in Rx descriptor

Set the RX_PROD_PKT_BD_FLAGS_EOP_PAD in Rx buffer descriptors.

Fixes: 2eb53b134aae ("net/bnxt: add initial Rx code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/bnxt: set default log level to informational
Ajit Khaparde [Tue, 17 Apr 2018 01:11:13 +0000 (18:11 -0700)]
net/bnxt: set default log level to informational

Set the default log level to RTE_LOG_INFO from RTE_LOG_NOTICE.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
6 years agonet/enic: enable overlay offload for VXLAN and GENEVE
Hyong Youb Kim [Mon, 16 Apr 2018 21:49:10 +0000 (14:49 -0700)]
net/enic: enable overlay offload for VXLAN and GENEVE

Recent NIC models support overlay offload. The overlay offload
feature enables the following on the NIC.
- Rx/Tx checksum offloads for both inner and outer packets.
- Rx inner packet type classification.
- TSO.
- Inner RSS.

TX descriptors do not require any changes, except the header length
for TSO. The NIC parses outer/inner packets and performs offloads on
them as necessary. The header length for tunneled TSO includes both
inner and outer headers.

The NIC actually parses and performs the above for NVGRE as well. DPDK
currently has no offload flags for NVGRE, and the hardware has no
controls to individually enable tunnel types either. So do nothing for
now.

The driver enables overlay offload by default. Add a devargs
'disable-overlay=<0|1>' to allow the app to disable it.

Also update the enic guide doc.

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
6 years agonet/tap: fix protocol field for non-IP
Vipin Varghese [Fri, 13 Apr 2018 05:58:47 +0000 (11:28 +0530)]
net/tap: fix protocol field for non-IP

When non IP packets are sent on TUN interface, the logic put Ipv6 as
protocol field in header. With the current patch, the check is modified
for ipv4, ipv6 and non ip.

Fixes: 204d026a3922 ("net/tap: support tun")

Suggested-by: Ophir Munk <ophirmu@mellanox.com>
Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/vmxnet3: change the SPDX tag style
Hemant Agrawal [Mon, 9 Apr 2018 08:58:33 +0000 (14:28 +0530)]
net/vmxnet3: change the SPDX tag style

Cc: skhare@vmware.com
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Yong Wang <yongwang@vmware.com>
6 years agonet/sfc: add missing Rx fini on RSS setup fail path
Ivan Malov [Tue, 17 Apr 2018 15:18:38 +0000 (16:18 +0100)]
net/sfc: add missing Rx fini on RSS setup fail path

Fixes: 4ec1fc3ba881 ("net/sfc: add basic stubs for RSS support on driver attach")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/enic: add primary MAC address handler
David Marchand [Mon, 16 Apr 2018 09:40:17 +0000 (11:40 +0200)]
net/enic: add primary MAC address handler

Modified enic_del_mac_address() to get a return value from the vnic layer.
Reused the .mac_addr_add and .mac_addr_del callbacks code to implement
primary mac address handler.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
6 years agonet/nfp: support MAC address change
Alejandro Lucero [Tue, 17 Apr 2018 09:16:53 +0000 (10:16 +0100)]
net/nfp: support MAC address change

This patch allows to use another MAC address than the one coming
with the NIC by default.

The change requires to tell the vNIC after writing into the port
BAR space. The change will fail if the port is enabled and the
vNIC does not support a live address change.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: fix possible resource leak
Yangchao Zhou [Tue, 17 Apr 2018 05:59:08 +0000 (13:59 +0800)]
net/nfp: fix possible resource leak

Fixes: c7e9729da6b5 ("net/nfp: support CPP")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agoethdev: remove new to old offloads API helpers
Shahaf Shuler [Tue, 17 Apr 2018 08:33:24 +0000 (11:33 +0300)]
ethdev: remove new to old offloads API helpers

According to

commit 315ee8374e0e ("doc: reduce initial offload API rework scope
     to drivers")

All PMDs should have moved to the new offloads API. Therefore it is safe
to remove the new->old convert helps.

The old->new helpers will remain to support application which still use
the old API.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodoc: add ifcvf driver document and release note
Xiao Wang [Tue, 17 Apr 2018 07:06:24 +0000 (15:06 +0800)]
doc: add ifcvf driver document and release note

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ifcvf: add ifcvf vDPA driver
Xiao Wang [Tue, 17 Apr 2018 07:06:23 +0000 (15:06 +0800)]
net/ifcvf: add ifcvf vDPA driver

The IFCVF vDPA (vhost data path acceleration) driver provides support for
the Intel FPGA 100G VF (IFCVF). IFCVF's datapath is virtio ring compatible,
it works as a HW vhost backend which can send/receive packets to/from
virtio directly by DMA.

Different VF devices serve different virtio frontends which are in
different VMs, so each VF needs to have its own DMA address translation
service. During the driver probe a new container is created, with this
container vDPA driver can program DMA remapping table with the VM's memory
region information.

Key vDPA driver ops implemented:

- ifcvf_dev_config:
  Enable VF data path with virtio information provided by vhost lib,
  including IOMMU programming to enable VF DMA to VM's memory, VFIO
  interrupt setup to route HW interrupt to virtio driver, create notify
  relay thread to translate virtio driver's kick to a MMIO write onto HW,
  HW queues configuration.

- ifcvf_dev_close:
  Revoke all the setup in ifcvf_dev_config.

Live migration feature is supported by IFCVF and this driver enables
it. For the dirty page logging, VF helps to log for packet buffer write,
driver helps to make the used ring as dirty when device stops.

Because vDPA driver needs to set up MSI-X vector to interrupt the
guest, only vfio-pci is supported currently.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/virtio: skip device probe in vDPA mode
Xiao Wang [Tue, 17 Apr 2018 07:06:22 +0000 (15:06 +0800)]
net/virtio: skip device probe in vDPA mode

If we want a virtio device to work in vDPA (vhost data path acceleration)
mode, we could add a "vdpa=1" devarg for this device to specify the mode.

This patch let virtio pmd skip device probe when detecting this parameter.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agovfio: add multi container support
Xiao Wang [Tue, 17 Apr 2018 07:06:21 +0000 (15:06 +0800)]
vfio: add multi container support

This patch adds APIs to support container create/destroy and device
bind/unbind with a container. It also provides API for IOMMU programing
on a specified container.

A driver could use "rte_vfio_container_create" helper to create a new
container from eal, use "rte_vfio_container_group_bind" to bind a device
to the newly created container. During rte_vfio_setup_device the container
bound with the device will be used for IOMMU setup.

Signed-off-by: Junjie Chen <junjie.j.chen@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agovfio: extend data structure for multi container
Xiao Wang [Tue, 17 Apr 2018 07:06:20 +0000 (15:06 +0800)]
vfio: extend data structure for multi container

Currently eal vfio framework binds vfio group fd to the default
container fd during rte_vfio_setup_device, while in some cases,
e.g. vDPA (vhost data path acceleration), we want to put vfio group
to a separate container and program IOMMU via this container.

This patch extends the vfio_config structure to contain per-container
user_mem_maps and defines an array of vfio_config. The next patch will
base on this to add container API.

Signed-off-by: Junjie Chen <junjie.j.chen@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agodrivers/net: remove duplicated includes
Thomas Monjalon [Mon, 16 Apr 2018 10:32:15 +0000 (12:32 +0200)]
drivers/net: remove duplicated includes

Duplicated includes are found with devtools/check-dup-includes.sh

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agobus/vdev: fix find device implementation
Gaetan Rivet [Fri, 27 Apr 2018 14:13:06 +0000 (16:13 +0200)]
bus/vdev: fix find device implementation

If start is set and a device before it matches the data,
this device is returned.

This induces potentially infinite loops.

Fixes: c7fe1eea8a74 ("bus: simplify finding starting point")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agobus/pci: fix find device implementation
Gaetan Rivet [Fri, 27 Apr 2018 14:13:05 +0000 (16:13 +0200)]
bus/pci: fix find device implementation

If start is set, and a device before it matches the data
passed for comparison, then this first device is returned.

This induces potentially infinite loops.

Fixes: c7fe1eea8a74 ("bus: simplify finding starting point")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agovhost/crypto: fix build with gcc 4.7.2
Maxime Coquelin [Fri, 27 Apr 2018 09:04:38 +0000 (11:04 +0200)]
vhost/crypto: fix build with gcc 4.7.2

Build error has been reported by Intel build system:
SUSE12SP3_64 / Linux 3.7.10-1 / GCC 4.7.2
lib/librte_vhost/vhost_crypto.c: In function â€˜rte_vhost_crypto_set_zero_copy’:
lib/librte_vhost/vhost_crypto.c:1192:2: error:
comparison of unsigned expression < 0 is always false

As enums can be either signed or unsigned, this patch removes
the negative check and cast to unsigned the upper limit check.

Fixes: 939066d96563 ("vhost/crypto: add public function implementation")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoeal: fix build on FreeBSD
Thomas Monjalon [Fri, 27 Apr 2018 01:49:19 +0000 (03:49 +0200)]
eal: fix build on FreeBSD

The auxiliary vector read is implemented only for Linux.
It could be done with procstat_getauxv() for FreeBSD.

Since the commit below, the auxiliary vector functions
are compiled for every architectures, including x86
which is tested with FreeBSD.

This patch is moving the Linux implementation in Linux directory,
and adding a fake/empty implementation for FreeBSD.

Fixes: 2ed9bf330709 ("eal: abstract away the auxiliary vector")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agoeal: fix build with glibc < 2.16
Thomas Monjalon [Fri, 27 Apr 2018 00:54:00 +0000 (02:54 +0200)]
eal: fix build with glibc < 2.16

The fake getauxval function does not use its parameter.
So the compiler raised this error:
lib/librte_eal/common/eal_common_cpuflags.c:25:25: error:
unused parameter 'type'

Fixes: 2ed9bf330709 ("eal: abstract away the auxiliary vector")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agomempool/bucket: do not allow one lcore to grab all buckets
Artem V. Andreev [Thu, 26 Apr 2018 10:59:23 +0000 (11:59 +0100)]
mempool/bucket: do not allow one lcore to grab all buckets

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agomempool/bucket: implement block dequeue operation
Artem V. Andreev [Thu, 26 Apr 2018 10:59:22 +0000 (11:59 +0100)]
mempool/bucket: implement block dequeue operation

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agomempool: support block dequeue operation
Artem V. Andreev [Thu, 26 Apr 2018 10:59:21 +0000 (11:59 +0100)]
mempool: support block dequeue operation

If mempool manager supports object blocks (physically and virtual
contiguous set of objects), it is sufficient to get the first
object only and the function allows to avoid filling in of
information about each block member.

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: implement abstract mempool info API
Artem V. Andreev [Thu, 26 Apr 2018 10:59:20 +0000 (11:59 +0100)]
mempool: implement abstract mempool info API

Primarily, it is intended as a way for the mempool driver to provide
additional information on how it lays up objects inside the mempool.

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool/bucket: implement bucket mempool manager
Artem V. Andreev [Thu, 26 Apr 2018 10:59:19 +0000 (11:59 +0100)]
mempool/bucket: implement bucket mempool manager

The manager provides a way to allocate physically and virtually
contiguous set of objects.

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoapp/pdump: remove unused socket path options
Thomas Monjalon [Wed, 25 Apr 2018 13:03:39 +0000 (15:03 +0200)]
app/pdump: remove unused socket path options

The options --server-socket-path and --client-socket-path
were said to be deprecated and will be removed soon.
No need to wait for removing application options which have
no effect, and can confuse the user.

Fixes: 660098d61f57 ("pdump: use generic multi-process channel")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agotest/mempool: fix autotest retry
Andrew Rybchenko [Wed, 25 Apr 2018 17:00:37 +0000 (18:00 +0100)]
test/mempool: fix autotest retry

Single producer / single consumer mempool handle is stored in static
variable and the mempool allocated if stored value is NULL.
If the mempool is freed, NULL should be restored to make sure that
the mempool is allocated once again next time when the test is run.

Fixes: 8ef772aee072 ("app/test: rework mempool test")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agotest: fix memory flags test for low NUMA nodes number
Phil Yang [Tue, 6 Feb 2018 02:21:38 +0000 (10:21 +0800)]
test: fix memory flags test for low NUMA nodes number

Since RTE_MAX_NUMA_NODES is configurable, the existing socket number
could greater than RTE_MAX_NUMA_NODES. Optimize test case to cover this
situation.(i.e RTE_MAX_NUMA_NODES=1)

Fixes: 45f1b6e8680a ("app: add new tests on eal flags")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
6 years agobus/fslmc: do not log messages if bus not present
Stephen Hemminger [Wed, 25 Apr 2018 23:16:37 +0000 (16:16 -0700)]
bus/fslmc: do not log messages if bus not present

A typical distribution will compile with default config and all
buses enabled. Therefore every driver should be silent and not
log anything for this normal case.

This patch gets rid of these messages when running on basic x86
environment such as bare metal or VM.

fslmc: DPAA2: DPRC not available
fslmc: FSLMC Bus Not Available. Skipping

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: shut up warning about master lcore
Stephen Hemminger [Thu, 26 Apr 2018 00:48:39 +0000 (17:48 -0700)]
eal: shut up warning about master lcore

This message looks suspicious and seen on healthy testpmd.
 EAL: WARNING: Master core has no memory on local socket!

The message is wrong: the master lcore is 0 and its socket is 0
and there are multiple available memory segments on socket 0.

At that point in the startup process, the count value is zero,
meaning they are not used yet so the check_socket gets confused.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: make semantics of lcore role function more intuitive
Anatoly Burakov [Thu, 26 Apr 2018 13:42:31 +0000 (14:42 +0100)]
eal: make semantics of lcore role function more intuitive

rte_lcore_has_role() returns 0 if role of lcore matches requested
role. The return value of the API is confusing, and this is a known
problem with a deprecation notice announcing the change to more
intuitive semantics:

Commit 064518f68d48 ("doc: announce EAL API change to lcore role function")

Implement changes announced in the deprecation notice, and remove it.
Also, fix usages of this API to reflect the change. Control thread patches
expected new behavior and were broken before, now they are fixed as well.

Fixes: d651ee4919cd ("eal: set affinity for control threads")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoevent/octeontx: fix snprintf mempool name overflow
Pavan Nikhilesh [Mon, 23 Apr 2018 13:39:33 +0000 (19:09 +0530)]
event/octeontx: fix snprintf mempool name overflow

Bugzilla-ID: 28
Fixes: f874c1eb1519 ("event/octeontx: create and free timer adapter")

Reported-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agodoc: fix PDF build
Marko Kovacevic [Wed, 25 Apr 2018 13:59:52 +0000 (14:59 +0100)]
doc: fix PDF build

A .svg extension was added instead of .* which caused
the pdf docs to not build this change fixes that.

Fixes: a5e1231f099b ("net/szedata2: do not affect Ethernet interfaces")

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agoservice: remove experimental tags
Harry van Haaren [Thu, 5 Apr 2018 13:15:46 +0000 (14:15 +0100)]
service: remove experimental tags

This commit removes the experimental tags from the
service cores functions, they now become part of the
main DPDK API/ABI.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoeal/linux: remove useless unlock of hugepage when clearing
Anatoly Burakov [Wed, 25 Apr 2018 10:08:13 +0000 (11:08 +0100)]
eal/linux: remove useless unlock of hugepage when clearing

Coverity was complaining about not checking result of call to
fcntl() for unlocking the file. Disregarding the fact that error
value returned from fcntl() unlock call is highly unlikely in the
first place, we are subsequently calling close() on that same fd,
which will drop the lock, which makes call to fcntl() unnecessary.

Fix this by removing a call to fcntl() altogether.

Coverity issue: 272607
Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agodoc: update preferred log level syntax in guides
Stephen Hemminger [Wed, 25 Apr 2018 03:17:50 +0000 (20:17 -0700)]
doc: update preferred log level syntax in guides

Use symbolic names and match rather than numbers and regex
in the guides.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agolog: add ability to match log type with globbing
Stephen Hemminger [Wed, 25 Apr 2018 03:17:49 +0000 (20:17 -0700)]
log: add ability to match log type with globbing

Regular expressions are not the best way to match a hierarchical
pattern like dynamic log levels. And the separator for dynamic
log levels is period which is the regex wildcard character.

A better solution is to use filename matching 'globbing' so
that log levels match like file paths. For compatibility,
use colon to separate pattern match style arguments. For
example:
--log-level 'pmd.net.virtio.*:debug'

This also makes the documentation match what really happens
internally.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: make log level save private
Stephen Hemminger [Wed, 25 Apr 2018 03:17:48 +0000 (20:17 -0700)]
eal: make log level save private

We don't want format of eal log level saved values to be visible
in ABI. Move to private storage in eal_common_log.

Includes minor optimization. Compile the regular expression for
each log match once, rather than each time it is used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: allow symbolic log levels
Stephen Hemminger [Wed, 25 Apr 2018 03:17:47 +0000 (20:17 -0700)]
eal: allow symbolic log levels

Much easeier to remember names than numbers. Allows
--log-level=pmd.net.ixgbe.*,debug

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: make syslog facility table const
Stephen Hemminger [Wed, 25 Apr 2018 03:17:46 +0000 (20:17 -0700)]
eal: make syslog facility table const

The mapping for facility name to value can be const.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoeal: abstract away the auxiliary vector
Aaron Conole [Mon, 2 Apr 2018 18:24:34 +0000 (14:24 -0400)]
eal: abstract away the auxiliary vector

Rather than attempting to load the contents of the auxv directly,
prefer to use an exposed API - and if that doesn't exist then attempt
to load the vector.  This is because on some systems, when a user
is downgraded, the /proc/self/auxv file retains the old ownership
and permissions.  The original method of /proc/self/auxv is retained.

This also removes a potential abort() in the code when compiled with
NDEBUG.  A quick parse of the code shows that many (if not all) of
the CPU flag parsing isn't used internally, so it should be okay.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
6 years agoeal: add last init priority
Gaetan Rivet [Tue, 24 Apr 2018 11:28:53 +0000 (13:28 +0200)]
eal: add last init priority

Add the priority RTE_PRIORITY_LAST, used for initialization routines
meant to be run after all other constructors.

This priority becomes the default priority for all DPDK constructors.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoeal: list acceptable init priorities
Gaetan Rivet [Tue, 24 Apr 2018 11:28:52 +0000 (13:28 +0200)]
eal: list acceptable init priorities

Build a central list to quickly see each used priorities for
constructors, allowing to verify that they are both above 100 and in the
proper order.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agodevargs: rename legacy API
Gaetan Rivet [Mon, 23 Apr 2018 23:54:52 +0000 (01:54 +0200)]
devargs: rename legacy API

The previous symbols were deprecated for two releases.
They are now marked as such and cannot be used anymore.

They are replaced by ones respecting the new namespace that are marked
experimental.

As a result, eth_dev attach and detach are slightly reworked to follow
the changes.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevargs: use proper namespace prefix
Gaetan Rivet [Mon, 23 Apr 2018 23:54:51 +0000 (01:54 +0200)]
devargs: use proper namespace prefix

rte_eal_devargs is useless, rte_devargs is sufficient.

Only experimental functions are changed for now.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevargs: update syntax documentation
Gaetan Rivet [Mon, 23 Apr 2018 23:54:50 +0000 (01:54 +0200)]
devargs: update syntax documentation

Device syntax documentation is out of date.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevargs: make parsing variadic
Gaetan Rivet [Mon, 23 Apr 2018 23:54:49 +0000 (01:54 +0200)]
devargs: make parsing variadic

rte_eal_devargs_parse can be used by EAL subsystems, drivers,
applications alike.

Device parameters may be presented with different structure each time;
as a single declaration string or several strings each describing
different parts of the declaration.

To simplify the use of this parsing facility, its parameters are made
variadic.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevargs: make devargs list private
Gaetan Rivet [Mon, 23 Apr 2018 23:54:48 +0000 (01:54 +0200)]
devargs: make devargs list private

Initially, rte_devargs was meant to be populated once and sometimes
accessed, then never emptied.

With the new hotplug functionality having better standing, new usage
appeared with repeated addition of devices and their subsequent removal.

Exposing devargs_list pushed bus drivers and libraries to be careless
and inconsistent in their memory management. Making it private will
allow to rationalize this part of the EAL and ensure that fewer memory
leaks occur during operations.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agotest: remove devargs unit tests
Gaetan Rivet [Mon, 23 Apr 2018 23:54:47 +0000 (01:54 +0200)]
test: remove devargs unit tests

The current test will not be compatible anymore with a private
devargs list.

Moreover, the new functions should have new tests, while the existing
API will be removed.

The current unit tests are thus obsolete and hereby removed.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agonet/vdev_netvsc: do not reference devargs list
Gaetan Rivet [Mon, 23 Apr 2018 23:54:46 +0000 (01:54 +0200)]
net/vdev_netvsc: do not reference devargs list

This list should not be used by drivers.
Use the public API instead.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agobus/pci: do not reference devargs list
Gaetan Rivet [Mon, 23 Apr 2018 23:54:45 +0000 (01:54 +0200)]
bus/pci: do not reference devargs list

This list should not be used by drivers.
Use the public API instead.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agobus/vdev: do not reference devargs list
Gaetan Rivet [Mon, 23 Apr 2018 23:54:44 +0000 (01:54 +0200)]
bus/vdev: do not reference devargs list

This list should not be operated upon by drivers.
Use the public API to achieve the same functionalities.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodevargs: introduce iterator
Gaetan Rivet [Mon, 23 Apr 2018 23:54:43 +0000 (01:54 +0200)]
devargs: introduce iterator

In preparation to making devargs_list private.

Bus drivers generally need to access rte_devargs pertaining to their
operations. This match is a common operation for bus drivers.

Add a new accessor for the rte_devargs list.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoexamples: use new API to create control threads
Olivier Matz [Tue, 24 Apr 2018 14:46:51 +0000 (16:46 +0200)]
examples: use new API to create control threads

A new API was introduced to create control thread:
rte_ctrl_thread_create(). Use it in examples when relevant.

While at it, change the prototype of the thread start functions: it's
not a good idea to cast it in (void *) since the compiler won't check
that the prototype is compatible.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoeal: set affinity for control threads
Olivier Matz [Tue, 24 Apr 2018 14:46:50 +0000 (16:46 +0200)]
eal: set affinity for control threads

The management threads must not bother the dataplane or service cores.
Set the affinity of these threads accordingly.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: set name when creating a control thread
Olivier Matz [Tue, 24 Apr 2018 14:46:49 +0000 (16:46 +0200)]
eal: set name when creating a control thread

To avoid code duplication, add a parameter to rte_ctrl_thread_create()
to specify the name of the thread.

This requires to add a wrapper for the thread start routine in
rte_thread_init(), which will first wait that the thread is configured.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: add function to create control threads
Olivier Matz [Tue, 24 Apr 2018 14:46:48 +0000 (16:46 +0200)]
eal: add function to create control threads

Many parts of dpdk use their own management threads. Introduce a new
wrapper for thread creation that will be extended in next commits to set
the name and affinity.

To be consistent with other DPDK APIs, the return value is negative in
case of error, which was not the case for pthread_create().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agouse sizeof to avoid double use of a length define
Olivier Matz [Tue, 24 Apr 2018 14:46:47 +0000 (16:46 +0200)]
use sizeof to avoid double use of a length define

Only a cosmetic change: the *_LEN defines are already used
when defining the buffer. Using sizeof() ensures that the length
stays consistent, even if the definition is modified.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agotest/power: fix build with shared library
Reshma Pattan [Tue, 24 Apr 2018 22:10:21 +0000 (23:10 +0100)]
test/power: fix build with shared library

Using private api `guest_channel_host_connect()`
will cause shared library build failure:
        test_power_kvm_vm.c:(.text+0x2cb):
        undefined reference to `guest_channel_host_connect'

So revert the changes done.

Fixes: d550a8cc31f3 ("app/test: enhance power manager unit tests")

Reported-by: Bruce Richardson <bruce.richardson@intel.com>
Suggested-by: David Hunt <david.hunt@intel.com>
Signed-off-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agodrivers/net: share vdev data to secondary process
Jianfeng Tan [Tue, 24 Apr 2018 05:51:24 +0000 (05:51 +0000)]
drivers/net: share vdev data to secondary process

dpdk-procinfo, as a secondary process, cannot fetch stats for vdev.

This patch enables that by attaching the port from the shared data.
We also fill the eth dev ops, with only some ops works in secondary
process, for example, stats_get().

Note that, we still cannot Rx/Tx packets on the ports which do not
support multi-process.

Reported-by: Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agodrivers/net: do not use private ethdev data
Jianfeng Tan [Tue, 24 Apr 2018 05:51:23 +0000 (05:51 +0000)]
drivers/net: do not use private ethdev data

We introduced private rte_eth_dev_data to allow vdev to be created
both in primary process and secondary process(es). This is not
friendly to multi-process model, for example, it leads to port id
contention issue if two processes both find the data entry is free.

And to get stats of primary vdev in secondary, we must allocate
from the pre-defined array so that we can find it.

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agobus/vdev: scan by multi-process channel
Jianfeng Tan [Tue, 24 Apr 2018 05:51:22 +0000 (05:51 +0000)]
bus/vdev: scan by multi-process channel

To scan the vdevs in primary, we send request to primary process
to obtain the names for vdevs.

Only the name is shared from the primary. In probe(), the device
driver is supposed to locate (or request more) the detail
information from the primary.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agobus/vdev: add lock on device list
Jianfeng Tan [Tue, 24 Apr 2018 05:51:21 +0000 (05:51 +0000)]
bus/vdev: add lock on device list

As we could add virtual devices from different threads now, we
add a spin lock to protect the vdev device list.

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: bring forward multi-process channel init
Jianfeng Tan [Tue, 24 Apr 2018 05:51:20 +0000 (05:51 +0000)]
eal: bring forward multi-process channel init

Adjust the init sequence: put mp channel init before bus scan
so that we can init the vdev bus through mp channel in the
secondary process before the bus scan.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agomempool: support flushing the default cache
Artem V. Andreev [Mon, 16 Apr 2018 13:24:40 +0000 (14:24 +0100)]
mempool: support flushing the default cache

Mempool get/put API cares about cache itself, but sometimes it is
required to flush the cache explicitly.

The function is moved in the file since it now requires
rte_mempool_default_cache().

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: remove callback to register memory area
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:39 +0000 (14:24 +0100)]
mempool: remove callback to register memory area

The callback is not required any more since there is a new callback
to populate objects using provided memory area which provides
the same information.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool/dpaa: prepare to remove register memory area op
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:38 +0000 (14:24 +0100)]
mempool/dpaa: prepare to remove register memory area op

Populate mempool driver callback is executed a bit later than
register memory area, provides the same information and will
substitute the later since it gives more flexibility and in addition
to notification about memory area allows to customize how mempool
objects are stored in memory.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agomempool/octeontx: prepare to remove register memory area op
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:37 +0000 (14:24 +0100)]
mempool/octeontx: prepare to remove register memory area op

Callback to populate pool objects has all required information and
executed a bit later than register memory area callback.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
6 years agomempool: deprecate xmem functions
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:36 +0000 (14:24 +0100)]
mempool: deprecate xmem functions

Move rte_mempool_xmem_size() code to internal helper function
since it is required in two places: deprecated rte_mempool_xmem_size()
and non-deprecated rte_mempool_op_calc_mem_size_default().

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: remove callback to get capabilities
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:35 +0000 (14:24 +0100)]
mempool: remove callback to get capabilities

The callback was introduced to let generic code to know octeontx
mempool driver requirements to use single physically contiguous
memory chunk to store all objects and align object address to
total object size. Now these requirements are met using a new
callbacks to calculate required memory chunk size and to populate
objects using provided memory chunk.

These capability flags are not used anywhere else.

Restricting capabilities to flags is not generic and likely to
be insufficient to describe mempool driver features. If required
in the future, API which returns structured information may be
added.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: add op to populate objects using provided memory
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:34 +0000 (14:24 +0100)]
mempool: add op to populate objects using provided memory

The callback allows to customize how objects are stored in the
memory chunk. Default implementation of the callback which simply
puts objects one by one is available.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: add op to calculate memory size to be allocated
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:33 +0000 (14:24 +0100)]
mempool: add op to calculate memory size to be allocated

Size of memory chunk required to populate mempool objects depends
on how objects are stored in the memory. Different mempool drivers
may have different requirements and a new operation allows to
calculate memory size in accordance with driver requirements and
advertise requirements on minimum memory chunk size and alignment
in a generic way.

Bump ABI version since the patch breaks it.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomempool: ensure mempool is initialized before populating
Artem V. Andreev [Mon, 16 Apr 2018 13:24:32 +0000 (14:24 +0100)]
mempool: ensure mempool is initialized before populating

Callback to calculate required memory area size may require mempool
driver data to be already allocated and initialized.

Signed-off-by: Artem V. Andreev <artem.andreev@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: rename flag to control IOVA-contiguous objects
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:31 +0000 (14:24 +0100)]
mempool: rename flag to control IOVA-contiguous objects

Flag MEMPOOL_F_NO_PHYS_CONTIG is renamed as MEMPOOL_F_NO_IOVA_CONTIG
to follow IO memory contiguous terminology.
MEMPOOL_F_NO_PHYS_CONTIG is kept for backward compatibility and
deprecated.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agomempool: fix leak when no objects are populated
Andrew Rybchenko [Mon, 16 Apr 2018 13:24:30 +0000 (14:24 +0100)]
mempool: fix leak when no objects are populated

Fixes: 84121f197187 ("mempool: store memory chunks in a list")
Cc: stable@dpdk.org
Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>