Commit Graph

1310 Commits

Author SHA1 Message Date
Ferruh Yigit
9fb3cd2c04 kni: fix ethtool build with kernel 4.11
build error:
.../lib/librte_eal/linuxapp/kni/igb_main.c:1034:10:
error: implicit declaration of function ‘pci_enable_msix’
    err = pci_enable_msix(pdev,
              ^~~~~~~~~~~~~~~

This build error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option
enabled.

Following Linux commit removes the pci_enable_msix()
Linux: 4244de1c64de ("PCI: remove pci_enable_msix")

Switch to pci_enable_msix_range() for kernel > 4.8 since current Linux
igb driver uses this function.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
2017-05-05 15:42:12 +02:00
Jerin Jacob
b5dc89392f eal: optimize TSC routines when HPET is disabled
Since DPDK has only two timer sources,
Avoid &eal_timer_source memory read and followed
by the switch case statement when
RTE_LIBEAL_USE_HPET is not defined.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-05-05 15:38:42 +02:00
Wei Dai
4d8b986bfe config: make backtrace optional
When building DPDK with musl, there is need not to disable
backtrace to remove some references to execinfo.h which is
not supported by musl now.
This also applies to some other libc implementation which
doesn't support backtrace() and backtrace_symbols().

musl is an implementation of the userspace portion
of the standard library functionality described in
the ISO C and POSIX standards, plus common extensions.
Got more details about musl from http://www.musl-libc.org .

Signed-off-by: Wei Dai <wei.dai@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-05-05 15:13:29 +02:00
Thomas Monjalon
2f6fec5390 vdev: remove eal prefix
The VDEV code will move to the bus drivers directory.
Rename functions from rte_eal_vdev_ to rte_vdev_
to prepare the move of the driver out of EAL.

The prefix rte_eal_vdrv_ is also renamed to rte_vdev_.
It was used for registration of vdev drivers.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-05-05 14:38:35 +02:00
Thomas Monjalon
3dcfe0390c pci: remove eal prefix
The PCI code will move to the bus drivers directory.
Rename functions from rte_eal_pci_ to rte_pci_
to prepare the move of the driver out of EAL.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-05-05 14:38:17 +02:00
Thomas Monjalon
b2036f7718 eal: remove forward declaration of generic driver
We can just move rte_driver definition before rte_device
(which depends on rte_driver).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-05-04 17:46:58 +02:00
Thomas Monjalon
5b923dfbe6 eal: remove generic driver and device lists
These lists were unused and useless because they are maintained per bus:
	struct rte_driver_list dev_driver_list
	struct rte_device_list dev_device_list

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-05-04 17:43:47 +02:00
Thomas Monjalon
70a969503b version: 17.05-rc3
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-05-02 01:11:34 +02:00
Adrien Mazarguil
37aa3a47a2 eal: fix debug macro redefinition
The RTE_FUNC_*_RET() and RTE_PROC_*_RET() macro definitions in rte_dev.h
require RTE_PMD_DEBUG_TRACE(). This macro is defined as needed by users of
rte_dev.h since its value depends on their own debug settings.

It may be defined multiple times as a result when including files from
various components simultaneously. Worse, these redefinitions may be
inconsistent. This causes the following compilation errors:

 In file included from /tmp/check-includes.sh.13890.c:27:0:
    build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]
 [...]
 In file included from build/include/rte_ethdev_pci.h:39:0,
                  from /tmp/check-includes.sh.13890.c:13:
    build/include/rte_ethdev.h:1042:0: note: this is the location of the
    previous definition
 [...]
 In file included from /tmp/check-includes.sh.13890.c:83:0:
    build/include/rte_cryptodev_pmd.h:65:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]
 [...]
 In file included from /tmp/check-includes.sh.13890.c:27:0:
    build/include/rte_eventdev_pmd.h:58:0: note: this is the location of
    the previous definition
 [...]

This commit moves the RTE_PMD_DEBUG_TRACE() definition to rte_dev.h where
it is enabled consistently depending on global configuration settings and
removes redundant definitions.

Also when disabled, RTE_PMD_DEBUG_TRACE() is now defined as (void)0 to
avoid empty statements warnings if used outside { } blocks.

Fixes: b974e4a40c ("ethdev: make error checking macros public")
Cc: stable@dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2017-05-01 00:10:23 +02:00
Alexey Kardashevskiy
e11222c7f4 vfio: fix structures for sPAPR IOMMU
If Linux UAPI headers in the system do not have VFIO_SPAPR_TCE_v2_IOMMU
defined, DPDK define necessary structures itself. However the existing
definitions are different from ones pushed to the mainline kernel.

This copies structures passed via VFIO_IOMMU_SPAPR_TCE_CREATE and
VFIO_IOMMU_SPAPR_TCE_REMOVE ioctls.

No change in behaviour is expected if installed linux UAPI headers
have knowledge of VFIO_SPAPR_TCE_v2_IOMMU.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-04-30 19:44:34 +02:00
Alejandro Lucero
a9c349e3a1 vfio: fix device unplug when several devices per group
VFIO allows a secure way of assigning devices to user space and those
devices which can not be isolated from other ones are set in same VFIO
group. Releasing or unplugging a device should be aware of remaining
devices is the same group for avoiding to close such a group.

Fixes: 94c0776b1b ("vfio: support hotplug")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-04-30 19:28:13 +02:00
Andrew Rybchenko
1123f89f6a vfio: set IOMMU type for the container once
If more than one used PCI device belongs to one IOMMU group,
it is still one IOMMU group and the container IOMMU type
should be set only once.

Fixes: 94c0776b1b ("vfio: support hotplug")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-04-30 19:26:13 +02:00
Alexey Kardashevskiy
7917d5f5ea pci: initialize generic driver pointer
The existing code initializes a PCI driver pointer but not the common one.
As the result, ring_dma_zone_reserve() in drivers/net/bnx2x/bnx2x_rxtx.c
crashed as dev->device->driver==NULL.

This adds missing initialization.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-04-30 15:28:01 +02:00
Thomas Monjalon
e5b1f2191f version: 17.05-rc2
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-04-21 03:27:07 +02:00
Gaetan Rivet
b5ece77212 ethdev: introduce device removal event
This new API allows reacting to a device removal.
A device removal is the sudden disappearance of a device from its
bus.

PMDs implementing support for this notification guarantee that the removal
of the underlying device does not incur a risk to the application.

In particular, Rx/Tx bursts and all other functions can still be called
(albeit likely returning errors) without triggering a crash, irrespective
of an application handling this event.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Signed-off-by: Elad Persiko <eladpe@mellanox.com>
2017-04-21 01:01:35 +02:00
Nicolas Dichtel
99bb58f3ad igb_uio: switch to new irq function for MSI-X
pci_enable_msix() will be removed in kernel 4.12.
The new API pci_alloc_irq_vectors() is available
since linux 4.8, thus let's use it.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aff171641d18
Link: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=4244de1c64de

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 15:31:41 +02:00
Chao Zhu
284ae3e9ff eal/ppc: fix mmap for memory initialization
On IBM POWER platform, when mapping /dev/zero file to hugepage memory
space, mmap will not respect the requested address hint. This will cause
the memory initialization for the second process fails. This patch adds
the required mmap flags to make it work. Beside this, users need to set
the nr_overcommit_hugepages to expand the VA range. When
doing the initialization, users need to set both nr_hugepages and
nr_overcommit_hugepages to the same value, like 64, 128, etc.

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2017-04-20 09:39:36 +02:00
Olivier Matz
2fc8e0bf04 log: fix dump of registered logs when disabled
When we pass --log-level=0, it disables the logs. This level is
not displayed properly by the function that dumps the registered log
types (it shows "unknown"). Show "disabled" instead.

Before:

  ./build/app/test --log-level=0
  RTE>>dump_log_types
  global log level is unknown
  ...

After:

  ./build/app/test --log-level=0
  RTE>>dump_log_types
  global log level is disabled
  ...

Fixes: 432050bfd0 ("eal: dump registered log types")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:31:18 +02:00
Olivier Matz
73454ace6a log: fix log level regexp matching
Fix misuse of regular expression functions, which was producing a
segfault.

After the patch, it works properly:

  $ ./build/app/test --no-huge --log-level=pmd,3
  RTE>>dump_log_types
  [...]
  id 30: user7, level is debug
  id 31: user8, level is debug
  id 32: pmd.i40e.init, level is critical
  id 33: pmd.i40e.driver, level is critical

Coverity issue: 143472
Fixes: a5279180f5 ("eal: change several log levels matching a regexp")

Reported-by: Jianfeng Tan <jianfeng.tan@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:31:15 +02:00
Olivier Matz
ea85e941d2 eal: remove undue printf
Remove the printf displaying the log level at initialization. It
was introduced for debug purpose, but was not intended to be pushed.

Fixes: 845afe51e4 ("eal: change specific log levels at startup")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:29:46 +02:00
Olivier Matz
9348ca1602 eal: remove log level from internal config
This field is only used in the initialization phase. Remove it since the
global log level can also be retrieved using a public API:
rte_log_get_global_level().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:29:11 +02:00
Olivier Matz
08853d3cbc eal: move internal config initialization
It's better to initialize the internal config in rte_eal_init()
instead of eal_log_level_parse(), since this structure is not only
about logs.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:29:01 +02:00
Olivier Matz
ea98a7afb4 log: fix default level
The initialization of the default log level (from configuration) was
removed by mistake in a previous commit. The global log level was
wrongly set to debug when no --log-level argument was passed. Restore
this initialization.

Before:
  $ ./build/app/test
  RTE>>dump_log_types
  global log level is debug
  ...

After:
  $ ./build/app/test
  RTE>>dump_log_types
  global log level is info
  ...

