dpdk.git
9 years agoexamples/l3fwd-acl: fix possible memory leak
Konstantin Ananyev [Tue, 16 Dec 2014 17:05:08 +0000 (17:05 +0000)]
examples/l3fwd-acl: fix possible memory leak

At error app_acl_init() can return without freeing dynamically allocated memory.
Not really a big problem, as if app_acl_init() fails,
then application would terminate immediately anyway.
Though it is a good coding practise to make a function to cleanup after itself.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
9 years agoapp/test: check for mbuf allocation failure
Bruce Richardson [Tue, 16 Dec 2014 15:03:50 +0000 (15:03 +0000)]
app/test: check for mbuf allocation failure

If mbuf allocation failed for whatever reason, we would get a NULL
pointer exception in test_table_acl.c:test_pipeline_single_filter test
case.
We fix this by causing an early break out of the application loop. If we
quit the test immediately we would leak any existing allocated mbufs,
but by breaking instead, we allow the test to continue and clean up the
mbufs already in the pipeline, while still having a test failure as the
mbuf counts should not match.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: fix crash after null check
Bruce Richardson [Tue, 16 Dec 2014 15:03:49 +0000 (15:03 +0000)]
app/test: fix crash after null check

In the kvargs test cases, we were checking for errors by checking if the
returned pointer value was NULL. In the error handling, we then tried to
free back the NULL pointer, which would cause a crash.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoapp/test: fix multi-process when device is bound to uio
Pablo de Lara [Thu, 11 Dec 2014 13:50:35 +0000 (13:50 +0000)]
app/test: fix multi-process when device is bound to uio

Since commit a155d4301 "support link bonding device initialization",
EAL probes drivers to the PCI devices in rte_eal_init,
then PCI resources are mapped if a device
is bound to igb_uio driver, for instance.
Therefore, test app probes all the devices and multiprocess unit test
tries to map resources twice in the secondary processes, and test fails,
caused by RTE_PCI_DRV_NEEDED_MAPPING flag in dummy pci driver my_driver2.

Test is fixed by setting the driver flags to 0.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoapp/testpmd: limit port mask bits to configured maximum
Bruce Richardson [Tue, 16 Dec 2014 14:39:44 +0000 (14:39 +0000)]
app/testpmd: limit port mask bits to configured maximum

The port mask parsing in testpmd allowed up to 64 bits to be processed,
even if RTE_MAX_ETHPORTS is set to a max of 32. Fix this by only
processing up to min(RTE_MAX_ETHPORTS,64) bits of the mask.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoaf_packet: fix crash on initialization failure
Bruce Richardson [Tue, 16 Dec 2014 16:30:22 +0000 (16:30 +0000)]
af_packet: fix crash on initialization failure

The cleanup code on error checks for *internals being NULL only after
using the pointer to perform other cleanup. Fix this by moving the
clean-up based on the pointer inside the check for NULL.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agovmxnet3: fix default Tx configuration
Pablo de Lara [Thu, 11 Dec 2014 21:18:40 +0000 (21:18 +0000)]
vmxnet3: fix default Tx configuration

Since commit fbde27f19ab8f "get default Rx/Tx configuration from dev info",
a default RX/TX configuration can be used for all PMDs.
In case of vmxnet3, the whole structure was zeroed and not filled out.
The PMD does not support multi segments or offload functions,
so txq_flags should have those flags set.

Test report: http://dpdk.org/ml/archives/dev/2014-December/009933.html

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Xiaonan Zhang <xiaonanx.zhang@intel.com>
9 years agoi40e: workaround for X710 performance
Helin Zhang [Tue, 16 Dec 2014 08:23:20 +0000 (16:23 +0800)]
i40e: workaround for X710 performance

On X710, performance number is far from the expectation on recent
firmware versions. The fix for this issue may not be integrated in
the following firmware version. So the workaround in software driver
is needed. It needs to modify the initial values of 3 internal only
registers. Note that the workaround can be removed when it is fixed
in firmware in the future.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agoixgbe: support X540 VF
Stephen Hemminger [Tue, 9 Dec 2014 16:37:24 +0000 (08:37 -0800)]
ixgbe: support X540 VF

Add missing setup for X540 MAC type when setting up VF.
Additional check exists in Linux driver but not in DPDK.

Signed-off-by: Bill Hong <bhong@brocade.com>
Signed-off-by: Stephen Hemminger <shemming@brocade.com>
9 years agoixgbe: fix multi-process support
Bruce Richardson [Fri, 5 Dec 2014 13:46:22 +0000 (13:46 +0000)]
ixgbe: fix multi-process support

When using multiple processes, the TX function used in all processes
should be the same, otherwise the secondary processes cannot transmit
more than tx-ring-size - 1 packets.
To achieve this, we extract out the code to select the ixgbe TX function
to be used into a separate function inside the ixgbe driver, and call
that from a secondary process when it is attaching to an
already-configured NIC.

Testing with symmetric MP app shows that we are able to RX and TX from
both primary and secondary processes once this patch is applied.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
9 years agoixgbe: fix array overflow in vector Rx
Bruce Richardson [Tue, 16 Dec 2014 16:30:23 +0000 (16:30 +0000)]
ixgbe: fix array overflow in vector Rx

Switch the order of the conditions in a while loop, so we check the
range of "i" against the max, before using it to index into the array.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoigb_uio: fix build with kernel 3.18
Shu Shen [Thu, 11 Dec 2014 19:33:23 +0000 (11:33 -0800)]
igb_uio: fix build with kernel 3.18

This patch fixes build failing with undefined symbol _PAGE_IOMAP with
kernel 3.18.

The Xen-specific _PAGE_IOMAP PTE flag was removed in kernel 3.18 and
could be used for other purpose in future. This patch ensures that
_PAGE_IOMAP flag is only used for kernels before 3.18.

Signed-off-by: Shu Shen <shu.shen@radisys.com>
Acked-by: Jincheng Miao <jmiao@redhat.com>
9 years agoring: fix return type in enqueue and dequeue burst functions
Pablo de Lara [Mon, 15 Dec 2014 13:41:46 +0000 (13:41 +0000)]
ring: fix return type in enqueue and dequeue burst functions

Enqueue and dequeue burst functions always return a positive
value (including 0), so return type should be unsigned,
instead of int.

Fixed also API doc for one of the functions.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agonet: fix IPv6 checksum
Konstantin Ananyev [Thu, 11 Dec 2014 11:49:42 +0000 (11:49 +0000)]
net: fix IPv6 checksum

