dpdk.git
9 years agoeal/linux: fix build
Thomas Monjalon [Tue, 3 Mar 2015 08:37:54 +0000 (09:37 +0100)]
eal/linux: fix build

Compilation fails in some distributions because of missing unistd.h
needed for pread/pwrite (seen with Suse):
lib/librte_eal/linuxapp/eal/eal_pci_uio.c:62:2:
error: implicit declaration of function ‘pread’

Fixes: 4a499c649590 ("eal/linux: enable uio_pci_generic support")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agodevargs: fix null dereferencing on failure
Pawel Wodkowski [Mon, 2 Mar 2015 11:09:22 +0000 (12:09 +0100)]
devargs: fix null dereferencing on failure

On failure devargs->args should not be accessed if devargs is NULL.

Fixes: c07691ae1089 ("devargs: remove limit on parameters length")

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoeal: clean up export of socket id variable
Neil Horman [Fri, 27 Feb 2015 12:33:13 +0000 (07:33 -0500)]
eal: clean up export of socket id variable

Theres no need to export this variable.  Its set and queried from an API call
that doesn't exist in the hot path.  Instead just export the rte_socket_id
symbol and make the variable private to protect it from type changes.  We should
do this with the other exported variables too, but I think its too late in the
release cycle to do that.

tested using distributor_autotest (which uses rte_socket_id), successfully.
Only tested on linux, as I don't currently have a bsd system spun up, but the
changes are symmetric, and should be fine

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoi40e: advertise TSO capability
Jijiang Liu [Thu, 26 Feb 2015 03:37:24 +0000 (11:37 +0800)]
i40e: advertise TSO capability

Advertise the DEV_TX_OFFLOAD_TCP_TSO flag in the PMD features. It means
that the i40e PMD supports the offload of TSO.

Test report: http://www.dpdk.org/ml/archives/dev/2015-March/014467.html

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Miroslaw Walukiewicz <miroslaw.walukiewicz@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Min Cao <min.cao@intel.com>
9 years agoi40e: enable TSO support
Jijiang Liu [Thu, 26 Feb 2015 03:37:23 +0000 (11:37 +0800)]
i40e: enable TSO support

This patch enables i40e TSO feature for both non-tunneling packet and
tunneling packet.

Test report: http://www.dpdk.org/ml/archives/dev/2015-March/014467.html

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Miroslaw Walukiewicz <miroslaw.walukiewicz@intel.com>
Signed-off-by: Grzegorz Galkowski <grzegorz.galkowski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Min Cao <min.cao@intel.com>
9 years agoi40e: move Tx offloads parameters to separate structure
Jijiang Liu [Thu, 26 Feb 2015 03:37:22 +0000 (11:37 +0800)]
i40e: move Tx offloads parameters to separate structure

The structure size is u64 so it could be used with single cpu operation.

Test report: http://www.dpdk.org/ml/archives/dev/2015-March/014467.html

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Signed-off-by: Miroslaw Walukiewicz <miroslaw.walukiewicz@intel.com>
Signed-off-by: Grzegorz Galkowski <grzegorz.galkowski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Min Cao <min.cao@intel.com>
9 years agoapp/testpmd: fix crash when portmask is specified
Tetsuya Mukawa [Fri, 27 Feb 2015 07:16:15 +0000 (16:16 +0900)]
app/testpmd: fix crash when portmask is specified

If testpmd is invoked with portmask option like below, segmentation
fault will occur. This patch fixes the issue.

Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agonull: fix build with gcc-4.7
Tetsuya Mukawa [Fri, 27 Feb 2015 05:18:18 +0000 (14:18 +0900)]
null: fix build with gcc-4.7

This patch fixes following errors with gcc-4.7.
 lib/librte_pmd_null/rte_eth_null.c:302:28:
     error: array subscript is above array bounds

Reported-by: John McNamara <john.mcnamara@intel.com>
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: John McNamara <john.mcnamara@intel.com>
9 years agonull: fix build with icc
Tetsuya Mukawa [Fri, 27 Feb 2015 05:19:35 +0000 (14:19 +0900)]
null: fix build with icc

This patch fixes following errors with icc.
 rte_eth_null.c(47): error #83:
     type qualifier specified more than once

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: John McNamara <john.mcnamara@intel.com>
9 years agoethdev: fix build with icc
Tetsuya Mukawa [Fri, 27 Feb 2015 05:20:34 +0000 (14:20 +0900)]
ethdev: fix build with icc

This patch fixes following errors with icc.
  error #188: enumerated type mixed with another type
    return -1;

Fixes: 92d94d3744d7 ("ethdev: attach or detach port")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: John McNamara <john.mcnamara@intel.com>
9 years agovirtio: fix build on freebsd
Changchun Ouyang [Fri, 27 Feb 2015 02:30:10 +0000 (10:30 +0800)]
virtio: fix build on freebsd

This patch fixes the compilation issue on freebsd:
lib/librte_pmd_virtio/virtio_ethdev.c: In function 'virtio_resource_init':
lib/librte_pmd_virtio/virtio_ethdev.c:1071:56: error: unused parameter 'pci_dev' [-Werror=unused-parameter]

Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource")

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
9 years agomlx4: fix build
Thomas Monjalon [Thu, 26 Feb 2015 16:56:34 +0000 (17:56 +0100)]
mlx4: fix build

There was a missing change due by hotplug integration.

Fixes: 9f1653e7b7e1 ("ethdev: add device type")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomlx4: remove old version compatibility
Thomas Monjalon [Thu, 26 Feb 2015 16:52:40 +0000 (17:52 +0100)]
mlx4: remove old version compatibility

