dpdk.git
9 years agovfio: interrupts
Anatoly Burakov [Fri, 13 Jun 2014 14:52:44 +0000 (15:52 +0100)]
vfio: interrupts

Creating code to handle VFIO interrupts in EAL interrupts (supports all
types of interrupts).

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agovfio: header for build support
Anatoly Burakov [Fri, 13 Jun 2014 14:52:42 +0000 (15:52 +0100)]
vfio: header for build support

Add VFIO compilation option to linuxapp config.

Adding a header that will determine if VFIO support should be compiled
in. If VFIO is enabled in config (and it's enabled by default), then the
header will also check for kernel version. If VFIO is enabled in config
and if the kernel version is 3.6+, then VFIO_PRESENT will be defined.
This is the macro that should be used to determine if VFIO support is
being compiled in.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: move interrupt type out of igb_uio
Anatoly Burakov [Fri, 13 Jun 2014 14:52:41 +0000 (15:52 +0100)]
eal: move interrupt type out of igb_uio

Moving interrupt type enum out of igb_uio and renaming it to be more
generic. Such a strange header naming and separation is done mostly to
make coming virtio patches easier to port to dpdk.org tree.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigb_uio: make compilation optional
Anatoly Burakov [Fri, 13 Jun 2014 14:52:40 +0000 (15:52 +0100)]
igb_uio: make compilation optional

Currently, igb_uio is always compiled. Some Linux distributions may not
want to include igb_uio with DPDK, so we need to make sure that igb_uio
compilation for Linuxapp targets can be optional.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: HuilongX Xu <huilongx.xu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING
Anatoly Burakov [Fri, 13 Jun 2014 14:52:39 +0000 (15:52 +0100)]
pci: rename RTE_PCI_DRV_NEED_IGB_UIO to RTE_PCI_DRV_NEED_MAPPING

Rename the RTE_PCI_DRV_NEED_IGB_UIO to be more generic.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: distinguish between legitimate failures and non-fatal errors
Anatoly Burakov [Fri, 13 Jun 2014 14:52:38 +0000 (15:52 +0100)]
pci: distinguish between legitimate failures and non-fatal errors

Currently, EAL does not distinguish between actual failures and expected
initialization errors. E.g. sometimes the driver fails to initialize
because it was not supposed to be initialized in the first place, such
as device not being managed by said driver.

This patch makes EAL fail on actual initialization errors while still
skipping over expected initialization errors.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: fix code style
Anatoly Burakov [Fri, 13 Jun 2014 14:52:37 +0000 (15:52 +0100)]
pci: fix code style

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: move uio mapping in a dedicated file
Anatoly Burakov [Fri, 13 Jun 2014 14:52:36 +0000 (15:52 +0100)]
pci: move uio mapping in a dedicated file

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: rework uio mapping to prepare for vfio
Anatoly Burakov [Fri, 13 Jun 2014 14:52:35 +0000 (15:52 +0100)]
pci: rework uio mapping to prepare for vfio

Separating mapping code and calls to open. This is a preparatory work
for VFIO patch since it'll need to map BARs too but it doesn't use path
in mapped_pci_resource. Also, renaming structs to be more generic.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomem: make --no-huge use mmap instead of malloc
Anatoly Burakov [Fri, 13 Jun 2014 14:52:50 +0000 (15:52 +0100)]
mem: make --no-huge use mmap instead of malloc

This makes it possible to run DPDK without hugepage memory when VFIO
is used, as VFIO uses virtual addresses to set up DMA mappings.

Technically, malloc is just fine, but we want to guarantee that
memory will be page-aligned, so using mmap to be safe.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: remove useless compilation flag
Anatoly Burakov [Fri, 13 Jun 2014 14:52:45 +0000 (15:52 +0100)]
eal: remove useless compilation flag

eal_hpet.c was renamed to eal_timer.c and, thanks to code changes, does
not need the -Wno-return-type any more.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbe: new vectorized functions for Rx/Tx
Bruce Richardson [Fri, 13 Jun 2014 22:52:24 +0000 (23:52 +0100)]
ixgbe: new vectorized functions for Rx/Tx

New file containing optimized receive and transmit functions which
use 128bit vector instructions to improve performance. When conditions
permit, these functions will be enabled at runtime by the device
initialization routines already in the PMD.

The compilation of the vectorized RX and TX code paths is controlled by
a new setting in the build time configuration for the IXGBE driver. Also
added is a setting which allows an optional further performance increase
by disabling the use of the olflags field on packet RX.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: XiaonanX Zhang <xiaonanx.zhang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
[Thomas: code-style adjustments]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoacl: new sample l3fwd-acl
Konstantin Ananyev [Fri, 13 Jun 2014 11:26:53 +0000 (12:26 +0100)]
acl: new sample l3fwd-acl

Demonstrates the use of the ACL library in the DPDK application to
implement packet classification and L3 forwarding.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
[Thomas: some code-style changes]

9 years agoacl: new test-acl application
Konstantin Ananyev [Fri, 13 Jun 2014 11:26:52 +0000 (12:26 +0100)]
acl: new test-acl application

Usage example and main test application for the ACL library.
Provides IPv4/IPv6 5-tuple classification.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
[Thomas: some code-style changes]

9 years agoacl: update unit tests
Konstantin Ananyev [Fri, 13 Jun 2014 11:26:51 +0000 (12:26 +0100)]
acl: update unit tests

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
9 years agoacl: new library
Konstantin Ananyev [Fri, 13 Jun 2014 11:26:50 +0000 (12:26 +0100)]
acl: new library

The ACL library is used to perform an N-tuple search over a set of rules with
multiple categories and find the best match for each category.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
[Thomas: some code-style changes]

9 years agovirtio: fix build with debug enabled
Stephen Hemminger [Fri, 13 Jun 2014 01:32:50 +0000 (18:32 -0700)]
virtio: fix build with debug enabled

Remove useless message that breaks if VIRTIO_DEBUG_DRIVER is defined.
virtio_ethdev.c:224:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
9 years agovirtio: checkpatch cleanups
Stephen Hemminger [Fri, 13 Jun 2014 01:32:40 +0000 (18:32 -0700)]
virtio: checkpatch cleanups

This fixes style problems reported by checkpatch including:
  * extra whitespace
  * spaces before tabs
  * strings broken across lines
  * excessively long lines
  * missing spaces after keywords
  * unnecessary paren's in return statements

Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
9 years agoconfig: minor cleanup
Thomas Monjalon [Thu, 12 Jun 2014 12:57:24 +0000 (14:57 +0200)]
config: minor cleanup

Move things at their right location and add missing comment.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agodistributor: add unit tests
Bruce Richardson [Thu, 29 May 2014 10:12:17 +0000 (11:12 +0100)]
distributor: add unit tests

Add a set of unit tests and some basic performance test for the
distributor library. These tests cover all the major functionality of
the library on both distributor and worker sides.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
9 years agodistributor: new packet distributor library
Bruce Richardson [Thu, 29 May 2014 10:12:14 +0000 (11:12 +0100)]
distributor: new packet distributor library

This adds the code for a new Intel DPDK library for packet distribution.
The distributor is a component which is designed to pass packets
one-at-a-time to workers, with dynamic load balancing. Using the RSS
field in the mbuf as a tag, the distributor tracks what packet tag is
being processed by what worker and then ensures that no two packets with
the same tag are in-flight simultaneously. Once a tag is not in-flight,
then the next packet with that tag will be sent to the next available
core.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
[Thomas: add doxygen @file comment]

9 years agoexamples/l3fwd: reorganise and optimize LPM code path
Konstantin Ananyev [Wed, 11 Jun 2014 13:38:46 +0000 (14:38 +0100)]
examples/l3fwd: reorganise and optimize LPM code path

With latest HW and optimised RX/TX path there is a huge gap between
tespmd iofwd and l3fwd performance results.
So there is an attempt to optimise l3fwd LPM code path and reduce the gap:
 - Instead of processing each input packet up to completion -
 divide packet processing into several stages and perform
 stage by stage for the whole burst.
 - Unroll things by the factor of 4 whenever possible.
 - Use SSE instincts for some operations (bswap, replace MAC addresses, etc).
 - Avoid TX packet buffering whenever possible.
 - Move some checks from RX/TX into setup phase.

Note that new(optimized) code path can be switched on/off by setting
ENABLE_MULTI_BUFFER_OPTIMIZE macro to 1/0.

Some performance data:
SUT: dual-socket board IVB 2.8GHz, 2x1GB pages.
4 ports on 4 NICs (all at socket 0) connected to the traffic generator.
kernel: 3.11.3-201.fc19.x86_64, gcc: 4.8.2.
64B packets, using the packet flooding method.
All 4 ports are managed by one logical core:
Optimised scalar PMD RX/TX was used.

                          DIFF % (NEW-OLD)
IPV4-CONT-BURST:               +23%
IPV6-CONT-BURST :              +13%
IPV4/IPV6-CONT-BURST:          +8%
IPV4-4STREAMSX8:               +7%
IPV4-4STREAMSX1:               -2%

Test cases description:
IPV4-CONT-BURST - IPV4 packets all packets from the one input port
are destined for the same output port.
IPV6-CONT-BURST - IPV6 packets all packets from the one input port
are destined for the same output port.
IPV4/IPV6-CONT-BURST - mix of the first 2 with interleave=1
(e.g: IPV4,IPV6,IPV4,IPV6, ...)
IPV4-4STREAMSX1 - 4 streams of IPV4 packets, where all packets
from same stream are destined for the same output port
(e.g: IPV4_DST_P0, IPV4_DST_P1,  IPV4_DST_P2, IPV4_DST_P3, IPV4_DST_P0, ...)
IPV4-4STREAMSX8 - same as above but packets for each stream
are coming in groups of 8
(e.g: IPV4_DST_P0 X 8, IPV4_DST_P1 X 8, IPV4_DST_P2 X 8, IPV4_DST_P3 X 8,
IPV4_DST_P0 X 8, ...)

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
9 years agolpm: introduce rte_lpm_lookupx4
Konstantin Ananyev [Wed, 11 Jun 2014 13:38:45 +0000 (14:38 +0100)]
lpm: introduce rte_lpm_lookupx4

Allows to lookup four IP addresses in an LPM table.
Uses SSE instrincts.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
9 years agopci: remove conditions on device definitions
Pawel Wodkowski [Wed, 11 Jun 2014 07:20:37 +0000 (08:20 +0100)]
pci: remove conditions on device definitions

This patch removes obsolete code that prevents defining
NICs 82575EB, I218 and I350.

Signed-off-by: Pawel Wodkowski <pawelx.wdkowski@intel.com>
[Thomas: remove conditions for I218]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/testpmd: Tx rate limitation for queue and VF
Ouyang Changchun [Mon, 26 May 2014 07:45:31 +0000 (15:45 +0800)]
app/testpmd: Tx rate limitation for queue and VF

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agoixgbe: Tx rate limitation for queue and VF
Ouyang Changchun [Mon, 26 May 2014 07:45:30 +0000 (15:45 +0800)]
ixgbe: Tx rate limitation for queue and VF

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agoethdev: Tx rate limitation for queue and VF
Ouyang Changchun [Mon, 26 May 2014 07:45:29 +0000 (15:45 +0800)]
ethdev: Tx rate limitation for queue and VF

Add API to support setting TX rate for a queue and a VF.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Acked-by: Jijiang Liu <jijiang.liu@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
9 years agoapp/testpmd: add commands for link up and down
Ouyang Changchun [Wed, 28 May 2014 07:15:02 +0000 (15:15 +0800)]
app/testpmd: add commands for link up and down

This patch adds commands to test the functionality of setting link up and down.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked by: Ivan Boule <ivan.boule@6wind.com>

9 years agoixgbe: link up and down
Ouyang Changchun [Wed, 28 May 2014 07:15:01 +0000 (15:15 +0800)]
ixgbe: link up and down

It is implemented by enabling or disabling TX laser.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked by: Ivan Boule <ivan.boule@6wind.com>

9 years agoethdev: API for link up and down
Ouyang Changchun [Wed, 28 May 2014 07:15:00 +0000 (15:15 +0800)]
ethdev: API for link up and down

This patch adds API to support the functionality of setting link up and down.
It can be used to repeatedly stop and restart RX/TX of a port without
re-allocating resources for the port and re-configuring the port.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked by: Ivan Boule <ivan.boule@6wind.com>

9 years agoethdev: fix compiler warning on PMD_DEBUG_TRACE formats
Konstantin Ananyev [Mon, 9 Jun 2014 17:26:17 +0000 (18:26 +0100)]
ethdev: fix compiler warning on PMD_DEBUG_TRACE formats

icc 12.1 complains about RTE_LOG() format:
"argument is incompatible with corresponding format string conversion"

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: prevent from starting/stopping already started/stopped device
Konstantin Ananyev [Mon, 9 Jun 2014 17:26:16 +0000 (18:26 +0100)]
ethdev: prevent from starting/stopping already started/stopped device

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigb/ixgbe: reset queue pointers after releasing
Konstantin Ananyev [Mon, 9 Jun 2014 17:26:15 +0000 (18:26 +0100)]
igb/ixgbe: reset queue pointers after releasing

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoe1000: do not release queue on alloc error
Konstantin Ananyev [Mon, 9 Jun 2014 17:26:14 +0000 (18:26 +0100)]
e1000: do not release queue on alloc error

If igb_alloc_rx_queue_mbufs() would fail to allocate an mbuf for RX queue,
it calls igb_rx_queue_release(rxq).
That causes rxq to be silently freed, without updating
dev->data->rx_queues[].
So any further reference to it will trigger the SIGSEGV.
Same thing in em PMD too.

To fix: igb_alloc_rx_queue_mbufs() should just return an error to the
caller and let upper layer to deal with the probem.
That's what ixgbe PMD is doing right now.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoremove trailing whitespaces
Bruce Richardson [Tue, 3 Jun 2014 23:42:50 +0000 (00:42 +0100)]
remove trailing whitespaces

This commit removes trailing whitespace from lines in files. Almost all
files are affected, as the BSD license copyright header had trailing
whitespace on 4 lines in it [hence the number of files reporting 8 lines
changed in the diffstat].

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
[Thomas: remove spaces before tabs in libs]
[Thomas: remove more trailing spaces in non-C files]
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopci: fix build for FreeBSD
Alan Carew [Thu, 5 Jun 2014 16:12:08 +0000 (17:12 +0100)]
pci: fix build for FreeBSD

Add __rte_unused to
pci_unbind_kernel_driver(struct rte_pci_device *dev)

Signed-off-by: Alan Carew <alan.carew@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoeal: fix build for FreeBSD
Alan Carew [Thu, 5 Jun 2014 16:12:07 +0000 (17:12 +0100)]
eal: fix build for FreeBSD

Recent change to rte_dump_tailq (commit 591a9d7985c1230652),
which now uses a FILE parameter causes compilation to fail under FreeBSD
and sourced to a missing include of stdio.h.

Errors:
rte_tailq.h:  unknown type name 'FILE' void rte_dump_tailq(FILE *f);
rte_memory.h: unknown type name 'FILE' void rte_dump_physmem_layout(FILE *f);

Signed-off-by: Alan Carew <alan.carew@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agomk: factorize config rules
Thomas Monjalon [Tue, 10 Jun 2014 13:42:57 +0000 (15:42 +0200)]
mk: factorize config rules

Error message for missing template is factorized in notemplate rule.

RTE_OUTPUT directory is marked as order-only prerequisite.

RTE_OUTPUT is always created after having been cleaned for rte_config.h.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by Olivier Matz <olivier.matz@6wind.com>

9 years agomk: allow updates to build config on make install
Bruce Richardson [Wed, 14 May 2014 15:55:10 +0000 (16:55 +0100)]
mk: allow updates to build config on make install

When running "make config", an additional config.orig file is also
generated, which is intended to hold the original, clean configuration
from the template.
When running make install, we first check if there is no existing
.config file, and run make config if not. If there is a file, we then
check if it's unmodified, in which case we regenerate a new .config to
take account of any possible updates to the template. Finally, in the
case where there is an existing .config file, and it HAS been modified,
we then do a check to see if the template has had further updates, and
throw an error if so. If no updates, we continue with the build using
the existing, user-modified config.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agomk: fix 32-bit link with gcc
Thomas Monjalon [Mon, 19 May 2014 21:45:03 +0000 (23:45 +0200)]
mk: fix 32-bit link with gcc

Some linker options were not prefixed by -Wl, when using CC:
-z muldefs
-melf_i386 (CPU_LDFLAGS in 32-bit config)

I didn't see any error with -z muldefs but it isn't documented in gcc
manual. So it's safer to explicitly pass it to the linker.
Also building 32-bit shared library raises this error:
gcc: error: unrecognized command line option â€˜-melf_i386’

Using macro linkerprefix fixes it.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agopcap: fix Tx mbuf corruption
Konstantin Ananyev [Wed, 28 May 2014 14:47:02 +0000 (15:47 +0100)]
pcap: fix Tx mbuf corruption

If pcap_sendpacket() fails, then eth_pcap_tx shouldn't silently free that
mbuf and continue.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Pablo de Lara Guarch <pablo.de.lara.guarch@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
9 years agoxen: fix memory size calculation
Jijiang Liu [Tue, 3 Jun 2014 13:00:15 +0000 (21:00 +0800)]
xen: fix memory size calculation

The unit of allocated_size is MB, so the change below is made.
Otherwise, it will fail to free memory when available memory is not enough.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
Tested-by: Heng Ding <hengx.ding@intel.com>
9 years agoxen: fix for contiguous region API in kernel 3.13
Jijiang Liu [Tue, 3 Jun 2014 12:59:33 +0000 (20:59 +0800)]
xen: fix for contiguous region API in kernel 3.13

Since Linux kernel version 3.13.0,
the xen_create/destroy_contiguous_region() API has been changed,
and the first parameter is physical address in the API.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
Tested-by: Heng Ding <hengx.ding@intel.com>
9 years agoxen: reserve memory at installing dom0_mm.ko
Jijiang Liu [Fri, 23 May 2014 06:53:10 +0000 (14:53 +0800)]
xen: reserve memory at installing dom0_mm.ko

The patch changes the way of reserving memory in Dom0 driver.

It will reserve memory at installing rte_dom0_mm.ko kernel module
instead of requesting memory dynamically during DPDK application startup.
Meanwhile, now driver requests memory size of 4M once first,
if it failed, and request memory size of 2M once.

The main reasons for these changes are as follows:
First, to reduce the impact of increasing in memory fragment
after system run a long time.
Second, to reduce number of memory segment.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agovirtio: support multiple queues
Ouyang Changchun [Thu, 29 May 2014 07:18:20 +0000 (15:18 +0800)]
virtio: support multiple queues

This patch supports multiple queues feature in DPDK based virtio-net frontend.
It firstly gets max queue number of virtio-net from virtio PCI configuration and
then send command to negotiate the queue number with backend; When receiving and
transmitting packets, it negotiates multiple virtio-net queues which serve RX/TX;
To utilize this feature, the backend also need support multiple queues feature
and enable it.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agovirtio: code-style cleanup
Ouyang Changchun [Thu, 29 May 2014 07:18:19 +0000 (15:18 +0800)]
virtio: code-style cleanup

This patch cleanups some coding style issue, and fixes some errors and warnings
reported by checkpatch.pl.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoexamples/vhost: zero copy mode
Ouyang Changchun [Wed, 28 May 2014 08:06:38 +0000 (16:06 +0800)]
examples/vhost: zero copy mode

This patch supports user space vhost zero copy. It removes packets copying between host and guest in RX/TX.
It introduces an extra ring to store the detached mbufs. At initialization stage all mbufs will put into
this ring; when one guest starts, vhost gets the available buffer address allocated by guest for RX and
translates them into host space addresses, then attaches them to mbufs and puts the attached mbufs into
mempool.
Queue starting and DMA refilling will get mbufs from mempool and use them to set the DMA addresses.

For TX, it gets the buffer addresses of available packets to be transmitted from guest and translates
them to host space addresses, then attaches them to mbufs and puts them to TX queues.
After TX finishes, it pulls mbufs out from mempool, detaches them and puts them back into the extra ring.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbe: queue start and stop
Ouyang Changchun [Wed, 28 May 2014 08:06:37 +0000 (16:06 +0800)]
ixgbe: queue start and stop

This patch implements queue start and stop functionality in IXGBE PMD;
it also enable hardware loopback for VMDQ mode in IXGBE PMD.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: queue start and stop
Ouyang Changchun [Wed, 28 May 2014 08:06:36 +0000 (16:06 +0800)]
ethdev: queue start and stop

This patch adds API to support queue start and stop functionality for RX/TX.
It allows RX and TX queue is started or stopped one by one, instead of starting
and stopping all of them at the same time.

Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/testpmd: allow to configure RSS hash key
Ivan Boule [Fri, 16 May 2014 08:58:43 +0000 (10:58 +0200)]
app/testpmd: allow to configure RSS hash key

Add the command "port config X rss-hash-key key" in the 'testpmd'
application to configure the RSS hash key used to compute the RSS
hash of input [IP] packets received on port X.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: allow to get RSS hash functions and key
Ivan Boule [Fri, 16 May 2014 08:58:42 +0000 (10:58 +0200)]
ethdev: allow to get RSS hash functions and key

1) Add a new function "rss_hash_conf_get" in the PMD API to retrieve the
   current configuration of the RSS functions and/or of the RSS key used
   by a NIC to compute the RSS hash of input packets.
   The new function uses the existing data structure "rte_eth_rss_conf" for
   returning the RSS hash configuration.