For rte_ipv6_phdr_cksum() gcc 4.8.* with "-O3" not always generates
correct code.
Sometimes it 'forgets' to put len and proto fields of psd_header on the stack.
To overcome that problem and speedup things a bit, refactored rte_raw_cksum()
by splitting ipv6 pseudo-header csum calculation into 3 phases:
1. calc sum for src & dst addresses
2. add sum for proto & len.
3. finalise sum
That makes gcc to generate valid code and helps to avoid any copying.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agocfgfile: fix read of empty file
Bruce Richardson [Tue, 16 Dec 2014 15:03:53 +0000 (15:03 +0000)]
cfgfile: fix read of empty file

If the file to be read by the cfgfile is empty, i.e. no configuration
data, but possibly comments present, the cfgfile should not mark the
last processed section (curr_section) as having N entries, since there
is no last processed section.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoeal: use safe snprintf to print version
Bruce Richardson [Tue, 16 Dec 2014 16:30:24 +0000 (16:30 +0000)]
eal: use safe snprintf to print version

When printing the version string to a local variable, use snprintf for
safety over sprintf. This is general good practice even if the values
to print are all hard-coded.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoeal: fix unused value warning in memcpy macro
Pawel Wodkowski [Mon, 15 Dec 2014 16:55:02 +0000 (16:55 +0000)]
eal: fix unused value warning in memcpy macro

GCC 4.5.1 from SUSE throws this error:
lib/librte_pmd_enic/enic_main.c:862:2: error: value computed is not used

This change use statements in expressions C extension provided by gcc to avoid
'value computed is not used' warning/error when size is not known at compile
time.

Reported-by: Michael Qiu <michael.qiu@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
[Thomas: apply same fix to ppc_64]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: fix link of combined shared library using CC
Sergio Gonzalez Monroy [Tue, 28 Oct 2014 15:48:49 +0000 (15:48 +0000)]
mk: fix link of combined shared library using CC

If we set EXTRA_CFLAGS=-O0, build fails with following error:
/usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO

Fix: link combined shared lib using CC if LINK_USING_CC is enabled.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
[Thomas: remove change to rte.lib.mk]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: fix link to combined library
Hiroshi Shimamoto [Thu, 11 Dec 2014 02:54:32 +0000 (02:54 +0000)]
mk: fix link to combined library

The application should be linked to the single combined library in the
condition that both of CONFIG_RTE_BUILD_COMBINE_LIB and
CONFIG_RTE_BUILD_SHARED_LIB are enabled.

The current makefile generates an application that links to each library.
This patch fixes to link the single library.

Before
$ ldd x86_64-ivshmem-linuxapp-gcc/app/test
linux-vdso.so.1 =>  (0x00007fff232a1000)
librte_distributor.so => not found
librte_kni.so => not found
librte_ivshmem.so => not found
librte_pipeline.so => not found
librte_table.so => not found
librte_port.so => not found
librte_timer.so => not found
librte_hash.so => not found
librte_lpm.so => not found
librte_power.so => not found
librte_acl.so => not found
librte_meter.so => not found
librte_sched.so => not found
libm.so.6 => /lib64/libm.so.6 (0x00007fc638020000)
librt.so.1 => /lib64/librt.so.1 (0x00007fc637e18000)
librte_kvargs.so => not found
librte_mbuf.so => not found
librte_ip_frag.so => not found
libethdev.so => not found
librte_malloc.so => not found
librte_mempool.so => not found
librte_ring.so => not found
librte_eal.so => not found
librte_cmdline.so => not found
librte_cfgfile.so => not found
librte_pmd_bond.so => not found
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fc637bfe000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fc6379fa000)
libintel_dpdk.so => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fc6377dd000)
libc.so.6 => /lib64/libc.so.6 (0x00007fc63741c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc638330000)

After
$ ldd x86_64-ivshmem-linuxapp-gcc/app/test
linux-vdso.so.1 =>  (0x00007fffb79fe000)
librt.so.1 => /lib64/librt.so.1 (0x00007f0d8a971000)
libm.so.6 => /lib64/libm.so.6 (0x00007f0d8a66f000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0d8a458000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f0d8a254000)
libintel_dpdk.so => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0d8a037000)
libc.so.6 => /lib64/libc.so.6 (0x00007f0d89c76000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0d8ab82000)

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: fix build with shared pcap pmd
Thomas Monjalon [Mon, 15 Dec 2014 22:44:49 +0000 (23:44 +0100)]
mk: fix build with shared pcap pmd

Some applications doesn't have the pcap link flag
when shared libraries are enabled.
Indeed in such case, pcap PMD must not be linked but pcap library should.

Actually -lpcap is always needed if pcap PMD is used,
and -lrte_pmd_pcap must be set only with static PMD library.
So the flags -lrte_pmd_pcap and -lpcap are enabled separately.

Workarounds in test-pmd/ and test-pipeline/ can be removed.

Reported-by: Stepan Sojka <stepan.sojka@adaptivemobile.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoversion: 1.8.0-rc4
Thomas Monjalon [Thu, 11 Dec 2014 00:42:52 +0000 (01:42 +0100)]
version: 1.8.0-rc4

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/test: fix memory needs
Pablo de Lara [Tue, 9 Dec 2014 10:11:12 +0000 (10:11 +0000)]
app/test: fix memory needs

Since commit b91c67e5a693211862aa7dc3b78630b4e856c2af,
maximum number of cores is 128, which has increase
the total memory necessary for a rte_mempool structure,
as the per-lcore local cache has been doubled in size.
Therefore, eal_flags unit test was broken since it needed
to use more hugepages.

Increased memory to 18MB, as that is the actual minimum memory necessary
(depending on the physical memory segments, DPDK may need less memory)

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
9 years agoexamples/l3fwd-vf: fix race condition
Daniel Mrzyglod [Tue, 8 Jul 2014 11:16:24 +0000 (12:16 +0100)]
examples/l3fwd-vf: fix race condition

When the routing is through the same queue, the app crashed.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoexamples/vhost: fix hard forward of jumbo frames
Ouyang Changchun [Wed, 10 Dec 2014 12:11:47 +0000 (20:11 +0800)]
examples/vhost: fix hard forward of jumbo frames

Search the right segment to increase its data length, rather than
wrongly early return and exit the tx function, which leads to drop all jumbo frame packets
when vm2vm is in hard forward mode.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
9 years agoexamples/vhost: increase maximum queue number
Huawei Xie [Tue, 9 Dec 2014 18:49:44 +0000 (02:49 +0800)]
examples/vhost: increase maximum queue number

Increase MAX_QUEUES from 256 to 512.

