On Linux, all huge pages are zeroed by the kernel before
first access by the DPDK application. But on FreeBSD,
the contigmem driver would only zero the contiguous
memory regions during initial driver load.
DPDK commit b78c91751 eliminated the explicit memset()
operation for rte_zmalloc(), which was OK on Linux
because the kernel zeroes the pages during app start,
but this broke FreeBSD when restarting app.
So this patch explicitly zeroes the pages before they are mmap'd,
to ensure equivalent behavior to Linux.
Fixes: b78c917511 ("mem: do not zero out memory on zmalloc")
Reported-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Tested-by: Daniel Verkamp <daniel.verkamp@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
The log history feature was deprecated in 16.07.
The remaining empty functions are removed in 16.11.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Having constructor function in the header file is generally
a bad idea, as it will eventually be implanted to 3rd party
library.
In this case it causes linking issues with 3rd party libraries
when an application is not linked to dpdk, due to missing
symbol called by constructor.
Fixes: ba7468997e ("spinlock: add HTM lock elision for x86")
Signed-off-by: Damjan Marion <damarion@cisco.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
PCIOCREAD and PCIOCWRITE ioctls to read/write PCI config space fail
with EPERM due to missing write permission. Fix by opening /dev/pci/
with O_RDWR instead.
Fixes: 632b2d1dee ("eal: provide functions to access PCI config")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
The KeepAlive rte_keepalive_mark_sleep function was not being exported.
Fixes: 90c622f356 ("keepalive: add liveness callback")
Signed-off-by: Remy Horton <remy.horton@intel.com>
rte_thread_setname was a macro defined only for Linux.
The function rte_thread_setname() can now be used on FreeBSD
as well on Linux.
It is required to build librte_pdump.
The macro was 0 for old glibc. The function is now returning -1.
The related logs are decreased from error to debug level because
it is not an important failure, just a debug inconvenience.
Fixes: 278f945402 ("pdump: add new library for packet capture")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
The function rte_keepalive_register_alive_callback do not exist.
The function rte_keepalive_register_relay_callback was missing for BSD.
Fixes: 90c622f356 ("keepalive: add liveness callback")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Adds and documents new callbacks that allow transitions to core
states other than dead to be reported to applications.
Signed-off-by: Remy Horton <remy.horton@intel.com>
This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
The SYSFS_PCI_DEVICES is a constant that makes the PCI testing
difficult as it points to an absolute path. We remove using this
constant and introducing a function pci_get_sysfs_path that gives
the same value. However, the user can pass a SYSFS_PCI_DEVICES env
variable to override the path. It is now possible to create a fake
sysfs hierarchy for testing.
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
The libraries rte_mempool and rte_ring are not used in EAL,
except for the ivshmem part (CONFIG_RTE_LIBRTE_IVSHMEM).
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
The log history uses rte_mempool. In order to remove the mempool
dependency in EAL (and improve the build), this feature is deprecated.
The ABI is kept but the behaviour is now voided because it seems this
function was not used. The history can be read from syslog.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
When compiling each file, the CPU flags are given as RTE_MACHINE_CPUFLAG_*
and in the list RTE_COMPILE_TIME_CPUFLAGS.
RTE_MACHINE_CPUFLAG_* are used to check the CPU features when compiling.
The list RTE_COMPILE_TIME_CPUFLAGS is used only to check the CPU at
runtime in the function rte_cpu_check_supported(). So it is not needed to
define this list for every files.
That's why RTE_COMPILE_TIME_CPUFLAGS is removed from the common variable
MACHINE_CFLAGS and is added only to the CFLAGS of eal_common_cpuflags.c.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Add DT_NEEDED entries for librte_eal external dependencies.
Details between the platforms differ somewhat, and for static
builds they need to be handled from mk/exec-env still.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
This patch adds a new function to the EAL API:
int rte_eal_primary_proc_alive(const char *path);
The function indicates if a primary process is alive right now.
This functionality is implemented by testing for a write-
lock on the config file, and the function tests for a lock.
The use case for this functionality is that a secondary
process can wait until a primary process starts by polling
the function and waiting. When the primary is running, the
secondary continues to poll to detect if the primary process
has quit unexpectedly, the secondary process can detect this.
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Maryam Tahhan <maryam.tahhan@intel.com>
This patch fixes a race-condition when a primary and
secondary process simultaneously probe PCI devices.
This is implemented by moving the rte_eal_mcfg_complete()
function call in rte_eal_init() until after rte_eal_pci_probe().
The memory mapping of PCI device in the secondary process *must*
happen after the primary has finished doing the mapping as it
relies on information written by the primary.
The end result is that the secondary process waits longer,
until the primary has completed its PCI probing, and then
notifies the secondary process.
This race-condition became visible during the development of
a function that allows a secondary process to be polling until
a primary process exists. The secondary would then probe PCI
devices at the same time, causing an error during rte_eal_init()
Linux EAL:
Fixes: 916e4f4f4e ("memory: fix for multi process support")
BSD EAL:
Fixes: 764bf26873 ("add FreeBSD support")
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
CONFIG_RTE_LIBRTE_EAL_*APP can be replaced by CONFIG_RTE_EXEC_ENV_*APP.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
The version 2.3 has been renamed 16.04.
Fixes: 6d7de6d2e3 ("version: switch to year.month numbers")
Reported-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
rte_get_log_type and rte_get_log_level functions has been available
for many versions. But they are missing from the shared library map
and therefore do not get exported correctly.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Most of the code is inspired on virtio driver.
rte_pci_ioport structure is filled at map time with anything needed for later
read / write calls.
At the moment, base field is used to store a x86 ioport (uint16_t) and will
be reused for other arches.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Tested-by: Santosh Shukla <sshukla@mvista.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
The patch c344eab3ee has moved the hardware definition of CPU flags.
Now the functions checking these hardware flags are also moved.
The function rte_cpu_get_flag_enabled() is no more inline.
The benefits are:
- remove rte_cpu_feature_table from the ABI (recently added)
- hide hardware details from the API
- allow to adapt structures per arch (done in next patch)
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
The new function rte_cpu_get_flag_name() is added to the EAL API.
It is implemented (duplicated) in each arch because the next patch
will remove the public exposure of the feature tables.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
fix the error reported by checkpatch:
"ERROR: return is not a function, parentheses are not required"
remove parentheses in return like:
"return (logical expressions)"
remove parentheses in return a function like:
"return (rte_mempool_lookup(...))"
Fixes: 6307b909b8 ("lib: remove extra parenthesis after return")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Normally we could set RTE_PCI_DRV_NEED_MAPPING flag so that eal will
invoke pci_map_device internally for us. From that point view, there
is no need to export pci_map_device.
However, for virtio pmd driver, which is designed to work without
binding UIO (or something similar first), pci_map_device() will fail,
which ends up with virtio pmd driver being skipped. Therefore, we can
not set RTE_PCI_DRV_NEED_MAPPING blindly at virtio pmd driver.
Therefore, this patch exports pci_map_device, and let virtio pmd call
it when necessary.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Santosh Shukla <sshukla@mvista.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
Reviewed-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Tested-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
Move cpu_feature_table array from arch specific rte_cpuflags.h files to
new arch specific rte_cpuflags.c files.
Main motivation is to escape from static variable declarations in
header files. cpu_feature_table has many copies in final binary, even
exist in some object files that does not use this variable at all.
And this can be a sample to create architecture specific source files
and move some functions which are not performance sensitive from
architecture header files to source files.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
test_mp_secondary was initially added by mistake.
rte_snprintf has been removed.
Fixes: 9d41beed24 ("lib: provide initial versioning")
Fixes: 3185322809 ("eal: remove rte_snprintf")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
There is a new function in the EAL API for internal use.
It has neither a proper prefix nor a .map export:
libethdev.so: undefined reference to `is_xen_dom0_supported'
Fixes: 719dbebceb ("xen: allow determining DOM0 at runtime")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Adds functions for detecting and reporting the live-ness of LCores,
the primary requirement of which is minimal overheads for the
core(s) being checked. Core failures are notified via an application
defined callback.
Signed-off-by: Remy Horton <remy.horton@intel.com>
There's no good reason to limit plugins to Linux, make it available
on FreeBSD too. Refactor the plugin code from Linux EAL to common
helper functions, also check for and fail on errors during initialization.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Someone may need to call rte_eal_init() with a fake argc/argv array
in the middle of using getopt() to parse its own unrelated argc/argv
parameters. So getopt lib shouldn't be reset by rte_eal_init().
Now eal will always save optind, optarg and optopt (and optreset on
FreeBSD) at the beginning, initialize optind (and optreset on FreeBSD)
to 1 before calling getopt_long(), then restore all values after.
Suggested-by: Don Provan <dprovan@bivio.net>
Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Tiwei Bie <btw@mail.ustc.edu.cn>
Reviewed-by: Don Provan <dprovan@bivio.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
The i40e driver was using a #define value for the max number of rxtx interrupts
supported. This value was defined only for linux, giving an error when compiling
on FreeBSD.
CC i40e_ethdev.o
/usr/home/bruce/dpdk.org/drivers/net/i40e/i40e_ethdev.c:3885:9: fatal error: use of undeclared
identifier 'RTE_MAX_RXTX_INTR_VEC_ID'
Copying the necessary #define into the FreeBSD EAL header fixes the compile
error.
Fixes: d37641029a ("eal/linux: add interrupt vectors")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
VFIO allows multiple MSI-X vector, others doesn't, but maybe will
allow it in the future.
Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type (VFIO) everywhere,
instead a capability api is more flexible for the condition change.
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
The patch adds condition check to avoid enable nothing.
In disable state, both max_intr and nb_efd are zero.
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
During VFIO_DEVICE_SET_IRQS, the previous order is
{Q0_fd, ... Qn_fd, misc_fd}.
The vector number of misc is indeterminable which is
ugly to some NIC (e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd, Q0_fd, ... Qn_fd},
always reserve the first vector to misc interrupt.
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Acked-by: David Marchand <david.marchand@6wind.com>
This patch adds support for pthread_setname_np on Linux and
pthread_set_name_np on FreeBSD.
Signed-off-by: Ravi Kerur <rkerur@gmail.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
[Thomas: add name in tep_termination example]
The function rte_eal_pci_close_one() was renamed rte_eal_pci_detach().
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: David Marchand <david.marchand@6wind.com>
The Rx interrupt feature is now part of the standard ABI.
Because of changes in rte_intr_handle and struct rte_eth_conf,
the eal and ethdev library versions are incremented.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
GCC 4.8 raises this error:
lib/librte_eal/bsdapp/eal/eal_pci.c:453:15: error: cast discards
'__attribute__((const))' qualifier from pointer target type
.pi_data = *(u_int32_t *)buf,
^
Note: this assignment seems useless because pi_data is filled
with memset later.
Fixes: 632b2d1dee ("eal: provide functions to access PCI config")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Build log:
lib/librte_eal/bsdapp/eal/eal_pci.c:462:9: error:
incompatible integer to pointer conversion passing 'u_int32_t'
(aka 'unsigned int') to parameter of type 'void *'
It is fixed by passing the pointer of pi.pi_data to memcpy.
By the way, it seems strange that pi_data is initialized twice:
.pi_data = *(u_int32_t *)buf
memcpy(&pi.pi_data, buf, len);
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The BSD function for contigmem init and attach must now use the same name
as Linux (hugepage prefix) to avoid code duplication.
The attach function was renamed but the init function was forgotten.
Fixes: d12b6da14b ("eal: deduplicate memory initialization")
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
The patch exposes intr event fd create and release for PMD.
The device driver can assign the number of event associated with interrupt vector.
It also provides misc functions to check 1) allows other slowpath intr(e.g. lsc);
2) intr event on fastpath is enabled or not.
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
The patch adds 'rte_intr_rx_ctl' to add or delete interrupt vector
events monitor on specified epoll instance.
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
The patch adds interrupt vectors support in rte_intr_handle.
'vec_en' is set when interrupt vectors are detected and associated
event fds are set. Those event fds are stored in efds[].
'intr_vec' is reserved for device driver to initialize the vector
mapping table.
Signed-off-by: Danny Zhou <danny.zhou@intel.com>
Signed-off-by: Cunming Liang <cunming.liang@intel.com>
Some drivers need ability to access PCI config (for example for power
management). This adds an abstraction to do this for both Linux
and BSD.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Harish Patil <harish.patil@qlogic.com>
Move common functions from BSD/Linux to eal_common_memory.c file.
BSD uses contigmem kernel module and Linux uses /proc/self/pagemap file.
Signed-off-by: Ravi Kerur <rkerur@gmail.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Move common functions from BSD/Linux to eal_common_timer.c.
BSD uses sysctl and Linux uses CLOCK_MONOTIC_RAW to calibrate TSC.
HPET is specific to Linux and not integrated in the common init.
Signed-off-by: Ravi Kerur <rkerur@gmail.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>