2) Add the ixgbe-specific function "ixgbe_dev_rss_hash_conf_get" and the
   igb-specific function "eth_igb_rss_hash_conf_get" to retrieve the RSS
   hash configuration of ixgbe and igb controllers respectively.

3) Add the command "show port X rss-hash [key]" in the testpmd application
   to display the RSS hash configuration of port X.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/testpmd: configure RSS without restart
Ivan Boule [Fri, 16 May 2014 08:58:41 +0000 (10:58 +0200)]
app/testpmd: configure RSS without restart

The function cmd_config_rss_parsed() associated with the command
"port config rss all" required to first stop all ports, in order to
then entirely re-configure all ports with the new RSS hash computation
parameters.
Use now the new function rte_eth_dev_rss_hash_conf_update() that dynamically
only changes the RSS hash computation parameters of a port, without needing
to previously stop the port.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: allow to set RSS hash computation flags and/or key
Ivan Boule [Fri, 16 May 2014 08:58:40 +0000 (10:58 +0200)]
ethdev: allow to set RSS hash computation flags and/or key

1) Add a new function "rss_hash_update" in the PMD API to dynamically
   update the RSS flags and/or the RSS key used by a NIC to compute the RSS
   hash of input packets.
   The new function uses the existing data structure "rte_eth_rss_conf" for
   the argument that contains the new hash flags and/or the new hash key to
   use.