No need to check DPDK version. It just has to work on HEAD.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: fix build without hotplug
Thomas Monjalon [Thu, 26 Feb 2015 10:46:52 +0000 (11:46 +0100)]
ethdev: fix build without hotplug

After setting CONFIG_RTE_LIBRTE_EAL_HOTPLUG=n, GCC stop compiling:
rte_ethdev.c:430:1: error: ‘rte_eth_dev_get_device_type’ defined but not used
rte_ethdev.c:438:1: error: ‘rte_eth_dev_save’ defined but not used
rte_ethdev.c:450:1: error: ‘rte_eth_dev_get_changed_port’ defined but not used
rte_ethdev.c:464:1: error: ‘rte_eth_dev_get_addr_by_port’ defined but not used
rte_ethdev.c:481:1: error: ‘rte_eth_dev_get_name_by_port’ defined but not used
rte_ethdev.c:503:1: error: ‘rte_eth_dev_is_detachable’ defined but not used

The hotplug option allows to build in environment (BSD) not yet
supported by this new feature.
It should be removed when BSD will be supported.
Waiting this day, let's fix build with hotplug disabled.

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoversion: 2.0.0-rc1
Thomas Monjalon [Wed, 25 Feb 2015 23:41:57 +0000 (00:41 +0100)]
version: 2.0.0-rc1

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agonull: support port hotplug
Tetsuya Mukawa [Mon, 23 Feb 2015 05:12:35 +0000 (14:12 +0900)]
null: support port hotplug

This patch adds port hotplug support to Null PMD.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agonull: new poll mode driver
Tetsuya Mukawa [Mon, 23 Feb 2015 05:12:34 +0000 (14:12 +0900)]
null: new poll mode driver

Null PMD is a driver of the virtual device particularly designed to measure
performance of DPDK PMDs. When an application call rx, Null PMD just allocates
mbufs and returns those. Also tx, the PMD just frees mbufs.

The PMD has following options.
- size: specify packe size allocated by RX. Default packet size is 64.
- copy: specify 1 or 0 to enable or disable copy while RX and TX.
Default value is 0(disabled).
This option is used for emulating more realistic data transfer.
Copy size is equal to packet size.

To use the PMD, enable CONFIG_RTE_BUILD_SHARED_LIB in config file. Then
compile the PMD as shared library. The library can be linked using '-d'
option when an application invokes.

Here is an example.
$ sudo ./testpmd -c f -n 4 -d librte_pmd_null.so \
--vdev 'eth_null0' --vdev 'eth_null1' -- -i --no-flush-rx

If testpmd is compiled with CONFIG_RTE_BUILD_SHARED_LIB, it may need to
specify more libraries using '-d' option.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agoapp/testpmd: support port hotplug
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:29 +0000 (04:32 +0900)]
app/testpmd: support port hotplug

The patch introduces following commands.
- port attach [ident]
- port detach [port_id]
 - attach: attaching a port
 - detach: detaching a port
 - ident: pci address of physical device.
          Or device name and parameters of virtual device.
         (ex. 0000:02:00.0, eth_pcap0,iface=eth0)
 - port_id: port identifier

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agopcap: support port hotplug
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:28 +0000 (04:32 +0900)]
pcap: support port hotplug

This patch adds finalization code to free resources allocated by the
PMD.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: add port hotplug framework in programmers guide
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:27 +0000 (04:32 +0900)]
doc: add port hotplug framework in programmers guide

This patch adds a new section for describing port hotplug framework.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agoethdev: attach or detach port
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:26 +0000 (04:32 +0900)]
ethdev: attach or detach port

These functions are used for attaching or detaching a port.
When rte_eth_dev_attach() is called, the function tries to realize the
device name as pci address. If this is done successfully,
rte_eth_dev_attach() will attach physical device port. If not, attaches
virtual devive port.
When rte_eth_dev_detach() is called, the function gets the device type
of this port to know whether the port is come from physical or virtual.
And then specific detaching function will be called.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agoethdev: add device type
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:24 +0000 (04:32 +0900)]
ethdev: add device type

This new parameter is needed to keep device type like PCI or virtual.
Port detaching processes are different between PCI device and virtual
device.
RTE_ETH_DEV_PCI indicates device type is PCI. RTE_ETH_DEV_VIRTUAL
indicates device is virtual.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agoethdev: close device
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:21 +0000 (04:32 +0900)]
ethdev: close device

The patch adds function pointer to rte_pci_driver and eth_driver
structure. These function pointers are used when ports are detached.
Also, the patch adds rte_eth_dev_uninit(). So far, it's not called
by anywhere, but it will be called when port hotplug function is
implemented.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agoethdev: release port
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:20 +0000 (04:32 +0900)]
ethdev: release port

This patch adds rte_eth_dev_release_port(). The function is used for
changing an attached status of the device that has specified name.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agoethdev: remove assumption that port will not be detached
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:18 +0000 (04:32 +0900)]
ethdev: remove assumption that port will not be detached

To remove assumption, do like followings.

This patch adds "RTE_PCI_DRV_DETACHABLE" to drv_flags of rte_pci_driver
structure. The flags indicate the driver can detach devices at runtime.
Also, remove assumption that port will not be detached.

To remove the assumption.
- Add 'attached' member to rte_eth_dev structure.
  This member is used for indicating the port is attached, or not.
  DEV_ATTACHED indicates a port is attached.
  DEV_DETACHED indicates a port is detached.
- Add rte_eth_dev_allocate_new_port().
  This function is used for allocating new port.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: add vdev init and uninit
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:25 +0000 (04:32 +0900)]
eal: add vdev init and uninit

The patch adds following functions.
- rte_eal_vdev_init();
- rte_eal_vdev_uninit();
- rte_eal_parse_devargs_str().
These functions are used for driver initialization and finalization.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agopci: probe or close device
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:23 +0000 (04:32 +0900)]
pci: probe or close device

