dpdk.git
10 years agoi40e/base: fix build with gcc < 4.4
Helin Zhang [Mon, 13 Oct 2014 07:18:19 +0000 (15:18 +0800)]
i40e/base: fix build with gcc < 4.4

It fixes the compile error as below on gcc version 4.3.4.
cc1: error: unrecognized command line option "-Wno-unused-but-set-variable"

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Zhaochen Zhan <zhaochen.zhan@intel.com>
10 years agovirtio: fix needed vring entry number
Ouyang Changchun [Wed, 15 Oct 2014 03:11:00 +0000 (11:11 +0800)]
virtio: fix needed vring entry number

Fix one issue in virtio TX: it needs one more vring descriptor to hold the virtio
header when transmitting packets, it is used later to determine whether to free
more entries from used vring.
It fixes failing to transmit any packet with 1 segment in the circumstance of only
1 descriptor in the vring free list.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
10 years agovhost: add in doc
Thomas Monjalon [Mon, 13 Oct 2014 17:22:45 +0000 (19:22 +0200)]
vhost: add in doc

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agovhost: add makefile
Huawei Xie [Wed, 8 Oct 2014 18:54:59 +0000 (02:54 +0800)]
vhost: add makefile

vhost lib is turned off by default.
vhost lib is based on cuse, which requires fuse development package
to be installed.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: fix build dependencies]

10 years agovhost: comment identified issues
Huawei Xie [Wed, 8 Oct 2014 18:54:58 +0000 (02:54 +0800)]
vhost: comment identified issues

1) FIXME: concurrent calls to vhost set mem table from different guests
could cause mem_temp to be overrided.
2) TODO: cmpset cost quite some cpu cyles. Allow app to disable this
feature if there is no contention in real workload.
3) FIXME: fix scatter gather mbuf copy to vhost vring chained buffers.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: coding style fixes
Huawei Xie [Wed, 8 Oct 2014 18:54:57 +0000 (02:54 +0800)]
vhost: coding style fixes

Fix serious coding style issues reported by checkpatch.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: static variable fixes
Huawei Xie [Wed, 8 Oct 2014 18:54:55 +0000 (02:54 +0800)]
vhost: static variable fixes

Add "static" for some variable definitions.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: clean includes
Huawei Xie [Wed, 8 Oct 2014 18:54:54 +0000 (02:54 +0800)]
vhost: clean includes

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: add debug print
Huawei Xie [Wed, 8 Oct 2014 18:54:52 +0000 (02:54 +0800)]
vhost: add debug print

Define PRINT_PACKET and LOG_DEBUG macros.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: add private context field
Huawei Xie [Wed, 8 Oct 2014 18:54:56 +0000 (02:54 +0800)]
vhost: add private context field

priv field could be used to store application specific context.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: supported features
Huawei Xie [Wed, 8 Oct 2014 18:54:53 +0000 (02:54 +0800)]
vhost: supported features

VHOST_SUPPORTED_FEATURES is the feature mask that vhost lib supports.
VHOST_FEATURES is the feature mask vhost currently supports after some features are turned on/off.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agovhost: allow to enable or disable features
Huawei Xie [Wed, 8 Oct 2014 18:54:51 +0000 (02:54 +0800)]
vhost: allow to enable or disable features

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agovhost: get available vring entries
Huawei Xie [Wed, 8 Oct 2014 18:54:51 +0000 (02:54 +0800)]
vhost: get available vring entries

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agovhost: rename ops registering function
Huawei Xie [Wed, 8 Oct 2014 18:54:50 +0000 (02:54 +0800)]
vhost: rename ops registering function

Rename init_virtio_net as rte_vhost_callback_register API.
rte_vhost_callback_register register the callbacks called when a
vhost device is created and ready to be added to data processing core
or is de-actived by guest.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: expose register and start functions
Huawei Xie [Wed, 8 Oct 2014 18:54:49 +0000 (02:54 +0800)]
vhost: expose register and start functions

Rename register_cuse_device as rte_vhost_driver_register API.
Rename start_session_loop as rte_vhost_driver_session_start API.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: get internal ops when registering
Huawei Xie [Wed, 8 Oct 2014 18:54:48 +0000 (02:54 +0800)]
vhost: get internal ops when registering

