dpdk.git
7 years agonet/tap: add link up and down operations
Pascal Mazon [Thu, 2 Feb 2017 16:18:03 +0000 (17:18 +0100)]
net/tap: add link up and down operations

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/tap: display name after parsing
Pascal Mazon [Thu, 2 Feb 2017 16:18:02 +0000 (17:18 +0100)]
net/tap: display name after parsing

The probe parses for user-defined iface name. Let's use that value.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/tap: keep kernel-assigned MAC address
Pascal Mazon [Thu, 2 Feb 2017 16:18:01 +0000 (17:18 +0100)]
net/tap: keep kernel-assigned MAC address

There's no point in having a different internal MAC address than the one
provided by the kernel when creating the netdevice.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/tap: skip overwritten file descriptor assignment
Pascal Mazon [Thu, 2 Feb 2017 16:18:00 +0000 (17:18 +0100)]
net/tap: skip overwritten file descriptor assignment

pmd->fds[0], pmd->rxq[0] and pmd->txq[0] are set a couple of lines after
the for loop that initializes them to -1.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/tap: fix log level of errors
Pascal Mazon [Thu, 2 Feb 2017 16:17:59 +0000 (17:17 +0100)]
net/tap: fix log level of errors

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/tap: fix name
Pascal Mazon [Thu, 2 Feb 2017 16:17:58 +0000 (17:17 +0100)]
net/tap: fix name

dev->data->name contains the device name, e.g. "net_tap0".
dev->data->dev_private->name contains the actual iface name,
e.g. "dtap0".

In any case, the name must to be consistent with the tun_alloc() call in
eth_dev_tap_create().

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
7 years agonet/mlx5: fix inline WQE consumption
Nélio Laranjeiro [Thu, 2 Feb 2017 10:34:13 +0000 (11:34 +0100)]
net/mlx5: fix inline WQE consumption

For some sizes of packets, the number of bytes copied in the work queue
element could be greater than the available size of the inline.  In such
situation it could consume one more work queue element where it should
not.

Fixes: 0e8679fcddc4 ("net/mlx5: fix inline logic")
Cc: stable@dpdk.org
Reported-by: Elad Persiko <eladpe@mellanox.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix Tx WQE corruption caused by starvation
Nélio Laranjeiro [Thu, 2 Feb 2017 10:34:12 +0000 (11:34 +0100)]
net/mlx5: fix Tx WQE corruption caused by starvation

Fixes an issue which may occurs with the inline feature activated and a
packet greater than the max_inline requested.

In such situation, more work request elements can be consumed and in the
worst case override some still handled by the NIC, this can result in
sending garbage on the network or putting the work queue in error.

Fixes: 2a66cf378954 ("net/mlx5: support inline send")
Cc: stable@dpdk.org
Reported-by: Elad Persiko <eladpe@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
7 years agonet/mlx5: fix ethernet header re-writing
Nélio Laranjeiro [Thu, 2 Feb 2017 10:34:11 +0000 (11:34 +0100)]
net/mlx5: fix ethernet header re-writing

First two bytes of the Ethernet header was written twice at the same place.

Fixes: b8fe952ec5b6 ("net/mlx5: prepare Tx vectorization")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/sfc: fix setting empty multicast list
Ivan Malov [Wed, 1 Feb 2017 08:17:11 +0000 (08:17 +0000)]
net/sfc: fix setting empty multicast list

The patch is to fix sfc_set_mc_addr_list() behaviour in order
to make it accept an empty multicast address list thus making
it possible to remove multicast addresses inserted previously

Fixes: 0fa0070e4391 ("net/sfc: support multicast addresses list controls")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agonet/mlx5: fix flow rule creation if ports are stopped
Nélio Laranjeiro [Tue, 31 Jan 2017 16:02:48 +0000 (17:02 +0100)]
net/mlx5: fix flow rule creation if ports are stopped

Adding a flow when the port is stopped ends in an inconsistent situation
where the queue can receive traffic when it should not.
Record new rules and apply them as soon as the port is started.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: fix verification of mark action
Nélio Laranjeiro [Tue, 31 Jan 2017 16:02:47 +0000 (17:02 +0100)]
net/mlx5: fix verification of mark action

A configuration structure for the MARK action must always be specified.

Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: use flow API default masks
Nélio Laranjeiro [Tue, 31 Jan 2017 16:02:46 +0000 (17:02 +0100)]
net/mlx5: use flow API default masks

Default masks were introduced in the API after its implementation in this
PMD.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: fix inconsistent link status
Shahaf Shuler [Tue, 31 Jan 2017 13:13:38 +0000 (15:13 +0200)]
net/mlx5: fix inconsistent link status

Querying the link status can end up being in an inconsistent state,
like the port is reporting speed although it is down.

For this case another query is scheduled.

A race condition can occur between the scheduled query and link
status interrupt handlers.

When the scheduled query by-pass interrupt handlers, the link status
will be stuck in an inconsistent state.

This patch addresses the race condition by not blocking link status
queries in case delayed query is used.

Fixes: 198a3c339a8f ("mlx5: handle link status interrupts")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agopci: fix UIO interrupt file descriptor check before close
Yong Wang [Fri, 10 Feb 2017 13:53:17 +0000 (08:53 -0500)]
pci: fix UIO interrupt file descriptor check before close

The "dev->intr_handle.fd" is possibly a negative value while it is
passed as an argument to function "close". Fix the check to the fd.

Fixes: 5a60a7ffc801 ("pci: introduce functions to alloc and free uio resource")

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
7 years agonet/virtio: add speed capability
Ido Barnea [Thu, 2 Feb 2017 12:05:07 +0000 (12:05 +0000)]
net/virtio: add speed capability