Fixes: 845afe51e4 ("eal: change specific log levels at startup")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 01:28:37 +02:00
Pablo de Lara
75915f1bde log: redefine logtype values
After the changes in commit c1b5fa94a4
("eal: support dynamic log types"), logtype is not treated as a
bitmask, but a decimal value. Therefore, values have to be
converted.

Fixes: c1b5fa94a4 ("eal: support dynamic log types")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-20 01:28:33 +02:00
Ferruh Yigit
da51d4d956 kni: fix ethtool support
Use correct config option, without CONFIG prefix.

Fixes: b2b0f85182 ("kni: add build option for ethtool support")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-20 00:13:37 +02:00
Hemant Agrawal
a016873eb3 vfio: export utility functions in map file
adding extra vfio utility functions to map file.
They will be used by other vfio supported buses like fslmc bus
for NXP DPAA2 devices

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2017-04-19 15:37:37 +02:00
Jan Blunck
d39670086a eal: parse driver argument before probing drivers
In some cases the virtual device name should be totally different than
the driver being used for the device. Therefore lets parse the devargs for
the "driver" argument before probing drivers in vdev_probe_all_drivers().

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-18 18:58:27 +02:00
Jan Blunck
beec692c51 eal: add name field to generic device
This adds a name field to the generic struct rte_device. The EAL is
checking for the name being populated when registering a device but
doesn't enforce global unique names as this is left to the bus
implementations.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-18 18:57:56 +02:00
Jan Blunck
5d2aa461cb vdev: use generic vdev struct for probe and remove
This is a preparation to embed the generic rte_device into the rte_eth_dev
also for virtual devices.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2017-04-14 15:41:50 +02:00
Jan Blunck
dda987315c vdev: make virtual bus use its device struct
This allows the virtual bus to be rescanned and probed by tracking the
creation of rte_vdev_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
7eff02a09a vdev: add virtual device arguments helper function
This adds the rte_vdev_device_args() helper function to prepare for
changing the virtual drivers probe() functions take a rte_vdev_device
pointer instead of the name+args strings.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2017-04-14 15:23:29 +02:00
Jan Blunck
665146f2c8 vdev: add virtual device name helper function
This adds the rte_vdev_device_name() helper function to retrieve the
rte_vdev_device name which makes moving the name of the low-level
device into struct rte_device easier in the future.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
6e051f50c9 vdev: add virtual device struct
This adds the rte_vdev_device structure which embeds a generic rte_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
598639950b vdev: refactor probe/remove
This is a preparation for the introduction of the struct rte_vdev_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
9721b4d543 eal: remove unused device init function
Signed-off-by: Jan Blunck <jblunck@infradead.org>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
810e5fa368 vdev: move virtual device probing into a bus
This is a refactoring of the virtual device probing which moves into into
a proper bus structure.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-04-14 15:23:29 +02:00
Jan Blunck
da76cc0234 eal: probe new virtual bus after other bus devices
Also see commit f4ce209a8c ("eal: postpone vdev initialization").

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2017-04-14 15:23:29 +02:00
Shreyansh Jain
9a8ad786c7 eal: bump ABI version for bus refactoring
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-14 15:23:28 +02:00
Shreyansh Jain
23d96eb688 pci: use bus driver for scan/probe
Remove EAL initiated direct PCI scan/probe and enable PCI Bus linkage.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-14 15:23:28 +02:00
Shreyansh Jain
0fd1a0eaae pci: add bus driver
Based on EAL Bus APIs, PCI bus callbacks and support functions are
introduced in this patch.

EAL continues to have direct PCI init/scan calls as well. These would be
removed in subsequent patches to enable bus only PCI devices.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-14 15:23:28 +02:00
Shreyansh Jain
ad3e1dec11 pci: remove loop over drivers in device detach
rte_eal_pci_detach calls pci_detach_all_drivers which loops over all
PCI drivers for detaching the device. This is unnecessary as the device
already has the PCI driver reference which can be used directly.

Removing pci_detach_all_drivers and restructuring rte_eal_pci_detach
and rte_eal_pci_detach_dev to work without looping over driver list.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-14 15:23:28 +02:00
Shreyansh Jain
f102b9c37d pci: split match and probe
Matching of PCI device address and driver ID table is being done at two
discreet locations duplicating the code. (rte_eal_pci_probe_one_driver
and rte_eal_pci_detach_dev).

Refactor the match logic as a single function.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-14 15:23:28 +02:00
Stephen Hemminger
c5ba278876 lib: remove unnecessary void cast
Remove unnecessary casts of void * pointers to a specific type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-04-11 18:05:10 +02:00
Thomas Monjalon
9097125100 version: 17.05-rc1
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-04-06 23:25:18 +02:00
Andrew Rybchenko
2ed8fd9d10 pci: do not log false failures for non-whitelisted devices
If probe of the whitelisted PCI device fails, reset ret to zero
to silently skip non-whitelisted PCI devices.

Fixes: 10f6c93cea ("eal: do not panic on PCI failures")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2017-04-06 23:13:06 +02:00
Aaron Conole
e9980a7573 eal: deprecate old cpu features check function
It's likely that this function isn't used anywhere, but since it was part
of the public API, mark the function for deprecation for at least one
release.

Signed-off-by: Aaron Conole <aconole@redhat.com>
2017-04-06 23:03:42 +02:00
Aaron Conole
b8951127a0 eal: add missing function to symbol map
This function rte_cpu_is_supported is now part of the public ABI,
so should be advertised as such.

Fixes: 37e97ad2c5 ("eal: do not panic when CPU is not supported")

Signed-off-by: Aaron Conole <aconole@redhat.com>
2017-04-06 22:54:44 +02:00
Qi Zhang
c23a1a3000 eal: clean up interrupt handle
The patch change the prototype of callback function
(rte_intr_callback_fn) by removing the unnecessary parameter.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2017-04-06 21:15:55 +02:00
Qi Zhang
13b38e79e1 vfio: keep interrupt source read only
Remove the inappropriate modification on get_max_intr
field that keep the intr_source read only.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Anatoly  Burakov <anatoly.burakov@intel.com>
2017-04-06 21:15:55 +02:00
Olivier Matz
4f0981e6ec eal: deprecate log functions
Deprecate the following functions:
- rte_set_log_level(), replaced by rte_log_set_global_level()
- rte_get_log_level(), replaced by rte_log_get_global_level()
- rte_set_log_type(), replaced by rte_log_set_level()
- rte_get_log_type(), replaced by rte_log_get_level()

The new functions provide a better control of the per-type log level,
and have a better name prefix (rte_log_).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 13:48:40 +02:00
Olivier Matz
845afe51e4 eal: change specific log levels at startup
Example of use:
  ./app/test-pmd --log-level='pmd\.i40e.*,8'

  This enables debug logs for all dynamic logs whose type starts with
  'pmd.i40e'.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 13:37:17 +02:00
Olivier Matz
a5279180f5 eal: change several log levels matching a regexp
Introduce a function to set the log level of several log types that
match a regular expression.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 13:37:17 +02:00
Olivier Matz
432050bfd0 eal: dump registered log types
Introduce a function to dump the global level and the registered log
types.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 13:37:17 +02:00
Olivier Matz
c1b5fa94a4 eal: support dynamic log types
Introduce 2 new functions to support dynamic log types:

- rte_log_register(): register a log name, and return a log type id
- rte_log_set_level(): set the log level of a given log type

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 13:37:17 +02:00
Olivier Matz
97cb466d65 mbuf: use 2 bytes for port and nb segments
Change the size of m->port and m->nb_segs to 16 bits. It is now possible
to reference a port identifier larger than 256 and have a mbuf chain
larger than 256 segments.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 11:30:29 +02:00
Jerin Jacob
dc448dc460 mbuf: make rearm data address naturally aligned
To avoid multiple stores on fast path, Ethernet drivers
aggregate the writes to data_off, refcnt, nb_segs and port
to an uint64_t data and write the data in one shot
with uint64_t* at &mbuf->rearm_data address.

Some of the non-IA platforms have store operation overhead
if the store address is not naturally aligned.This patch
fixes the performance issue on those targets.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-04-05 11:30:29 +02:00
Jerin Jacob
4f0804bbdf eventdev: implement the northbound APIs
This patch implements northbound eventdev API interface using
southbond driver interface

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-04 19:12:00 +02:00
Jianfeng Tan
99998feec9 eal/linux: add interrupt type for vdev
A new interrupt type, RTE_INTR_HANDLE_VDEV, is added to support lsc and rxq
interrupt for vdev.

For lsc interrupt, except from original EPOLLIN events, we also listen for
socket peer closed connection event (EPOLLRDHUP and EPOLLHUP).

For rxq interrupt, add a precondition to avoid invoking any vfio and uio
code.

For intr_handle initialization, let each vdev driver to do that.

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
2017-04-01 10:36:17 +02:00
Shahaf Shuler
49e2f374e4 eal/linux: support external Rx interrupt
Prior to this patch only UIO/VFIO interrupt handlers types were supported.
This patch adds support for the external interrupt handler type, allowing
external drivers to set their own fds with specific interrupt handlers.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
2017-04-04 18:59:39 +02:00
Nirmoy Das
2972254ce1 kni: fix build on Suse 12 SP3
Add support for SLES12SP3, which uses kernel 4.4,
but backported features from newer kernels.

Signed-off-by: Nirmoy Das <ndas@suse.de>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-04 17:11:26 +02:00
Jerin Jacob
9256eed78a eal/linux: fix build with glibc 2.25
glibc 2.25 is warning about if applications depend on
sys/types.h for makedev macro, it expects to be included
from <sys/sysmacros.h>

Found this error while testing with GCC 6.3.1 on archlinux.