vhost_net_device_ops is internal implementation in vhost lib.
register_cuse_device will be vhost driver register API.
There is no need for it to know the internal vhost ops.
Instead, that ops is retrieved in register_cuse_device
through get_virtio_net_callbacks.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: remove index parameter
Huawei Xie [Wed, 8 Oct 2014 18:54:47 +0000 (02:54 +0800)]
vhost: remove index parameter

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: enqueue/dequeue burst
Huawei Xie [Wed, 8 Oct 2014 18:54:45 +0000 (02:54 +0800)]
vhost: enqueue/dequeue burst

rte_vhost_enqueue_burst copies host packets to guest.
rte_vhost_enqueue_burst will call virtio_dev_rx and virtio_dev_merge_rx
respectively depending on whether merge-able feature is negotiated or not
in the vhost device.

virtio_dev_merge_tx is renamed to rte_vhost_dequeue_burst.
rte_vhost_dequeue_burst gets to-be-sent packets from guest.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: merged patches]

10 years agovhost: add queue id parameter
Huawei Xie [Wed, 8 Oct 2014 18:54:43 +0000 (02:54 +0800)]
vhost: add queue id parameter

queue_id parameter is added to Rx/Tx functions for multiple queue support
in future.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: calculate mbuf size
Huawei Xie [Wed, 8 Oct 2014 18:54:42 +0000 (02:54 +0800)]
vhost: calculate mbuf size

As a lib, we have no idea the app defined mbuf size.
This patch will calculate mbuf size dynamically.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: return packets to upper layer
Huawei Xie [Wed, 8 Oct 2014 18:54:41 +0000 (02:54 +0800)]
vhost: return packets to upper layer

This patch makes virtio_dev_merge_tx return the received packets to app layer.
Previously virtio_tx_route was called to route these packets and then free them.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: move address translation function
Huawei Xie [Wed, 8 Oct 2014 18:54:51 +0000 (02:54 +0800)]
vhost: move address translation function

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split from a previous patch]

10 years agovhost: move internal structure
Huawei Xie [Wed, 8 Oct 2014 18:54:46 +0000 (02:54 +0800)]
vhost: move internal structure

The structure virtio_net_config_ll is moved to virtio_net.c.
It is related to internal virtio device management,
so it should not be exposed to other files.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: remove retry logic
Huawei Xie [Wed, 8 Oct 2014 18:54:40 +0000 (02:54 +0800)]
vhost: remove retry logic

It was used to wait some time and retry when there are not enough descriptors.
App could implement this policy easily if it needs.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: remove zero copy memory region generation logic
Huawei Xie [Wed, 8 Oct 2014 18:54:39 +0000 (02:54 +0800)]
vhost: remove zero copy memory region generation logic

Currently zero copy feature isn't generic as it couples closely with nic.
It isn't put in the vhost lib in this version.
gpa(guest physical address) to hpa(host physical address) mapping region
logic is removed.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: remove switching related logics
Huawei Xie [Wed, 8 Oct 2014 18:54:38 +0000 (02:54 +0800)]
vhost: remove switching related logics

The following logics will be moved to vhost example:
 1. mac learning, which is used to learn the mac address from the first
transmitted packet of guest and bind the vhost device to a queue in a
pool of VMDQ.
 2. VMDQ mac/vlan filter: Each pool the vhost device is bind to is
assigned a mac/vlan filter.
 3. num_devices is used to specify the maximum vhost devices the nic supports.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovhost: remove useless code for Rx/Tx
Huawei Xie [Wed, 8 Oct 2014 18:54:37 +0000 (02:54 +0800)]
vhost: remove useless code for Rx/Tx

Remove all other codes and only keep virtio_dev_rx, copy_from_mbuf_to_vring,
virtio_dev_merge_rx, virtio_dev_merge_tx.

Previous vhost merge-able feature introduces another version of tx function,
virtio_dev_merge_tx. Actually it is not related to merge-able feature but is
the fix for memcpy between mbuf and vring descriptors.
This lib will create the tx functions based on virtio_dev_merge_tx.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: do not remove code used or moved later]

10 years agovhost: move from examples to dedicated library
Huawei Xie [Wed, 8 Oct 2014 18:54:35 +0000 (02:54 +0800)]
vhost: move from examples to dedicated library