- Add pci_close_all_drivers()
  The function tries to find a driver for the specified device, and
  then close the driver.
- Add rte_eal_pci_probe_one() and rte_eal_pci_close_one()
  The functions are used for probe and close a device.
  First the function tries to find a device that has the specified
  PCI address. Then, probe or close the device.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agopci: unmap igb_uio resources
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:22 +0000 (04:32 +0900)]
pci: unmap igb_uio resources

The patch adds functions for unmapping igb_uio resources. The patch is only
for Linux and igb_uio environment. VFIO and BSD are not supported.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agopci: consolidate address comparisons
Tetsuya Mukawa [Wed, 25 Feb 2015 19:32:19 +0000 (04:32 +0900)]
pci: consolidate address comparisons

This patch replaces pci_addr_comparison() and memcmp() of pci addresses by
rte_eal_compare_pci_addr().

To compare PCI addresses, rte_eal_compare_pci_addr() doesn't use memcmp().
This is because sizeof(struct rte_pci_addr) returns 6, but actually
this structure is like below.

struct rte_pci_addr {
        uint16_t domain;                /**< Device domain */
        uint8_t bus;                    /**< Device bus */
        uint8_t devid;                  /**< Device ID */
        uint8_t function;               /**< Device function. */
};

If the structure is dynamically allocated in a function without bzero,
last 1 byte may have value. As a result, memcmp may not work.
To avoid such a case, rte_eal_compare_pci_addr() compare following values.

        dev_addr = (addr->domain << 24) | (addr->bus << 16) |
                                (addr->devid << 8) | addr->function;

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agopci: select memory mapping from driver type
Michael Qiu [Wed, 25 Feb 2015 19:32:17 +0000 (04:32 +0900)]
pci: select memory mapping from driver type

With the driver type flag in struct rte_pci_dev, we do not need
to always map uio devices with vfio related function when
vfio enabled.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agopci: add kernel driver type
Michael Qiu [Wed, 25 Feb 2015 19:32:16 +0000 (04:32 +0900)]
pci: add kernel driver type

Currently, dpdk has no ability to know which type of driver(
vfio-pci/igb_uio/uio_pci_generic) the device used. It only can
check whether vfio is enabled or not statically.

It really useful to have the flag, because different type need to
handle differently in runtime. For example, pci memory map,
pot hotplug, and so on.

This patch add a flag field for pci device to solve above issue.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agoixgbe: fix build with gcc 5
Panu Matilainen [Tue, 24 Feb 2015 13:13:43 +0000 (15:13 +0200)]
ixgbe: fix build with gcc 5

gcc 5 supports a new logical-not-parentheses warning which
ixgbe_common.c triggers, causing build failure with -Werror.
Since this source must not be modified, silence the warning instead.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoapp/test: add crc32 algorithms equivalence check
Yerden Zhumabekov [Wed, 25 Feb 2015 12:34:06 +0000 (18:34 +0600)]
app/test: add crc32 algorithms equivalence check

New function test_crc32_hash_alg_equiv() checks whether software,
4-byte operand and 8-byte operand versions of CRC32 hash function
implementations return the same result value.

Signed-off-by: Yerden Zhumabekov <e_zhumabekov@sts.kz>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agodoc: add mlx4 driver
Adrien Mazarguil [Wed, 25 Feb 2015 13:52:06 +0000 (14:52 +0100)]
doc: add mlx4 driver

This documentation covers implementation details, features and limitations,
configuration, prerequisites and provides a usage example.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agomlx4: new poll mode driver
Adrien Mazarguil [Wed, 25 Feb 2015 13:52:05 +0000 (14:52 +0100)]
mlx4: new poll mode driver

This PMD manages all variants of Mellanox ConnectX-3 (EN 40, EN 10, Pro EN
40) as well as their virtual functions in SR-IOV context through IB Verbs
(libibverbs) and the dedicated user-space driver (libmlx4).

It is disabled by default due to dependencies on these libraries and only
supports Linux userland at the moment partly because /sys (sysfs) support is
required.

Also claim responsibility in the MAINTAINERS file.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Olga Shern <olgas@mellanox.com>
9 years agoscripts: check features to generate configuration header
Adrien Mazarguil [Wed, 25 Feb 2015 13:52:04 +0000 (14:52 +0100)]
scripts: check features to generate configuration header

This script looks for types, macros and functions in header files using
compilation options found in the environment (CC, CFLAGS, CPPFLAGS) to
define feature macros in a generated header.

Useful in combination with external headers that do not provide such macros.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
9 years agoeal/x86: optimize memcpy for SSE and AVX
Zhihong Wang [Thu, 29 Jan 2015 02:38:47 +0000 (10:38 +0800)]
eal/x86: optimize memcpy for SSE and AVX

Main code changes:

1. Differentiate architectural features based on CPU flags
    a. Implement separated move functions for SSE/AVX/AVX2 to make full utilization of cache bandwidth
    b. Implement separated copy flow specifically optimized for target architecture

2. Rewrite the memcpy function "rte_memcpy"
    a. Add store aligning
    b. Add load aligning based on architectural features
    c. Put block copy loop into inline move functions for better control of instruction order
    d. Eliminate unnecessary MOVs

3. Rewrite the inline move functions
    a. Add move functions for unaligned load cases
    b. Change instruction order in copy loops for better pipeline utilization
    c. Use intrinsics instead of assembly code

4. Remove slow glibc call for constant copies

Test report: http://dpdk.org/ml/archives/dev/2015-January/011848.html

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Tested-by: Jingguo Fu <jingguox.fu@intel.com>
Reviewed-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoapp/test: extend memcpy test coverage
Zhihong Wang [Thu, 29 Jan 2015 02:38:46 +0000 (10:38 +0800)]
app/test: extend memcpy test coverage