lib/librte_eal/linuxapp/eal/eal_pci_uio.c: In function ‘pci_mknod_uio_dev’:
lib/librte_eal/linuxapp/eal/eal_pci_uio.c:134:13:
error: In the GNU C Library, "makedev" is defined
by <sys/sysmacros.h>. For historical compatibility, it is
currently defined by <sys/types.h> as well, but we plan to
remove this soon. To use "makedev", include <sys/sysmacros.h>
directly. If you did not intend to use a system-defined macro
"makedev", you should undefine it after including <sys/types.h>. [-Werror]
 dev = makedev(major, minor);
             ^~~~~~~~~~~~~~~~~

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-04-04 14:52:06 +02:00
Bruce Richardson
8415429e43 nic_uio: fix device binding at boot
When loading nic_uio from /boot/loader.conf as specified in the Getting
Started Guide doc, the NIC devices were not bound at boot. Unloading the
nic_uio driver and reloading it would cause them to be bound, however.

The root cause appears to be the fact that when the module is loaded at
boot, the call to find the pci device when parsing the b:d:f parameter
fails to return the device. That means that later on when the device
is probed as part of a PCI scan, no action is taken as it's not recorded
as a device to be used.

We fix this by having the b:d:f string parsed again on probe if the
initial check to see if it's an already-known device fails. In my tests,
this causes the NIC devices to be successfully bound at boot time, as
well as leaving things working as before in the case the module is loaded
post-boot.

Fixes: 764bf26873 ("add FreeBSD support")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-04 12:28:03 +02:00
Jianfeng Tan
dd18a2f0b2 vfio: fix secondary process start
When binding with vfio-pci, secondary process cannot be started with
an error message:

    cannot find TAILQ entry for PCI device.

It's due to: struct rte_pci_addr is padded with 1 byte for alignment
by compiler. Then below comparison in commit 2f4adfad0a
("vfio: add multiprocess support") will fail if the last byte is not
initialized.

    memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr)

And commit cdc242f260 ("eal/linux: support running as unprivileged user")
just triggers this bug by using a stack un-initialized variable.

The fix is to use rte_eal_compare_pci_addr() for pci addr comparison.

Fixes: 2f4adfad0a ("vfio: add multiprocess support")
Fixes: cdc242f260 ("eal/linux: support running as unprivileged user")
Cc: stable@dpdk.org

Reported-by: Pawel Rutkowski <pawelx.rutkowski@intel.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2017-04-04 11:58:57 +02:00
Anatoly Burakov
9fa5993f10 vfio: fix build
Some compilers require definition of vfio_iommu_spapr_tce_ddw_info
before its use in vfio_iommu_spapr_tce_info, so move tce_info
definition below tce_ddw_info.

Fixes: 468f42cc26 ("vfio: fix build on old kernel")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-04-03 20:00:23 +02:00
Ferruh Yigit
21be6fb6af igb_uio: fix build with kernel < 3.2
Recently added "dma_zalloc_coherent()" call is causing build error
for Linux kernels < 3.2.

compile error:
lib/librte_eal/linuxapp/igb_uio/igb_uio.c:
  In function ‘igbuio_pci_probe’:
lib/librte_eal/linuxapp/igb_uio/igb_uio.c:434:2:
error: implicit declaration of function ‘dma_zalloc_coherent’
  [-Werror=implicit-function-declaration]
  map_addr = dma_zalloc_coherent(&dev->dev, 1024,
  ^

dma_zalloc_coherent() introduced with Linux kernel 3.2, with commit
Linux: 842fa69f3e0c ("include/linux/dma-mapping.h: add dma_zalloc_coherent()")
Since it does not exist for older kernels, causing a build error.

Switched to dma_alloc_coherent() API to prevent build error.

Fixes: d287e4d41b ("igb_uio: map dummy DMA forcing IOMMU domain attachment")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-04-03 19:49:58 +02:00
David Su
f0d1896fa1 igb_uio: use non-threaded ISR
This eliminates the overhead of a task switch when an interrupt arrives.

Signed-off-by: David Su <david.w.su@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-03-30 22:26:07 +02:00
Alejandro Lucero
d287e4d41b igb_uio: map dummy DMA forcing IOMMU domain attachment
For using a DPDK app when iommu is enabled, it requires to
add iommu=pt to the kernel command line. But using igb_uio driver
makes DMAR errors because the device has not an IOMMU domain.

Since kernel 3.15, iommu=pt requires to use the internal kernel
DMA API for attaching the device to the IOMMU 1:1 mapping, aka
si_domain. Previous versions did attach the device to that
domain when intel iommu notifier was called.

This is not a problem if the driver does later some call to the
DMA API because the mapping can be done then. But DPDK apps do
not use that DMA API at all.

Doing this dma map and unmap is harmless even when iommu is not
enabled at all.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-03-30 22:26:07 +02:00
Alejandro Lucero
94c0776b1b vfio: support hotplug
Current device hotplug is just supported by UIO managed devices.
This patch adds same functionality with VFIO.

It has been validated through tests using IOMMU and also with
VFIO and no-iommu mode.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-03-30 18:40:15 +02:00
Nikhil Rao
bb7927fd21 vfio: fix disabling INTx
The flags member of irq_set should be ORed with VFIO_IRQ_SET_ACTION_MASK
and not VFIO_IRQ_SET_ACTION_UNMASK. The bug was found by code inspection.

Fixes: 5c782b3928 ("vfio: interrupts")
Cc: stable@dpdk.org

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-03-30 16:59:49 +02:00
Anatoly Burakov
468f42cc26 vfio: fix build on old kernel
Fixing compile failures for kernels without sPAPR IOMMU support.

Fixes: 0fe9830b53 ("eal/ppc: support sPAPR IOMMU for vfio-pci")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-03-30 16:55:57 +02:00
Ferruh Yigit
d4d2380cbb kni: fix build with kernel 4.11
compile error:
.../build/build/lib/librte_eal/linuxapp/kni/kni_net.c:124:6:
error: implicit declaration of function ‘signal_pending’
[-Werror=implicit-function-declaration]
  if (signal_pending(current) || ret_val <= 0) {
      ^~~~~~~~~~~~~~

Linux 4.11 moves signal function declarations to its own header file:
Linux: 174cd4b1e5fb ("sched/headers: Prepare to move signal wakeup &
sigpending methods from <linux/sched.h> into <linux/sched/signal.h>")

Use new header file "linux/sched/signal.h" to fix the build error.

Cc: stable@dpdk.org

Reported-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Pankaj Gupta <pagupta@redhat.com>
2017-03-30 16:45:36 +02:00
Bruce Richardson
6f6d2a66f8 eal/bsd: query the cpu count only once
Rather than querying the number of CPUs on the system multiple times, and
printing out the number each time, just query the value from sysctl once
and store it for future reuse.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 23:56:58 +02:00
Olivier Matz
feb9f680cd mk: optimize directory dependencies
Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC without -j).

- for instance, it is possible to express a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Robin Jarry <robin.jarry@6wind.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-03-27 23:28:43 +02:00
Aaron Conole
ac71108d64 eal: add info about various init error codes
The rte_eal_init function will now pass failure reason hints to the
application.  To help app developers decipher this, add some brief
information about what the codes are indicating.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:59:53 +02:00
Aaron Conole
1908008f5d eal: do not panic on bus probe/scan failure
For now, exit the init.  It's likely that even aborting the initialization
is premature in this case, as it may be possible to proceed even if one
bus or another is not available.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:59:06 +02:00
Aaron Conole
e2c0413f2d eal: do not panic on vdev init failure
Even if one vdev should fail, there's no need to prevent further
processing.  Log the error, and reflect it to the higher levels to
decide.

Seems like it's possible to continue.  At least, the error is reflected
properly in the logs.  A user could then go and correct or investigate
the situation.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:58:28 +02:00
Aaron Conole
10f6c93cea eal: do not panic on PCI failures
Some devices may be inaccessible for a variety of reasons, or the
PCI-bus may be unavailable causing the whole thing to fail.  Still,
better to continue attempts at probes.

Since PCI isn't neccessarily required, it may be possible to simply log
the error and continue on letting the user check the logs and restart
the application when things have failed.

This will usually be an issue because of permissions.  However, it could
also be caused by OOM.  In either case, errno will contain the
underlying cause.

For linux, it is safe to re-init the system here, so allow the
application to take corrective action and reinit.

For BSD, this is not the case, for other reasons, including hugepage
allocation has already happened, and needs to be properly uninitialized.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:58:00 +02:00
Aaron Conole
4fe1d33987 eal: do not panic if plugins fail to init
Plugins are useful and important.  However, it seems crazy to abort
everything just because they don't initialize properly.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:57:13 +02:00
Aaron Conole
c050e5abae eal: do not panic on interrupt thread init
There could be some confusion as to why the call failed - this change
will always reflect the value of the error in rte_error.

When initializing the interrupt thread, there are a number of possible
reasons for failure - some of which are correctable by the application.
Do not panic() needlessly, and give the application a change to reflect
this information to the user.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:56:59 +02:00
Aaron Conole
330bed86d3 eal: do not panic on timer init failure
After code inspection, there is no way for eal_timer_init() to fail.  It
simply returns 0 in all cases.  As such, this test could either go-away
or stay here as 'future-proofing'.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:55:49 +02:00
Aaron Conole
7d5c430f69 eal: do not panic on a number of conditions
When log initialization fails, it's generally because the fopencookie
failed.  While this is rare in practice, it could happen, and it is
likely because of memory pressure.  So, flag the error, and allow the
user to retry.

Memory init can only fail when access to hugepages (either as primary or
secondary process) fails (and that is usually permissions).  Since the
manner of failure is not reversible, we cannot allow retry.

There are some theoretical racy conditions in the system that _could_
cause early tailq init to fail;  however, no need to panic the
application.  While it can't continue using DPDK, it could make better
alerts to the user.

rte_eal_alarm_init() call uses the linux timerfd framework to create a
poll()-able timer using standard posix file operations.  This could fail
for a few reasons given in the man-pages, but many could be
corrected by the user application.  No need to panic.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:54:49 +02:00
Aaron Conole
8f113d9818 eal: set errno when exiting for already initialized
Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:53:46 +02:00
Aaron Conole
ce3bede01e eal: do not panic on memzone init failure
When memzone initialization fails, report the error to the calling
application rather than panic().  Without a good way of detaching /
releasing hugepages, at this point the application will have to restart.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:53:06 +02:00
Aaron Conole
a0222a4679 eal: do not panic on argument parsing error
It's possible that the application could take a corrective action here,
and either prompt the user for different arguments, or at least perform
a better logging.  Exiting this early prevents any useful information
gathering from the application layer.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:52:08 +02:00
Aaron Conole
547a61af71 eal: do not panic on hugepage info init
When attempting to scan hugepages, signal to the eal that an error has
occurred, rather than performing a panic.

If we fail to acquire hugepage information, simply signal an error to
the application.  This clears the run_once counter, allowing the user or
application to take a corrective action and retry.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:50:37 +02:00
Aaron Conole
37e97ad2c5 eal: do not panic when CPU is not supported
This adds a new API to check for the eal cpu versions.

It's now possible to gracefully exit the application, or for
applications which support non-dpdk datapaths working in concert with
DPDK datapaths, there no longer is the possibility of exiting for
unsupported CPUs.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:50:09 +02:00
Aaron Conole
647644e51f eal: do not panic on CPU detection
There may be no way to gracefully recover, but the application
should be notified that a failure happened, rather than completely
aborting.  This allows the user to proceed with a "slow-path" type
solution.

After this change, the EAL CPU NUMA node resolution step can no longer
emit an rte_panic.  This aligns with the code in rte_eal_init, which
expects failures to return an error code.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-27 15:47:10 +02:00
Ben Walker
24a5357968 pci: fix device registration on FreeBSD
The FreeBSD implementation wasn't registering new devices
with the device framework on start up. However, common
code attempts to unregister them on shutdown which causes
a SEGFAULT. This fix makes the FreeBSD code do the same
thing as the Linux code for registration.

Fixes: 13a1317d3b ("pci: create device list and fallback on its members")
Cc: stable@dpdk.org

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-03-27 12:07:53 +02:00
Matt Peters
b61befb48c igb_uio: support devices with only I/O BAR
Allow the BAR setup to succeed if a device has at least 1 BAR region
defined.  Previously, the device probe would only succeed if at least one
memory BAR existed, but there are devices that have only port I/O BARs.

For example, on Virtual Box a virtio device has only a single I/O BAR
because by default MSI-X is not enabled.  While in qemu/kvm the virtio
device has MSI-X enabled and therefore has both an I/O and Memory BAR.

The following are excerpts from "lspci -nnvvvv -s 00:09.0" on both types of
systems.

Virtual Box:

    Region 0: I/O ports at d260 [size=32]
    Capabilities: [80] #00 [0000]

QEMU/KVM:

    Region 0: I/O ports at c060 [size=32]
    Region 1: Memory at febd1000 (32-bit, non-prefetchable) [size=4K]
    Expansion ROM at feb80000 [disabled] [size=256K]
    Capabilities: [40] MSI-X: Enable+ Count=3 Masked-
            Vector table: BAR=1 offset=00000000
            PBA: BAR=1 offset=00000800

Signed-off-by: Matt Peters <matt.peters@windriver.com>
Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-03-15 14:02:41 +01:00
Thomas Monjalon
31123211bd remove unmaintained TILE-Gx architecture
The TILE-Gx architecture and its driver mpipe are not maintained.
The code is removed to avoid confusion.

A last update has been done in 17.05 before removal.
It can be built with the updated toolchain:
	http://www.mellanox.com/repository/solutions/tile-scm/
and libgxio:
	http://www.mellanox.com/repository/solutions/tile-scm/libgxio-1.0.tar.xz

Quote from http://dpdk.org/ml/archives/dev/2017-February/057940.html
"
Mellanox agrees to remove TILE-Gx support from DPDK.org, but will continue
to support customers using DPDK.
Customer that needs support should contact Mellanox directly.
"

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-03-15 11:40:57 +01:00
Gowrishankar Muthukrishnan
0fe9830b53 eal/ppc: support sPAPR IOMMU for vfio-pci
Below changes adds pci probing support for vfio-pci devices in power8.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
2017-03-09 18:39:45 +01:00
Ben Walker
cdc242f260 eal/linux: support running as unprivileged user
For Linux kernel 4.0 and newer, the ability to obtain
physical page frame numbers for unprivileged users from
/proc/self/pagemap was removed. Instead, when an IOMMU
is present, simply choose our own DMA addresses instead.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2017-03-09 17:08:46 +01:00
Jan Blunck
b2fba63690 eal: ensure constness of container_of target
This adds a check to ensure that the container_of() macro is not used to
cast away (remove) constness.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-08 14:04:29 +01:00
Jan Blunck
7cfd280578 eal: fix container_of macro for const members
This fixes the usage of structure members that are declared const to get
a pointer to the embedding parent structure.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-03-08 13:48:36 +01:00
Chris Metcalf
dd0eedb1cf tile: fix build
Re-enable CONFIG_RTE_LIBRTE_SCHED, since it is needed to build
correctly.

Fix a few warnings when compiling mpipe_tilegx.c.

Remove an empty rte_cpu_feature_table[] array using a bogus type.

Properly set RTE_OBJCOPY_{TARGET,ARCH} in mk/arch/tile/rte.vars.mk.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
2017-02-27 16:44:32 +01:00
Chris Metcalf
f80468b680 eal/tile: avoid use of non-upstreamed header
It's trivial to directly invoke a read of the special-purpose
register that holds the clock cycle counter, so just do that.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
2017-02-27 16:44:23 +01:00
Thomas Monjalon
420195e6af log: remove old symbols from map
When removing log history functions, the map has not been updated.

Fixes: d7e61ad3ae ("log: remove deprecated history dump")

Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-02-21 11:43:45 +01:00
Ferruh Yigit
aa0d7c2d32 kni: remove KNI vhost support
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-02-21 11:43:07 +01:00
Thomas Monjalon
d450914ab8 version: 17.05-rc0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-02-17 12:17:39 +01:00
Thomas Monjalon
b9ebab26d9 version: 17.02.0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-02-14 22:17:45 +01:00
Qi Zhang
2eed820fd4 vfio: fix maximum number of interrupt for MSI-X
The max number of interrupt request is possible
be changed after rte_intr_callback_register, so
in get_max_intr, we need to check if necessary to
update the max_intr.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2017-02-13 22:25:04 +01:00
Thomas Monjalon
47aa9d4e0d version: 17.02-rc3
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-02-10 17:15:32 +01:00
Yong Wang
511a4c74b8 pci: fix UIO interrupt file descriptor check before close
The "dev->intr_handle.fd" is possibly a negative value while it is
passed as an argument to function "close". Fix the check to the fd.

Fixes: 5a60a7ffc8 ("pci: introduce functions to alloc and free uio resource")

Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
2017-02-10 14:23:27 +01:00
Patrick MacArthur
811b6b2506 vfio: fix file descriptor leak in multi-process
When a secondary process wants access to the VFIO container file
descriptor, the primary process calls vfio_get_container_fd() which
always opens an entirely new file descriptor on /dev/vfio/vfio.
However, once the file descriptor has been passed to the subprocess, it
is effectively duplicated, meaning that the copy of the file descriptor
in the primary process is no longer needed.  However, the primary
process does not close the duplicate fd, which results in a resource
leak.

This can be reproduced by starting a primary process with a small
RLIMIT_NOFILE limit configured to use VFIO for at least one device, and
repeatedly launching secondary processes until the file descriptor limit
is exceeded.

Fix the resource leak by closing the local vfio container file
descriptor after passing it to the secondary process.

Fixes: 2f4adfad0a ("vfio: add multiprocess support")
Cc: stable@dpdk.org

Signed-off-by: Patrick MacArthur <patrick@patrickmacarthur.net>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2017-02-09 18:39:30 +01:00
Thomas Monjalon
5b243cbab2 version: 17.02-rc2
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-30 23:47:11 +01:00
Emmanuel Roullit
3cdfdf2a33 devargs: reset driver name pointer on parsing failure
The pointer set by strdup() needs to be cleared on failure to avoid a
potential double-free from the caller.

Found with clang static analysis:
lib/librte_eal/common/eal_common_devargs.c:123:2:
warning: Attempt to free released memory
        free(buf);
        ^~~~~~~~~

Fixes: 0fe11ec592 ("eal: add vdev init and uninit")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
2017-01-29 23:34:07 +01:00
Olivier Matz
ec7df18bb7 eal: fix warning about debug log at startup
The log "Debug logs available - lower performance" should
now only be displayed when dataplane debug logs are enabled.

The issue occurs only if the default log level (CONFIG_RTE_LOG_LEVEL) is
set to DEBUG in the configuration, which is not the case by default.

Fixes: 5d8f0baf69 ("log: do not drop debug logs at compile time")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-01-29 22:58:14 +01:00
Michał Mirosław
d613f57dd0 kni: guard against unterminated name oops
If the name is too long, it triggers BUG in alloc_netdev().

Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-29 22:50:28 +01:00
Michał Mirosław
4d0db6df1c kni: set interface name source as user-space
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-29 22:47:30 +01:00
Ferruh Yigit
b2b0f85182 kni: add build option for ethtool support
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-29 22:36:26 +01:00
Pablo de Lara
2ee926f1fd eal: fix FreeBSD build
rte_bus_scan() and rte_bus_probe() have been introduced
in eal.c, but it is missing the rte_bus.h header file,
for BSD systems.

Fixes: f44abbc12f ("bus: add scanning")
Fixes: c3cec1d807 ("bus: add probing")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2017-01-19 15:29:45 +01:00
Thomas Monjalon
6818a7f480 version: 17.02-rc1
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-19 05:54:41 +01:00
Shreyansh Jain
c3cec1d807 bus: add probing
Bus implementations can implement a probe handler to match the devices
scanned against the drivers registered.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-19 04:58:17 +01:00
Shreyansh Jain
f44abbc12f bus: add scanning
Scan for bus discovers the devices available on the bus and adds them
to a bus specific device list. Each bus mandatorily implements this
method.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-19 04:58:12 +01:00
Shreyansh Jain
a97725791e bus: introduce bus abstraction
This patch introduces the rte_bus abstraction for EAL.
The model is:
 - One or more devices are connected to a Bus
 - Drivers are running instances which manage one or more devices
 - Bus is responsible for identifying devices (and interrupt propogation)
 - Driver is responsible for initializing the device

This patch adds a 'rte_bus' base class which would be extended for
specific implementations. It also introduces Bus registration and
deregistration functions.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2017-01-19 04:57:18 +01:00
Pablo de Lara
56b6ef874f efd: new Elastic Flow Distributor library
Elastic Flow Distributor (EFD) is a distributor library that uses
perfect hashing to determine a target/value for a given incoming flow key.
It has the following advantages:

- First, because it uses perfect hashing, it does not store
  the key itself and hence lookup performance is not dependent
  on the key size.

- Second, the target/value can be any arbitrary value hence
  the system designer and/or operator can better optimize service rates
  and inter-cluster network traffic locating.

- Third, since the storage requirement is much smaller than a hash-based
  flow table (i.e. better fit for CPU cache), EFD can scale to
  millions of flow keys.
  Finally, with current optimized library implementation performance
  is fully scalable with number of CPU cores.

Signed-off-by: Byron Marohn <byron.marohn@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
Acked-by: Christian Maciocco <christian.maciocco@intel.com>
2017-01-18 20:53:28 +01:00
Jerin Jacob
b15740bd43 eal/arm64: change barrier definitions to macros
Change rte_*wb definitions to macros in order to
keep consistent with other barrier definitions in
the file.

Suggested-by: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 17:18:26 +01:00
Jerin Jacob
e783b81d44 eal/arm64: override I/O device read/write access
Override the generic I/O device memory read/write access and implement it
using armv8 instructions for arm64.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 17:18:26 +01:00
Jerin Jacob
a2c4cd8648 eal: let all architectures use generic I/O implementation
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 17:17:28 +01:00
Jerin Jacob
4540fbb2ae eal: add generic I/O device read/write implementation
This patch implements the generic version of rte_read[b/w/l/q]_[relaxed]
and rte_write[b/w/l/q]_[relaxed] using rte_io_wmb() and rte_io_rmb()

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 17:12:05 +01:00
Jerin Jacob
69736db1d8 eal: introduce I/O device memory read/write operations
This commit introduces 8-bit, 16-bit, 32bit, 64bit I/O device
memory read/write operations along with the relaxed versions.

The weakly-ordered machine like ARM needs additional I/O barrier for
device memory read/write access over PCI bus.
By introducing the eal abstraction for I/O device memory read/write access,
The drivers can access I/O device memory in architecture agnostic manner.

The relaxed version does not have additional I/O memory barrier, useful in
accessing the device registers of integrated controllers which
implicitly strongly ordered with respect to memory access.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
2cf953cfd8 eal/arm64: define I/O device memory barriers
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
67ce81bd3d eal/arm64: define SMP barrier
dmb instruction based barrier is used for smp version of memory barrier.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
84733fd0d7 eal/arm64: fix memory barrier definition
dsb instruction based barrier is used for non smp
version of memory barrier.

Fixes: d708f01b71 ("eal/arm: add atomic operations for ARMv8")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
2017-01-18 16:57:11 +01:00
Jerin Jacob
b41508b7a4 eal/armv7: define I/O device memory barriers
The patch does not provide any functional change for ARMv7.
I/O barriers are mapped to existing smp barriers.

CC: Jan Viktorin <viktorin@rehivetech.com>
CC: Jianbo Liu <jianbo.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
38b636b7cc eal/arm: separate SMP barrier definition for ARMv7 and ARMv8
Separate the smp barrier definition for arm and arm64 for fine
control on smp barrier definition for each architecture.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
da07a35be5 eal/ppc64: define I/O device memory barriers
The patch does not provide any functional change for ppc_64.
I/O barriers are mapped to existing smp barriers.

CC: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
dff90714b1 eal/tile: define I/O device memory barriers
The patch does not provide any functional change for tile.
I/O barriers are mapped to existing smp barriers.

CC: Zhigang Lu <zlu@ezchip.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
e802521171 eal/x86: define I/O device memory barriers
The patch does not provide any functional change for IA.
I/O barriers are mapped to existing smp barriers.

CC: Bruce Richardson <bruce.richardson@intel.com>
CC: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Jerin Jacob
1ea155733e eal: introduce I/O device memory barriers
This commit introduce rte_io_mb(), rte_io_wmb() and rte_io_rmb(), in
order to enable memory barriers between I/O device and CPU.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-18 16:57:11 +01:00
Michał Mirosław
d75547718c net/i40e: return errno when interrupt setup fails
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Reviewed-by: Jingjing Wu <jingjing.wu@intel.com>
2017-01-17 19:41:42 +01:00
Zhihong Wang
f5472703c0 eal: optimize aligned memcpy on x86
This patch optimizes rte_memcpy for well aligned cases, where both
dst and src addr are aligned to maximum MOV width. It introduces a
dedicated function called rte_memcpy_aligned to handle the aligned
cases with simplified instruction stream. The existing rte_memcpy
is renamed as rte_memcpy_generic. The selection between them 2 is
done at the entry of rte_memcpy.

The existing rte_memcpy is for generic cases, it handles unaligned
copies and make store aligned, it even makes load aligned for micro
architectures like Ivy Bridge. However alignment handling comes at
a price: It adds extra load/store instructions, which can cause
complications sometime.

DPDK Vhost memcpy with Mergeable Rx Buffer feature as an example:
The copy is aligned, and remote, and there is header write along
which is also remote. In this case the memcpy instruction stream
should be simplified, to reduce extra load/store, therefore reduce
the probability of load/store buffer full caused pipeline stall, to
let the actual memcpy instructions be issued and let H/W prefetcher
goes to work as early as possible.

This patch is tested on Ivy Bridge, Haswell and Skylake, it provides
up to 20% gain for Virtio Vhost PVP traffic, with packet size ranging
from 64 to 1500 bytes.

The test can also be conducted without NIC, by setting loopback
traffic between Virtio and Vhost. For example, modify the macro
TXONLY_DEF_PACKET_LEN to the requested packet size in testpmd.h,
rebuild and start testpmd in both host and guest, then "start" on
one side and "start tx_first 32" on the other.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
2017-01-17 16:40:05 +01:00
Ben Walker
b0d3e3f73b pci: use address struct in function arguments
Instead of passing domain, bus, devid, func, just pass
an rte_pci_addr.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-01-12 15:55:16 +01:00
Ben Walker
22dda618c0 pci: separate detaching ethernet ports from PCI devices
Attaching and detaching ethernet ports from an application
is not the same thing as physically removing a PCI device,
so clarify the flags indicating support. All PCI devices
are assumed to be physically removable, so no flag is
necessary in the PCI layer.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-12 15:48:54 +01:00
Ben Walker
e84ad157b7 pci: unmap resources if probe fails
If resources were mapped prior to probe, unmap them
if probe fails.

This does not handle the case where the kernel driver was
forcibly unbound prior to probe.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2017-01-12 15:47:45 +01:00
Nelio Laranjeiro
86c743cf91 eal: define generic vector types
Add common vector type definitions to all CPU architectures.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
2017-01-04 21:50:19 +01:00
Thomas Monjalon
c6dab2a873 tools: move to usertools
Rename tools/ into usertools/ to differentiate from buildtools/
and devtools/ while making clear these scripts are part of
DPDK runtime.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2017-01-04 21:17:32 +01:00
Jan Blunck
eac901ce29 ethdev: decouple from PCI device
This makes struct rte_eth_dev independent of struct rte_pci_device by
replacing it with a pointer to the generic struct rte_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-25 23:30:19 +01:00
Stephen Hemminger
71ff78a7f7 eal: make driver pointer const in device struct
The info in rte_device about driver is immutable and
shouldn't change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jan Blunck <jblunck@infradead.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-12-24 18:46:40 +01:00
Jan Blunck
bb30369dc1 eal: allow passing const interrupt handle
Both register/unregister and enable/disable don't necessarily require the
rte_intr_handle to be modifiable. Therefore lets constify it.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:45:50 +01:00
Jan Blunck
9b815f2141 eal: define container_of macro
This macro is based on Jan Viktorin's original patch but also checks the
type of the passed pointer against the type of the member.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
[jblunck@infradead.org: add type checking and __extension__]
Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-24 18:45:01 +01:00
Stephen Hemminger
3030127eb2 pci: remove unused unbind support
No device driver sets the unbind flag in current public code base.
Therefore it is good time to remove the unused dead code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2016-12-21 16:13:46 +01:00
Jerin Jacob
f4ce209a8c eal: postpone vdev initialization
Some platform like octeontx may use pci and
vdev based combined device to represent a logical
dpdk functional device.In such case, postponing the
vdev initialization after pci device
initialization will provide the better view of
the pci device resources in the system in
vdev's probe function, and it allows better
functional subsystem registration in vdev probe
function.

As a bonus, This patch fixes a bond device
initialization use case.

example command to reproduce the issue:
./testpmd -c 0x2  --vdev 'eth_bond0,mode=0,
slave=0000:02:00.0,slave=0000:03:00.0' --
--port-topology=chained

root cause:
In existing case(vdev initialization and then pci
initialization), creates three Ethernet ports with
following port ids
0 - Bond device
1 - PCI device 0
2 - PCI devive 1

Since testpmd, calls the configure/start on all the ports on
start up,it will translate to following illegal setup sequence

1)bond device configure/start
1.1) pci device0 stop/configure/start
1.2) pci device1 stop/configure/start
2)pci device 0 configure(illegal setup case,
as device in start state)