Those files will be refactored in subsequent patches to form user space
vhost library.
Makefile and main.h are removed.
main.c is renamed to vhost_rxtx.c and will provide vring enqueue/dequeue API.
virtio-net.h is renamed to rte_virtio_net.h which is the API header file.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: remove from examples Makefile and merge file renaming]

10 years agotools: fix setup script for Fedora 21
Daniel Mrzyglod [Fri, 10 Oct 2014 10:08:08 +0000 (11:08 +0100)]
tools: fix setup script for Fedora 21

script was expecting /lib/modules/$(uname -r)/kernel/drivers/uio/uio.ko
but in fedora 21 there are Compressed kernel modules - xz (LZMA)

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
10 years agomempool: remove useless variable
Keith Wiles [Thu, 9 Oct 2014 20:02:28 +0000 (15:02 -0500)]
mempool: remove useless variable

Remove n_orig variable as it is not required.

Signed-off-by: Keith Wiles <keith.wiles@windriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoixgbe/base: disable some gcc warnings
Ouyang Changchun [Thu, 9 Oct 2014 07:27:59 +0000 (15:27 +0800)]
ixgbe/base: disable some gcc warnings

This patch disables compilation complain from lower GCC version (less than 4.6).

Note: Only supported versions of GCC are 4.x.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoexamples: use factorized default Rx/Tx configuration
Pablo de Lara [Wed, 1 Oct 2014 09:49:05 +0000 (10:49 +0100)]
examples: use factorized default Rx/Tx configuration

For apps that were using default rte_eth_rxconf and rte_eth_txconf
structures, these have been removed and now they are obtained by
calling rte_eth_dev_info_get, just before setting up RX/TX queues.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
10 years agoi40e: set default Rx/Tx configuration
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
i40e: set default Rx/Tx configuration

Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]

10 years agoixgbe: set default Rx/Tx configuration
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
ixgbe: set default Rx/Tx configuration

Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]

10 years agoigb: set default Rx/Tx configuration
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
igb: set default Rx/Tx configuration

Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]

10 years agoethdev: get default Rx/Tx configuration from dev info
Pablo de Lara [Wed, 1 Oct 2014 09:49:04 +0000 (10:49 +0100)]
ethdev: get default Rx/Tx configuration from dev info

Many sample apps use duplicated code to set rte_eth_txconf and rte_eth_rxconf
structures. This patch allows the user to get a default optimal RX/TX configuration
through rte_eth_dev_info get, and still any parameters may be tweaked as wished,
before setting up queues.

Besides, if a NULL pointer is passed to rte_eth_rx_queue_setup or
rte_eth_tx_queue_setup, these functions get internally the default RX/TX
configuration for the user.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
[Thomas: split patch]

10 years agoethdev: reset whole dev info structure before filling
Pablo de Lara [Wed, 1 Oct 2014 09:49:03 +0000 (10:49 +0100)]
ethdev: reset whole dev info structure before filling

To guarantee that RX/TX configuration structures are reseted
before modifying them, plus the other dev info fields,
dev info structure is zeroed beforehand.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
10 years agoexamples/netmap_compat: add default build target
Pablo de Lara [Wed, 1 Oct 2014 22:42:56 +0000 (23:42 +0100)]
examples/netmap_compat: add default build target

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoapp/testpmd: print message if queue start/stop is not supported
Nicolás Pernas Maradei [Sat, 4 Oct 2014 19:19:51 +0000 (20:19 +0100)]
app/testpmd: print message if queue start/stop is not supported

Print an error message to the user when trying to start/stop a rx/tx queue and
this function is not supported by the PMD driver. The patch does not check if
the return value is -EINVAL because testpmd is already validating the port and
queue id.

Signed-off-by: Nicolás Pernas Maradei <nico@emutex.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agopcap: fix double stop error
Nicolás Pernas Maradei [Sat, 4 Oct 2014 22:24:17 +0000 (23:24 +0100)]
pcap: fix double stop error