The chosen fake capability (10G) is consistent with the reported
link speed in virtio_dev_link_update():
link.link_speed = SPEED_10G;

The feature is not marked in doc/guides/nics/features/virtio.ini
because it is only a fake value.

Signed-off-by: Ido Barnea <ibarnea@cisco.com>
[Thomas: comments added]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agodoc: postpone ABI changes in igb_uio
Jianfeng Tan [Thu, 9 Feb 2017 16:06:46 +0000 (16:06 +0000)]
doc: postpone ABI changes in igb_uio

This ABI changes to remove iomem and ioport mapping in igb_uio. The
purpose of this changes was to fix a bug: when DPDK app crashes,
those devices by igb_uio are not stopped either DPDK PMD driver or
igb_uio driver.

Then it has been pointed out by Stephen Hemminger that it has
backward compatibility issue: cannot run old version DPDK on
modified igb_uio.

However, we still have not figure out a new way to fix this bug
without this change. Let's postpone this deprecation announcement
in case this change cannot be avoided.

Fixes: 3bac1dbc1ed ("doc: announce iomem and ioport removal from igb_uio")

Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agodoc: add guide to use virtio-user as exceptional path
Jianfeng Tan [Thu, 9 Feb 2017 16:06:45 +0000 (16:06 +0000)]
doc: add guide to use virtio-user as exceptional path

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
7 years agodoc: add guide to use virtio-user for container networking
Jianfeng Tan [Thu, 9 Feb 2017 16:06:44 +0000 (16:06 +0000)]
doc: add guide to use virtio-user for container networking

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
7 years agomk: move PMD libraries linking to applications
Ferruh Yigit [Tue, 31 Jan 2017 15:04:48 +0000 (15:04 +0000)]
mk: move PMD libraries linking to applications

Some PMDs provide device specific APIs. Bond and xenvirt are existing
samples for this.

And since these are PMD libraries, there are two options on how to link
them for shared library build:

1- They can be linked to all applications by default, using common
rte.app.mk file.

2- They can be explicitly linked to applications that use device
specific API.

Currently option one is in use, this patch switches to the option two.

Moves library linking to the Makefile of application Makefile that uses
device specific API.

This prevent these PMD libraries to be a dependency to applications
that don't use these device specific APIs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agoapp/testpmd: use LDLIBS in makefile
Ferruh Yigit [Tue, 31 Jan 2017 15:04:47 +0000 (15:04 +0000)]
app/testpmd: use LDLIBS in makefile

_LDLIBS is for internal usage, convert to LDLIBS usage.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agomk: link more libraries without --whole-archive
Ferruh Yigit [Tue, 31 Jan 2017 15:01:32 +0000 (15:01 +0000)]
mk: link more libraries without --whole-archive

During app build with static library, some libraries wrapped with
--whole-archive compiler flag.

Wrapped libraries are mainly PMD libraries, this is required because PMD
APIs not called directly but run through callbacks registered via
constructor functions.

Also some set of libraries, depends to the PMD libraries needs this,
because of same reason.

All the libraries used by a plugin (any driver) must be in
--whole-archive to ensure that every symbols will be available for the
plugin.

But other libraries can be out of this flag, and this saves some bytes
in final binary.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agoexamples/ethtool: display bus information
Qiming Yang [Wed, 4 Jan 2017 12:18:15 +0000 (20:18 +0800)]
examples/ethtool: display bus information

This patch enhances the ethtool example to support to show
bus information, in the same way that the Linux kernel
ethtool does.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
7 years agosched: fix crash when freeing port
Alan Dewar [Mon, 6 Feb 2017 17:32:42 +0000 (18:32 +0100)]
sched: fix crash when freeing port

Prevent a segmentation fault in rte_sched_port_free by only accessing
the port structure after the NULL pointer check has been made.

Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets")
Cc: stable@dpdk.org
Signed-off-by: Alan Dewar <adewar@brocade.com>
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
7 years agovfio: fix file descriptor leak in multi-process
Patrick MacArthur [Thu, 26 Jan 2017 23:05:21 +0000 (18:05 -0500)]
vfio: fix file descriptor leak in multi-process

When a secondary process wants access to the VFIO container file
descriptor, the primary process calls vfio_get_container_fd() which
always opens an entirely new file descriptor on /dev/vfio/vfio.
However, once the file descriptor has been passed to the subprocess, it
is effectively duplicated, meaning that the copy of the file descriptor
in the primary process is no longer needed.  However, the primary
process does not close the duplicate fd, which results in a resource
leak.

This can be reproduced by starting a primary process with a small
RLIMIT_NOFILE limit configured to use VFIO for at least one device, and
repeatedly launching secondary processes until the file descriptor limit
is exceeded.

Fix the resource leak by closing the local vfio container file
descriptor after passing it to the secondary process.

Fixes: 2f4adfad0a69 ("vfio: add multiprocess support")
Cc: stable@dpdk.org
Signed-off-by: Patrick MacArthur <patrick@patrickmacarthur.net>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
7 years agoapp/crypto-perf: fix FreeBSD build
Daniel Mrzyglod [Tue, 7 Feb 2017 09:44:34 +0000 (10:44 +0100)]
app/crypto-perf: fix FreeBSD build

This patch fixes error: implicit declaration of function 'getline'

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
7 years agodoc: add flow API to features list
Nelio Laranjeiro [Thu, 9 Feb 2017 15:27:09 +0000 (16:27 +0100)]
doc: add flow API to features list

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agodoc: add xstats to virtio features list
Jiayu Hu [Tue, 7 Feb 2017 09:40:30 +0000 (17:40 +0800)]
doc: add xstats to virtio features list