The fix changes the initialization sequence and
allow initialization in following valid setup order
1) pcie device 0 configure/start
2) pcie device 1 configure/start
3) bond device 2 configure/start
3.1) pcie device 0/stop/configure/start
3.2) pcie device 1/stop/configure/start

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2016-12-21 15:41:17 +01:00
Jianfeng Tan
2eba8d21f3 eal: restrict cores auto detection
This patch uses pthread_getaffinity_np() to narrow down used
cores when none of below options is specified:
  * coremask (-c)
  * corelist (-l)
  * and coremap (--lcores)

The purpose of this patch is to leave out these core related options
when DPDK applications are deployed under container env, so that
users do not need decide the core related parameters when developing
applications. Instead, when applications are deployed in containers,
use cpu-set to constrain which cores can be used inside this container
instance. And DPDK application inside containers just rely on this
auto detect mechanism to start polling threads.

Note: previously, some users are using isolated CPUs, which could
be excluded by default. Please add commands like taskset to use
those cores.

Test example:
$ taskset 0xc0000 ./examples/helloworld/build/helloworld -m 1024

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-12-21 15:31:16 +01:00
Aaron Conole
12b9b2ee70 eal: clarify the argc and argv documentation
It's been a source of confusion in the past, and even with this update
may continue to be a source of confusion.  However, the original
language seems to imply that the DPDK EAL will take ownership of the
array passed in.  Loosening the language up a bit might give a better
understanding for what is actually happening.