2) Add the ixgbe-specific function "ixgbe_dev_rss_hash_update" and the
   igb-specific function "eth_igb_rss_hash_update" to update the RSS
   hash configuration of ixgbe and igb controllers respectively.
   Before changing anything, these 2 functions check that the update RSS
   operation does not attempt to disable RSS, if RSS was enabled at port
   initialization time, or does not attempt to enable RSS, if RSS was
   disabled at port initialization time.

Note:
   Configuring the RSS hash flags and the RSS key used by a NIC consists in
   updating appropriate PCI registers of the NIC.
   These operations have been manually tested with the interactive commands
   "write reg" and "write regbit" of the testpmd application.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: check RETA queue indices against number of queues
Ivan Boule [Fri, 16 May 2014 08:58:39 +0000 (10:58 +0200)]
ethdev: check RETA queue indices against number of queues

Each entry of the RSS redirection table (RETA) of igb and ixgbe ports
contains a 4-bit RX queue index, thus imposing RSS RX queue indices to
be strictly lower than 16.
In addition, if a RETA entry is configured with a RX queue index that is
strictly lower than 16, but is greater or equal to the number of RX queues
of the port, then all input packets whose RSS hash value indexes that RETA
entry are silently dropped by the NIC.

Make the function rte_eth_dev_rss_reta_update() check that RX queue indices
that are supplied in the reta_conf argument are strictly lower than
ETH_RSS_RETA_MAX_QUEUE (16) and are strictly lower than the number of
RX queues of the port.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigbvf: fix mac type for 82576
Konstantin Ananyev [Tue, 6 May 2014 14:33:01 +0000 (15:33 +0100)]
igbvf: fix mac type for 82576