Currently, extended statistics has been supported by virtio. But there
are no corresponding document updates. Therefore, this patch is to update
the document for virtio xstats feature.

Fixes: 76d4c652e07d ("virtio: add extended stats")

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agodoc: add known issue for virtio TSO with clones
Olivier Matz [Mon, 6 Feb 2017 13:16:53 +0000 (14:16 +0100)]
doc: add known issue for virtio TSO with clones

Document the issue with Tso on shared packets.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
7 years agodoc: update release notes for enic driver
John Daley [Wed, 1 Feb 2017 19:21:38 +0000 (11:21 -0800)]
doc: update release notes for enic driver

Signed-off-by: John Daley <johndale@cisco.com>
7 years agodoc: automate examples file list for API
Ferruh Yigit [Wed, 8 Feb 2017 17:54:55 +0000 (17:54 +0000)]
doc: automate examples file list for API

These files are linked to API documentation as usage samples, list of
files created automatically during doc creation.

Remove manually updated old one.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agomaintainers: update email address
Matej Vido [Tue, 24 Jan 2017 14:16:54 +0000 (15:16 +0100)]
maintainers: update email address

Signed-off-by: Matej Vido <matejvido@gmail.com>
7 years agomaintainers: update mlx4/mlx5
Adrien Mazarguil [Mon, 23 Jan 2017 14:37:51 +0000 (15:37 +0100)]
maintainers: update mlx4/mlx5

Promote Nelio as additional maintainer for mlx4 and mlx5 PMDs.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
7 years agomaintainers: split virtio and vhost
Yuanhan Liu [Thu, 12 Jan 2017 06:24:58 +0000 (14:24 +0800)]
maintainers: split virtio and vhost

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agomaintainers: update for virtio
Yuanhan Liu [Thu, 12 Jan 2017 06:24:57 +0000 (14:24 +0800)]
maintainers: update for virtio

Huawei has left DPDK team for months, and he hasn't showed up since
then. Remove him.

Cc: Huawei Xie <huawei.xie@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agodoc: add guidelines on stable and lts releases
John McNamara [Fri, 13 Jan 2017 13:06:22 +0000 (13:06 +0000)]
doc: add guidelines on stable and lts releases

Add document explaining the current Stable and LTS process.

Signed-off-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agopkg: remove xen-devel for aarch64
Anders Roxell [Wed, 18 Jan 2017 21:46:04 +0000 (22:46 +0100)]
pkg: remove xen-devel for aarch64

Disable xen-devel since it just got available for aarch64 in Fedora 25.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
7 years agopkg: support aarch64
Anders Roxell [Wed, 18 Jan 2017 21:46:03 +0000 (22:46 +0100)]
pkg: support aarch64

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
7 years agoversion: 17.02-rc2
Thomas Monjalon [Mon, 30 Jan 2017 22:39:15 +0000 (23:39 +0100)]
version: 17.02-rc2

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
7 years agodoc: add device specific API
Ferruh Yigit [Mon, 30 Jan 2017 18:27:25 +0000 (18:27 +0000)]
doc: add device specific API

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/tap: fix invalid queue file descriptor
Keith Wiles [Sun, 29 Jan 2017 02:12:05 +0000 (20:12 -0600)]
net/tap: fix invalid queue file descriptor

Rx and Tx queues share the common tap file descriptor, but save this
value separately.

Setting up Rx/Tx queue sets up both queues, release_queue close the
tap file but update file descriptor only for that queue.

This makes other queue's file descriptor invalid.

As a workaround, prevent release_queue callback to be called by default.

This is done by separating Rx/Tx setup functions, so that each only
setup its own queue, this prevents rte_eth_rx/tx_queue_setup() calling
release_queue before setup_queue.

Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD")

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agodrivers/net: remove redundant new line from logs
Ferruh Yigit [Fri, 27 Jan 2017 15:16:32 +0000 (15:16 +0000)]
drivers/net: remove redundant new line from logs

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
7 years agonet/mlx5: fix flow pattern validation
Nélio Laranjeiro [Fri, 27 Jan 2017 15:35:20 +0000 (16:35 +0100)]
net/mlx5: fix flow pattern validation

Size of the mask is wrongly computed and make the validation process only
verify the first 4 bytes of the layer.

Fixes: 2097d0d1e2cc ("net/mlx5: support basic flow items and actions")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/mlx5: fix flow pattern VLAN validation
Nélio Laranjeiro [Fri, 27 Jan 2017 15:35:19 +0000 (16:35 +0100)]
net/mlx5: fix flow pattern VLAN validation

TCI field is read from the wrong place due to an invalid cast. Moreover
there is no need to limit matching to VID since PCP and DEI bits can be
matched as well.

Fixes: 12475fb203ad ("net/mlx5: support VLAN flow item")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
7 years agonet/ixgbe: fix API comments for doxygen
Ferruh Yigit [Fri, 27 Jan 2017 12:27:20 +0000 (12:27 +0000)]
net/ixgbe: fix API comments for doxygen

Fixes: 57aa1fd284d5 ("net/ixgbe: move set VF functions from the ethdev")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/i40e: fix API comments for doxygen
Ferruh Yigit [Fri, 27 Jan 2017 12:27:19 +0000 (12:27 +0000)]
net/i40e: fix API comments for doxygen

Fixes: a541407fe4bc ("net/i40e: set VF MAC anti-spoofing from PF")
Fixes: 4cbc41efcbb2 ("net/i40e: set VF VLAN anti-spoofing from PF")
Fixes: c0ec14757c5f ("net/i40e: set VF unicast promiscuous mode from PF")
Fixes: ae57070ca8b7 ("net/i40e: set VF multicast promiscuous mode from PF")
Fixes: 83bb95e3fefc ("net/i40e: set VF VLAN insertion from PF")
Fixes: 61fff9b4c68b ("net/i40e: set VF broadcast mode from PF")
Fixes: c33abbc1440e ("net/i40e: set VF VLAN tag from PF")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/i40e: fix crash in close
Bernard Iremonger [Fri, 27 Jan 2017 10:22:47 +0000 (10:22 +0000)]
net/i40e: fix crash in close