librte_pmd_pcap driver was opening the pcap/interfaces only at init time and
closing them only when the port was being stopped. This behaviour would cause
problems (leading to segfault) if the user closed the port 2 times. The first
time the pcap/interfaces would be normally closed but libpcap would throw an
error causing a segfault if the closed pcaps/interfaces were closed again.
This behaviour is solved by re-openning pcaps/interfaces when the port is
started (only if these weren't open already for example at init time).

Signed-off-by: Nicolás Pernas Maradei <nico@emutex.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
10 years agoi40e: fix Tx descriptors reset
Jim Harris [Wed, 1 Oct 2014 22:00:21 +0000 (15:00 -0700)]
i40e: fix Tx descriptors reset

Fix the descriptor initialization loop, so that it initializes
the i40e_tx_desc::cmd_type_offset_bsz for the correct index
into the tx_ring array.

Previously it would use the index once to initialize the txd
local variable, then again when setting cmd_type_offset_bsz.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
10 years agoixgbe: fix build with bypass enabled
Pablo de Lara [Wed, 1 Oct 2014 22:27:25 +0000 (23:27 +0100)]
ixgbe: fix build with bypass enabled

Since commit aae1047905621 ("use the right debug macro"),
DEBUGOUT was replaced by PMD_DRV_LOG which requires at least
2 arguments. But the level argument was missing.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agomempool: fix build with debug enabled and clang
Keith Wiles [Sun, 5 Oct 2014 06:16:22 +0000 (01:16 -0500)]
mempool: fix build with debug enabled and clang

When enabling RTE_LIBRTE_MEMPOOL_DEBUG and compiling with clang
compiler an error occurs, because ifdefed code includes push/pop pragmas.

Signed-off-by: Keith Wiles <keith.wiles@windriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoeal/bsd: fix core detection
David Marchand [Wed, 8 Oct 2014 08:43:31 +0000 (10:43 +0200)]
eal/bsd: fix core detection

Following "options parsing" patchset (commit d7cb626f and 489a9d6c), core
detection is not working correctly on bsd.

./x86_64-native-bsdapp-gcc/app/test -c f -n 4 -- -i
[...]
EAL: lcore 0 unavailable
EAL: invalid coremask

Align bsd to linux:
- commit f563a372 "eal: fix recording of detected/enabled logical cores"
- commit 4f04db8b "eal: check coremask against detected lcores"

Reported-by: Zhan, Zhaochen <zhaochen.zhan@intel.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Zhaochen Zhan <zhaochen.zhan@intel.com>
10 years agombuf: comment for ctrl mbuf flag
Bruce Richardson [Fri, 3 Oct 2014 15:36:52 +0000 (16:36 +0100)]
mbuf: comment for ctrl mbuf flag

Add in a doxygen comment for the ctrl mbuf flag definition.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agombuf: update Rx flag format
Bruce Richardson [Fri, 3 Oct 2014 15:36:51 +0000 (16:36 +0100)]
mbuf: update Rx flag format

Update the format of the RX flags to match that of the TX flags. In
general the flags are now specified as "1ULL << X", with a few
exceptions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agombuf: group Tx flags near end of field
Bruce Richardson [Fri, 3 Oct 2014 15:36:50 +0000 (16:36 +0100)]
mbuf: group Tx flags near end of field

This patch takes the existing TX flags defined for the mbuf and shifts
each uniquely defined one left so that additional RX flags can be
defined without having RX and TX flags mixed together. Under the new
scheme, RX flags start at bit 0 and work left, TX flags start at bit 55
and work right, and bits 56-63 are reserved for generic mbuf use, not
for offloads.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoapp/testpmd: change rxfreet default to 32
Bruce Richardson [Tue, 23 Sep 2014 11:08:15 +0000 (12:08 +0100)]
app/testpmd: change rxfreet default to 32

To improve performance by using bulk alloc or vectored RX routines, we
need to set rx free threshold (rxfreet) value to 32, so make this the
testpmd default.

Thirty-two is the minimum setting needed to enable either the
bulk alloc or vector RX routines inside the ixgbe driver, so it's
best made the default for that reason. Please see
"check_rx_burst_bulk_alloc_preconditions()" in ixgbe_rxtx.c, and
RX function assignment logic in "ixgbe_dev_rx_queue_setup()" in
the same file.

The difference in IO performance for testpmd when called without any
optional parameters, and using 10G NICs using the ixgbe driver, can be
significant - approx 25% or more.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
10 years agoixgbe: add prefetch to improve slow-path tx perf
Bruce Richardson [Tue, 23 Sep 2014 11:08:14 +0000 (12:08 +0100)]
ixgbe: add prefetch to improve slow-path tx perf

Make a small improvement to slow path TX performance by adding in a
prefetch for the second mbuf cache line.
Also move assignment of l2/l3 length values only when needed.

What I've done with the prefetches is two-fold:
1) changed it from prefetching the mbuf (first cache line) to prefetching
the mbuf pool pointer (second cache line) so that when we go to access
the pool pointer to free transmitted mbufs we don't get a cache miss. When
clearing the ring and freeing mbufs, the pool pointer is the only mbuf
field used, so we don't need that first cache line.
2) changed the code to prefetch earlier - in effect to prefetch one mbuf
ahead. The original code prefetched the mbuf to be freed as soon as it
started processing the mbuf to replace it. Instead now, every time we
calculate what the next mbuf position is going to be we prefetch the mbuf
in that position (i.e. the mbuf pool pointer we are going to free the mbuf
to), even while we are still updating the previous mbuf slot on the ring.
This gives the prefetch much more time to resolve and get the data we need
in the cache before we need it.