Signed-off-by: Aaron Conole <aconole@redhat.com>
2016-12-21 15:25:29 +01:00
Olivier Matz
0880c40113 drivers: advertise kmod dependencies in pmdinfo
Add a new macro RTE_PMD_REGISTER_KMOD_DEP() that allows a driver to
declare the list of kernel modules required to run properly.

Today, most PCI drivers require uio/vfio.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-12-20 18:26:00 +01:00
Anatoly Burakov
c431384c8f vdev: fix detaching with alias
Fixes: d63eed6b2d ("eal: add driver name alias")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-12-07 21:14:43 +01:00
Robin Jarry
51c0c01b70 kni: avoid using lsb_release script
The lsb_release script is part of an optional package which is not
always installed. On the other hand, /etc/lsb-release is always present
even on minimal Ubuntu installations.

    root@ubuntu1604:~# dpkg -S /etc/lsb-release
    base-files: /etc/lsb-release

Read the file if present and use the variables defined in it.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-07 18:36:05 +01:00
Thomas Monjalon
65df6d069d config: remove insecure warnings
There was an option CONFIG_RTE_INSECURE_FUNCTION_WARNING (disabled by
default), which prevents from using some libc functions:
sprintf, snprintf, vsnprintf, strcpy, strncpy, strcat, strncat, sscanf,
strtok, strsep and strlen.

It's all about using them at the right place with the right precautions.
However, it is neither really possible nor a good advice to disable them.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-12-07 18:34:02 +01:00
Wei Dai
f1d54e6dfb pci: fix check of mknod
In function pci_mknod_uio_dev() in lib/librte_eal/eal/eal_pci_uio.c,
The return value of mknod() is ret, not f got by fopen().
So the value of ret should be checked for mknod().

Fixes: f7f97c1604 ("pci: add option --create-uio-dev to run without hotplug")

Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2016-12-06 11:59:39 +01:00
Olivier Matz
5d8f0baf69 log: do not drop debug logs at compile time
Today, all logs whose level is lower than INFO are dropped at
compile-time. This prevents from enabling debug logs at runtime using
--log-level=8.

The rationale was to remove debug logs from the data path at
compile-time, avoiding a test at run-time.

This patch changes the behavior of RTE_LOG() to avoid the compile-time
optimization, and introduces the RTE_LOG_DP() macro that has the same
behavior than the previous RTE_LOG(), for the rare cases where debug
logs are in the data path.

So it is now possible to enable debug logs at run-time by just
specifying --log-level=8. Some drivers still have special compile-time
options to enable more debug log. Maintainers may consider to
remove/reduce them.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-12-01 18:09:13 +01:00
Thomas Monjalon
3549dd6715 version: 17.02-rc0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-11-14 15:16:46 +01:00
Thomas Monjalon
d3bfeaaabf version: 16.11.0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-11-13 15:28:12 +01:00
Thomas Monjalon
a02a9135dc version: 16.11-rc3
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-11-07 22:13:27 +01:00
Igor Ryzhov
25c62ca4eb pci: fix probing error if no driver found
The rte_eal_pci_probe_one function could return false positive result if
no driver is found for the device.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-11-07 14:50:47 +01:00
David Marchand
d82eeefe7a pci: unset driver if probe fails
dev->driver should be set only if a driver did take the device.

Signed-off-by: David Marchand <david.marchand@6wind.com>
2016-11-07 14:50:47 +01:00
Ben Walker
d9dd34bc8a pci: probe only devices without any driver
If the user asks to probe multiple times, the probe
callback should only be called on devices that don't have
a driver already loaded.

This is useful if a driver is registered after the
execution of a program has started and the list of devices
needs to be re-scanned.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-06 22:58:08 +01:00
Jianbo Liu
545f16daf6 eal/ppc: fix file descriptor leak when getting CPU features
Close the file descriptor after finish using it.

Fixes: 9ae15538 ("eal/ppc: cpu flag checks for IBM Power")

Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
2016-11-06 22:42:06 +01:00
Jianbo Liu
a1ed637873 eal/arm: fix file descriptor leak when getting CPU features
Close the file descriptor after finish using it.

Fixes: b94e5c94 ("eal/arm: add CPU flags for ARMv7")
Fixes: 97523f82 ("eal/arm: add CPU flags for ARMv8")

Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
2016-11-06 22:41:51 +01:00
Thomas Monjalon
ca41215c05 version: 16.11-rc2
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-10-26 23:51:42 +02:00
Jan Blunck
d63eed6b2d eal: add driver name alias
This adds infrastructure for drivers to allow being requested by an alias
so that a renamed driver can still get loaded by its legacy name.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2016-10-25 18:49:18 +02:00
Ferruh Yigit
6445198f80 kni: fix build with kernel 4.9
compile error:
  CC [M]  .../lib/librte_eal/linuxapp/kni/igb_main.o
.../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21:
error: initialization from incompatible pointer type
	[-Werror=incompatible-pointer-types]
  .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
                     ^~~~~~~~~~~~~~~~~~~

Linux kernel 4.9 updates API for ndo_set_vf_vlan:
Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support")

Use new API for Linux kernels >= 4.9

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-10-25 16:20:43 +02:00
Ferruh Yigit
1735110509 kni: fix build with kernel < 3.1
compile error:
  CC [M]  .../lib/librte_eal/linuxapp/kni/kni_misc.o
cc1: warnings being treated as errors
.../lib/librte_eal/linuxapp/kni/kni_misc.c: In function ‘kni_exit_net’:
.../lib/librte_eal/linuxapp/kni/kni_misc.c:113:18:
error: unused variable ‘knet’

For kernel versions < v3.1 mutex_destroy() is a macro and does nothing,
this cause an unused variable warning for knet which used in the
mutex_destroy()

mutex_destroy() converted into static inline function with commit:
Linux: 4582c0a4866e ("mutex: Make mutex_destroy() an inline function")

To fix the warning unused attribute added to the knet variable.

Fixes: 93a298b34e ("kni: support core id parameter in single threaded mode")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-14 22:21:28 +02:00
Thomas Monjalon
fed622dfd9 version: 16.11-rc1
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-10-14 02:34:11 +02:00
Shreyansh Jain
01f1922786 drivers: rename register macro prefix
All macros related to driver registeration renamed from DRIVER_*
to RTE_PMD_*

This includes:

 DRIVER_REGISTER_PCI -> RTE_PMD_REGISTER_PCI
 DRIVER_REGISTER_PCI_TABLE -> RTE_PMD_REGISTER_PCI_TABLE
 DRIVER_REGISTER_VDEV -> RTE_PMD_REGISTER_VDEV
 DRIVER_REGISTER_PARAM_STRING -> RTE_PMD_REGISTER_PARAM_STRING
 DRIVER_EXPORT_* -> RTE_PMD_EXPORT_*

Fix PMDINFOGEN tool to look for matches of RTE_PMD_REGISTER_*.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-10-14 01:49:32 +02:00
Ferruh Yigit
473c4957a4 kni: move kernel version ifdefs to compat header
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:12:26 +02:00
Ferruh Yigit
dd6d3570c8 kni: prefer uint32_t to unsigned int
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:12:11 +02:00
Ferruh Yigit
e4728a1cfa kni: update log messages
Remove some function entrance logs and changed log level of some logs.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:12:00 +02:00
Ferruh Yigit
f13fbc033a kni: remove compile time debug configuration
Since switched to kernel dynamic debugging it is possible to remove
compile time debug log configuration.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:11:26 +02:00
Ferruh Yigit
dec1ffcae7 kni: move functions to eliminate declarations
Function implementations kept same.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:11:12 +02:00
Ferruh Yigit
d2d7d6fc5f kni: remove unnecessary messages for out of memory
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:09:12 +02:00
Ferruh Yigit
dd3e4e36d4 kni: update kernel logging
Switch to dynamic logging functions. Depending kernel configuration this
may cause previously visible logs disappear.