Main code changes:
1. Added more typical data points for a thorough performance test
2. Added unaligned test cases since it's common in DPDK usage

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoapp/test: remove unnecessary memcpy test cases
Zhihong Wang [Thu, 29 Jan 2015 02:38:45 +0000 (10:38 +0800)]
app/test: remove unnecessary memcpy test cases

Removed unnecessary test cases for base move functions
since the function "func_test" covers them all.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoapp/test: disable variable tracking assignment for memcpy
Zhihong Wang [Thu, 29 Jan 2015 02:38:44 +0000 (10:38 +0800)]
app/test: disable variable tracking assignment for memcpy

VTA is for debugging only, it increases compile time and binary size,
especially when there're a lot of inlines.
So disable it since memcpy test contains a lot of inline calls.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agotimer: fix reset return value
Robert Sanford [Wed, 25 Feb 2015 04:09:49 +0000 (23:09 -0500)]
timer: fix reset return value

- API rte_timer_reset() should return -1 when the timer is in the
RUNNING or CONFIG state. Instead, it ignores the return value of
internal function __rte_timer_reset() and always returns 0.
We change rte_timer_reset() to return the value returned by
__rte_timer_reset().

- Enhance timer stress test 2 to report how many timer reset
collisions occur, i.e., how many times rte_timer_reset() fails
due to a timer being in the CONFIG state.

Signed-off-by: Robert Sanford <rsanford2@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agotimer: fix stress test on multiple runs
Robert Sanford [Wed, 25 Feb 2015 04:09:48 +0000 (23:09 -0500)]
timer: fix stress test on multiple runs

Fix timer stress test to succeed on multiple runs.

Signed-off-by: Robert Sanford <rsanford2@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agotimer: pause in reset sync
Robert Sanford [Wed, 25 Feb 2015 04:09:47 +0000 (23:09 -0500)]
timer: pause in reset sync

In rte_timer_reset_sync(), insert rte_pause() into loop that waits
for rte_timer_reset() to succeed.

Signed-off-by: Robert Sanford <rsanford2@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agoexamples/l2fwd-jobstats: add new example
Pawel Wodkowski [Tue, 24 Feb 2015 16:33:24 +0000 (17:33 +0100)]
examples/l2fwd-jobstats: add new example

This app demonstrate usage of new rte_jobstats library.
It is basically the orginal l2fwd with following modifications to met
library requirements:
- main_loop() was split into two jobs: forward job and flush job. Logic
for those jobs is almost the same as in original application.
- stats is moved to rte_alarm callback to not introduce overhead of
printing.
- stats are expanded to show rte_jobstats statistics.
- added new parameter '-l' to automatic thousands separator.

Comparing original l2fwd and l2fwd-jobstats apps will show approach what
is needed to properly write own application with rte_jobstats
measurements.

New available statistics:
- Total and % of fwd and flush execution time
- management time - overhead of rte_timer + overhead of rte_jobstats
library
- Idle time and % of time spent waiting for fwd or flush to be ready to
execute.
- per job execution time and period.

Fixes: 2caeb8c0141d ("examples/l2fwd-jobstats: new example")
[Thomas: files were missing in the previous commit]

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoeal: fix missing symbol in version map
Cunming Liang [Wed, 25 Feb 2015 03:39:48 +0000 (11:39 +0800)]
eal: fix missing symbol in version map

As per_lcore__socket_id and rte_sys_gettid are missing in version map,
it causes compiling error when CONFIG_RTE_BUILD_SHARED_LIB is enabled.

Fixes: ef76436c6834 ("eal: get unique thread id")
Fixes: 9e29251b2afa ("eal: thread affinity API")

Reported-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: John McNamara <john.mcnamara@intel.com>
9 years agodoc: update programmers guide for uio_pci_generic
Bruce Richardson [Tue, 24 Feb 2015 16:27:40 +0000 (16:27 +0000)]
doc: update programmers guide for uio_pci_generic

Since DPDK now has support for the in-tree uio_pci_generic driver,
update the programmers guide document to reference this module, and to use it
in preference to the igb_uio driver, which is DPDK-specific.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agodoc: update linux guide for uio_pci_generic use
Bruce Richardson [Tue, 24 Feb 2015 16:27:39 +0000 (16:27 +0000)]
doc: update linux guide for uio_pci_generic use

Since DPDK now has support for the in-tree uio_pci_generic driver,
update the GSG document to reference this module, and to use it
in preference to the igb_uio driver, which is DPDK-specific.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoeal/linux: remove unnecessary check for primary instance
Bruce Richardson [Tue, 24 Feb 2015 13:30:47 +0000 (13:30 +0000)]
eal/linux: remove unnecessary check for primary instance

In pci_uio_map_resource we check that we are in a primary process
before calling pci_uio_set_bus_master. However, there is already
an earlier check which means that we are always in a primary instance
at this point in the code, so the check can be removed.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoeal/linux: populate uio maps from pci resources array
Bruce Richardson [Tue, 24 Feb 2015 13:30:46 +0000 (13:30 +0000)]
eal/linux: populate uio maps from pci resources array

Rather than scanning the resource file in sysfs a second time, we
can pull the information on physical addresses of BARs from the
pci resource information already present in the dev structure.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoeal/linux: mmap uio resources using resourceX files
Bruce Richardson [Tue, 24 Feb 2015 13:30:45 +0000 (13:30 +0000)]
eal/linux: mmap uio resources using resourceX files