In vhost example, MAX_QUEUES macro should be the maximum possible queue number of the port.
Theoretically we should only set up the queues that are used, i.e., first rx queue of each pool, or
at most queues from 0 to MAX_QUEUES. Before we revise the implementation and are certain all NICs support
this well, add a remind message to user.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
9 years agoi40e: fix RSS RETA query
Helin Zhang [Wed, 10 Dec 2014 03:10:16 +0000 (11:10 +0800)]
i40e: fix RSS RETA query

There is a bug in querying reta, of storing the data to the correct entry.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
9 years agoenic: fix build with gcc 4.7.2
Helin Zhang [Tue, 9 Dec 2014 08:56:10 +0000 (16:56 +0800)]
enic: fix build with gcc 4.7.2

Compile warnings/errors was found on gcc 4.7.2 as follows. Variables
was reported of being used but uninitialized. Assigning an initial
value to it is needed.

lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_get_mac_addr:
lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized
in this function [-Werror=uninitialized]
lib/librte_pmd_enic/vnic/vnic_dev.c:629:10: note: a1 was declared here
lib/librte_pmd_enic/vnic/vnic_dev.c: In function vnic_dev_set_mac_addr:
lib/librte_pmd_enic/vnic/vnic_dev.c:393:16: error: a1 may be used uninitialized
in this function [-Werror=uninitialized]
lib/librte_pmd_enic/vnic/vnic_dev.c:980:10: note: a1 was declared here

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agobond: fix mac assignment to slaves
Declan Doherty [Mon, 8 Dec 2014 11:19:32 +0000 (11:19 +0000)]
bond: fix mac assignment to slaves

Adding call to mac_address_slaves_update from the lsc handler when the
first slave become active to propagate any mac changes made while
devices are inactive

Changed removing slave logic to use memmove instead of memcpy to move
data within the same array, as this was corrupting the slave array.

Adding unit test to cover failing assignment scenarios

Test report: http://dpdk.org/ml/archives/dev/2014-December/009623.html

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SunX Jiajia <sunx.jiajia@intel.com>
9 years agoxen: fix build with kernel 3.18
Jincheng Miao [Wed, 10 Dec 2014 13:04:53 +0000 (21:04 +0800)]
xen: fix build with kernel 3.18

From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

Add xen_dom0/compat.h to be compatible with older kernel.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agokni: fix build with kernel 3.18
Jincheng Miao [Wed, 10 Dec 2014 03:33:02 +0000 (11:33 +0800)]
kni: fix build with kernel 3.18

From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

Add kni/compat.h to be compatible with older kernel.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigb_uio: fix build with kernel 3.18
Jincheng Miao [Wed, 10 Dec 2014 03:33:01 +0000 (11:33 +0800)]
igb_uio: fix build with kernel 3.18

From upstream kernel commit 3db2e9cd, strict_strto* serial functions
are removed. So that we should directly used kstrtoul instead.

kstrtoul exists from RHEL6.4, so for compatibility with old kernel and RHEL,
add some logic to igb_uio/compat.h.

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoigb_uio: fix build with long term kernel and RHEL
Jincheng Miao [Wed, 10 Dec 2014 03:33:00 +0000 (11:33 +0800)]
igb_uio: fix build with long term kernel and RHEL

Function pci_num_vf() is introduced from upstream linux-2.6.34. So
this patch make compatible with longterm kernel linux-2.6.32.63.

For RHEL, function pci_num_vf() begins from RHEL5 update9. And
it is stub-defined when CONFIG_PCI_IOV is not enabled.

So dropped the CONFIG_PCI_IOV checking of commit 11ba0426.

For other distro like RHEL behaved to pci_num_vf(), we could simply
append following condition macro:
(!(defined(OTHER_RELEASE_CODE) && \
 OTHER_RELEASE_CODE >= OTHER_RELEASE_VERSION(X, Y)))

Signed-off-by: Jincheng Miao <jmiao@redhat.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoethdev: fix build with libc ip6 header
Mark Kavanagh [Tue, 9 Dec 2014 17:32:08 +0000 (17:32 +0000)]
ethdev: fix build with libc ip6 header

The name of the rte_eth_fdir_flow's rte_eth_ipv6_flow attribute,
'ip6_flow', clashes with a macro defined in
/usr/include/netinet/ip6.h, such that when DPDK is linked with an
application that uses the afforementioned header, the macro is
expanded within the DPDK struct, causing a compilation error.

Rename the relevant attribute in DPDK to resolve this.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agonet: fix build with gcc 4.4.7 and strict aliasing
Michael Qiu [Thu, 4 Dec 2014 04:16:04 +0000 (12:16 +0800)]
net: fix build with gcc 4.4.7 and strict aliasing

include/rte_ip.h:161: error: dereferencing pointer ‘u16’
        does break strict-aliasing rules
include/rte_ip.h:157: note: initialized from here
        ...

The root cause is that, compile enable strict aliasing by default,
while in function rte_raw_cksum() try to convert 'const char *'
to 'const uint16_t *'.

This workaround is to solve the compile issue of GCC strict-aliasing (two
different type pointers should not be point to the same memory address).

For GCC 4.4.7 it will definitely occurs if  flags "-fstrict-aliasing"
and "-Wall" used.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
[Thomas: add workaround comment]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: fix build with icc
Michael Qiu [Wed, 10 Dec 2014 10:46:42 +0000 (18:46 +0800)]
eal: fix build with icc

lib/librte_eal/linuxapp/eal/eal.c(461): error #2259: non-pointer
conversion from "long long" to "void *" may lose significant bits
   RTE_PTR_ALIGN_CEIL((uintptr_t)addr, RTE_PGSIZE_16M);

The root cause is that "RTE_PGSIZE_16M" is defined as unsigned long long.
But in i686 platform "void *" is 32-bit.
It is safe to cast to size_t and make it works in both 32 & 64-bit
platform.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoeal: fix build for 32-bit system
Michael Qiu [Wed, 10 Dec 2014 10:46:41 +0000 (18:46 +0800)]
eal: fix build for 32-bit system