e1000_vfadapt type corresponds to 82576 VF devices,
check e1000_set_mac_type() for more details.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
9 years agoixgbevf: assign a default mac address
Ivan Boule [Mon, 12 May 2014 14:12:30 +0000 (16:12 +0200)]
ixgbevf: assign a default mac address

When initializing a VF with no initial MAC address assigned by
the underlying Host PF driver, assign a default MAC address.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: reset unused mailbox data registers
Ivan Boule [Mon, 12 May 2014 14:11:54 +0000 (16:11 +0200)]
ixgbevf: reset unused mailbox data registers

The VF_RESET message of the 82599 PF/VF communication protocol issued by a
a Guest VF driver may include an optional permanent MAC address assigned to
the VF by the Guest OS, in order to make it recorded into the 82599 RAR
registers by the Host PF driver.

To indicate the absence of this optional MAC address, the VF_RESET command
assumes that a NULL MAC address is sent, instead of using a dedicated bit
for this purpose. However, when sending a VF_RESET command with no permanent
MAC address, the function ixgbe_reset_hw_vf() of the 82599 VF driver
directly invokes the function ixgbe_write_mbx_vf() with a message that does
not include a NULL MAC address, wrongly assuming that this function fills in
with zero all unused mailbox data registers.

More globally, it is safer to explicitely reset to zero all remaining mailbox
data registers that are not used to store the content of a message, in order
to reset the data sent in a previous VF/PF exchange (in either side),
including the last exchange performed by another Guest OS to which that VF
was previously assigned.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: skip null and permanent mac addresses
Ivan Boule [Mon, 12 May 2014 14:11:36 +0000 (16:11 +0200)]
ixgbevf: skip null and permanent mac addresses