In terms of performance difference, a quick sanity test using testpmd
on a Xeon (Sandy Bridge uarch) platform showed performance increases
between approx 8-18%, depending on the particular RX path used in
conjuntion with this TX path code.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
10 years agombuf: switch vlan_tci and reserved2 fields
Bruce Richardson [Tue, 23 Sep 2014 11:08:17 +0000 (12:08 +0100)]
mbuf: switch vlan_tci and reserved2 fields

Move the vlan_tci field up by two bytes in the mbuf data structure. This
has two effects:
* Ensures the the ixgbe vector driver places the vlan tag in the correct
  place in the mbuf.
* Allows a second vlan tag field, if one is added in the future, to be
  placed after the existing vlan field, rather than before.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
10 years agombuf: add userdata pointer field
Bruce Richardson [Tue, 23 Sep 2014 11:08:16 +0000 (12:08 +0100)]
mbuf: add userdata pointer field

While some applications may store metadata about packets in the packet
mbuf headroom, this is not a workable solution for packet metadata which
is either:
* larger than the headroom (or headroom is needed for adding pkt headers)
* needs to be shared or copied among packets

To support these use cases in applications, we reserve a general
"userdata" pointer field inside the second cache-line of the mbuf. This
is better than having the application store the pointer to the external
metadata in the packet headroom, as it saves an additional cache-line
from being used.

Apart from storing metadata, this field also provides a general 8-byte
scratch space inside the mbuf for any other application uses that are
applicable.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
10 years agombuf: ensure next pointer is set to null on free
Bruce Richardson [Tue, 23 Sep 2014 11:08:13 +0000 (12:08 +0100)]
mbuf: ensure next pointer is set to null on free

The receive functions for packets do not modify the next pointer so
the next pointer should always be cleared on mbuf free, just in case.
The slow-path TX needs to clear it, and the standard mbuf free function
also needs to clear it. Fast path TX does not handle chained mbufs so
is unaffected

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
10 years agoi40e/base: fix arq_event_info struct
Helin Zhang [Tue, 9 Sep 2014 07:21:38 +0000 (15:21 +0800)]
i40e/base: fix arq_event_info struct

Overloading the 'msg_size' field in the 'arq_event_info' struct
is a bad idea. It leads to bugs when the structure is used in a
loop, since the input value (buffer size) is overwritten by the
output value (actual message length). The fix introduces one
more field of 'buf_len' for the buffer size, and renames the
field of 'msg_size' to 'msg_len' for the real message size.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: debug write register request
Helin Zhang [Tue, 9 Sep 2014 07:21:35 +0000 (15:21 +0800)]
i40e/base: debug write register request

The firmware api request of writes to hardware registers should be
exposed to driver. The new API of 'i40e_aq_debug_write_register'
is introduced for that.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: support 10G base T
Helin Zhang [Tue, 9 Sep 2014 07:21:34 +0000 (15:21 +0800)]
i40e/base: support 10G base T

10G base T type support is added.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: get link status to report flow control settings
Helin Zhang [Tue, 9 Sep 2014 07:21:37 +0000 (15:21 +0800)]
i40e/base: get link status to report flow control settings