Change the order of releasing the VSI's.
Release the VMDq VSI's first, then release the main VSI.

Fixes: 3cb446b4aeb2 ("i40e: free vmdq vsi when closing")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agonet/enic: fix MAC address add and remove
John Daley [Thu, 26 Jan 2017 20:12:12 +0000 (12:12 -0800)]
net/enic: fix MAC address add and remove

The mac_addr_add callback function was simply replacing the primary MAC
address instead of adding new ones and the mac_addr_remove callback would
only remove the primary MAC form the adapter. Fix the functions to add or
remove new address. Allow up to 64 MAC addresses per port.

Fixes: fefed3d1e62c ("enic: new driver")

Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Nelson Escobar <neescoba@cisco.com>
7 years agodrivers/net: make PCI device id struct const
Ferruh Yigit [Thu, 26 Jan 2017 14:07:44 +0000 (14:07 +0000)]
drivers/net: make PCI device id struct const

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
7 years agonet/cxgbe: remove unused variables
Emmanuel Roullit [Tue, 24 Jan 2017 20:48:58 +0000 (21:48 +0100)]
net/cxgbe: remove unused variables

Found with clang static analysis:
drivers/net/cxgbe/sge.c:900:3: warning:
Value stored to 'in_use' is never read
        in_use += q->size;
        ^         ~~~~~~~

Removing "in_use" variable makes "hw_cidx" variable unused, which is
removed too.

Fixes: 4a01078b4fd1 ("cxgbe: add Tx support")
Cc: stable@dpdk.org
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
7 years agonet/ixgbevf: fix max packet length
Yi Zhang [Wed, 14 Dec 2016 18:50:19 +0000 (02:50 +0800)]
net/ixgbevf: fix max packet length

Current ixgbevf driver get max_rx_pktlen = 15872, but in fact PF
supports 15872-byte jumbo frame and VF only supports 9728-byte jumbo
frame. If VF is running DPDK driver and set frame_size > 9728 ,PF
running kernel ixgbe driver will report an error and set VF failed.
This patch fixs DPDK ixgbevf driver to get correct jumbo frame size
of VF.

More datasheet references from Wei Dai:

In 82599 datasheet, there is an annotation in the chapter 1.3 Features
Summary (page 29)
 The 82599 supports full-size 15.5 KB (15872-byte) jumbo packets while
 in a basic mode of operation. When DCB mode is enabled,
 or security engines enabled or virtualization is enabled, the 82599
 supports 9.5 KB (9728-byte) jumbo packets.

In x540 datasheet, there is also an annotation in the chapter 1.3
Features Summary (page 13)
 The X540 and 82599 support full-size 15.5 KB jumbo packets while in a
 basic mode of operation. When DCB mode is enabled,
 or security engines enabled, or virtualization is enabled, or OS2BMC is
 enabled, then the X540 supports 9.5 KB jumbo packets.
 Packets to/from MC longer than 2KB are filtered out.

In x550 datasheet, there is still also an annotation in the chapter 1.4
Feature Summary (page 23)
 All the products support full-size 15.5 KB jumbo packets while in a
 basic mode of operation. When DCB mode is enabled, or security
 engines enabled, or virtualization is enabled, or OS2BMC is enabled,
 then only 9.5 KB jumbo packets are supported. Packets to/
 from the MC longer than 2 KB are filtered out.

Fixes: 2144f6630fca ("ixgbe: add redirection table size in device info")
Cc: stable@dpdk.org
Signed-off-by: Yi Zhang <zhang.yi75@zte.com.cn>
Acked-by: Wei Dai <wei.dai@intel.com>
7 years agonet/i40e: fix checksum flag in x86 vector Rx
Qi Zhang [Tue, 24 Jan 2017 19:06:59 +0000 (14:06 -0500)]
net/i40e: fix checksum flag in x86 vector Rx

When no error reported in Rx descriptor, we should set
CKSUM_GOOD flag before return.

Fixes: 9966a00a0688 ("net/i40e: enable bad checksum flags in vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
7 years agonet/bonding: remove useless assignment
Emmanuel Roullit [Tue, 24 Jan 2017 21:15:55 +0000 (22:15 +0100)]
net/bonding: remove useless assignment

Found with clang static analysis:
drivers/net/bonding/rte_eth_bond_pmd.c:903:3:
warning: Value stored to 'num_not_send' is never read
        num_not_send += slave_bufs_pkts[RTE_MAX_ETHPORTS] - num_send;
        ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 06fe78b98ccd ("bond: add mode 6")
Cc: stable@dpdk.org
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
7 years agonet/cxgbe/base: initialize variable before reading EEPROM
Emmanuel Roullit [Tue, 24 Jan 2017 20:48:57 +0000 (21:48 +0100)]
net/cxgbe/base: initialize variable before reading EEPROM

data value could have been garbage if VPD access timed out for VPD read
request could not been issued.

Found with clang static analysis:
drivers/net/cxgbe/base/t4_hw.c:1577:22:
warning: The left operand of '&' is a garbage value
        } while ((stats_reg & 0x1) && --max_poll);
                  ~~~~~~~~~ ^

Fixes: fe0bd9ee5da3 ("net/cxgbe: support EEPROM access")
Cc: stable@dpdk.org
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
7 years agonet/ena: prepare TSO offload calculation
Jakub Palider [Tue, 24 Jan 2017 14:22:53 +0000 (15:22 +0100)]
net/ena: prepare TSO offload calculation