How to enable dynamic logging:
https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:09:02 +02:00
Ferruh Yigit
05788ff054 kni: prefer ether_addr_copy to memcpy
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:08:44 +02:00
Ferruh Yigit
e479813505 kni: prefer min_t to min
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:08:40 +02:00
Ferruh Yigit
88b7a2a7bd kni: enclose macros with complex values in parens
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:08:14 +02:00
Ferruh Yigit
59b36980e4 kni: do not use assignment in if condition
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:08:04 +02:00
Ferruh Yigit
50e25e4049 kni: move trailing statement on next line
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:07:16 +02:00
Ferruh Yigit
fa34b39dfd kni: move comparison constants on the right
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:06:42 +02:00
Ferruh Yigit
e227435ec0 kni: remove useless return
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:06:38 +02:00
Ferruh Yigit
0861751c93 kni: prefer unsigned int to unsigned
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:06:30 +02:00
Ferruh Yigit
1b9190aff3 kni: fix spacing and line lenghts
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:05:31 +02:00
Ferruh Yigit
9afcc5bc74 kni: make static struct const
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:05:28 +02:00
Ferruh Yigit
fbd71b623f kni: uninitialize global variables
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 23:05:20 +02:00
Ferruh Yigit
f60c4df6bb kni: move externs to the header file
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 22:49:41 +02:00
Vladyslav Buslov
93a298b34e kni: support core id parameter in single threaded mode
Allow binding KNI thread to specific core in single threaded mode
by setting core_id and force_bind config parameters.

Signed-off-by: Vladyslav Buslov <vladyslav.buslov@harmonicinc.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-10-13 22:24:45 +02:00
John Ousterhout
844bd77c03 log: respect logger configured before EAL init
Before this patch, application-specific loggers could not be
installed before rte_eal_init completed (the initialization process
called rte_openlog_stream, overwriting any previously installed
logger). This made it impossible for an application to capture the
initial log messages generated during rte_eal_init. This patch changes
initialization so that information from a previous call to
rte_openlog_stream is not lost. Specifically:
* The default log stream is now maintained separately from an
  application-specific log stream installed with rte_openlog_stream.
* rte_eal_common_log_init has been renamed to eal_log_set_default,
  since this is all it does. It no longer invokes rte_openlog_stream; it
  just updates the default stream. Also, this method now returns void,
  rather than int, since there are no errors.

This patch also removes the "early log" mechanism and cleans up the
log initialization mechanism:
* The default log stream defaults to stderr on all platforms if
  eal_log_set_default hasn't been invoked (Linux used to use stdout
  during the first part of initialization).
* Removed rte_eal_log_early_init; all of the desired functionality can
  be achieved by calling eal_log_set_default.
* Removed lib/librte_eal/bsdapp/eal/eal_log.c: it contained only one
  function, rte_eal_log_init, which is not needed or invoked for BSD.
* Removed declaration for eal_default_log_stream in rte_log.h (it's now
  private to eal_common_log.c).
* Moved call to rte_eal_log_init earlier in rte_eal_init for Linux, so
  that it starts using the preferrred log ASAP.

Signed-off-by: John Ousterhout <ouster@cs.stanford.edu>
2016-10-13 22:13:18 +02:00
Mauricio Vasquez B
29f1cb4b38 doc: fix file argument of debug functions
Previous patch updated the functions without updating all the comments.

Fixes: 591a9d7985 ("add FILE argument to debug functions")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquez@polito.it>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-10-13 21:25:53 +02:00
Thomas Monjalon
5fc07e3eb7 app/test: fix vdev names
The vdev eth_ring has been renamed to net_ring.
Some unit tests are using the old name and fail.

Fixes also the vdev comments in EAL and ethdev.

Fixes: 2f45703c17 ("drivers: make driver names consistent")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-10-13 15:55:42 +02:00
Shreyansh Jain
50a3345fa9 vdev: rename init/uninit ops to probe/remove
Inline with PCI probe and remove, VDEV probe and remove hooks provide
a uniform naming.
PCI probe represents scan and driver initialization. For VDEV, it will
represent argument parsing and initialization.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-10-06 16:02:14 +02:00
Olivier Matz
11fd19f764 mem: fix build with -O1
When compiled with EXTRA_CFLAGS="-O1", the compiler is not
able to detect that size is always initialized when used, and
issues a wrong warning:

  eal_memory.c: In function ‘rte_eal_hugepage_attach’:
  eal_memory.c:1684:3: error: ‘size’ may be used uninitialized in this
                       function [-Werror=maybe-uninitialized]
     munmap(hp, size);
     ^

Workaround this issue by initializing size to 0.
Seen on gcc (Debian 5.4.1-1) 5.4.1 20160803.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2016-10-06 15:23:53 +02:00
Ferruh Yigit
094be9925d kni: remove unnecessary ethtool files
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2016-10-05 15:45:21 +02:00
Ferruh Yigit
7550f1201f kni: remove unused ethtool files
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2016-10-05 15:45:11 +02:00
Jean Tourrilhes
db8c96c551 mem: fix hugepage mapping error messages
Running secondary is tricky due to the need to map the memory region
at the right place in VM, which is whatever primary has chosen. If the
base address for primary happens to by already mapped in the
secondary, we will hit precisely these error messages (depending if we
fail on the config region or the hugepages). This is why there is
already a comment about ASLR.

The issue is that in most cases, remapping does not happen and "errno"
is not changed and therefore stale. In our case, we got a "permission
denied", which sent us down the wrong track. It's such a common error
for secondary that I feel this error message should be unambiguous and
helpful.
The call to close was also moved because close() may override errno.

Signed-off-by: Jean Tourrilhes <jt@labs.hpe.com>
2016-10-05 11:42:45 +02:00
Konstantin Ananyev
fd4015e98e eal: fix C++ link of delay function pointer
When compiling with C++, it treats
void (*rte_delay_us)(unsigned int us);
as definition of the global variable.
So further linking with librte_eal fails.

Fixes: b4d63fb622 ("eal: customize delay function")

Steps to reproduce:

$ cat rttm1.cpp

using namespace std;

int main(int argc, char *argv[])
{
        int ret = rte_eal_init(argc, argv);
        rte_delay_us(1);
        cout << "return code ";
        cout << ret;
        return ret;
}

$ g++ -m64 -I/${RTE_SDK}/${RTE_TARGET}/include -c  -o rttm1.o rttm1.cpp
$ gcc -m64 -pthread -o rttm1 rttm1.o -ldl -Wl,-lstdc++ \
  -L/${RTE_SDK}/${RTE_TARGET}/lib -Wl,-lrte_eal
.../librte_eal.a(eal_common_timer.o):
(.bss+0x0): multiple definition of `rte_delay_us'
rttm1.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status

$ nm rttm1.o | grep rte_delay_us
0000000000000092 t _GLOBAL__sub_I_rte_delay_us
0000000000000000 B rte_delay_us

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2016-10-05 11:16:28 +02:00
Jerin Jacob
f91bcbb2d9 eal/armv8: use high-resolution cycle counter
Existing cntvct_el0 based rte_rdtsc() provides portable
means to get wall clock counter at user space. Typically
it runs at <= 100MHz.

The alternative method to enable rte_rdtsc() for high resolution
wall clock counter is through armv8 PMU subsystem.
The PMU cycle counter runs at CPU frequency, However,
access to PMU cycle counter from user space is not enabled
by default in the arm64 linux kernel.
It is possible to enable cycle counter at user space access
by configuring the PMU from the privileged mode (kernel space).

by default rte_rdtsc() implementation uses portable
cntvct_el0 scheme. Application can choose the PMU based
implementation with CONFIG_RTE_ARM_EAL_RDTSC_USE_PMU

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2016-10-04 10:43:44 +02:00
Yangchao Zhou
6edfa69ba6 pci: fix memory leak when detaching device
Fixes: dbe6b4b61b ("pci: probe or close device")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-04 10:05:51 +02:00
Jan Viktorin
13a1317d3b pci: create device list and fallback on its members
Now that rte_device is available, drivers can start using its members
(numa, name) as well as link themselves into another rte_device list.

As of now no one is using this list, but can be used for moving over all
devices (pdev/vdev/Xdev) and perform bulk actions (like cleanup).

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Reword commit log for extra rte_device list]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-03 16:34:03 +02:00
Jan Viktorin
a000b58662 eal: introduce generalized device
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>
2016-10-03 16:34:02 +02:00
Jan Viktorin
0a4f4001db eal: register drivers explicitly
To register both vdev and pci drivers into the list of all rte_driver,
we have to call rte_eal_driver_register explicitly.

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>
2016-10-03 16:33:59 +02:00
Jan Viktorin
2f3193cf0f pci: inherit common driver in PCI driver
Remove the 'name' member from rte_pci_driver and move to generic
rte_driver.

Most of the PMD drivers were initially using DRIVER_REGISTER_PCI(<name>..)
as well as assigning a name to eth_driver.pci_drv.name member.
In this patch, only the original DRIVER_REGISTER_PCI(<name>..) name has
been populated into the rte_driver.name member - assignments through
eth_driver has been removed.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
[Shreyansh: Rebase and expand changes to newly added files]
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Acked-by: David Marchand <david.marchand@6wind.com>
2016-10-03 16:33:55 +02:00
Jan Viktorin
9df1ae8a88 eal: rename and move PCI resource structure
There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.

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>
2016-10-03 16:33:53 +02:00
Jan Viktorin
8a4764a466 eal: include dev headers in place of PCI headers
Further refactoring and generalization of PCI infrastructure will
require access to the rte_dev.h contents.

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>
2016-10-03 16:33:52 +02:00
Jan Viktorin
2695c6df69 eal: remove unused PMD types
- All devices register themselfs by calling a kind of DRIVER_REGISTER_XXX.
  The PMD_REGISTER_DRIVER is not used anymore.
- PMD_VDEV type is also not being used - can be removed from all VDEVs.

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>
2016-10-03 16:33:51 +02:00
Jan Viktorin
fe363dd425 drivers: use vdev registration
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>
2016-10-03 16:33:48 +02:00
Jan Viktorin
7d299777ec eal: remove PCI/vdev unused code
- 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>
2016-10-03 16:33:45 +02:00
Jan Viktorin
a160404539 eal: extract vdev infra
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>
2016-10-03 16:33:42 +02:00
David Marchand
e8c528cb92 eal: add hotplug operations for PCI and vdev
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>
2016-10-03 16:33:32 +02:00
David Marchand
284576e3f6 ethdev: do not scan all PCI devices on attach
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>
2016-10-03 16:33:29 +02:00
David Marchand
affe1cdc00 pci: introduce helpers for device name parsing/update
- 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>
2016-10-03 16:33:26 +02:00
David Marchand
83dae4213d eal: introduce driver init macros
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>
2016-10-03 16:33:12 +02:00
Shreyansh Jain
af424af840 pci: replace devinit/devuninit with probe/remove
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>
2016-10-03 16:33:01 +02:00
David Marchand
3c1405b2f1 pci: initialize lists statically
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>
2016-10-03 16:32:49 +02:00
David Marchand
3071e0aaa8 eal: remove duplicate function declaration
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>
2016-10-03 16:32:43 +02:00
Flavio Leitner
4757d06634 eal: move CPU flags check from constructor to init
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>
2016-10-03 16:13:36 +02:00
Maciej Czekaj
c00ae961ff mem: fix crash on hugepage mapping error
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>
2016-10-03 16:06:27 +02:00
Yuanhan Liu
016a23a81e mem: remove single file segments
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>
2016-10-03 15:20:51 +02:00
Jozef Martiniak
b4d63fb622 eal: customize delay function
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>
2016-09-26 14:48:42 +02:00
Ferruh Yigit
6bbfb64b4e kni: fix large stack frame size
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>
2016-09-22 17:46:39 +02:00
Ferruh Yigit
8451269e6d kni: remove continuous memory restriction
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>
2016-09-21 19:18:44 +02:00
Yangchao Zhou
f503b8cff5 kni: fix error rollback kernel crash
Fixes: 9c61145ff6 ("kni: allow multiple threads")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-09-21 18:36:23 +02:00
Ferruh Yigit
7f5565592c kni: fix build with kernel 4.8
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>
2016-09-21 18:15:18 +02:00
Ferruh Yigit
ac11f6e84a kni: fix build with kernel < 3.0
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>
2016-09-21 18:14:34 +02:00
Pablo de Lara
e30a0178d2 kni: support RHEL 7.3
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>
2016-09-21 18:10:15 +02:00
Ferruh Yigit
d12bb41359 kni: fix debug build
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>
2016-09-21 18:06:08 +02:00
Robin Jarry
da5d107207 mem: use more restrictive permissions on hugepages
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>
2016-09-16 14:51:27 +02:00
Adrien Mazarguil
96330befb1 lib: hide static functions never defined
Arch-specific functions not defined for all architectures (missing on x86
in this case) and not used anywhere should not expose a prototype.

This commit prevents the following error:

 error: `rte_mov48' declared `static' but never defined

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
cd370e48ba lib: remove named variadic macros in exported headers
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