The fix is to use get_link_status but not get_phy_capabilities
for reporting FC settings.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: workaround for firmware version
Helin Zhang [Tue, 9 Sep 2014 07:21:36 +0000 (15:21 +0800)]
i40e/base: workaround for firmware version

The workaround helps fix the API if the FW is 4.2 or later.
In addition, an unreachable 'break' statement has been removed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: get rid of sparse warnings
Helin Zhang [Tue, 9 Sep 2014 07:21:31 +0000 (15:21 +0800)]
i40e/base: get rid of sparse warnings

There are variables that represent values in little endian.
Adding prefix of '__Le' can remove warnings during sparse
checks. In addition, remove some unreachable 'break' statements,
and add 'UL' on a couple of constants.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: force a shifted bit to be unsigned
Helin Zhang [Tue, 9 Sep 2014 07:21:29 +0000 (15:21 +0800)]
i40e/base: force a shifted bit to be unsigned

Force a shifted '1' to be 'unsigned' to avoid shifting a signed int.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: remove code for TPH
Helin Zhang [Tue, 9 Sep 2014 07:21:33 +0000 (15:21 +0800)]
i40e/base: remove code for TPH

The code wrapped in '#ifdef I40E_TPH_SUPPORT' was added
to check if 'TPH' (TLP Processing Hints) is supported, and enable it.
It is not used currently and can be removed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: remove code for software validation only
Helin Zhang [Tue, 9 Sep 2014 07:21:32 +0000 (15:21 +0800)]
i40e/base: remove code for software validation only

The code wrapped in '#ifdef I40E_DCB_SW' is currently for software
validation only, it should be removed at all.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: remove useless code for pre-boot
Helin Zhang [Tue, 9 Sep 2014 07:21:30 +0000 (15:21 +0800)]
i40e/base: remove useless code for pre-boot

The code wrapped in '#ifdef PREBOOT_SUPPORT' was added for
queue context initialization specifically for A0 silicon.
As A0 silicon has gone for a long time, the code should be
removed at all. In addition, the checks of 'QV_RELEASE'
and 'PREBOOT_SUPPORT' are also not needed anymore and can
be removed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: remove useless code for Solaris
Helin Zhang [Tue, 9 Sep 2014 07:21:27 +0000 (15:21 +0800)]
i40e/base: remove useless code for Solaris

The code wrapped in '#ifdef DMA_SYNC_SUPPORT' was written specially
for Solaris, it is not needed anymore for others including DPDK.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: remove test code for ethtool
Helin Zhang [Tue, 9 Sep 2014 07:21:28 +0000 (15:21 +0800)]
i40e/base: remove test code for ethtool

The code wrapped in '#ifdef ETHTOOL_TEST' in i40e_diag.c is for
ethtool testing only, it is not needed anymore and can be removed.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: support nvmupdate by default
Helin Zhang [Tue, 9 Sep 2014 07:21:26 +0000 (15:21 +0800)]
i40e/base: support nvmupdate by default

'nvmupdate' is intended to support the userland NVMUpdate tool for
Fortville eeprom. These code changes is to remove the conditional
compile macro, and support those by default. In addition, renaming
all 'errno' to avoid any compile warning or error.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoi40e/base: make the indentation more consistent
Helin Zhang [Tue, 9 Sep 2014 07:21:25 +0000 (15:21 +0800)]
i40e/base: make the indentation more consistent

In share code, 'tab' is used to align values rather than 'space'.
The changes in i40e_adminq_cmd.h is to make the indentation more
consistent in share code.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Reviewed-by: Chen Jing <jing.d.chen@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
10 years agoixgbe: support X550
Ouyang Changchun [Mon, 29 Sep 2014 07:16:26 +0000 (15:16 +0800)]
ixgbe: support X550

Update device id and PF driver to support X550.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: support X550
Ouyang Changchun [Mon, 29 Sep 2014 07:16:25 +0000 (15:16 +0800)]
ixgbe/base: support X550

Add new file to support controller X550, therefore update the Makefile
and README file. It also updates the API functions, DCB related functions,
mailbox related functions, etc to support X550.
In addition, some new macros used by X550 are added.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: merge dependent patches]

