The shared libraries built with the current makefile set produce static
libraries rather than actual shared objects. This is due to several missing
options that are required to correctly build shared objects using ld, as well as
a mis-specified -share option (which should be -shared). Switching to the use of
CC rather than LD and fixing the -shared option corrects these problems and
builds the DSOs correctly.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
When loading a library "libfoo.so" (depending on "libbar.so", located in an
entirely different folder), with a LD_LIBRARY_PATH=/path/to/libfoo.so", it
returns an error:
EAL: ./libfoo.so: cannot open shared object file: No such file or directory
If the first dlopen() fails (here, because it can't find all dependencies),
the code requires for a second dlopen() that looks for "./libfoo.so". It
turns on pathname matching, which does not use LD_LIBRARY_PATH. As a result,
it fails because it cannot find "./libfoo.so".
The error message matches the error of the second dlopen(), not the first's.
Do not try to look for a different library ("./"-prefixed) than the one
provided in argument. Let the dynamic library management handle it, just
provide an appropriate LD_LIBRARY_PATH.
Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
lcores that are set in coremask should be checked against lcores detected on
system. This way, we won't need to check them later.
Besides, if specifying an unavailable lcore, we currently panic in
eal_thread_loop() because pthread_setaffinity_np fails.
So this check will return an error with a more explicit message in
eal_parse_coremask().
"EAL: pthread_setaffinity_np failed
PANIC in eal_thread_loop():
cannot set affinity"
becomes :
"EAL: lcore 4 unavailable
EAL: invalid coremask"
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Only the last feature was checked since commit 99f2cdf9ca
(eal: fix %rbx corruption and simplify the code)
The return code for rte_cpu_get_flag_enabled is only checked on the termination
of the for loop that it is called inside, but should be checked for every
iteration it makes through the for loop. This is caused by some silly missing
brackets. Simply add them in
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Reported-by: Pablo De Lara Guarch <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
For RH 6.5:
- always include mdio.h to get the definitions of MDIO_EEE, ETHTOOL_GEEE
- is_link_local_ether_addr(), pcie_capability_clear_and_set_word(), and
ether_addr_equal() have been backported
For RH 6.4:
- same issue with ether_addr_equal()
- here ETH_GEE is defined without having the functions.
igb_ethtool.c:2441: error: implicit declaration of function ‘mmd_eee_adv_to_ethtool_adv_t’
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
On RH 6.5:
igb_main.c:2298: error: unknown field ‘ndo_fdb_add’ specified in
initializer
FDB ops are present in RH 6.5 via the extension of netdev, so add the
ifdef inside the netdev ops definition of igb.
However, FDB functions are not set for RHEL 6.5: the implementation
relies on dev_mc_add_excl API which has not been backported.
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
rxhash has been renamed to hash. In 3.14 and newer, we can use
skb_set_hash().
Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Need to pass mode argument to open with O_CREAT.
Must check return value from ftruncate().
Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Pass CROSS_COMPILE to the kernel build system when compiling kernel
modules. Although we export CC etc. the top level kernel Makefile will
override the environment. As a result it will end up using wrong tools
if cross-compilation is desired but CROSS_COMPILE is not set.
Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The registration of an external vdev driver (a .so library) is done in a
function that has the ((constructor)) attribute. This function is called
when dlopen(driver.so) is invoked.
As a result, we need to do the dlopen() before calling
rte_eal_vdev_init() that calls the initialization functions of all
registered drivers.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Instead of having a list of virtual device drivers in EAL code, add an
API to register drivers. Thanks to this new registration method, we can
remove the references to pmd_ring, pmd_pcap and pmd_xenvirt in EAL code.
This also enables the ability to register a virtual device driver as
a shared library.
The registration is done in an init function flaged with
__attribute__((constructor)). The new convention is to name this
function rte_pmd_xyz_init(). The per-device init function is renamed
rte_pmd_xyz_devinit().
By the way the internal PMDs are now also .so/standalone ready. Let's do
it later on. It will be required to ease maintenance.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The name "nonpci_devs" for virtual devices is ambiguous as a physical
device can also be non-PCI (ex: usb, sata, ...). A better name for this
file is "vdev" as it only deals with virtual devices.
This patch doesn't introduce any change except renaming.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Copy all the dump commands provided in app/test into app/testpmd. These
commands are useful to debug a problem when using testpmd.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Some PCI drivers may require some specific initialization arguments at
start-up.
Even if unused today, adding this feature seems coherent with virtual
devices in order to provide a full-featured rte_devargs framework. In
the future, it could be added in pmd_ixgbe or pmd_igb for instance to
enable debug of drivers or setting a specific operating mode at
start-up.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit splits the "--use-device" option in two new options:
- "--pci-whitelist or -w": add a PCI device in the white list
- "--vdev": instanciate a new virtual device
Before the patch, the same option "--use-device" was used for these 2
use-cases.
By the way, we also add "--pci-blacklist" in addition to the existing
"-b" for coherency with the whitelist parameter.
Test result:
echo 100 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 100 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
./app/test -c 0x15 -n 3 -m 64
RTE>>eal_flags_autotest
[...]
Test OK
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit changes the API of --use-device command line argument.
It changes the separators from ';' to ','. Indeed, ';' is not the best
choice as this character is also used to separate shell commands,
forcing the user to surround arguments with quotes.
This commit impacts both devargs and kvargs as each of them define
a separator in --use-device argument:
- devargs defines the separator between the device name or pci_id and
its arguments
- kvargs defines the separator between each key/value pairs in
arguments for drivers using the kvargs API to parse their arguments
The modification of devargs and kvargs is done in one commit to keep
the coherency of --use-device.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Remove old whitelist code:
- remove references to rte_pmd_ring, rte_pmd_pcap and pmd_xenvirt in
is_valid_wl_entry() as we want to be able to register external virtual
drivers as a shared library. Moreover this code was duplicated with
dev_types[] from eal_common_pci.c
- eal_common_whitelist.c was badly named: it was able to process PCI
devices white list and the registration of virtual devices
- the parsing code was complex: all arguments were prepended in
one string dev_list_str[4096], then split again
Use the newly introduced rte_devargs to get:
- the PCI white list
- the PCI black list
- the list of virtual devices
Rework the tests:
- a part of the whitelist test can be removed as it is now tested
in app/test/test_devargs.c
- the other parts are just reworked to adapt them to the new API
This commit induce a small API modification: it is not possible to specify
several devices per "--use-device" option. This notation was anyway a bit
cryptic. Ex:
--use-device="eth_ring0,eth_pcap0;iface=ixgbe0"
now becomes:
--use-device="eth_ring0" --use-device="eth_pcap0;iface=ixgbe0"
On the other hand, it is now possible to work in PCI blacklist mode and
instanciate virtual drivers, which was not possible before this patch.
Test result:
./app/test -c 0x15 -n 3 -m 64
RTE>>devargs_autotest
EAL: invalid PCI identifier <08:1>
EAL: invalid PCI identifier <00.1>
EAL: invalid PCI identifier <foo>
EAL: invalid PCI identifier <>
EAL: invalid PCI identifier <000f:0:0>
Test OK
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit introduces a new API for storing device arguments given by
the user. It only adds the framework and the test. The modification of
EAL to use this new module is done in next commit.
The final goals:
- unify pci-blacklist, pci-whitelist, and virtual devices arguments
in one file
- allow to register a virtual device driver from a dpdk extension
provided as a shared library. For that we will require to remove
references to rte_pmd_ring and rte_pmd_pcap in argument parsing code
- clarify the API of eal_common_whitelist.c, and rework its code that is
often complex for no reason.
- support arguments for PCI devices and possibly future non-PCI devices
(other than virtual devices) without effort.
Test result:
echo 100 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 100 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
./app/test -c 0x15 -n 3 -m 64
RTE>>eal_flags_autotest
[...]
Test OK
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
To avoid confusion with virtual devices, rename device_list as
pci_device_list and driver_list as pci_driver_list.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
To fully support dpdk extensions (loading of .so), all symbols provided
by dpdk libraries must be available in the binaries: before this patch,
unused functions/variables from dpdk static libraries could be stripped
by the linker because they are not used. These symbols can be used by a
dpdk extension that is loaded at runtime with the -d option.
Adding --whole-archive when generating a binary solves this issue.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
It may happen that DPDK application gets killed while having
acquired locks on the ethernet hardware, causing these locks to
be never released. On next restart of the application, DPDK
skip those ports because it can not acquire the lock,
this may cause some ports (or even complete board if SMBI is locked)
to be inaccessible from DPDK application until reboot of the
hardware.
This patch release locks that are supposed to be locked due to
an improper exit of the application.
Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
It may happen that DPDK application gets killed while having
acquired locks on the ethernet hardware, causing these locks to
be never released. On next restart of the application, DPDK
skip those ports because it can not acquire the lock,
this may cause some ports (or even complete board if SMBI is locked)
to be inaccessible from DPDK application until reboot of the
hardware.
This patch release locks that are supposed to be locked due to
an improper exit of the application.
Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This reverts commit da6fd0759c.
"timer: get TSC frequency from /proc/cpuinfo"
The use of cpuinfo to determine the frequency of the TSC is not
advisable and leads to incorrect results when power management is
in use. This is because, while the TSC frequency does not change
in modern cpus with constant_tsc support, the frequency of the core,
and hence the frequency of the core reported by cpuinfo *does* change.
Depending on the current frequency of core 0 when an application is
started, the EAL can get a wildly incorrect value for the TSC freq.
Since frequency is scaled down for power saving, any incorrect value
is likely to be lower than the default, which means that any delay
loops inside the code which rely on the TSC will be shorter than
planned. This can cause issues (reported on the mailing list by a number
of people) where ports are not initialized correctly due to delays being
too short.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Neil Horman reported that on x86-64 the upper half of %rbx would get
clobbered when the code was compiled PIC or PIE, because the
i386-specific code to preserve %ebx was incorrectly compiled.
However, the code is really way more complex than it needs to be. For
one thing, the CPUID instruction only needs %eax (leaf) and %ecx
(subleaf) as parameters, and since we are testing for bits, we might
as well list the bits explicitly. Furthermore, we can use an array
rather than doing a switch statement inside a structure.
Reported-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Reviewed-by: H. Peter Anvin <hpa@linux.intel.com>
If .config file is changed and .depdirs was built before,
it must be updated.
It is now done silently (-s) in checkconfig rule.
Now .depdirs is not redone if .config is older.
It has been tested by enabling PMD_PCAP after a default build.
KVARGS dependency should appear in .depdirs.
There is also a typo fix for PHONY rule.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Flow director in X540 uses the same registers as in 82599.
So it just has to be enabled in the 82599 implementation.
Signed-off-by: Mauro Annarumma <mauroannarumma@hotmail.it>
Acked-by: Maxime Leroy <maxime.leroy@6wind.com>
The include file should not change the GCC compile options for
the whole file being compiled, but only for the one inline function
that needs it. Using the push_options/pop_options fixes this.
Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The argument to rte_jhash2() is not changed.
Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
rte_pktmbuf_attach copies the packet meta data but does not
copy the offload flags. This means that cloned packets lose
their offload settings such as vlan tag.
Signed-off-by: Stephen Hemminger <shemming@brocade.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
In order to distinguish clearly this implementation from the extension
vmxnet3-usermap, it is renamed to reflect its usage of uio framework.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Thomas Graf <tgraf@redhat.com>
Since commit 10ed994 (pci: use igb_uio mapping only when needed),
the flag RTE_PCI_DRV_NEED_IGB_UIO must be set even if RTE_EAL_UNBIND_PORTS
is disabled.
It was not the case for virtio_uio and vmxnet3_uio so the uio resources were
not mapped when RTE_EAL_UNBIND_PORTS was not defined.
Specifically, pci_uio_map_resource() was not called so
pci_dev->mem_resource was not mapped.
Signed-off-by: Daniel Kan <dan@nyansa.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
When not using vmxnet3-uio and virtio-uio PMDs, prevent igb_uio from binding
these devices. This way, vmxnet3 and virtio PMDs won't fail to initialize
because of a device silently bound to igb_uio.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
In order to distinguish clearly this implementation from the extension
virtio-net-pmd, it is renamed to reflect its usage of uio framework.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Chris Wright <chrisw@redhat.com>
In order to make this tool available among other system commands,
the name must be more specific.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Chris Wright <chrisw@redhat.com>
Insert get_physaddr() into public API as rte_mem_virt2phy().
rte_mem_virt2phy() permits to obtain the physical address of any
virtual address mapped to the current process.
get_physaddr() was working only for addresses pointing exactly to
the first byte of a page.
Note that this function is very slow and shouldn't be called
after initialization to avoid a performance bottleneck.
The memory must be locked with mlock(). The function rte_mem_lock_page()
is a mlock() helper that lock the whole page.
A better name would be rte_mem_virt2phys but rte_mem_virt2phy is more
consistent with rte_mempool_virt2phy.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This reverts commit 57c24af85d
which was wrongly rebased in 1.6.0 branch:
- commit log must be changed for 1.6.0
- it breaks building for 32-bit
A new version of this commit has to be done.
The initial commit doesn't build for 32-bit:
8ea9ff83 (mem: allow virtual memory address hinting)
lib/librte_eal/linuxapp/eal/eal.c: In function ‘eal_parse_base_virtaddr’:
build/include/rte_common.h:133:22:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
^
RTE_PTR_ALIGN_CEIL return type is the same as what we give it as input.
So instead of casting the returned value, cast 'addr' which should be the same
as base_virtaddr.
Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This reverts commits
a0cdfcf9 (use pcap-config to guess compilation flags),
ef5b2363 (fix build with empty LIBPCAP_CFLAGS) and
60191b89 (fix build when pcap_sendpacket is unavailable).
These patches are creating more problems than solving the initial one
(which was a build error with too old pcap libraries).
Since old pcap libraries are not that common, just revert them.
Reported-by: Meir Tseitlin <mirots@gmail.com>
Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Due to a merge conflict between commits 4c745617a1 and 9d5752d80,
rte_eth_pcap.c was not compiling with the following error:
rte_eth_pcap.c: In function 'rte_pmd_init_internals':
rte_eth_pcap.c:559:30: error: dereferencing pointer to incomplete type
rte_eth_pcap.c:560:15: error: dereferencing pointer to incomplete type
rte_eth_pcap.c:561:18: error: dereferencing pointer to incomplete type
rte_eth_pcap.c:603:47: error: dereferencing pointer to incomplete type
rte_eth_pcap.c: In function 'rte_pmd_pcap_init':
rte_eth_pcap.c:732:73: error: 'dict' undeclared (first use in this
function)
rte_eth_pcap.c:732:73: note: each undeclared identifier is reported
only once for each function it appears in
This commit replaces "struct args_dict" by "struct rte_kvargs" to fix
the compilation issue.
By the way, it also removes the declaration of these functions from
the header file as no other file in DPDK references one of them. It
avoids to include <rte_kvargs.h> in rte_eth_pcap.h.
Reported-by: Meir Tseitlin <mirots@gmail.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Applications can test versions, for compatibility, this way:
#if RTE_VERSION >= RTE_VERSION_NUM(1,2,3,4)
RTE_VERSION was already defined for use with rte_config.
It is moved in rte_version.h and updated to current version number.
Note that the first tag having this helper is 1.2.3r2.
Releases r0 have not this patch.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
The entries for the configuration of the reception and of the transmission
of pause frames are inverted in the mode conversion array.
Signed-off-by: Zijie Pan <zijie.pan@6wind.com>
Acked-by: Ivan Boule <ivan.boule@6wind.com>
Some features are not available if LIBRTE_CMDLINE is disabled:
- interactive mode
- ethernet address parsing
Note: ethernet address parsing could be rewritten without cmdline dependency.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Some features are not available if LIBRTE_CMDLINE is disabled:
- interactive commands
- cmdline tests
Remove also cmdline_parse includes which are not needed.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
ether_addr_equal() was added in Linux 3.5. compare_ether_addr() was
deleted in 3.14. Start using ether_addr_equal() and provide an own
implementation for older kernels.
This fixes the compilation with Linux 3.14-rc1.
Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The netdev_features_t typedef appeared in Linux 3.3, but checking the kernel
version isn't enough with some distributions (such as Debian Wheezy) that
backported it into 3.2, causing a compilation failure due to redefinition.
Since the presence of a typedef can't be tested at compile time, this commit
adds type kni_netdev_features_t, which, depending on the kernel version,
translates either to u32 or netdev_features_t.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>