Instead of distinguishing the BAR mappings via offset within a single
file, originally /dev/uioX, switch to mapping each individual bar via
the appropriately numbered resourceX file.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agomaintainers: claim responsibility for jobstats library and example
Pawel Wodkowski [Tue, 24 Feb 2015 16:33:25 +0000 (17:33 +0100)]
maintainers: claim responsibility for jobstats library and example

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoexamples/l2fwd-jobstats: new example
Pawel Wodkowski [Tue, 24 Feb 2015 16:33:24 +0000 (17:33 +0100)]
examples/l2fwd-jobstats: new example

This app demonstrate usage of new rte_jobstats library.
It is basically the orginal l2fwd with following modifications to met
library requirements:
- main_loop() was split into two jobs: forward job and flush job. Logic
for those jobs is almost the same as in original application.
- stats is moved to rte_alarm callback to not introduce overhead of
printing.
- stats are expanded to show rte_jobstats statistics.
- added new parameter '-l' to automatic thousands separator.

Comparing original l2fwd and l2fwd-jobstats apps will show approach what
is needed to properly write own application with rte_jobstats
measurements.

New available statistics:
- Total and % of fwd and flush execution time
- management time - overhead of rte_timer + overhead of rte_jobstats
library
- Idle time and % of time spent waiting for fwd or flush to be ready to
execute.
- per job execution time and period.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agojobstats: new library
Pawel Wodkowski [Tue, 24 Feb 2015 16:33:23 +0000 (17:33 +0100)]
jobstats: new library

This library provide API to measure time spend in particular parts of
code and to calculate optimal polling time.

To calculate a those statistics application code need to be divided into
parts (called jobs) that do something. It is up to application to decide
what is considered a job.

Series of jobs must be surrounded with the rte_jobstats_context_start()
and rte_jobstats_context_finish() calls. After that, jobs might be
started.  Each job must be surrounded with rte_jobstats_start() and
rte_jobstats_finish() calls.

After job finishes its execution, period in which it should be called
again is adjusted. It might be used to minimize time wasted on
unnecessary polls/calls. Adjustment is based on data provided by job
itself (ex: number of packets it processed).

After all jobs in serie are executed fallowing statistics are updated
and might be used by application. Statistics can be reset. Some of
provided statistic data:
 - total/min/max execution - time spent in executing jobs.
 - total/min/max management - time spent outside execution area. This
value might be used to measure overhead of scheduling jobs. This time
also contains overhead of rte_jobstats library itself.
 - number of loops that executed at least one job
 - executed jobs
 - time when statistics were reset.

Each job provide total/min/max execution time and execution count
statistics.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoapp/test: fix missing NULL pointer checks
Daniel Mrzyglod [Tue, 27 Jan 2015 15:44:53 +0000 (16:44 +0100)]
app/test: fix missing NULL pointer checks

In test_sched, we are missing NULL pointer checks after create_mempool()
and rte_pktmbuf_alloc(). Add in these checks using TEST_ASSERT_NOT_NULL macros.

VERIFY macro was removed and replaced by standard test ASSERTS from "test.h" header.
This provides additional information to track when the failure occurred.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
9 years agodevargs: restore empty devargs
David Marchand [Tue, 24 Feb 2015 09:41:31 +0000 (10:41 +0100)]
devargs: restore empty devargs

Following commit c07691ae1089, an implicit change has been done in the
devargs API.
This triggers problem in virtual pmds that did not check for parameters
validity as it was implicitely valid.

Fix this by restoring the empty argument as "" and add a note in the api.
Restore associated tests.

Fixes: c07691ae1089 ("devargs: remove limit on parameters length")

Reported-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agodoc: new eal multi-pthread feature
Cunming Liang [Mon, 16 Feb 2015 07:34:10 +0000 (15:34 +0800)]
doc: new eal multi-pthread feature

The patch add the multi-pthread section under EAL chapter of prog_guide.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
9 years agoring: add optional yield to avoid spin forever
Cunming Liang [Tue, 17 Feb 2015 02:08:15 +0000 (10:08 +0800)]
ring: add optional yield to avoid spin forever

Add a sched_yield() syscall if the thread spins for too long,
waiting other thread to finish its operations on the ring.
That gives pre-empted thread a chance to proceed and finish
with ring enqueue/dequeue operation.
The purpose is to reduce contention on the ring.
By ring_perf_test, it doesn't shows additional perf penalty.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoring: support non-EAL thread
Cunming Liang [Tue, 17 Feb 2015 02:08:14 +0000 (10:08 +0800)]
ring: support non-EAL thread

ring debug stat won't take care non-EAL thread.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agomempool: support non-EAL thread
Cunming Liang [Tue, 17 Feb 2015 02:08:13 +0000 (10:08 +0800)]
mempool: support non-EAL thread

For non-EAL thread, bypass per lcore cache, directly use ring pool.
It allows using rte_mempool in either EAL thread or any user pthread.
As in non-EAL thread, it directly rely on rte_ring and it's none preemptive.
It doesn't suggest to run multi-pthread/cpu which compete the rte_mempool.
It will get bad performance and has critical risk if scheduling policy is RT.
Haven't found significant performance decrease by mempool_perf_test.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agotimer: support non-EAL thread
Cunming Liang [Tue, 17 Feb 2015 02:08:16 +0000 (10:08 +0800)]
timer: support non-EAL thread

Allow to setup timers only for EAL (lcore) threads (__lcore_id < MAX_LCORE_ID).
E.g. – dynamically created thread will be able to reset/stop timer for lcore thread,
but it will be not allowed to setup timer for itself or another non-lcore thread.
rte_timer_manage() for non-lcore thread would simply do nothing and return straightway.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agospinlock: support non-EAL thread
Cunming Liang [Tue, 17 Feb 2015 02:08:12 +0000 (10:08 +0800)]
spinlock: support non-EAL thread