On a 82599 VF, the deletion of a dynamically added MAC address consists in
first flushing all added MAC addresses, then in adding again all remaining MAC
addresses.
For this purpose, the function ixgbevf_remove_mac_addr() parses the pool
of MAC addresses associated with a VF, and must skip the VF permanent MAC
address that is stored into it, as well as all NULL MAC addresses.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: avoid adding twice the permanent mac address
Ivan Boule [Mon, 12 May 2014 14:11:06 +0000 (16:11 +0200)]
ixgbevf: avoid adding twice the permanent mac address

During the initialization of a VF device, the rte_eth_dev_start() function
indirectly invokes the PMD "mac_addr_add" function with the permanent MAC
address assigned to the device.
In the case of 82599 VFs, this operation leads to exhausting the very
limited set of PF resources used to store VF MAC addresses.

To address this issue, do nothing in the function ixgbevf_add_mac_addr()
if the added MAC address is equal to the permanent MAC address of the VF.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: add/remove mac address
Ivan Boule [Mon, 12 May 2014 14:10:46 +0000 (16:10 +0200)]
ixgbevf: add/remove mac address

Add missing PMD functions in the ixgbevf driver to add (respectively remove)
a MAC address to/from a 82599 VF.
For this purpose, these 2 functions use the VF/PF mailbox-based protocol.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: fix jumbo frame
Konstantin Ananyev [Tue, 6 May 2014 14:31:12 +0000 (15:31 +0100)]
ixgbevf: fix jumbo frame

When latest Linux ixgbe PF is used, and DPDK VF is used in DPDK application,
jumbo frames are not received.
Also - if Linux ixgbe PF has MTU set to 1500 (default),
then normal sized packets can be received by DPDK VF.
However, if Linux PF has MTU > 1500, then DPDK VF receives no packets
(normal or jumbo).
With ixgbe_mbox_api_10 ixgbe simply didn't allow set VF MTU > 1514 for 82599.
With ixgbe_mbox_ajpi_11 it does, though now, if PF uses jumbo frames,
it simply disables RX for all VFs.
So to work with PF ithat using jumbo frames, at startup each VF has to:
1. negotiate with PF mbox_api_11.
2. Send to PF SET_LPE message with desired MTU.
Note, that if PF already uses MTU bigger then asked by the VF,
then PF wouldn't take any action.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
9 years agotimer: fix pending counter
Vadim Suraev [Wed, 21 May 2014 20:35:55 +0000 (23:35 +0300)]
timer: fix pending counter

Bug: When a timer is running
 - if rte_timer_stop is called, the pending decrement is
 skipped (decremented only if the timer is pending) and due
 to the update flag the future processing is skipped so the
 timer is counted as pending while it is stopped. - the same
 applies when rte_timer_reset is called but then the pending
 statistics is additionally incremented so the timer is
 counted pending twice.