Since there is no way to force named variadic macros as extensions, use a
a standard __VA_ARGS__ with an extra dummy argument to format strings.

This commit prevents the following errors:

 error: ISO C does not permit named variadic macros

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
8480682efb lib: work around forward reference to enum types
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: ISO C forbids forward references to `enum' types

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
f04519d809 lib: add missing include dependencies
Exported header files for use by applications should be self sufficient and
allow out of order inclusion. Moreover, they must include all the system
headers they need for types and macros.

This commit prevents the following errors:

 error: `RTE_MAX_LCORE' undeclared here (not in a function)
 error: `RTE_LPM_VALID_EXT_ENTRY_BITMASK' undeclared
  (first use in this function)
 error: #error "Unsupported cache line size"
 error: `asm' undeclared (first use in this function)
 error: implicit declaration of function `[...]'
 error: unknown type name `[...]'
 error: field `mac_addr' has incomplete type
 error: `CHAR_BIT' undeclared here (not in a function)
 error: `struct [...]' declared inside parameter list
 error: unknown type name `uint8_t'

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
79d6f5fc58 lib: work around unnamed structs/unions
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked to avoid warnings and compilation failures.

Unnamed structs/unions are allowed since C11, however many compiler
versions do not use this mode by default.

This commit prevents the following errors:

 error: ISO C99 doesn't support unnamed structs/unions
 error: struct has no named members

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
8d4b8c87f2 lib: work around nonstandard bit-fields
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: type of bit-field `[...]' is a GCC extension

Note: the standard does not require implementations to issue a diagnostic
message with these, and such errors do not occur with recent GCC or clang
versions. However, GCC 4.7 is still common and using the extension keyword
is easier than checking compiler version.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
347a1e037f lib: use C99 syntax for zero-size arrays
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

The extension keyword is used whenever the C99 syntax cannot do it.

This commit prevents the following errors:

 error: ISO C forbids zero-size array `[...]'

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
517b89b090 lib: work around large enum values
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: ISO C restricts enumerator values to range of `int'

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Adrien Mazarguil
5f2c68a710 lib: work around braced-groups within expressions
Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

This commit prevents the following errors:

 error: ISO C forbids braced-groups within expressions

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-13 15:35:28 +02:00
Gowrishankar Muthukrishnan
d2cc795934 lpm: add AltiVec for ppc64
This patch adds ppc64le port for LPM library in DPDK.

Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
2016-09-09 17:56:08 +02:00
Vincent Guo
6914c3b844 kni: fix module init/exit
Fix pernet calls when HAVE_SIMPLIFIED_PERNET_OPERATIONS is not set.

Fixes: e6734d21b4 ("kni: fix build with kernel 2.6.32")

Signed-off-by: Vincent Guo <guopengfei160@163.com>
Acked-by Ferruh Yigit <ferruh.yigit@intel.com>
2016-09-09 16:30:37 +02:00
Ferruh Yigit
c37a291cd1 kni: support RHEL 6.8
Add support for RHEL6.8 which uses an old version of kernel with some
new features backported.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-09-09 16:03:39 +02:00
Ferruh Yigit
5544a453b4 kni: fix crash when removing interface
Removing KNI interface that has no PCI driver for ethtool support cause
kernel crash.

Fixes: 109febfe58 ("net/igb: move PCI device IDs from EAL")
Fixes: 221fba3b98 ("net/ixgbe: move PCI device IDs from EAL")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-09-09 15:47:48 +02:00
Christian Ehrhardt
9eedaa6990 kni: remove triple license information
License information is already in LICENSE.GPL.
Remove two extra copies and change referred filename in the files.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-08-24 18:25:36 +02:00
Shreyansh Jain
b21fb6cce3 eal: fix a comment
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-08-24 17:57:01 +02:00
Ferruh Yigit
b3aaf05cd7 eal: remove empty file for device IDs
All PCI device ids moved to drivers, it is safe to delete
rte_pci_dev_ids.h

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-08-23 15:33:16 +02:00
Ferruh Yigit
109febfe58 net/igb: move PCI device IDs from EAL
PCI device ids moved from common header into igb driver itself.

KNI starts using pci_device_id from kni/ethtool/igb driver, this is only
for KNI ethtool support, KNI data path is not affected.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-08-23 15:33:01 +02:00
Ferruh Yigit
221fba3b98 net/ixgbe: move PCI device IDs from EAL
PCI device ids moved from common header into ixgbe driver itself.

KNI starts using pci_device_id from kni/ethtool/ixgbe driver, this is
only for KNI ethtool support, KNI data path is not affected.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-08-23 15:32:33 +02:00
David Marchand
c711ccb309 ivshmem: remove library and its EAL integration
Following discussions on the mailing list [1] and since nobody stood up to
implement the necessary cleanups, here is the ivshmem integration removal.

There is not much to say about this patch, a lot of code is being removed.
The default configuration file for packet_ordering example is replaced with
the "native" x86 file.
The only tricky part is in eal_memory with the memseg index stuff.

More cleanups can be done after this but will come in subsequent patchsets.

[1]: http://dpdk.org/ml/archives/dev/2016-June/040844.html

Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Panu Matilainen <pmatilai@redhat.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2016-08-23 12:23:58 +02:00
Jim Harris
82f9318055 contigmem: zero all pages during mmap
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>
2016-08-22 22:59:05 +02:00
Thomas Monjalon
0b50aa7c07 version: 16.11-rc0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-08-03 18:48:59 +02:00
Thomas Monjalon
d7e61ad3ae log: remove deprecated history dump
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>
2016-08-03 18:48:54 +02:00
Thomas Monjalon
20e2b6eba1 version: 16.07.0
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-07-28 20:48:41 +02:00
Wei Dai
e7e769b409 eal: fix tail blank check in --lcores argument
the tail blank after a group of lcore or cpu set
will make check of its end character fail.
for example: --lcores '(0-3)@(0-3)   ,(4-5)@(4-5)',
the next character after cpu set (0-3) is not ','
or '\0', which fail the check in eal_parse_lcores( ).

Fixes: 53e54bf817 ("eal: new option --lcores for cpu assignment")

Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-07-28 18:11:30 +02:00
Wei Dai
f40c745450 eal: fix parsing of option --lcores
The '-' in lcore set overrides cpu set of following
lcore set in the argument of EAL option --lcores.
for example --locres '0-2,(3-5)@(3,4),6@(5,6),7@(5-7)',
0-2 make lflags=1 which indeed suppress following
cpu set (3,4), (5,6) and (5-7) after @ .

Fixes: 53e54bf817 ("eal: new option --lcores for cpu assignment")

Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-07-28 18:11:13 +02:00