In non-EAL thread, lcore_id always be LCORE_ID_ANY.
It can't be used as unique id for recursive spinlock.
Then use rte_gettid() to replace it.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agolog: support non-EAL thread
Cunming Liang [Tue, 17 Feb 2015 02:08:10 +0000 (10:08 +0800)]
log: support non-EAL thread

For those non-EAL thread, *_lcore_id* is invalid and probably larger than RTE_MAX_LCORE.
The patch adds the check and allows only EAL thread using EAL per thread log level and log type.
Others shares the global log level.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: initialize lcore and socket id
Cunming Liang [Tue, 17 Feb 2015 02:08:11 +0000 (10:08 +0800)]
eal: initialize lcore and socket id

Set _lcore_id and _socket_id to (-1) by default.
For those non EAL thread, _lcore_id shall always be LCORE_ID_ANY.
The libraries using _lcore_id as index need to take care.
_socket_id always be SOCKET_ID_ANY until the thread changes the affinity
by rte_thread_set_affinity().

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agomalloc: avoid unknown socket id
Cunming Liang [Tue, 17 Feb 2015 02:08:09 +0000 (10:08 +0800)]
malloc: avoid unknown socket id

Add check for rte_socket_id(), avoid get unexpected return like (-1).
By using rte_malloc_socket(), socket id is assigned by socket_arg.
If socket_arg set to SOCKET_ID_ANY, it expects to use the socket id to which the current cores belongs.
As the thread may affinity on a cpuset, the cores in the cpuset may belongs to different NUMA nodes.
The value of _socket_id probably be SOCKET_ID_ANY(-1), the case is not expected in origin malloc_get_numa_socket().

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: apply thread affinity by assigned cpuset
Cunming Liang [Tue, 17 Feb 2015 02:08:07 +0000 (10:08 +0800)]
eal: apply thread affinity by assigned cpuset

EAL threads use assigned cpuset to set core affinity during startup.
It keeps 1:1 mapping, if no '--lcores' option is used.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: thread affinity API
Cunming Liang [Tue, 17 Feb 2015 02:08:03 +0000 (10:08 +0800)]
eal: thread affinity API

1. add two TLS *_socket_id* and *_cpuset*
2. add one internal API, eal_cpu_socket_id/eal_thread_dump_affinity
3. add two public API, rte_thread_set/get_affinity
4. update EAL version map for EAL public API

The API works for both EAL thread and non EAL thread.
When calling rte_thread_set_affinity, the *_socket_id* and
*_cpuset* of calling thread will be updated if the thread
successfully set the cpu affinity.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: get unique thread id
Cunming Liang [Tue, 17 Feb 2015 02:08:06 +0000 (10:08 +0800)]
eal: get unique thread id

The rte_gettid() wraps the linux and freebsd syscall gettid().
It provides a persistent unique thread id for the calling thread.
It will save the unique id in TLS on the first time.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: get socket id from cpu id
Cunming Liang [Tue, 17 Feb 2015 02:08:02 +0000 (10:08 +0800)]
eal: get socket id from cpu id

It defines eal_cpu_socket_id() which exposing the origin private cpu_socket_id().
The function is only used inside EAL. It returns socket_id of the specified cpu_id.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: fix strnlen return value with icc
Cunming Liang [Tue, 17 Feb 2015 02:08:01 +0000 (10:08 +0800)]
eal: fix strnlen return value with icc

The problem is that strnlen() here may return invalid value with 32bit icc.
(actually it returns it’s second parameter,e.g: sysconf(_SC_ARG_MAX)).
It starts to manifest hwen max_len parameter is > 2M and using icc –m32 –O2 (or above).

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoapp/test: add unit tests for --lcores option
Cunming Liang [Sun, 15 Feb 2015 05:47:31 +0000 (13:47 +0800)]
app/test: add unit tests for --lcores option

The patch add unit test for the new eal option "--lcores".

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
9 years agoeal: new option --lcores for cpu assignment
Cunming Liang [Tue, 17 Feb 2015 02:08:00 +0000 (10:08 +0800)]
eal: new option --lcores for cpu assignment

It supports one new eal long option '--lcores' for EAL thread cpuset assignment.

The format pattern:
--lcores='<lcores[@cpus]>[<,lcores[@cpus]>...]'
lcores, cpus could be a single digit/range or a group.
'(' and ')' are necessary if it's a group.
If not supply '@cpus', the value of cpus uses the same as lcores.

e.g. '1,2@(5-7),(3-5)@(0,2),(0,6),7-8' means starting 9 EAL thread as below
  lcore 0 runs on cpuset 0x41 (cpu 0,6)
  lcore 1 runs on cpuset 0x2 (cpu 1)
  lcore 2 runs on cpuset 0xe0 (cpu 5,6,7)
  lcore 3,4,5 runs on cpuset 0x5 (cpu 0,2)
  lcore 6 runs on cpuset 0x41 (cpu 0,6)
  lcore 7 runs on cpuset 0x80 (cpu 7)
  lcore 8 runs on cpuset 0x100 (cpu 8)

Test report: http://dpdk.org/ml/archives/dev/2015-February/013383.html

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Qun Wan <qun.wan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal: add cpuset into lcore config
Cunming Liang [Tue, 17 Feb 2015 02:07:58 +0000 (10:07 +0800)]
eal: add cpuset into lcore config

The patch adds 'cpuset' into per-lcore configure 'lcore_config[]',
as the lcore no longer always 1:1 pinning with physical cpu.
The lcore now stands for a EAL thread rather than a logical cpu.

It doesn't change the default behavior of 1:1 mapping, but allows to
affinity the EAL thread to multiple cpus.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoenic: fix bsd namespace conflict
Cunming Liang [Tue, 17 Feb 2015 02:08:08 +0000 (10:08 +0800)]
enic: fix bsd namespace conflict