Solution: decrement the pending
 statistics after returning from the callback. If
 rte_timer_stop was called, it skipped decrementing the
 pending statistics. If rte_time_reset was called, the
 pending statistics was incremented. If neither was called
 and the timer is periodic, the pending statistics is
 incremented when it is reloaded

Signed-off-by: Vadim Suraev <vadim.suraev@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agotimer: fix reloading after changes
Vadim Suraev [Wed, 21 May 2014 19:53:45 +0000 (22:53 +0300)]
timer: fix reloading after changes

Bug: when a periodic timer's callback is running, if another
 timer is manipulated, the periodic timer is not reloaded.
Solution: set the update flag only if the modified timer is
 in RUNNING state

Signed-off-by: Vadim Suraev <vadim.suraev@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agocmdline: fix infinite loop after EOF
Cristian Dumitrescu [Fri, 23 May 2014 15:21:24 +0000 (16:21 +0100)]
cmdline: fix infinite loop after EOF

Stop on EOF when reading commands from a file or a pipe.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agomk: fix linking drivers in static apps
Bruce Richardson [Fri, 23 May 2014 14:39:24 +0000 (15:39 +0100)]
mk: fix linking drivers in static apps

The variable CONFIG_RTE_BUILD_SHARED_LIB was in rte.app.mk as
"RTE_BUILD_SHARED_LIB", which meant that none of the example apps linked
in the PMDs and just didn't work with any eth ports in any static builds.

This bug has been introduced in commit 3660cdf990:
  pcap: convert to use of PMD_REGISTER_DRIVER and fix linking

Link for l2fwd before patch:
  "... -Wl,--whole-archive -Wl,-lrte_kni -Wl,-lrte_timer -Wl,-lrte_hash
-Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm
-Wl,-lrt -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lethdev
-Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
-Wl,-lrte_cmdline -Wl,-lrt -Wl,-lm -Wl,-ldl -Wl,--end-group
-Wl,--no-whole-archive"

Link for l2fwd after patch:
  "...  -Wl,--whole-archive -Wl,-lrte_kni -Wl,-lrte_timer -Wl,-lrte_hash
-Wl,-lrte_lpm -Wl,-lrte_power -Wl,-lrte_meter -Wl,-lrte_sched -Wl,-lm
-Wl,-lrt -Wl,--start-group -Wl,-lrte_kvargs -Wl,-lrte_mbuf -Wl,-lethdev
-Wl,-lrte_malloc -Wl,-lrte_mempool -Wl,-lrte_ring -Wl,-lrte_eal
-Wl,-lrte_cmdline -Wl,-lrte_pmd_vmxnet3_uio -Wl,-lrte_pmd_virtio_uio
-Wl,-lrte_pmd_ixgbe -Wl,-lrte_pmd_e1000 -Wl,-lrte_pmd_ring -Wl,-lrt
-Wl,-lm -Wl,-ldl -Wl,--end-group -Wl,--no-whole-archive"

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agokni: fix build on Fedora 18 with kernel 3.6.10
Helin Zhang [Thu, 22 May 2014 03:35:17 +0000 (11:35 +0800)]
kni: fix build on Fedora 18 with kernel 3.6.10

Error of "implicit-function-declaration" can be seen when building KNI
kernel module on Linux kernel 3.6.10 platform, as follows.
  lib/librte_eal/linuxapp/kni/igb_ethtool.c:
    In function igb_get_eee:
  lib/librte_eal/linuxapp/kni/igb_ethtool.c:
    2441:4: error: implicit declaration of function
    mmd_eee_adv_to_ethtool_adv_t
  lib/librte_eal/linuxapp/kni/igb_ethtool.c:
    In function igb_set_eee:
  lib/librte_eal/linuxapp/kni/igb_ethtool.c:
    2551:2: error: implicit declaration of function
    ethtool_adv_to_mmd_eee_adv_t

The root cause is as follows.
On Fedora 18 with kernel 3.6.10, ETHTOOL_GEEE is defined in Linux
header file of "linux/ethtool.h", while is not defined in most of other
linux kernel versions.
mmd_eee_cap_to_ethtool_sup_t(), mmd_eee_adv_to_ethtool_adv_t() and
ethtool_adv_to_mmd_eee_adv_t() in kcompat.h are disabled by "#if
!defined(ETHTOOL_GEEE) || (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE <=
RHEL_RELEASE_VERSION(6,4))", while are called in igb_get_eee() in
igb_ethtool.c which is enabled by "#ifdef ETHTOOL_GEEE".

Reported-by: Prashant Upadhyaya <prashant.upadhyaya@aricent.com>
Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agosched: fix grinder bug
Stephen Hemminger [Wed, 14 May 2014 16:25:27 +0000 (09:25 -0700)]
sched: fix grinder bug

The rte_scheduler will get stuck and not deliver any more packets
if there are two active subports and then one of them stops enqueing
more packets. This is because of a bug in how the grinder state machines
are managed.

If a non-zero grinder is assigned (but not yet active), then the dequeue
would miss it and always return zero packets. The cure is to always
do a first pass over all grinders.

Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agosched: fix build if debug enabled
Stephen Hemminger [Wed, 14 May 2014 16:25:26 +0000 (09:25 -0700)]
sched: fix build if debug enabled

Fix build error if RTE_SCHED_DEBUG is enabled.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agosched: use malloc instead of memzone for allocation
Stephen Hemminger [Wed, 14 May 2014 16:25:25 +0000 (09:25 -0700)]
sched: use malloc instead of memzone for allocation

The existing rte scheduler can only be safely configured once per port
because a memory zone has a fixed size once it is created and can never
be freed or change in size.

This patch changes the scheduler to use rte_malloc instead. This allows
for a port to be reconfigured by doing rte_sched_port_free followed
rte_sched_port_config.

The patch also removes the now unused name parameter from the
port parameters structure.

Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoconfig: rename "default" configurations as "native"
David Marchand [Wed, 14 May 2014 14:58:08 +0000 (16:58 +0200)]
config: rename "default" configurations as "native"