While ENA can handle checksum calculations in almost all cases,
it cannot do so when DF bit in IPv4 header is not set,
that is DF=0, and TSO is requested. For that situation pseudo
header must be prepared manually.

Signed-off-by: Jakub Palider <jpa@semihalf.com>
7 years agonet/ixgbe: fix API parameter checking
Tiwei Bie [Tue, 24 Jan 2017 09:00:49 +0000 (17:00 +0800)]
net/ixgbe: fix API parameter checking

Add checks to rte_pmd_ixgbe_macsec_* APIs to ensure that the
port is an ixgbe port.

Fixes: b35d309710fe ("net/ixgbe: add MACsec offload")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
7 years agonet/ixgbe: return success when SFP is not present
Wei Dai [Tue, 24 Jan 2017 08:14:20 +0000 (16:14 +0800)]
net/ixgbe: return success when SFP is not present

Ignore the error=IXGBE_ERR_SFP_NOT_PRESENT when SFP is not present.
If it is not ignored, testpmd will fail during the NIC initialization
process.
Ixgbe kernel driver ignores this error and works well. So DPDK
does same thing.

Signed-off-by: Wei Dai <wei.dai@intel.com>
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
7 years agonet/bnx2x: fix Rx mode configuration
Rasesh Mody [Tue, 24 Jan 2017 05:38:33 +0000 (21:38 -0800)]
net/bnx2x: fix Rx mode configuration

Check if promisc mode was set when setting allmulti mode and vice-versa.
Introduced BNX2X_RX_MODE_ALLMULTI_PROMISC for the same. If check is
absent the filter configuration gets over written.

Fixes: 540a211084a7 ("bnx2x: driver core")
Fixes: 5dbc53d7e5a2 ("net/bnx2x: restrict Rx mask flags sent to the PF")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
7 years agonet/szedata2: fix device memory access
Matej Vido [Tue, 24 Jan 2017 10:49:52 +0000 (11:49 +0100)]
net/szedata2: fix device memory access

Fixes: 8acba705b119 ("net/szedata2: localize handling of PCI resources")

Signed-off-by: Matej Vido <vido@cesnet.cz>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
7 years agonet/i40e: fix deletion of all macvlan filters
Jingjing Wu [Mon, 23 Jan 2017 09:42:45 +0000 (17:42 +0800)]
net/i40e: fix deletion of all macvlan filters

filter_type is not set when removing all macvlan filters. It will
cause error when send AQ command to HW.
This patch fixes this issue.

Fixes: 4861cde46116 ("i40e: new poll mode driver")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agonet/i40e: fix validation when deleting MAC address
Jingjing Wu [Mon, 23 Jan 2017 09:42:44 +0000 (17:42 +0800)]
net/i40e: fix validation when deleting MAC address

When VF sends request to remove MAC address, PF host will check
if it is a non-zero or unicast address. When VF remove a multicast
address, it will report error.
This patch fixes this issue.

Fixes: ec852c94af39 ("net/i40e: enhance sanity check of MAC")
Cc: stable@dpdk.org
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
7 years agonet/qede/base: fix FreeBSD build
Rasesh Mody [Mon, 23 Jan 2017 05:02:38 +0000 (21:02 -0800)]
net/qede/base: fix FreeBSD build

This patch addresses compilation errors on FreeBSD with clang 3.8.0.