Some macros already been defined by freebsd 'sys/param.h'.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal/bsd: fix namespace conflict
Cunming Liang [Tue, 17 Feb 2015 02:07:59 +0000 (10:07 +0800)]
eal/bsd: fix namespace conflict

Fix namespace with EAL prefix.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoeal/bsd: standardize init sequence between linux and bsd
Cunming Liang [Tue, 17 Feb 2015 02:08:05 +0000 (10:08 +0800)]
eal/bsd: standardize init sequence between linux and bsd

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agomaintainers: claim VFIO and IVSHMEM
Anatoly Burakov [Tue, 24 Feb 2015 11:19:18 +0000 (11:19 +0000)]
maintainers: claim VFIO and IVSHMEM

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: fix build with Debian/Ubuntu-specific gcc version
Panu Matilainen [Tue, 24 Feb 2015 10:46:56 +0000 (12:46 +0200)]
mk: fix build with Debian/Ubuntu-specific gcc version

Commit 71f0ab1849b4fc3ca928deb566df12ca725ed150 broke compilation
on some versions of Debian and Ubuntu where gcc has been modified
to only emit MAJOR.MINOR part of the version from 'gcc -dumpversion'.
Drop the micro-version from gcc version comparisons to work around
this, it wasn't being used for anything anyway.

Fixes: 71f0ab1849b4 ("mk: rework gcc version detection to permit versions newer than 4.x")

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoeal: add help option
Thomas Monjalon [Thu, 29 Jan 2015 16:51:17 +0000 (17:51 +0100)]
eal: add help option

Help is printed with -h or --help.

Help is also printed for an unknown option.
This was broken since the rework of options.

Fixes: 489a9d6c9f77 ("merge bsd and linux common options parsing")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoeal: sort and align options lists
Thomas Monjalon [Thu, 29 Jan 2015 16:42:31 +0000 (17:42 +0100)]
eal: sort and align options lists

Options listing in usage help was a mess.
The main usage line is fixed and shorter.
The options in usage output are logically sorted (cpu/mem/dev/proc),
aligned and lightly reworded.
The options in declarations are alphabetically sorted.
Code in swith statement is not moved.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agodoc: describe ACL memory size build parameter
Konstantin Ananyev [Wed, 18 Feb 2015 16:28:51 +0000 (16:28 +0000)]
doc: describe ACL memory size build parameter

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Siobhan Butler <siobhan.a.butler@intel.com>
9 years agodoc: describe ACL classification methods
Konstantin Ananyev [Wed, 18 Feb 2015 16:28:50 +0000 (16:28 +0000)]
doc: describe ACL classification methods

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Siobhan Butler <siobhan.a.butler@intel.com>
9 years agodoc: add restrictions for ACL rule fields
Konstantin Ananyev [Wed, 18 Feb 2015 16:28:49 +0000 (16:28 +0000)]
doc: add restrictions for ACL rule fields

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Siobhan Butler <siobhan.a.butler@intel.com>
9 years agoenic: change probe log message level
Stephen Hemminger [Sat, 14 Feb 2015 15:32:59 +0000 (10:32 -0500)]
enic: change probe log message level

Drivers should be silent on boot.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoenic: replace use of printf with log
Stephen Hemminger [Sat, 14 Feb 2015 15:32:58 +0000 (10:32 -0500)]
enic: replace use of printf with log

Device driver should log via DPDK log, not to printf which is
sends to /dev/null in a daemon application.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: include rte_log.h]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: rework gcc version detection to permit versions newer than 4.x
Panu Matilainen [Mon, 23 Feb 2015 14:53:56 +0000 (16:53 +0200)]
mk: rework gcc version detection to permit versions newer than 4.x

Separately comparing major and minor versions becomes seriously clumsy
when with major version changes, convert the entire version string into
a numeric value (ie 4.6.0 becomes 460 and 5.0.0 becomes 500) and use
that for comparisons, eliminate unnecessary negations while at it.
This makes the comparisons simpler, more obvious and makes gcc 5.0
naturally recognized at least as capable as newest 4.x.

This three-digit scheme would run into trouble if gcc ever went to
two-digit version segments, but that hasn't happened in the last 10+
years so it seems like a safe assumption.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbe: remove unused function causing error with clang
Keith Wiles [Mon, 23 Feb 2015 18:24:43 +0000 (12:24 -0600)]
ixgbe: remove unused function causing error with clang

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agofm10k: fix clang warning flags
Jeff Shaw [Wed, 18 Feb 2015 17:57:43 +0000 (09:57 -0800)]
fm10k: fix clang warning flags

This commit fixes the following error which was reported when
compiling with clang by removing the option.

error: unknown warning option '-Wno-unused-but-set-variable'

Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
9 years agofm10k: fix build with unused debug function
Jeff Shaw [Wed, 18 Feb 2015 18:07:40 +0000 (10:07 -0800)]
fm10k: fix build with unused debug function

This commit fixes the following error which was reported when
compiling with clang by moving the function inside an
RTE_LIBRTE_FM10K_DEBUG_RX ifdef block.

error: unused function 'dump_rxd'

Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
9 years agoexamples/packet_ordering: move creation of reorder buffer
Sergio Gonzalez Monroy [Fri, 20 Feb 2015 12:10:53 +0000 (12:10 +0000)]
examples/packet_ordering: move creation of reorder buffer

There was no error checking after calling rte_reorder_create.
Move the creation of the reorder buffer before launching threads
in case of memory error.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agombuf: fix a couple of doxygen comments
Sergio Gonzalez Monroy [Fri, 20 Feb 2015 12:10:52 +0000 (12:10 +0000)]
mbuf: fix a couple of doxygen comments