The "default" part in configuration filenames is misleading.
Rename this as "native", as this is the RTE_MACHINE that is set in these files.
This should make it clearer for people who build DPDK on a system then run it on
another one.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoconfig: factorize configurations
David Marchand [Wed, 14 May 2014 14:58:07 +0000 (16:58 +0200)]
config: factorize configurations

linux and bsd default configurations now have their own default common
configuration files.
Specific options are then set in the specific files.
This makes it easier to globally enable/disable some features in DPDK for
multiple targets.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoigb: fix indentation of previous patchset
Thomas Monjalon [Wed, 21 May 2014 11:23:50 +0000 (13:23 +0200)]
igb: fix indentation of previous patchset

There was an indentation error in commit d93c252e88f2b29a5
"convert to use of PMD_REGISTER_DRIVER and fix linking"

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: fix indentation of previous patchset
Thomas Monjalon [Wed, 21 May 2014 11:21:16 +0000 (13:21 +0200)]
eal: fix indentation of previous patchset

There was an indentation error in commit e57f20e051770861377ff
"make vdev init path generic for both virtual and pci devices"

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: remove rte_pmd_init_all function
Neil Horman [Mon, 21 Apr 2014 14:59:39 +0000 (10:59 -0400)]
ethdev: remove rte_pmd_init_all function

Now that we've converted all the pmds in dpdk to use the driver registration
macro, rte_pmd_init_all has become empty.  As theres no reason to keep it around
anymore, just remove it and fix up all the eample callers.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agovmxnet3: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:38 +0000 (10:59 -0400)]
vmxnet3: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the vmxnet3 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the vmxnet3 library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agovirtio: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:37 +0000 (10:59 -0400)]
virtio: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the virtio pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the virtio library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbevf: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:36 +0000 (10:59 -0400)]
ixgbevf: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the ixgbevf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbevf library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbe: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:35 +0000 (10:59 -0400)]
ixgbe: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the ixgbe pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the ixgbe library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigbvf: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:33 +0000 (10:59 -0400)]
igbvf: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the igbvf pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igbvf library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigb: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:32 +0000 (10:59 -0400)]
igb: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the igb pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the igb library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoe1000: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:34 +0000 (10:59 -0400)]
e1000: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the e1000 pmd driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the e1000 library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: make vdev init path generic for both virtual and pci devices
Neil Horman [Mon, 21 Apr 2014 14:59:31 +0000 (10:59 -0400)]
eal: make vdev init path generic for both virtual and pci devices

Currently, physical device pmds use a separate initalization path
(rte_pmd_init_all) while virtual devices use a constructor registration and
rte_eal_dev_init.  Theres no reason to have them be separate.  This patch
removes the vdev specific nomenclature from the vdev init path and makes it more
generic for use with all pmds.  This is the first step in converting the
physical device pmds to using the same constructor based registration path that
the virtual devices use.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoxenvirt: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:30 +0000 (10:59 -0400)]
xenvirt: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the xenvirt driver to use the PMD_REGISTER_DRIVER macro.
This means that the test applications now have no reference to the xenvirt library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

A few notes:

xenvirt was unbuildable as of commit 4c39baf297d10c217e7d3e7370f26a1fede58308..
That commit neglected to include the rte_vdev.h header, so several structs were
left undefined.  This patch includes a fix for that as well.

Also, The linkage for xenvirt is broken in much the same way pmd_ring was, in
that the xenvirt pmd has a function that is called directly from applications
(the example being the testpmd application).  The function is
rte_mempool_gntalloc_create, and should clearly be moved into the rte_mempool
library, with the supporting code in the function implementation moved to a new
xenvirt library separate from the pmd.  This is a large undertaking that
detracts from the purpose of this series however, and so for now, I'm leaving
the linkage to the application in place, and will address this issue in a later
series

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoring: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:29 +0000 (10:59 -0400)]
ring: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the ring driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the ring library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Note that the ring driver was also written in such a way that it violated some
general layering principles, several functions were contained in the pmd which
were being called by example from the test application in the app/test
directory.  Specifically it was calling eth_ring_pair_attach,
eth_ring_pair_create and rte_eth_ring_devinit, which should only be called
internally to the dpdk core library.  To correct this I've removed those
functions, and instead allowed them to be called indirectly at initalization
time using the vdev command line argument key nodeaction=<name>:<node>:<action>
where action is one of ATTACH or CREATE.  I've tested out the functionality of
the command line with the testpmd utility, with success, and have removed the
called functions from the test utility.  This will affect how the test utility
is invoked (the -d and --vdev option will need to be specified on the command
line now), but honestly, given the way it was coded, I think the testing of the
ring pmd was not the best example of how to code with dpdk to begin with.  I
have also left the two layer violating functions in place, so as not to break
existing applications, but added deprecation warnings to them so that apps can
migrate off them.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agopcap: convert to use of PMD_REGISTER_DRIVER and fix linking
Neil Horman [Mon, 21 Apr 2014 14:59:28 +0000 (10:59 -0400)]
pcap: convert to use of PMD_REGISTER_DRIVER and fix linking

Convert the pcap driver to use the PMD_REGISTER_DRIVER macro and fix up the
Makefile so that its linkage is only done if we are building static libraries.
This means that the test applications now have no reference to the pcap library
when building DSO's and must specify its use on the command line with the -d
option.  Static linking will still initalize the driver automatically.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: add PMD_REGISTER_DRIVER macro
Neil Horman [Mon, 21 Apr 2014 14:59:27 +0000 (10:59 -0400)]
eal: add PMD_REGISTER_DRIVER macro

Rather than have each driver have to remember to add a constructor to it to make
sure its gets registered properly, wrap that process up in a macro to make
registration a one line affair.  This also sets the stage for us to make
registration of vdev pmds and physical pmds a uniform process

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoivshmem: fix build
Olivier Matz [Mon, 19 May 2014 12:36:37 +0000 (14:36 +0200)]
ivshmem: fix build