drivers/net/qede/base/ecore_cxt.c:1257:2: error:
     shifting a negative signed value is undefined
          SET_FIELD(cdu_params, CDUC_NCIB, elems_per_page);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/qede/base/ecore.h:82:27: note: expanded from macro 'SET_FIELD'
          (value) &= ~(name##_MASK << name##_SHIFT);
                    ~~~~~~~~~~~ ^

Fixes: ec94dbc57362 ("qede: add base driver")
Cc: stable@dpdk.org
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agonet/mlx5: fix memory leak when parsing device params
Shahaf Shuler [Sun, 22 Jan 2017 08:24:47 +0000 (10:24 +0200)]
net/mlx5: fix memory leak when parsing device params

in case of an error argument list is not freed.

Fixes: e72dd09b614e ("net/mlx5: add support for configuration through kvargs")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
7 years agodoc: add known uio_pci_generic issue for i40e
Jeff Guo [Sun, 22 Jan 2017 02:03:41 +0000 (10:03 +0800)]
doc: add known uio_pci_generic issue for i40e

When bind the "uio_pci_generic" module in X710/XL710/XXV710,
the result is failed. The "uio_pci_generic" module is not
supported by X710/XL710/XXV710.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
7 years agonet/sfc: fix TSO limits imposed to the number of Tx queues
Ivan Malov [Mon, 23 Jan 2017 11:06:15 +0000 (11:06 +0000)]
net/sfc: fix TSO limits imposed to the number of Tx queues

The number of Tx queues requested by the user must not be overridden;
instead, the limits imposed by TSO must be applied to the advertised
maximum

Fixes: fec33d5bb3eb ("net/sfc: support firmware-assisted TSO")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
7 years agonet/sfc: use eal I/O device memory barriers API
Andrew Rybchenko [Fri, 20 Jan 2017 13:53:51 +0000 (13:53 +0000)]
net/sfc: use eal I/O device memory barriers API

The previous version relied on the fact that DMA sync for device and
PIO write barrier in pair. Now each does its job.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agonet/sfc: use eal I/O device memory read/write API
Andrew Rybchenko [Fri, 20 Jan 2017 13:53:50 +0000 (13:53 +0000)]
net/sfc: use eal I/O device memory read/write API

Use relaxed version of these functions to guarantee no changes on
the step.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agonet/sfc: enable TSO by default
Andrew Rybchenko [Fri, 20 Jan 2017 15:22:56 +0000 (15:22 +0000)]
net/sfc: enable TSO by default

Remove RTE_LIBRTE_SFC_EFX_TSO config option since it is not
required any more:
 - unreasonable limit on number of Tx queues when TSO is not
   actually required should be solved using per-device parameter
 - performance difference with and without TSO compiled in is small

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
7 years agonet/sfc: do not panic if alarms are not supported
Andrew Rybchenko [Thu, 19 Jan 2017 11:12:20 +0000 (11:12 +0000)]
net/sfc: do not panic if alarms are not supported

Alarms are not supported on the FreeBSD.
Application must poll link status periodically itself using
rte_eth_link_get_nowait() to avoid management event queue overflow.

Fixes: 2de39f4e1310 ("net/sfc: periodic management EVQ polling using alarm")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
7 years agonet/mlx5: fix Rx packet validation and type
Nélio Laranjeiro [Fri, 20 Jan 2017 15:27:29 +0000 (16:27 +0100)]
net/mlx5: fix Rx packet validation and type

Rx checksum validation and packet type offloads are read from the wrong
location.

Fixes: 501505c5608a ("net/mlx: fix IPv4 and IPv6 packet type")
Fixes: 350f4c482e46 ("net/mlx5: fix Rx checksum macros")
Fixes: 6218063b39a6 ("net/mlx5: refactor Rx data path")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: fix flow API mark combined with drop
Nélio Laranjeiro [Fri, 20 Jan 2017 15:27:28 +0000 (16:27 +0100)]
net/mlx5: fix flow API mark combined with drop

Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")
Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: fix queue wrap-around of multi-packet send
Yongseok Koh [Wed, 18 Jan 2017 00:51:55 +0000 (16:51 -0800)]
net/mlx5: fix queue wrap-around of multi-packet send

When the WQ is wrapped around, it wrongly checks the condition when
resetting the pointer. It should be compared against the end of the queue,
not the beginning of the queue. And this isn't even needed when the length
of the copying data crosses the boundary.

Fixes: fdcb0f53053b ("net/mlx5: use work queue buffer as a raw buffer")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: increase RSS indirection table size limit
Yongseok Koh [Wed, 18 Jan 2017 00:39:29 +0000 (16:39 -0800)]
net/mlx5: increase RSS indirection table size limit

The size of Rx RSS indirection table was limited by 256, but it is not
required anymore for all Mellanox NICs. However, the librte_ether still
limits the size by 512.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/mlx5: add prefetching Rx completion queue
Yongseok Koh [Tue, 17 Jan 2017 02:09:40 +0000 (18:09 -0800)]
net/mlx5: add prefetching Rx completion queue

On receiving a compressed session of Rx completion, prefetch every entries
to be invalidated. Also, invalidate consumed completions per every 8
mini-completions, not to wait until the last entry is consumed. This helps
to reduce jitter in rx_burst.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
7 years agonet/i40e: fix Rx checksum flag
Xiao Wang [Thu, 19 Jan 2017 05:39:23 +0000 (21:39 -0800)]
net/i40e: fix Rx checksum flag

When no error reported in Rx descriptor, we should set CKSUM_GOOD flag
before return.

Fixes: b704f9071b09 ("net/i40e: implement new Rx checksum flag")
Cc: stable@dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
7 years agonet/ixgbe: fix blocked interrupts
Qi Zhang [Mon, 16 Jan 2017 19:23:52 +0000 (14:23 -0500)]
net/ixgbe: fix blocked interrupts

While handling link status change (LSC) interrupt, all interrupts are
blocked until delayed interrupt handler finishes.

The wait duration is at least one second and this may cause timeouts in
VF to PF mailbox.

Make sure only LSC interrupt is blocked while waiting for delayed
interrupt handler to finish.

Fixes: 0a45657a6794 ("pci: rework interrupt handling")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
7 years agonet/sfc: fix flow control settings on port start
Andrew Rybchenko [Thu, 12 Jan 2017 09:03:23 +0000 (09:03 +0000)]
net/sfc: fix flow control settings on port start

efx_phy_adv_cap_set() sets all advertised phy capabilities including
pause capabilities which are also configured using efx_mac_fcntl_set().

If we set speed and autonegotiation capabilities only, we should
preserve already configured pause capabilities.

Fixes: d23f3a89ab54 ("net/sfc: support link speed and duplex settings")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
7 years agonet/sfc: fix link status when port is not started
Andrew Rybchenko [Thu, 12 Jan 2017 09:03:22 +0000 (09:03 +0000)]
net/sfc: fix link status when port is not started

Fixes: 886f8d8a05bf ("net/sfc: retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
7 years agonet/sfc: synchronize link status with HW on start
Andrew Rybchenko [Thu, 12 Jan 2017 09:03:21 +0000 (09:03 +0000)]
net/sfc: synchronize link status with HW on start

Fixes: 886f8d8a05bf ("net/sfc: retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
7 years agonet/sfc: avoid usage of possibly uninitialized link mode
Andrew Rybchenko [Thu, 12 Jan 2017 09:03:20 +0000 (09:03 +0000)]
net/sfc: avoid usage of possibly uninitialized link mode

In fact efx_port_poll() always initializes it, but it isn't
explicitly documented feature of the API. Moreover, the API
annocation suggests that return code should be checked.

Fixes: 886f8d8a05bf ("net/sfc: retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
7 years agonet/virtio: optimize header reset on any layout
Yuanhan Liu [Wed, 11 Jan 2017 04:27:12 +0000 (12:27 +0800)]
net/virtio: optimize header reset on any layout

When any layout is used, the header is stored in the head room of mbuf.
mbuf is allocated and filled by user, means there is no gurateen the
header is all zero for non TSO case. Therefore, we have to do the reset
by ourself:

    memest(hdr, 0, head_size);

The memset has two impacts on performance:

- memset could not be inlined, which is a bit costly.
- more importantly, it touches the mbuf, which could introduce severe
  cache issues as described by former patch.

Similiary, we could do the same trick: reset just when necessary, when
the corresponding field is already 0, which is likely true for a simple
l2 forward case. It could boost the performance up to 20+% in micro
benchmarking.

Cc: stable@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agonet/virtio: fix performance regression due to TSO
Yuanhan Liu [Wed, 11 Jan 2017 04:27:11 +0000 (12:27 +0800)]
net/virtio: fix performance regression due to TSO

TSO is now enabled, but it's not actually being used by default in a
simple L2 forward mode. In such case, we have to zero the virtio net
headers, to inform the vhost backend that no offload is being used:

    hdr->csum_start = 0;
    hdr->csum_offset = 0;
    hdr->flags = 0;

    hdr->gso_type = 0;
    hdr->gso_size = 0;
    hdr->hdr_len = 0;

Such writes could be very costly; it introduces severe cache issues:
The above operations introduce cache write for each packet, which
stalls the read operation from the vhost backend.

The fact that virtio net header is initiated to zero in PMD driver
init stage means that these costly writes are unnecessary and could
be avoided:

    if (hdr->csum_start != 0)
        hdr->csum_start = 0;

And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the
performance drop introduced by TSO enabling is recovered: it could
be up to 20% in micro benchmarking.

Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload")
Fixes: 696573046e9e ("net/virtio: support TSO")
Cc: stable@dpdk.org
Cc: Olivier Matz <olivier.matz@6wind.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
7 years agonet/vhost: fix unix socket not removed as closing
Jianfeng Tan [Tue, 24 Jan 2017 08:37:38 +0000 (08:37 +0000)]
net/vhost: fix unix socket not removed as closing

The commit aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
moves rte_vhost_driver_register and rte_vhost_driver_unregister from
dev_start() and dev_stop() into driver's probe() and remove().

Apps, like testpmd, using vhost pmd in server mode, usually calls
dev_stop() and dev_close() as quitting, instead of driver-specific
remove(). Then those unix socket files have no chance to get removed.

Semantically, device-specific things should be put into device-specific
APIs. Fix this issue by moving rte_vhost_driver_unregister, plus other
structure free into dev_close().

Fixes: aed0b12930b3 ("net/vhost: fix socket file deleted on stop")
Cc: stable@dpdk.org
Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agovhost: remove unneeded variable assignment
Emmanuel Roullit [Tue, 24 Jan 2017 20:31:29 +0000 (21:31 +0100)]
vhost: remove unneeded variable assignment

Found with clang static analysis:
lib/librte_vhost/vhost_user.c:996:3: warning:
Value stored to 'ret' is never read
        ret = vhost_user_get_vring_base(dev, &msg.payload.state);
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agovhost: do not GSO when no header is present
Emmanuel Roullit [Tue, 24 Jan 2017 20:36:03 +0000 (21:36 +0100)]
vhost: do not GSO when no header is present

Found with clang static analysis:
lib/librte_vhost/virtio_net.c:723:17: warning:
Access to field 'data_off' results in a dereference of a null pointer
(loaded from variable 'tcp_hdr')
        m->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
                     ^~~~~~~~~~~~~~~~~

Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities")
Cc: stable@dpdk.org
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agonet/virtio-user: check value returned from malloc
Jianfeng Tan [Thu, 26 Jan 2017 03:05:42 +0000 (03:05 +0000)]
net/virtio-user: check value returned from malloc

Value returned from malloc is not checked for errors before being used.
This patch fixes following coverity issue.

    static struct vhost_memory_kernel *
    prepare_vhost_memory_kernel(void)
    {
        ...
        vm = malloc(sizeof(struct vhost_memory_kernel) +
                    max_regions *
                    sizeof(struct vhost_memory_region));
        ...
    >>>     CID 140744:    (NULL_RETURNS)
    >>>     Dereferencing a null pointer "vm".
                mr = &vm->regions[k++];

Coverity issue: 140744
Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
7 years agonet/virtio: fix crash when number of virtio devices > 1
Yuanhan Liu [Sun, 22 Jan 2017 08:47:00 +0000 (16:47 +0800)]
net/virtio: fix crash when number of virtio devices > 1

The vtpci_ops assignment needs the 'hw->port_id' as an input parameter.
That said, we should set 'hw->port_id' firstly, then do the vtpci_ops
assignment, while the code does reversely. That would result to a crash
when more than one virtio devices are used, because we keep assigning
proper vtpci_ops to virtio_hw_internal[0]->vtpci_ops, leaving the pointer
for other ports being NULL.

Reverse the order fixes this issue.

Fixes: 9470427c88e1 ("net/virtio: do not store PCI device pointer at shared memory")
Cc: stable@dpdk.org
Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: fix long stall of negotiation
Yuanhan Liu [Sun, 22 Jan 2017 08:46:59 +0000 (16:46 +0800)]
vhost: fix long stall of negotiation

Setting up the mapping from GPA (guest physical address) to HPA (guest
physical address) could be very time consuming when the guest memory is
backened with small pages (4K). The bigger the guest memory, the longer
it takes. This could lead a very long vhost-user negotiation.

Since the mapping is only needed in zero copy mode so far, we could
avoid such time consuming settup when zero copy is turned off (which is
the default case).

It's actually a workaround, a right fix might be to start a new thread,
and hide the big latency there.

Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")
Cc: stable@dpdk.org
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agovhost: fix dead loop in enqueue path
Yuanhan Liu [Sun, 22 Jan 2017 08:46:58 +0000 (16:46 +0800)]
vhost: fix dead loop in enqueue path

If a malicious guest forges a dead loop desc chain (let desc->next point
to itself) and desc->len is zero, this could lead to a dead loop in
copy_mbuf_to_desc(following is a simplified code to show this issue
clearly):

    while (mbuf_is_not_totally_consumed) {
        if (desc_avail == 0) {
            desc = &descs[desc->next];
            desc_avail = desc->len;
        }

        COPY(desc, mbuf, desc_avail);
    }

I have actually fixed a same issue before: commit a436f53ebfeb ("vhost:
avoid dead loop chain"); it fixes the dequeue path though, leaving the
enqueue path still vulnerable.

The fix is the same. Add a var nr_desc to avoid the dead loop.

Fixes: f1a519ad981c ("vhost: fix enqueue/dequeue to handle chained vring descriptors")
Cc: stable@dpdk.org
Reported-by: Xieming Katty <katty.xieming@huawei.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
7 years agocrypto/qat: make PCI device id struct const
Ferruh Yigit [Thu, 26 Jan 2017 14:07:42 +0000 (14:07 +0000)]
crypto/qat: make PCI device id struct const

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
7 years agodoc: describe new performance test application
Slawomir Mrozowicz [Wed, 25 Jan 2017 16:27:35 +0000 (17:27 +0100)]
doc: describe new performance test application

Add documentation to describe using the new performance test application.

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
7 years agoapp/crypto-perf: add test vectors files
Slawomir Mrozowicz [Wed, 25 Jan 2017 16:27:34 +0000 (17:27 +0100)]
app/crypto-perf: add test vectors files

Add test vectors example files to the performance test application.

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
7 years agoapp/crypto-perf: introduce performance test application
Slawomir Mrozowicz [Wed, 25 Jan 2017 16:27:33 +0000 (17:27 +0100)]
app/crypto-perf: introduce performance test application

This patchset introduce new application which allows measuring
performance parameters of PMDs available in crypto tree. The goal of
this application is to replace existing performance tests in app/test.
Parameters available are: throughput (--ptest throughput) and latency
(--ptest latency). User can use multiply cores to run tests on but only
one type of crypto PMD can be measured during single application
execution. Cipher parameters, type of device, type of operation and
chain mode have to be specified in the command line as application
parameters. These parameters are checked using device capabilities
structure.
Couple of new library functions in librte_cryptodev are introduced for
application use.
To build the application a CONFIG_RTE_APP_CRYPTO_PERF flag has to be set
(it is set by default).
Example of usage: -c 0xc0 --vdev crypto_aesni_mb_pmd -w 0000:00:00.0 --
--ptest throughput --devtype crypto_aesni_mb --optype cipher-then-auth
--cipher-algo aes-cbc --cipher-op encrypt --cipher-key-sz 16 --auth-algo
sha1-hmac --auth-op generate --auth-key-sz 64 --auth-digest-sz 12
--total-ops 10000000 --burst-sz 32 --buffer-sz 64

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com>
7 years agocryptodev: retrieve device info
Slawomir Mrozowicz [Wed, 25 Jan 2017 16:27:32 +0000 (17:27 +0100)]
cryptodev: retrieve device info

This patch adds helper functions for new performance application which
provide identifiers and number of crypto device and
provide and check capabilities available for defined device and algorithm.
The performance application can be used to measure throughput and latency
of cryptography operation performed by crypto device.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: add documentation
Fan Zhang [Tue, 24 Jan 2017 16:24:01 +0000 (16:24 +0000)]
crypto/scheduler: add documentation

Adds the description of the cryptodev scheduler PMD overview,
limitations, build, instructions, modes, etc.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: add unit test
Fan Zhang [Tue, 24 Jan 2017 16:24:00 +0000 (16:24 +0000)]
crypto/scheduler: add unit test

Same as other cryptodev PMDs, it is necessary to carry out the unit
test for scheduler PMD. Currently the test is designed to attach 2
AESNI-MB cryptodev PMDs as slaves, sets the scheduling mode as round-
robin, and runs almost all AESNI-MB test items (except for sessionless
tests). In the end, the slaves are detached.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: enable compilation
Fan Zhang [Tue, 24 Jan 2017 16:23:58 +0000 (16:23 +0000)]
crypto/scheduler: enable compilation

Adds Makefile for scheduler cryptodev PMD, and updates existing
Makefiles. Different than other cryptodev PMDs, scheduler PMD
is required to be built as shared libraries.

Adds scheduler PMD enable and debug flags to config/common_base.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: register operation functions
Fan Zhang [Tue, 24 Jan 2017 16:23:57 +0000 (16:23 +0000)]
crypto/scheduler: register operation functions

Implements all standard operations required for cryptodev,
and register them to cryptodev operation function pointer table.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: register as vdev driver
Fan Zhang [Tue, 24 Jan 2017 16:23:56 +0000 (16:23 +0000)]
crypto/scheduler: register as vdev driver

Adds crypto scheduler's PMD's probe and remove function and the device's
enqueue and dequeue burst functions. A cryptodev scheduler PMD is
then registered in the end.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
7 years agocrypto/scheduler: add round-robin mode
Fan Zhang [Tue, 24 Jan 2017 16:23:55 +0000 (16:23 +0000)]
crypto/scheduler: add round-robin mode

Implements round-robin scheduling mode and register into cryptodev
scheduler ops structure. This mode enqueues a burst of operation
to one of its slaves, and iterates the next burst to the other
slave. Same procedure is done on dequeueing operations.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>