All PMD_VDEV drivers can now use rte_vdev_driver instead of the
rte_driver (which is embedded in the rte_vdev_driver).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
- Remove checks for VDEV from rte_eal_vdev_(init/uninint) as all devices
are inherently virtual here.
- PDEVs perform PCI specific inits - rte_eal_dev_init() need not call
rte_driver->init();
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Move all PMD_VDEV-specific code into a separate module and header
file to not polute the generic code anymore. There is now a list
of virtual devices available.
The rte_vdev_driver integrates the original rte_driver inside
(C inheritance). The rte_driver will be however change in the
future to serve as a common base for all other types of drivers.
The existing PMDs (PMD_VDEV) are to be modified later (there is
no change for them at the moment).
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
Now that hotplug has been moved to eal, there is no reason to keep the
device type in this layer.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Remove bus logic from ethdev hotplug by using eal for this.
Current api is preserved:
- the last port that has been created is tracked to return it to the
application when attaching,
- the internal device name is reused when detaching.
We can not get rid of ethdev hotplug yet since we still need some
mechanism to inform applications of port creation/removal to substitute
for ethdev hotplug api.
dev_type field in struct rte_eth_dev and rte_eth_dev_allocate are kept as
is, but this information is not needed anymore and is removed in the
following commit.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Hotplug invocations, which deals with devices, should come from the layer
that already handles them, i.e. EAL.
For both attach and detach operations, 'name' is used to select the bus
that will handle the request.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
No need to scan all devices, we only need to update the device being
attached.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
- Move rte_eth_dev_create_unique_device_name() from ether/rte_ethdev.c to
common/include/rte_pci.h as rte_eal_pci_device_name(). Being a common
method, can be used across crypto/net PCI PMDs.
- Remove crypto specific routine and fallback to common name function.
- Introduce a eal private Update function for PCI device naming.
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Merge crypto/pci helper patches]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Simplify crypto and ethdev pci drivers init by using newly introduced
init macros and helpers.
Those drivers then don't need to register as "rte_driver"s anymore.
Exceptions:
- virtio and mlx* use RTE_INIT directly as they have custom initialization
steps.
- VDEV devices are not modified - they continue to use PMD_REGISTER_DRIVER.
Update documentation for replacing an example referring to
PMD_REGISTER_DRIVER.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
crypto and ethdev drivers aligned to PCI probe/remove. These wrappers are
mapped directly to PCI resources.
Existing handlers for init/uninit can be easily reused for this.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Introduce a RTE_INIT macro used to mark an init function as a constructor.
Current eal macros have been converted to use this (no functional impact).
DRIVER_REGISTER_PCI is added as a helper for pci drivers.
Suggested-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
[Shreyansh: Update PCI Registration macro name]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Pure coding style, but it might make it easier later if we want to move
fields in rte_cryptodev_driver and eth_driver structures.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This information is not used and just adds noise.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Probe and Remove are more appropriate names for PCI init and uninint
operations. This is a cosmetic change.
Only MLX* uses the PCI direct registration, bypassing PMD_* macro.
The callbacks for this too have been updated.
VDEV are left out. For them, init/uninit are more appropriate.
Suggested-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
These lists can be initialized once and for all at build time.
With this, those lists are only manipulated in a common place
(and we could even make them private).
A nice side effect is that pci drivers can now register in constructors.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
rte_eal_dev_init is declared in both eal_private.h and rte_dev.h since its
introduction.
This function has been exported in ABI, so remove it from eal_private.h
Fixes: e57f20e051 ("eal: make vdev init path generic for both virtual and pci devices")
Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
An application might be linked to DPDK but not really use it,
so move the cpu flag check to the EAL initialization instead.
Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Aaron Conole <aconole@redhat.com>
In ASLR-enabled system, it is possible that selected
virtual space is occupied by program segments. Therefore,
error path should not blindly unmap all memmory segments
but only those already mapped.
Steps that lead to crash:
1. memeseg 0 in secondary process overlaps with libc.so
2. mmap of /dev/zero fails for virtual space of memseg 0
3. munmap of memseg 0 leads to unmapping libc.so itself
4. app gets SIGSEGV after returning from syscall to libc
Fixes: ea329d7f8e ("mem: fix leak after mapping failure")
Signed-off-by: Maciej Czekaj <maciej.czekaj@caviumnetworks.com>
RTE_EAL_SINGLE_FILE_SEGMENTS was introduced with ivshmem integration.
Now that ivshmem was removed (commit c711ccb309)
and a simple git grep shows no one else references it;
I think we can now remove it.
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Instead of checking if the current and alternative signatures are 0,
it is faster to check if the key index associated to an entry
is 0, meaning that the slot is empty.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
This commit fixes a corner case scenario. When a key is deleted,
its signature in the hash table gets clear, which should prevent
a lookup of that same key, unless the signature of the key is all zeroes.
In that case, there will be a match, and key would be compared against
the key that is in the table (which does not get cleared,
as the performance penalty would be high), resulting in a wrong hit.
To prevent this from happening, the key index associated to that entry
should be set to zero when deleting it, so in case that same key
is looked up just after a deletion, it will point to the dummy key slot,
which guarantees a miss.
Fixes: 48a3991196 ("hash: replace with cuckoo hash implementation")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
Ring stores the free slots available to be used in the key table.
The ring size was being increased by 1, because of the dummy slot,
used for key misses, but this is not actually stored in the ring,
so there is no need to increase it.
Fixes: 5915699153 ("hash: fix scaling by reducing contention")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
When running single-core, some drivers tend to call rte_delay_us for a
long time, and that is causing packet drops.
To avoid this, rte_delay_us can be replaced with user-defined delay
function with:
void rte_delay_us_callback_register(void(*userfunc)(unsigned));
When userfunc==rte_delay_us_block build-in blocking delay function is
restored.
Signed-off-by: Jozef Martiniak <jozmarti@cisco.com>
rte_sched_port_free should release only enqueued packets of all queues.
Previous behavior is that enqueued and already dequeued packets of
only first 4 queues are released.
Fixes: 61383240 ("sched: release enqueued mbufs when freeing port")
Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Add a check to see if the primary process is running and exit gracefully
if it is not.
Suggested-by: Patrick Kutch <patrick.g.kutch@intel.com>
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
When testpmd is run, the application would hang on the second time
that "start" is executed. This is because the timer limit would get
multiplied to an unreachably high number.
At the start of flush_fwd_rx_queues(), the timer limit now resets
to stop it from getting to this high number.
The timer has been made local for this function.
Fixes: f487715f36 ("app/testpmd: add timeout in Rx queue flushing")
Signed-off-by: James Poole <james.g.poole@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Avoid access to mempool pointer if it is NULL.
Coverity issue: 127553
Fixes: b19a0c75a0 ("app/testpmd: remove anonymous mempool code")
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
macro ‘APP_METADATA_OFFSET’ was not used to initialize
‘signature_offset’ and ‘key_offset’ part of struct
rte_table_hash_lru_params.
Instead integer offset values were directly used.
with this fix 'hash-8-lru', 'hash-16-lru', 'hash-32-lru' table types are
able to forward traffic as expected.
Fixes: 48f31ca50c ("app/pipeline: packet framework benchmark")
Signed-off-by: Sankar Chokkalingam <sankarx.chokkalingam@intel.com>
Signed-off-by: Guruprasad Rao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
The pipeline object is not freed when a particular test-case of the
unit-test finishes. Using rte_pipeline_free() before returning the
outcome for each test-case fixes the issue.
Fixes: 5205954791 ("app/test: packet framework unit tests")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
The sched test consumes 35MB memory. When memory is too fragmented (with
2M hugepages), the test can fail.
To reduce this risk, decrease it to 4.5MB by modifying
n_pipes_per_subport and qsize.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
In hash autotest, the size of tables that should be successfully created
is 32K entries (256KB), except for the table called "different_name",
which is 1M entries (8MB). When memory is too fragmented (with 2M
hugepages), the test can fail.
To avoid allocation failures due to memory fragmentation, decrease the
size of the table to 32K.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
RTE_DEVEL_BUILD is set to := y in mk/rte.vars.mk, which makes it
impossible to override via an environment variable, and forces users
to pass it inline in the make call.
Use ?= instead to have it pick up the environment variable as well.
Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Some targets in mk/internal/rte.compile-pre.mk are calling CC or
HOSTCC without passing CPPFLAGS, EXTRA_CPPFLAGS or HOST_CPPFLAGS,
HOST_EXTRA_CPPFLAGS.
On Debian/Ubuntu builds this means that preprocessor flags set by the
dpkg-buildpackage environment, like hardening flags, are not
correctly passed to all objects builds.
Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Verbosity is considered enabled when $V is not empty.
It is a well spread shortcut in makefiles, see git grep '$(if $(*V'
So V=0 and V=1 are equivalent.
It is fixed by unsetting V when it is 0.
A side effect is to fix kernel module compilation verbosity
which is set to 0 when V is empty.
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
FreeBSD make install fails because of unsupported tar option:
tar: Option --warning=no-ignore-newer is not supported
Issue fixed by removing unsupported tar option.
Fixes: 6b62a72a70 ("mk: install a standard cutomizable tree")
Fixes: e4552b9cc6 ("mk: install doc")
Reported-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Compile error:
.../lib/librte_eal/linuxapp/kni/kni_net.c:
In function ‘kni_net_rx_lo_fifo’:
.../lib/librte_eal/linuxapp/kni/kni_net.c:331:1:
error: the frame size of 1056 bytes is larger than 1024 bytes
[-Werror=frame-larger-than=]
This compile error seen with some compiler / kernel combinations.
Moved some local variables to the kni_dev struct.
Fixes: 8451269e6d ("kni: remove continuous memory restriction")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Set cmp_jump_table_idx to KEY_CUSTOM in rte_hash_cmp_eq so that the custom
function we are setting in rte_hash_set_cmp_func properly works. The custom
function is only called by rte_hash_cmp_eq if cmp_jump_table_idx is set to
KEY_CUSTOM.
Fixes: 95da2f8e9c ("hash: customize compare function")
Signed-off-by: Masoud Hasanifard <masoudhasanifard@gmail.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
As per srTCM RFC 2697, we should be updating the E bucket only after the
C bucket overflows. This patch fixes the current DPDK implementation,
where we are updating both the buckets simultaneously at the same rate
(CIR) which results in token accumulation rate of (2*CIR).
Signed-off-by: Nikhil Jagtap <nikhil.jagtap@gmail.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Use mempool buf_addr and buf_physaddr fields for address translation.
Since each mbuf address calculated separately, the restriction of all
mbufs should come from a continuous memory restriction is no more valid.
mbuf related FIFO's content changed, rx_q and alloc_q now carries
physical address of mbufs. tx_q and free_q content not changed, they
still carries virtual address of mbufs.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Linux kernel v4.8 removes macro DEFINE_PCI_DEVICE_TABLE
Linux: 7e9321599011 ("treewide: remove references to the now unnecessary
DEFINE_PCI_DEVICE_TABLE")
Replaced macro with its value in kni ethtool drivers.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Compile error:
CC [M] .../build/lib/librte_eal/linuxapp/kni/igb_main.o
.../build/lib/librte_eal/linuxapp/kni/igb_main.c:
In function ‘igb_check_swap_media’:
.../build/lib/librte_eal/linuxapp/kni/igb_main.c:1556:7:
error: variable ‘link’ set but not used [-Werror=unused-but-set-variable]
bool link;
^
With Linux kernel >= v3.0 this warning disabled:
Linux: 8417da6f2128 ("kbuild: Fix passing -Wno-* options to gcc 4.4+")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Add support for RHEL 7.3, which uses kernel 3.10,
but backported features from newer kernels.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Fix build error with Linux kernel >= v4.7
Fix compile error because of Linux API change, 'trans_start' field
removed from 'struct net_device'.
Linux: 9b36627acecd ("net: remove dev->trans_start")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
When using rte_mempool_create(), the mempool handler is selected
depending on the flags given by the user:
- multi-consumer / multi-producer
- multi-consumer / single-producer
- single-consumer / multi-producer
- single-consumer / single-producer
The flags were not properly tested, resulting in the selection of sc/sp
handler if sc/mp or mc/sp was asked. This can lead to corruption or
crashes because the get/put operations are not atomic.
Fixes: 449c49b93a ("mempool: support handler operations")
Signed-off-by: Weiliang Luo <droidluo@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
There is no need for the page files to be readable (and executable) by
other users. This can be exploited by non-privileged users to access the
working memory of a DPDK app.
Open the files with 0600.
Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
As discussed in the past release, driver names are modified
to be more consistent, and the future driver should follow
this new convention.
Driver names consist of:
"driver category"_"driver folder name"_"optional extra name".
For example:
- Crypto null driver -> "crypto_null"
- Network IXGBE VF driver -> "net_ixgbe_vf"
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>