Fix compilation error introduced by:
e5ac7c2ff367edd eal: don't inline string functions

The stdio.h include is missing due to its removing from rte_string_fns.h.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agomempool: add iterator function
Stephen Hemminger [Fri, 2 May 2014 23:42:54 +0000 (16:42 -0700)]
mempool: add iterator function

Add function to iterate over mempool.
Useful for diagnostic code that wants to look at mempool usage patterns.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
10 years agomemzone: add iterator function
Stephen Hemminger [Fri, 2 May 2014 23:42:55 +0000 (16:42 -0700)]
memzone: add iterator function

When doing diagnostic function, it is useful to have a ability
to iterate over all memzones.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
10 years agoeal: don't inline string functions
Stephen Hemminger [Fri, 2 May 2014 23:42:53 +0000 (16:42 -0700)]
eal: don't inline string functions

It makes no sense to inline string functions, in fact snprintf
can't be inlined because the function supports variable number of
arguments.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[Thomas: update includes]
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
10 years agoadd FILE argument to debug functions
Stephen Hemminger [Fri, 2 May 2014 23:42:56 +0000 (16:42 -0700)]
add FILE argument to debug functions

The DPDK dump functions are useful for remote debugging of an
applications. But when application runs as a daemon, stdout
is typically routed to /dev/null.

Instead change all these functions to take a stdio FILE * handle
instead. An application can then use open_memstream() to capture
the output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[Thomas: fix quota_watermark example]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agospelling fixes
Stephen Hemminger [Fri, 2 May 2014 23:42:52 +0000 (16:42 -0700)]
spelling fixes

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
10 years agomk: add "make examples" target in root makefile
Olivier Matz [Fri, 16 May 2014 08:19:01 +0000 (10:19 +0200)]
mk: add "make examples" target in root makefile

It is now possible to build all projects from the examples/ directory
using one command from root directory.

Some illustration of what is possible:

- build examples in the DPDK tree for one target

  # install the x86_64-default-linuxapp-gcc in
  # ${RTE_SDK}/x86_64-default-linuxapp-gcc directory
  user@droids:~/dpdk.org$ make install T=x86_64-default-linuxapp-gcc
  # build examples for this new installation in
  # ${RTE_SDK}/examples directory
  user@droids:~/dpdk.org$ make examples T=x86_64-default-linuxapp-gcc

- build examples outside DPDK tree for several targets

  # install all targets matching x86_64-*-linuxapp-gcc in
  # ${RTE_SDK}/x86_64-*-linuxapp-gcc directories
  user@droids:~/dpdk.org$ make install T=x86_64-*-linuxapp-gcc
  # build examples for these installations in /tmp/foobar
  user@droids:~/dpdk.org$ make examples T=x86_64-*-linuxapp-gcc O=/tmp/foobar

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoexamples/netmap_compat: fix makefile
Olivier Matz [Fri, 16 May 2014 08:19:00 +0000 (10:19 +0200)]
examples/netmap_compat: fix makefile

It is not allowed to reference a an absolute file name in SRCS-y.
A VPATH has to be used, else the dependencies won't be checked
properly.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoexamples/qos_sched: fix makefile
Olivier Matz [Fri, 16 May 2014 08:18:59 +0000 (10:18 +0200)]
examples/qos_sched: fix makefile

The example does not compile as the linker complains about duplicated
symbols.

Remove -lsched from LDLIBS, it is already present in rte.app.mk and
added by the DPDK framework automatically.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoexamples: add a makefile to build all examples
Olivier Matz [Fri, 16 May 2014 08:18:58 +0000 (10:18 +0200)]
examples: add a makefile to build all examples

It is now possible to build all examples by doing the following:

  user@droids:~/dpdk.org$ cd examples
  user@droids:~/dpdk.org/examples$ make RTE_SDK=${PWD}/.. \
      RTE_TARGET=x86_64-default-linuxapp-gcc

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoexamples: use rte.extsubdir.mk to build examples with subdirectories
Olivier Matz [Fri, 16 May 2014 08:18:57 +0000 (10:18 +0200)]
examples: use rte.extsubdir.mk to build examples with subdirectories

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agomk: introduce rte.extsubdir.mk for projects with subdirectories
Olivier Matz [Fri, 16 May 2014 08:18:56 +0000 (10:18 +0200)]
mk: introduce rte.extsubdir.mk for projects with subdirectories

This makefile can be included by a project that needs to build several
applications or libraries that are located in different directories.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agomk: add missing scripts directory in install directory
David Marchand [Fri, 9 May 2014 13:31:01 +0000 (15:31 +0200)]
mk: add missing scripts directory in install directory

Trying to install headers for an external library using DPDK exported makefile
rte.extshared.mk results in following error :

$ cd dpdk
$ make install DESTDIR=/home/marchand/myapp/staging/plop T=x86_64-default-linuxapp-gcc
$ cd ~/myapp
$ make RTE_SDK=/home/marchand/myapp/staging/plop RTE_TARGET=x86_64-default-linuxapp-gcc
  CC plop.o
  LD plop.so
  SYMLINK-FILE include/plop.h
/bin/sh:
/home/marchand/myapp/staging/plop/scripts/relpath.sh: No such file or directory
ln: `/home/marchand/myapp/build/include' and `./include' are the same file
make[1]: *** [/home/marchand/myapp/build/include/plop.h] Error 1
make: *** [all] Error 2

This comes from the fact that DPDK only installs its mk/ directory while some
makefiles require the scripts/ directory content as well.

So install missing files from scripts/.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
10 years agoapp/testpmd: add --disable-link-check option
David Marchand [Wed, 30 Apr 2014 13:30:02 +0000 (15:30 +0200)]
app/testpmd: add --disable-link-check option

When starting/stopping ports, a link status check on all available ports is
done. This can be annoying when cables are not plugged at the time.
Default behavior is untouched.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>