10 years agoixgbe/base: i2c combined read/write
Ouyang Changchun [Tue, 7 Oct 2014 08:11:12 +0000 (10:11 +0200)]
ixgbe/base: i2c combined read/write

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: malicious driver detection
Ouyang Changchun [Tue, 7 Oct 2014 12:49:03 +0000 (14:49 +0200)]
ixgbe/base: malicious driver detection

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: iosf sideband read/write
Ouyang Changchun [Tue, 7 Oct 2014 12:47:41 +0000 (14:47 +0200)]
ixgbe/base: iosf sideband read/write

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: anti spoofing
Ouyang Changchun [Tue, 7 Oct 2014 12:45:16 +0000 (14:45 +0200)]
ixgbe/base: anti spoofing

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: source address pruning
Ouyang Changchun [Tue, 7 Oct 2014 12:43:35 +0000 (14:43 +0200)]
ixgbe/base: source address pruning

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: support EEE
Ouyang Changchun [Tue, 7 Oct 2014 12:42:01 +0000 (14:42 +0200)]
ixgbe/base: support EEE

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: dma coalescing
Ouyang Changchun [Tue, 7 Oct 2014 12:39:24 +0000 (14:39 +0200)]
ixgbe/base: dma coalescing

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: thermal sensor
Ouyang Changchun [Tue, 7 Oct 2014 12:31:21 +0000 (14:31 +0200)]
ixgbe/base: thermal sensor

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: fdir cloud mode
Ouyang Changchun [Mon, 29 Sep 2014 07:16:12 +0000 (15:16 +0800)]
ixgbe/base: fdir cloud mode

Supports flow director cloud mode in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: reset VF registers
Ouyang Changchun [Mon, 29 Sep 2014 07:16:23 +0000 (15:16 +0800)]
ixgbe/base: reset VF registers

Reset VF registers to initial values in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: clean phy sfp handling
Ouyang Changchun [Tue, 7 Oct 2014 07:53:52 +0000 (09:53 +0200)]
ixgbe/base: clean phy sfp handling

Remove 10GBASE_ER support.
Always support 1000BASE_LX.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: support qsfp and lco
Ouyang Changchun [Fri, 3 Oct 2014 18:48:20 +0000 (20:48 +0200)]
ixgbe/base: support qsfp and lco

- Implement functions to do I2C byte read and write
- Support 82599_QSFP_SF_QP and 82599_LS

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: move phy sfp detection in a function
Ouyang Changchun [Fri, 3 Oct 2014 18:40:49 +0000 (20:40 +0200)]
ixgbe/base: move phy sfp detection in a function

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: rework semaphore
Ouyang Changchun [Mon, 29 Sep 2014 07:16:21 +0000 (15:16 +0800)]
ixgbe/base: rework semaphore

- Store lan_id and physical semaphore mask into hardware physical information,
and use them to control read and write physical registers in IXGBE base code.
- Extend mask from 16 bits to 32 bits for releasing or acquiring SWFW semaphore
in IXGBE base code. It is used in reading and writing I2C byte.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: merge dependent patches]

10 years agoixgbe/base: remove unnecessary delay
Ouyang Changchun [Mon, 29 Sep 2014 07:16:22 +0000 (15:16 +0800)]
ixgbe/base: remove unnecessary delay

Remove unnecessary delay when setting up physical link and negotiating
in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: wait longer while polling X540 flash update
Ouyang Changchun [Mon, 29 Sep 2014 07:16:18 +0000 (15:16 +0800)]
ixgbe/base: wait longer while polling X540 flash update

It need wait for 5 ms for polling EEC register in IXGBE X540 base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: wait longer for VF link status
Ouyang Changchun [Tue, 7 Oct 2014 08:12:14 +0000 (10:12 +0200)]
ixgbe/base: wait longer for VF link status

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: fix flow control comment
Ouyang Changchun [Tue, 7 Oct 2014 08:12:04 +0000 (10:12 +0200)]
ixgbe/base: fix flow control comment

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: refactor manageability block communication
Ouyang Changchun [Mon, 29 Sep 2014 07:16:14 +0000 (15:16 +0800)]
ixgbe/base: refactor manageability block communication

Introduce a new argument to let caller determine if it need read and
return data or not after executing host interface command in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: refactor eeprom checksum calculation
Ouyang Changchun [Mon, 29 Sep 2014 07:16:13 +0000 (15:16 +0800)]
ixgbe/base: refactor eeprom checksum calculation