lib/librte_eal/linuxapp/eal/eal_memory.c:324:4: error: comparison
is always false due to limited range of data type [-Werror=type-limits]
    || (hugepage_sz == RTE_PGSIZE_16G)) {
    ^

This was introuduced by commit b77b5639:
        mem: add huge page sizes for IBM Power

The root cause is that size_t is 32-bit in i686 platform,
but RTE_PGSIZE_16M and RTE_PGSIZE_16G are always 64-bit.

Force hugepage_sz to always 64-bit to avoid this issue.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agolib: fix cache alignment of structures
Jia Yu [Fri, 7 Nov 2014 17:28:09 +0000 (09:28 -0800)]
lib: fix cache alignment of structures

Include rte_memory.h for lib files that use __rte_cache_aligned
attribute.

Consider the following code:

struct per_core_foo {
...
} __rte_cache_aligned;

struct global_foo {
struct per_core_foo foo[RTE_MAX_CORE];
};

If __rte_cache_aligned is not defined (rte_memory.h is not included),
the code compiles but the structure is not aligned... it defines the
structure and creates a global variable called __rte_cache_aligned.
And this can lead to really bad things if this code is in a .h that
is included by files that may or may not include rte_memory.h

Signed-off-by: Jia Yu <jyu@vmware.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomk: fix build 32-bits shared libraries with 64-bits system
Sergio Gonzalez Monroy [Wed, 22 Oct 2014 16:36:22 +0000 (17:36 +0100)]
mk: fix build 32-bits shared libraries with 64-bits system

Incompatible libraries error when building shared libraries for 32bits on
a 64bits system.
Fix issue by passing CPU_CFLAGS to CC when LINK_USING_CC is enabled.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agomk: fix build shared libraries
Hiroshi Shimamoto [Wed, 3 Dec 2014 23:33:54 +0000 (23:33 +0000)]
mk: fix build shared libraries

Only CPU_LDFLAGS is used in mk/rte.sharelib.mk.
It should be LDFLAGS to build the library with correct linkage options.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Reviewed-by: Hayato Momma <h-momma@ce.jp.nec.com>
9 years agoversion: 1.8.0-rc3
Thomas Monjalon [Sat, 6 Dec 2014 10:24:04 +0000 (11:24 +0100)]
version: 1.8.0-rc3

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoexamples/vhost: use factorized default Rx/Tx configuration
Huawei Xie [Wed, 12 Nov 2014 22:34:07 +0000 (06:34 +0800)]
examples/vhost: use factorized default Rx/Tx configuration

Refer to Pablo's commit (81f7ecd934372fc):
    "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."

Move zero copy's deferred start set up ahead.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
9 years agoexamples/vhost: support new VMDQ API for i40e
Huawei Xie [Wed, 12 Nov 2014 22:34:06 +0000 (06:34 +0800)]
examples/vhost: support new VMDQ API for i40e

In Niantic, if VMDQ mode is set, all queues are allocated to VMDQ in DPDK.
In I40E, only configured part of continous queues are allocated to VMDQ.
The rte_eth_dev_info structure is extended to provide VMDQ queue base,
queue number, and VMDQ pool base information.
This patch support the new VMDQ API in vhost example.

FIXME in PMD:
 * added mac address will be flushed at rte_eth_dev_start.
 * we don't support selectively setting up queues well.

Test report: http://dpdk.org/ml/archives/dev/2014-December/009427.html

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
Tested-by: Jingguo Fu <jingguox.fu@intel.com>
9 years agoi40e: use macros for vlan filtering registers
Huawei Xie [Tue, 2 Dec 2014 09:02:06 +0000 (17:02 +0800)]
i40e: use macros for vlan filtering registers

Add two macros I40E_VFTA_IDX and I40E_VFTA_BIT for vlan filter search and set.
Add vlan_id check in vlan filter search and set function.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agoi40e: fix vlan filtering
Huawei Xie [Tue, 2 Dec 2014 09:02:05 +0000 (17:02 +0800)]
i40e: fix vlan filtering

">> 5" rather than ">> 4"

vlan id is a 12 bit value.
VFTA is 128 x 32 bit array (128 double word array) which could store 2^12 vlan bits.
Each bit represents whether corresponding vlan tag is set in the VSI.
Use high 7 bits as the index for the double word array.

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
9 years agoixgbe: do not override buffer length
Konstantin Ananyev [Fri, 5 Dec 2014 15:20:34 +0000 (15:20 +0000)]
ixgbe: do not override buffer length

The template mbuf_initializer is hard coded with a buflen which
might have been set differently by the application at the time of
mbuf pool creation.

- move buf_len fields out of rearm_data marker.
- make ixgbe_recv_pkts_vec() not touch buf_len field at all
(as all other RX functions behave).

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
9 years agoixgbe: fix setup of mbuf initializer template
Jean-Mickael Guerin [Thu, 4 Dec 2014 14:26:20 +0000 (15:26 +0100)]
ixgbe: fix setup of mbuf initializer template

Add a compiler barrier to make sure all fields covered by
the marker rearm_data are assigned before the read.

Fixes: 0ff3324da2 ("ixgbe: rework vector pmd following mbuf changes")

Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoenic: fix uninitialized variable
Bruce Richardson [Fri, 5 Dec 2014 15:57:12 +0000 (15:57 +0000)]
enic: fix uninitialized variable

The variable notify_pa is only initialized inside one branch of
an if statement, triggering a compiler error with clang 3.3 on FreeBSD.

  CC vnic/vnic_dev.o
lib/librte_pmd_enic/vnic/vnic_dev.c:777:6: fatal error: variable 'notify_pa'
      is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        if (!vnic_dev_in_reset(vdev)) {

Fix this issue by adding "= 0" to the variable definition.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoenic: fix initialization error with clang
Bruce Richardson [Fri, 5 Dec 2014 15:57:11 +0000 (15:57 +0000)]
enic: fix initialization error with clang

This patch fixes the following compiler error raised by clang 3.3
on FreeBSD 10:

  CC enic_clsf.o
lib/librte_pmd_enic/enic_clsf.c:99:25: fatal error: missing field 'u' initializer [-Wmissing-field-initializers]
        struct filter fltr = {0};

It fixes it by changing the initializer to set a named field to zero,
thereby automatically setting the rest of the unnamed fields also to
zero.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoaf_packet: add compile-time checks for kernel-specific options
John W. Linville [Thu, 4 Dec 2014 21:42:05 +0000 (16:42 -0500)]
af_packet: add compile-time checks for kernel-specific options

This allows the PMD to compile with kernels that don't support the
options in question.  The "#if defined(...)" lines are a bit ugly,
but I don't know of any better way to accomplish the task.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agodoc: add freebsd ports
Bruce Richardson [Mon, 24 Nov 2014 15:50:39 +0000 (15:50 +0000)]
doc: add freebsd ports

Since the DPDK is now part of the BSD ports collection, we should
recommend installing from ports as the best way to get it up and
running.
In order to achieve this, while still keeping the document readable, the
chapter on system requirements has been moved to instead be a section
within the chapter on compiling the DPDK outside of the ports
collection. This move is necessary, since it covered a lot of detail on
installing other ports required to build DPDK. These steps are not
needed when installing DPDK itself from ports.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: adjust line lengths in freebsd guide
Bruce Richardson [Mon, 24 Nov 2014 15:48:56 +0000 (15:48 +0000)]
doc: adjust line lengths in freebsd guide

The FreeBSD GSG rst files had very inconsistent line lengths for text
within paragraph blocks. Sometimes a line would be very short, while often
lines would be quite long.
This patch adjusts the formatting of the rst files so that lines break
at approx the 80-character mark, as is standard in the DPDK source code.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: auto-generate date in guides
Bruce Richardson [Mon, 24 Nov 2014 14:23:52 +0000 (14:23 +0000)]
doc: auto-generate date in guides

The index.html file for each of the "guide" docs had a hard-coded
date value in them of June 2014. Rather than update each of these
for each revision, just use the |today| directive to insert the date
at which the document was generated.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: fix testpmd guide
Pablo de Lara [Mon, 1 Dec 2014 11:40:48 +0000 (11:40 +0000)]
doc: fix testpmd guide

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: reorder testpmd commands
Pablo de Lara [Mon, 1 Dec 2014 11:40:47 +0000 (11:40 +0000)]
doc: reorder testpmd commands

Moved commands in testpmd UG to set queue rates
to match order in testpmd command help.

Created new section "Filters" to match that
same section in testpmd UG, and moved all
commands related to it there.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: fix testpmd commands
Pablo de Lara [Mon, 1 Dec 2014 11:40:46 +0000 (11:40 +0000)]
doc: fix testpmd commands

tx_checksum set function does not use bitmask anymore, but strings

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: new testpmd commands
Pablo de Lara [Mon, 1 Dec 2014 11:40:45 +0000 (11:40 +0000)]
doc: new testpmd commands

Added info in testpmd functions section for the following commands:

- tunnel_filter add
- tunnel_filter rm
- rx_vxlan_port add
- rx_vxlan_port rm
- port stop/start queue
- set port mac address filter (for VF)
- tx_checksum set
- tso set
- tso show

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: add vhost library
Siobhan Butler [Tue, 2 Dec 2014 21:11:42 +0000 (21:11 +0000)]
doc: add vhost library

As Vhost will be a library in DPDK 1.8, adding a new section to
Programmer's Guide to describe its use.

Signed-off-by: Siobhan Butler <siobhan.a.butler@intel.com>
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: add distributor application
Siobhan Butler [Tue, 2 Dec 2014 14:02:46 +0000 (14:02 +0000)]
doc: add distributor application

New distributor sample app user guide section for sample app user guide.

Signed-off-by: Siobhan Butler <siobhan.a.butler@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agodoc: update bonding
Declan Doherty [Mon, 1 Dec 2014 17:10:12 +0000 (17:10 +0000)]
doc: update bonding

Adding details for link status interrupts and link status polling.
Adding details for mode 4 / mode 5
Tidying up rst document to conform to 80 character line limit
Adding diagrams to explain bonding modes
Removed link_bonding.png file

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
9 years agoexamples/multi_process: fix resilience by enabling Rx drop
Bruce Richardson [Wed, 3 Dec 2014 16:56:59 +0000 (16:56 +0000)]
examples/multi_process: fix resilience by enabling Rx drop

The symmetric_mp example app is set up to allow two processes to
share a NIC port, with each pulling packets from one queue. In order
to have the app continue working when one of the process dies, the
drop_en bit should be set in the NIC configuration. Without this bit
set, the NIC will stall once any queue fills. With the bit set, once
a queue fills, all subsequent packets for that queue are discarded
allowing other queues to continue operating as normal.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agotable: fix lookup with incomplete bitmask
Bruce Richardson [Thu, 4 Dec 2014 14:24:12 +0000 (14:24 +0000)]
table: fix lookup with incomplete bitmask

When a lookup was done on a table_array structure with an incomplete
bitmask, the results was always zero hits. This was because the
pkts_mask value was cleared as we process each entry, and the result
was assigned at the end of the loop, when pkts_mask was zero.
Changing the assignment to occur at the start, before the pkts_mask
gets cleared, fixes this issue.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

9 years agoi40e: setup flow director only if enabled
Jingjing Wu [Thu, 4 Dec 2014 15:40:23 +0000 (23:40 +0800)]
i40e: setup flow director only if enabled

In order not to affect the FVL's performance by default setting, this
patch moves the flow director initialization from i40e_pf_setup to
i40e_dev_configure according to the mode in fdir configure info.
Then the resources used for flow director will be only setup if it is enabled.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
9 years agombuf: replace inner fields by outer fields semantic
Jijiang Liu [Tue, 2 Dec 2014 15:06:07 +0000 (23:06 +0800)]
mbuf: replace inner fields by outer fields semantic

Replace the inner_l2_len and the inner_l3_len field with the
outer_l2_len and outer_l3_len field, and rework csum forward engine
and i40e PMD due to these changes.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agombuf: add Tx offloading flags for tunnels
Jijiang Liu [Tue, 2 Dec 2014 15:06:06 +0000 (23:06 +0800)]
mbuf: add Tx offloading flags for tunnels

Replace PKT_TX_VXLAN_CKSUM with PKT_TX_UDP_TUNNEL_PKT in order to indicate
a packet is an UDP tunneling packet, and introduce 3 TX offload flags for
outer IP TX checksum, which are PKT_TX_OUTER_IP_CKSUM, PKT_TX_OUTER_IPV4
and PKT_TX_OUTER_IPV6 respectively.
Rework csum forward engine and i40e PMD due to these changes.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agombuf: remove aliasing of Tx offloading flags with Rx ones
Jijiang Liu [Tue, 2 Dec 2014 15:06:05 +0000 (23:06 +0800)]
mbuf: remove aliasing of Tx offloading flags with Rx ones

The reason of redefining the PKT_TX_IPV4 and the PKT_TX_IPV6 is listed below,
It will avoid to send a packet with a bad info:
  - we receive a Ether/IP6/IP4/L4/data packet
  - the driver sets PKT_RX_IPV6_HDR
  - the stack decapsulates IP6
  - the stack sends the packet, it has the PKT_TX_IPV6 flag but it's an IPv4 packet.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agoapp/testpmd: fix endianness detection
Thomas Monjalon [Wed, 3 Dec 2014 20:12:00 +0000 (21:12 +0100)]
app/testpmd: fix endianness detection

Use endianness detection factorized in EAL.

The comment about arpa/inet.h is not valid anymore since
commit d07180f211c08 ("net: fix conflict with libc").

The macro _htons could also be moved in rte_byteorder.h
by providing some constant byte swapping.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
9 years agoeal: detect endianness
Thomas Monjalon [Wed, 3 Dec 2014 20:01:19 +0000 (21:01 +0100)]
eal: detect endianness

There is no standard to check endianness.
So we need to try different checks.
Previous trials were done in testpmd (see commits
51f694dd40f56 and 64741f237cf29) without full success.
This one is not guaranteed to work everywhere so it could
evolve when exceptions are found.

If endianness is not detected, there is a fallback on x86
to little endian. It could be forced before doing detection
but it would add some arch-dependent code in the generic header.

The option CONFIG_RTE_ARCH_BIG_ENDIAN introduced for IBM Power only
(commit a982ec81d84d53) can be removed. A compile-time check is better.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Acked-by: Michael Qiu <michael.qiu@intel.com>
9 years agocmdline: fix overflow on bsd
Alan Carew [Fri, 5 Dec 2014 14:19:07 +0000 (15:19 +0100)]
cmdline: fix overflow on bsd

When using test-pmd with flow director in FreeBSD, the application will
segfault/Bus error while parsing the command-line. This is due to how
each commands result structure is represented during parsing, where the offsets
for each tokens value is stored in a character array(char result_buf[BUFSIZ])
in cmdline_parse()(./lib/librte_cmdline/cmdline_parse.c).

The overflow occurs where BUFSIZ is less than the size of a commands result
structure, in this case "struct cmd_pkt_filter_result"
(app/test-pmd/cmdline.c) is 1088 bytes and BUFSIZ on FreeBSD is 1024 bytes as
opposed to 8192 bytes on Linux.

The problem can be reproduced by running test-pmd on FreeBSD:
./testpmd -c 0x3 -n 4 -- -i --portmask=0x3 --pkt-filter-mode=perfect
And adding a filter:
add_perfect_filter 0 udp src 192.168.0.0 1024 dst 192.168.0.0 1024 flexbytes
0x800 vlan 0 queue 0 soft 0x17

This patch removes the OS dependency on BUFSIZ and defines and uses a
library #define CMDLINE_PARSE_RESULT_BUFSIZE 8192

Added boundary checking to ensure this buffer size cannot overflow, with
an error message being produced.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
http://git.droids-corp.org/?p=libcmdline.git;a=commitdiff;h=b1d5b169352e57df3fc14c51ffad4b83f3e5613f

Signed-off-by: Alan Carew <alan.carew@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agocmdline: revert fix overflow on bsd
Thomas Monjalon [Thu, 4 Dec 2014 15:13:45 +0000 (16:13 +0100)]
cmdline: revert fix overflow on bsd

Revert commit a0547e0a751100 because it is an old version
of the patch and was applied by error.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoenic: fix warnings
Thomas Monjalon [Tue, 2 Dec 2014 13:38:31 +0000 (14:38 +0100)]
enic: fix warnings

A lot of warnings were not seen because $(WERROR_FLAGS) was not set
in the Makefile. But they appear with toolchains that enforce more checks.

-Wno-deprecated seems useless.
-Wno-strict-aliasing is added to avoid false positives.

This patch cleans up unused variable, unused functions, wrong types,
static declarations, etc. A lot of functions have unused parameters;
it suggests that more clean-up could be needed.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Sujith Sankar <ssujith@cisco.com>
9 years agokni: fix build on IBM Power
Chao Zhu [Thu, 4 Dec 2014 10:14:08 +0000 (18:14 +0800)]
kni: fix build on IBM Power

Because of different cache line size, the alignment of struct
rte_kni_mbuf in rte_kni_common.h doesn't work on IBM Power. This patch
changed from 64 to RTE_CACHE_LINE_SIZE micro to do the alignment.

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agocmdline: fix overflow on bsd
Alan Carew [Mon, 20 Oct 2014 15:23:13 +0000 (16:23 +0100)]
cmdline: fix overflow on bsd

When using test-pmd with flow director in FreeBSD, the application will
segfault/Bus error while parsing the command-line. This is due to how
each commands result structure is represented during parsing, where the offsets
for each tokens value is stored in a character array(char result_buf[BUFSIZ])
in cmdline_parse()(./lib/librte_cmdline/cmdline_parse.c).

The overflow occurs where BUFSIZ is less than the size of a commands result
structure, in this case "struct cmd_pkt_filter_result"
(app/test-pmd/cmdline.c) is 1088 bytes and BUFSIZ on FreeBSD is 1024 bytes as
opposed to 8192 bytes on Linux.

This patch removes the OS dependency on BUFSIZ and defines and uses a
library #define CMDLINE_PARSE_RESULT_BUFSIZE 8192

The problem can be reproduced by running test-pmd on FreeBSD:
./testpmd -c 0x3 -n 4 -- -i --portmask=0x3 --pkt-filter-mode=perfect
And adding a filter:
add_perfect_filter 0 udp src 192.168.0.0 1024 dst 192.168.0.0 1024 flexbytes
0x800 vlan 0 queue 0 soft 0x17

Signed-off-by: Alan Carew <alan.carew@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
9 years agokni: create interface in current network namespace
Takayuki Usui [Wed, 3 Dec 2014 01:37:26 +0000 (10:37 +0900)]
kni: create interface in current network namespace

With this patch, KNI interface (e.g. vEth0) is created in the
network namespace where the DPDK application is running.
Otherwise, all interfaces are created in the default namespace
in the host.

put_net() is required, since get_net_ns_by_pid() increments
the reference counter of the network namespace with get_net().

Signed-off-by: Takayuki Usui <takayuki@midokura.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
9 years agoi40e: fix build with 16-byte descriptors
Helin Zhang [Wed, 3 Dec 2014 01:13:27 +0000 (09:13 +0800)]
i40e: fix build with 16-byte descriptors

The compile error will occur as below when set 'RTE_LIBRTE_I40E_16BYTE_RX_DESC=y'.
'fd_id' should be used to replace 'fd', as 'fd' is not defined in that structure
at all. In addition, local variable of 'flexbl' and 'flexbh' must be used only if
32 bytes RX descriptor is selected.

error logs:
lib/librte_pmd_i40e/i40e_rxtx.c: In function i40e_rxd_build_fdir:
lib/librte_pmd_i40e/i40e_rxtx.c:431:28: error: volatile union <anonymous> has no member named fd
lib/librte_pmd_i40e/i40e_rxtx.c:427:19: error: unused variable flexbl [-Werror=unused-variable]
lib/librte_pmd_i40e/i40e_rxtx.c:427:11: error: unused variable flexbh [-Werror=unused-variable]

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
9 years agotable: fix maybe-uninitialized variable with gcc lto
Dennis Marinus [Tue, 2 Dec 2014 00:39:06 +0000 (16:39 -0800)]
table: fix maybe-uninitialized variable with gcc lto

This patch fixes a maybe-uninitialized warning when compiling DPDK with
GCC 4.9 + Link Time Optimization.

Signed-off-by: Dennis Marinus <dmarinus@amazon.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoixgbe: fix build with bypass and debug enabled
Thomas Monjalon [Mon, 1 Dec 2014 17:11:02 +0000 (18:11 +0100)]
ixgbe: fix build with bypass and debug 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.

Commit 7a10de5e27 fixed the logs but not the macros FUNC_PTR_OR_*
which are not preprocessed if RTE_LIBRTE_IXGBE_DEBUG_DRIVER is disabled.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
9 years agoapp/testpmd: fix macro check for little endian
Bruce Richardson [Mon, 1 Dec 2014 11:38:55 +0000 (11:38 +0000)]
app/testpmd: fix macro check for little endian

Compiling with clang on FreeBSD gave a compilation error:
app/test-pmd/csumonly.c:84:5: fatal error: '__BYTE_ORDER' is not defined, evaluates to 0 [-Wundef]

Querying the preprocessor defines show both the define and value used
are incorrect.
$ clang -dM -E - < /dev/null | grep BYTE
\#define  __BYTE_ORDER__  __ORDER_LITTLE_ENDIAN__

Changing the check to  __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ then
resolves the issue.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoapp/testpmd: fix out-of-range error on bsd
Bruce Richardson [Mon, 1 Dec 2014 11:38:54 +0000 (11:38 +0000)]
app/testpmd: fix out-of-range error on bsd

The definition value for IPPROTO_DIVERT protocol uses a value
which is out of range of the uint8_t type, giving clang compiler
errors on FreeBSD.

app/test-pmd/icmpecho.c:231:7: fatal error: overflow converting case value
        to switch condition type (258 to 2) [-Wswitch]
                case IPPROTO_DIVERT: /**< divert pseudo-protocol */

This is fixed by having the code to return the protocol name
use the uint16_t type for the protocol value input.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoenic: fix build with clang
Sujith Sankar [Sat, 29 Nov 2014 07:17:37 +0000 (12:47 +0530)]
enic: fix build with clang

This patch fixes the warnings and error reported by clang compiler on Linux.

Reported-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoixgbe: fix bitfield assignation with clang
Olivier Matz [Mon, 1 Dec 2014 10:36:13 +0000 (11:36 +0100)]
ixgbe: fix bitfield assignation with clang

Commit 1224decaa44 ("support TCP segmentation offload")
changed the way the bitfields are assigned in ixgbe, example:

  tx_offload_mask.l2_len = ~0;

This result in a compilation error with clang:

  error: implicit truncation from 'int' to bitfield
    changes value from -1 to 127 [-Werror,-Wbitfield-constant-conversion]

Replacing the '=' with a '|=' fixes the issue.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agomk: fix linking with some linux toolchains
Sergio Gonzalez Monroy [Thu, 30 Oct 2014 10:57:42 +0000 (10:57 +0000)]
mk: fix linking with some linux toolchains

Ubuntu/Debian toolchain passes --as-needed flag to the linker by default.
Add --no-as-needed flag by default in linuxapp exec-env to ensure correct
linking.

The problem arises because librte_eal doesn't add a DT_NEEDED entry for
librte_mempool despite the fact that it references symbols in that library.
It does this because we don't explicitly link with -lrte_mempool when we
build librte_eal.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoscripts: fix newline in configuration with bsd sed
David Marchand [Fri, 28 Nov 2014 15:42:44 +0000 (16:42 +0100)]
scripts: fix newline in configuration with bsd sed

Use of \n in sed expression is not portable and triggered an invalid
configuration on BSD (at least).
Replace with an explicit newline.

Reported-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoenic: fix build by using standard integer types
Sujith Sankar [Fri, 28 Nov 2014 09:38:19 +0000 (15:08 +0530)]
enic: fix build by using standard integer types

ENIC PMD was giving compilation errors on ppc_64-power8-linuxapp-gcc because
of types such as u_int32_t.  This patch replaces all those with uint32_t and
similar ones.

Reported-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agobond: fix build with gcc 4.3
Pablo de Lara [Fri, 28 Nov 2014 15:10:16 +0000 (15:10 +0000)]
bond: fix build with gcc 4.3

GCC 4.3 complains that slow_pkts array in bond_ethdev_tx_burst_8023ad
may be used uninitialized, so it has been initialized to NULL.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoixgbe: fix mbuf failure statistics in vector Rx
Balazs Nemeth [Fri, 28 Nov 2014 09:21:45 +0000 (09:21 +0000)]
ixgbe: fix mbuf failure statistics in vector Rx

The statistics that is reported through the rx_nombuf fields in struct
rte_eth_stats was not set when the vector PMD was used. The statistics
should report the number of mbufs that could _not_ be allocated during
rearm of the RX queue. The non-vector PMD reports it correctly. The
use of either vector PMD or non-vector PMD depends on runtime
configuration. Hence it is possible that a change in configuration
would disable this statistics. To prevent this from happening, the
statistics should be reported by both implementations.

Signed-off-by: Balazs Nemeth <balazs.nemeth@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
9 years agoversion: 1.8.0-rc2
Thomas Monjalon [Thu, 27 Nov 2014 21:18:32 +0000 (22:18 +0100)]
version: 1.8.0-rc2

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agobond: set offload capabilities flags
Jia Yu [Thu, 27 Nov 2014 21:23:37 +0000 (21:23 +0000)]
bond: set offload capabilities flags

Before the fix, bond device's offload capabilities are unset. This fix
takes the minimum common set of slave devices' capabilities as bond
device's capabilities. For simplicity, we ensure all slave devices
to have a capability before bond device can claim this capability,
even if some slave devices are unused (i.e. linked down, standby).

Signed-off-by: Jia Yu <jyu@vmware.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
9 years agobond: unit tests for mode 5
Daniel Mrzyglod [Thu, 27 Nov 2014 16:33:41 +0000 (16:33 +0000)]
bond: unit tests for mode 5

This Patch add unit tests for mode 5 - tlb - to the oders
link bonding unit tests.

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
9 years agobond: add mode 5
Daniel Mrzyglod [Thu, 27 Nov 2014 16:33:40 +0000 (16:33 +0000)]
bond: add mode 5

Add support for mode 5 (Transmit load balancing) into pmd driver

This patch add support for Adaptive transmit load balancing (mode 5) to the
librte_pmd_bond library. This mode provides an adaptive transmit load
balancing. It dynamically changes the transmitting slave, according to the
computed load.

Further details are described here:
https://www.kernel.org/doc/Documentation/networking/bonding.txt
In implementation callback is used for sorting slave order - providing
statistics for burst function about slave bandwith usage  and sort
interfaces due to usage.

Difference in this implementation vs Linux implementation:
- We Are trying send all pkts – If one interface hasn’t send packets we are
trying to send rest of packets by other slaves sorted previously by callback
function.

Some implementation details:
- Every 100ms is taken obytes statistics from every slave.
- Every 10 ms the slaves in  table are sorted and updated by callback -
bandwidth and successfully transmitted bytes from previous iteration which
happens every 100 ms
- There is callback function which updates this statistics for transparency and
for rather intensive computation involved in this mode.

Test report: http://dpdk.org/ml/archives/dev/2014-November/008729.html

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Tested-by: SunX Jiajia <sunx.jiajia@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
9 years agobond: add mode 4
Pawel Wodkowski [Thu, 27 Nov 2014 18:01:10 +0000 (18:01 +0000)]
bond: add mode 4

This patch set add support for dynamic link aggregation (mode 4) to the
librte_pmd_bond library. This mode provides auto negotiation/configuration
of peers and well as link status changes monitoring using out of band
LACP (link aggregation control protocol) messages. For further details of
LACP specification see the IEEE 802.3ad/802.1AX standards. It is also
described here
https://www.kernel.org/doc/Documentation/networking/bonding.txt.

In this implementation we have an array of mode 4 settings for each slave.
There is also assumption that for every port is one aggregator (it might
be unused if better is found).

Difference in this implementation vs Linux implementation:
- this implementation it is not directly based on state machines but current
  state is calculated from actor and partner states (and other things too).

Some implementation details:
- during rx burst every packet Is checked if this is LACP or marker packet.
  If it is LACP frame it is passed to mode 4 logic using slaves rx ring  and
  removed from rx buffer before it is returned
- in tx burst, packets from mode 4 (if any) are injected into each slave.
- there is a timer running in background to process/produce mode 4
  frames form rx/to tx functions.

Some requirements for this mode:
- for LACP mode to work rx and tx burst functions must be invoked
  at least in 100ms intervals
- provided buffer to rx burst should be at least 2x slave count size. This is
  not needed but might increase performance especially during initial
  handshake.

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
9 years agoenic: fix vfio inclusion
Sujith Sankar [Thu, 27 Nov 2014 17:14:40 +0000 (22:44 +0530)]
enic: fix vfio inclusion

Inclusion of vfio.h was giving compilation errors if kernel version is less
than 3.6.0 and if RTE_EAL_VFIO was in config.

Removed inclusion of vfio.h and replaced RTE_EAL_VFIO with VFIO_PRESENT.

Reported-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Sujith Sankar <ssujith@cisco.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoenic: fix dependencies
Thomas Monjalon [Thu, 27 Nov 2014 17:53:49 +0000 (18:53 +0100)]
enic: fix dependencies

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoconfig: disable enic driver on Power
David Marchand [Thu, 27 Nov 2014 11:42:38 +0000 (12:42 +0100)]
config: disable enic driver on Power

enic driver is giving trouble because of non-standard types :

  CC enic_res.o
In file included from
lib/librte_pmd_enic/enic_res.c:36:0:
lib/librte_pmd_enic/enic_compat.h:92:1: error: unknown type name ‘u_int32_t’
 static inline u_int32_t ioread32(volatile void *addr)
 ^

Disable it on Power for now.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agoscripts: fix symbol overriding in configuration
David Marchand [Thu, 27 Nov 2014 11:29:05 +0000 (12:29 +0100)]
scripts: fix symbol overriding in configuration

When redefining the same symbol in configuration (basically after an inclusion),
we need to undefine the previous symbol to avoid "redefined" errors.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agonet: fix conflict with libc
Thomas Monjalon [Thu, 27 Nov 2014 11:28:17 +0000 (12:28 +0100)]
net: fix conflict with libc

It was impossible to include netinet/in.h and rte_ip.h
because the IP protocols were redefined.
It is removed because useless.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
9 years agoapp/testpmd: fix RSS flags size
Jia Yu [Fri, 7 Nov 2014 15:43:01 +0000 (07:43 -0800)]
app/testpmd: fix RSS flags size

Since commit 8a387fa85f02 ("ethdev: more RSS flags") in DPDK 1.7,
RSS flags have increased.
According to rss_hf definition in rte_eth_rss_conf, it shall be uint64 type.
Using uint16 will get truncated value, and cause incorrect output. This
fix corrected this issue.

Signed-off-by: Jia Yu <jyu@vmware.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agomempool: avoid dump crash with null pointer
Keith Wiles [Sun, 28 Sep 2014 05:28:44 +0000 (05:28 +0000)]
mempool: avoid dump crash with null pointer

Check the FILE *f and rte_mempool *mp pointers for NULL.

Signed-off-by: Keith Wiles <keith.wiles@windriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
9 years agoadd prefix to cache line macros
Sergio Gonzalez Monroy [Wed, 19 Nov 2014 12:26:06 +0000 (12:26 +0000)]
add prefix to cache line macros

CACHE_LINE_SIZE is a macro defined in machine/param.h in FreeBSD and
conflicts with DPDK macro version.
Adding RTE_ prefix to avoid conflicts.
CACHE_LINE_MASK and CACHE_LINE_ROUNDUP are also prefixed.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
[Thomas: updated on HEAD, including PPC]

9 years agoeal/bsd: remove unused HPET support
Sergio Gonzalez Monroy [Thu, 20 Nov 2014 14:06:59 +0000 (14:06 +0000)]
eal/bsd: remove unused HPET support

The HPET support in the BSD EAL was copied directly from the Linux version,
but did not actually work on FreeBSD. We replace this old code with a simple
compiler message that informs the user that we don't support HPET on BSD if
they enable such support in the build-time configuration file.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
9 years agoeal/bsd: use sysctl to get TSC frequency
Sergio Gonzalez Monroy [Thu, 20 Nov 2014 14:06:58 +0000 (14:06 +0000)]
eal/bsd: use sysctl to get TSC frequency

BSD provides the TSC frequency value through sysctl.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>