Fix a couple of doxygen comments in mbuf structure:
 - seqn had no doxygen syntax.
 - usr was not generating proper link to function.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agodoc: add reorder api to doxygen
Sergio Gonzalez Monroy [Fri, 20 Feb 2015 12:10:51 +0000 (12:10 +0000)]
doc: add reorder api to doxygen

Add missing reorder lirbary directory to doxygen configuration.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agolib: fix C++11 compilation
Stefan Puiu [Fri, 20 Feb 2015 13:23:26 +0000 (15:23 +0200)]
lib: fix C++11 compilation

In C++11 concatenated string literals need to have a space in between.
Found with clang++-3.4, IIRC g++-4.8 also complains about this.

Sample error message:
error: invalid suffix on literal; C++11 requires a space between literal
and identifier [-Wreserved-user-defined-literal]

Signed-off-by: Stefan Puiu <stefan.puiu@gmail.com>
Reviewed-by: John McNamara <john.mcnamara@intel.com>
9 years agokni: optimize Rx burst
Hemant Agrawal [Wed, 23 Jul 2014 06:45:12 +0000 (12:15 +0530)]
kni: optimize Rx burst

The current implementation of rte_kni_rx_burst polls the fifo for buffers.
Irrespective of success or failure, it allocates the mbuf and try to put them into the alloc_q
if the buffers are not added to alloc_q, it frees them.
This waste lots of cpu cycles in allocating and freeing the buffers if alloc_q is full.

The logic has been changed to:
1. Initially allocand add buffer(burstsize) to alloc_q
2. Add buffers to alloc_q only when you are pulling out the buffers.

Signed-off-by: Hemant Agrawal <hemant@freescale.com>
Reviewed-by: Jay Rolette <rolette@infiniteio.com>
9 years agolpm: fix overflow issue
Igor Ryzhov [Fri, 20 Feb 2015 13:16:46 +0000 (16:16 +0300)]
lpm: fix overflow issue

LPM table overflow may occur if table is full and added rule has
the biggest depth that already have some rules.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agopipeline: fix port meta for non-default entries
Ildar Mustafin [Sat, 21 Feb 2015 08:31:21 +0000 (11:31 +0300)]
pipeline: fix port meta for non-default entries

Signed-off-by: Ildar Mustafin <imustafin@bk.ru>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
9 years agovhost: support dynamically registering server
Huawei Xie [Mon, 23 Feb 2015 17:36:33 +0000 (17:36 +0000)]
vhost: support dynamically registering server

* support calling rte_vhost_driver_register after rte_vhost_driver_session_start
* add mutext to protect fdset from concurrent access
* add busy flag in fdentry. this flag is set before cb and cleared after cb is finished.

mutex lock scenario in vhost:

* event_dispatch(in rte_vhost_driver_session_start) runs in a separate thread, infinitely
processing vhost messages through cb(callback).
* event_dispatch acquires the lock, get the cb and its context, mark the busy flag,
and releases the mutex.
* vserver_new_vq_conn cb calls fdset_add, which acquires the mutex and add new fd into fdset.
* vserver_message_handler cb frees data context, marks remove flag to request to delete
connfd(connection fd) from fdset.
* after cb returns, event_dispatch
  1. clears busy flag.
  2. if there is remove request, call fdset_del, which acquires mutex, checks busy flag, and
removes connfd from fdset.
* rte_vhost_driver_unregister(not implemented) runs in another thread, acquires the mutex,
calls fdset_del to remove fd(listenerfd) from fdset. Then it could free data context.

The above steps ensures fd data context isn't freed when cb is using.

VM(s) should have been shutdown before rte_vhost_driver_unregister.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agovhost: support ifname for vhost-user
Huawei Xie [Mon, 23 Feb 2015 17:36:32 +0000 (17:36 +0000)]
vhost: support ifname for vhost-user

for vhost-cuse, ifname is the name of the tap device
for vhost-user, ifname is the name of the unix domain socket path

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Signed-off-by: Przemyslaw Czesnowicz <przemyslaw.czesnowicz@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agovhost: support vhost-user
Huawei Xie [Mon, 23 Feb 2015 17:36:31 +0000 (17:36 +0000)]
vhost: support vhost-user

In rte_vhost_driver_register(), vhost unix domain socket listener fd is created
and added to polled(based on select) fdset.

In rte_vhost_driver_session_start(), fds in the fdset are checked for
processing. If there is new connection from qemu, connection fd accepted is
added to polled fdset. The listener and connection fds in the fdset are
then both checked. When there is message on the connection fd, its
callback vserver_message_handler is called to process vhost-user messages.

To support identifying which virtio is from which guest VM, we could call
rte_vhost_driver_register with different socket path. Virtio devices from
same VM will connect to VM specific socket. The socket path information is
stored in the virtio_net structure.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Signed-off-by: Przemyslaw Czesnowicz <przemyslaw.czesnowicz@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agovhost: add select based event driven processing
Huawei Xie [Mon, 23 Feb 2015 17:36:30 +0000 (17:36 +0000)]
vhost: add select based event driven processing

for more generic event driven processing, refer to:
http://libevent.org/

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Tetsuya Mukawa <mukawa@igel.co.jp>
9 years agovhost: implement cuse memory table
Huawei Xie [Mon, 23 Feb 2015 17:36:29 +0000 (17:36 +0000)]
vhost: implement cuse memory table

remove set_memory_table ops

vhost-cuse or vhost-user will both implement their own set_memory_region handler.

In current vhost-cuse implementation, guest numa memory isn't supported.
Assume that guest memory is backed by only one file.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Signed-off-by: Przemyslaw Czesnowicz <przemyslaw.czesnowicz@intel.com>