Refines function to let eeprom checksum calculation return
either a negative error code on error, or the 16-bit checksum
in IXGBE base code.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: factorize fdir command complete check
Ouyang Changchun [Mon, 29 Sep 2014 07:16:11 +0000 (15:16 +0800)]
ixgbe/base: factorize fdir command complete check

Implements a function to check command complete for flow director in
IXGBE base code, and replaces related code snippet with this function.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: move manageability function
Ouyang Changchun [Fri, 3 Oct 2014 13:17:36 +0000 (15:17 +0200)]
ixgbe/base: move manageability function

Manageability query is a common routine (not specific to 82599).

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
[Thomas: split patch]

10 years agoixgbe/base: new error types
Ouyang Changchun [Mon, 29 Sep 2014 07:16:19 +0000 (15:16 +0800)]
ixgbe/base: new error types

This patch defines new error type in IXGBE base code; they are
used to report different kinds of error.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: various clean up
Ouyang Changchun [Mon, 29 Sep 2014 07:16:10 +0000 (15:16 +0800)]
ixgbe/base: various clean up

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agoixgbe/base: minor changes
Ouyang Changchun [Mon, 29 Sep 2014 07:16:09 +0000 (15:16 +0800)]
ixgbe/base: minor changes

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
10 years agovirtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not negotiated
Damjan Marion [Thu, 11 Sep 2014 22:25:08 +0000 (15:25 -0700)]
virtio: fix crash if VIRTIO_NET_F_CTRL_VQ is not negotiated

If VIRTIO_NET_F_CTRL_VQ is not negotiated hw->cvq will be NULL

Signed-off-by: Damjan Marion <damarion@cisco.com>
Acked-by: Changchun Ouyang <Changchun.ouyang@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
10 years agokni: fix build on Ubuntu 12.04.5
Daniel Mrzyglod [Tue, 30 Sep 2014 12:10:25 +0000 (13:10 +0100)]
kni: fix build on Ubuntu 12.04.5

Recent Ubuntu 12.04.5 LTS is shipped with 3.13.0-36.63 as the only
supported kernel.
So skb_set_hash has been backported and is conflicting with kni kcompat one.
Commit a09b359daca ("fix build on Ubuntu 14.04") describes the initial problem.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
[Thomas: reorder conditions to ease reading]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoixgbe: fix build with clang
Bruce Richardson [Tue, 30 Sep 2014 09:40:08 +0000 (10:40 +0100)]
ixgbe: fix build with clang

Clang fails with an error about a variable being used uninitialized:

lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:67:30:
error: variable 'dma_addr0' is uninitialized
      when used here [-Werror,-Wuninitialized]
                        dma_addr0 = _mm_xor_si128(dma_addr0, dma_addr0);
                                                  ^~~~~~~~~

This error can be fixed by replacing the call to xor which
takes two parameters, by a call to setzero, which does not take any.

Reported-by: Keith Wiles <keith.wiles@windriver.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoversion: 1.8.0-rc1
Thomas Monjalon [Mon, 29 Sep 2014 20:03:21 +0000 (22:03 +0200)]
version: 1.8.0-rc1

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoethdev: rename flag for queue start and stop
Ouyang Changchun [Fri, 26 Sep 2014 05:00:53 +0000 (13:00 +0800)]
ethdev: rename flag for queue start and stop

Rename start_?x_per_q to ?x_deferred_start
and add comments.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agodoc: apply one comment to all members of a group
Thomas Monjalon [Wed, 17 Sep 2014 16:11:12 +0000 (18:11 +0200)]
doc: apply one comment to all members of a group

A doxygen group begins with /**@{*/ and ends with /**@}*/.
By enabling DISTRIBUTE_GROUP_DOC, the first comment is applied
to each undocumented member of the group.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agopcap: set port id in received mbuf
Saori Usami [Fri, 5 Sep 2014 10:10:36 +0000 (19:10 +0900)]
pcap: set port id in received mbuf

The port parameter in mbuf should be set with an input port id
because DPDK apps may use it to know where each packet came from.

Signed-off-by: Saori Usami <susami@igel.co.jp>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>