Commit Graph

2762 Commits

Author SHA1 Message Date
Adrien Mazarguil
1ad44ac13c cmdline: add alignment constraint
This prevents sigbus errors on architectures that cannot handle unexpected
unaligned accesses to the output buffer.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:19:11 +01:00
Adrien Mazarguil
4fffc05a2b cmdline: support dynamic tokens
Considering tokens must be hard-coded in a list part of the instruction
structure, context-dependent tokens cannot be expressed.

This commit adds support for building dynamic token lists through a
user-provided function, which is called when the static token list is empty
(a single NULL entry).

Because no structures are modified (existing fields are reused), this
commit has no impact on the current ABI.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:18:25 +01:00
Adrien Mazarguil
b1a4b4cbc0 ethdev: introduce generic flow API
This new API supersedes all the legacy filter types described in
rte_eth_ctrl.h. It is slightly higher level and as a result relies more on
PMDs to process and validate flow rules.

Benefits:

- A unified API is easier to program for, applications do not have to be
  written for a specific filter type which may or may not be supported by
  the underlying device.

- The behavior of a flow rule is the same regardless of the underlying
  device, applications do not need to be aware of hardware quirks.

- Extensible by design, API/ABI breakage should rarely occur if at all.

- Documentation is self-standing, no need to look up elsewhere.

Existing filter types will be deprecated and removed in the near future.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olga Shern <olgas@mellanox.com>
2016-12-23 10:11:07 +01:00
Ferruh Yigit
15925897e7 ethdev: cleanup device ops struct whitespace
- Grouped related items using empty lines
- Aligned arguments to same column
- All item comments that doesn't fit same line are placed blow the item
  itself
- Moved some comments to same line if overall line < 100 chars

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-22 15:59:05 +01:00
Ferruh Yigit
a4435629a9 ethdev: remove invalid function from version map
Fixes: 9d41beed24 ("lib: provide initial versioning")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-22 15:48:13 +01:00
Jan Blunck
5c51e40445 ethdev: add internal reset function
This is a helper for DPDK internal users to force a reconfiguration of a
device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-21 18:47:53 +01:00
Jan Blunck
c3d3ba9892 ethdev: free queue array after releasing all queues
If all queues are released lets also free up the dev->data->rx/tx_queues
to be able to properly reinitialize.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-21 18:40:09 +01:00
Jan Blunck
d00d7cc883 ethdev: release queue before setting up
If a queue has been setup before lets release it before we setup.
Otherwise we might leak resources.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
2016-12-21 18:27:58 +01:00
Jan Blunck
75aca7997e ethdev: initialize more fields on allocation
This moves the non-PCI related initialization of the link state interrupt
callback list and the setting of the default MTU to rte_eth_dev_allocate()
so that drivers only need to set non-default values.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-21 17:32:17 +01:00
Jan Blunck
7f95f78a8a ethdev: clear data when allocating device
Lets clear the eth_dev->data when allocating a new rte_eth_dev so that
drivers only need to set non-zero values.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-12-21 17:30:27 +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
Anatoly Burakov
f9ae888b1e ethdev: fix port lookup if none
Aside from avoiding doing useless work, this also fixes a segfault
when calling rte_eth_dev_get_port_by_name() whenever no devices
were found yet, and therefore rte_eth_dev_data wasn't yet allocated.

Fixes: 9c5b8d8b9f ("ethdev: clean port id retrieval when attaching")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-12-07 19:04:41 +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
Reshma Pattan
6d059e9980 doc: add pdump library to API doxygen
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-12-06 15:43:13 +01:00
Yong Wang
247bde5231 doc: fix typos in code comments
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-12-06 15:25:01 +01:00
Olivier Matz
8ee94d8aee mempool: fix API documentation
A previous commit changed the local_cache table into a
pointer, reducing the size of the rte_mempool structure.

Fix the API comment of rte_mempool_create() related to
this modification.

Fixes: 213af31e09 ("mempool: reduce structure size if no cache needed")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-12-06 15:18:51 +01:00
Wei Zhao
580db2a5ce mempool: remove a redundant word in comment
There is a redundant repetition word "for" in comment line of the
file rte_mempool.h after the definition of RTE_MEMPOOL_OPS_NAMESIZE.
The word "for" appears twice in line 359 and 360. One of them is
redundant, so delete it.

Fixes: 449c49b93a ("mempool: support handler operations")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2016-12-06 15:18:51 +01:00
Wei Zhao
e8453b9f3c mempool: remove redundant socket id assignment
There is a redundant repetition mempool socket_id assignment in the
file rte_mempool.c in function rte_mempool_create_empty. The
statement "mp->socket_id = socket_id;"appear twice in line 821
and 824. One of them is redundant, so delete it.

Fixes: 85226f9c52 ("mempool: introduce a function to create an empty pool")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2016-12-06 15:18:51 +01:00
Bert van Leeuwen
e0ccf33800 ethdev: check maximum number of queues for statistics
Arrays inside rte_eth_stats have size=RTE_ETHDEV_QUEUE_STAT_CNTRS.
Some devices report more queues than that and this code blindly uses
the reported number of queues by the device to fill those arrays up.
This patch fixes the problem using MIN between the reported number of
queues and RTE_ETHDEV_QUEUE_STAT_CNTRS.

Fixes: ce757f5c9a ("ethdev: new method to retrieve extended statistics")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
2016-12-06 14:18:26 +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
Reshma Pattan
c9c7758dde pdump: fix log messages
The ethdev Rx/Tx remove callback apis doesn't set rte_errno during
failures, instead they just return negative error number, so using
that number in logs instead of rte_errno upon Rx and Tx callback
removal failures.

Fixes: 278f9454 ("pdump: add new library for packet capture")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-11-12 22:27:09 +01:00
Nipun Gupta
f5e9ed5c4e mempool: fix leak if populate fails
This patch fixes the issue of memzone not being freed incase the
rte_mempool_populate_phys fails in the rte_mempool_populate_default

This issue was identified when testing with OVS ~2.6
- configure the system with low memory (e.g. < 500 MB)
- add bridge and dpdk interfaces
- delete brigde
- keep on repeating the above sequence.

Fixes: d1d914ebbc ("mempool: allocate in several memory chunks by default")

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2016-11-12 22:27:09 +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
Alain Leon
8035bdde78 doc: fix typos
Fixes typos present in the documentation and code comments.

Signed-off-by: Alain Leon <xerebz@gmail.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-11-07 21:50:27 +01:00
Wei Dai
083e2f2600 ethdev: comment statistics field support
Add comments to describe that not all statistics fields in
struct rte_eth_stats are supported by any type of network
interface card. If any statistics field is not supported,
its value is 0.

Signed-off-by: Wei Dai <wei.dai@intel.com>
2016-11-07 21:33:38 +01:00
Wenzhuo Lu
91cd905af9 ip_frag: fix IP reassembly regression
After changing pkt[0] to pkt[], the example IP reassembly is not working.
It's weird because this change is fine. There should be no difference
between them.
As a workaround, revert this change.

Fixes: 347a1e037f ("lib: use C99 syntax for zero-size arrays")

Reported-by: Huilong Xu <huilongx.xu@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
2016-11-07 21:27:50 +01:00
Yuanhan Liu
164a601b52 vhost: remove references to vhost-cuse
vhost-cuse is removed, update corresponding comments that are still
referencing it.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
2016-11-07 15:59:21 +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
Fiona Trahe
59ab9a97c8 cryptodev: clarify how operations affect buffers
Updated comments on API to clarify which parts of mbufs are
copied or changed by crypto operations.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2016-11-07 00:22:58 +01:00
Wei Dai
c7e9d6a6ed lpm: fix freeing memory
The memory pointed by lpm->rules_tbl should also be freed
when memory malloc for tbl8 fails in rte_lpm_create_v1604( ).
And the memory pointed by lpm->tbl8 should also be freed
when the lpm object is freed in rte_lpm_free_v1604( ).

Fixes: f1f7261838 ("lpm: add a new config structure for IPv4")

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Wei Dai <wei.dai@intel.com>
2016-11-06 23:46:03 +01:00
Dmitriy Yakovlev
bf39fb4c5b cfgfile: fix API comments
Fixed style and return values in Doxygen comments.

Fixes: eaafbad419 ("cfgfile: library to interpret config files")

Signed-off-by: Dmitriy Yakovlev <bombermag@gmail.com>
2016-11-06 23:34:40 +01:00
Ferruh Yigit
20dbd33a36 net: remove mempool dependency
Fixes: b25c2a8c69 ("net: introduce net library")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2016-11-06 23:25:20 +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
e65b5069fd ethdev: rename library for consistency
The library was named libethdev without rte_ prefix.
It is now fixed, the library namespace is consistent.

Note: the ABI version has already been changed in this release cycle.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2016-11-06 20:53:23 +01:00
Shreyansh Jain
6ba1affa54 lib: fix ABI version after device model rework
rte_device/driver generalization patches [1] were merged without a change
in the LIBABIVER variable. This patches bumps the macro of affected libs:

- libcryptodev and libetherdev have been bumped
- librte_eal version changed in
  d7e61ad3ae ("log: remove deprecated history dump")

Details of ABI/API changes:
- EAL [version already bumped in: d7e61ad3ae]
  |- type field was removed from rte_driver
  |- rte_pci_device now embeds rte_device
  |- rte_pci_resource renamed to rte_mem_resource
  |- numa_node and devargs of rte_pci_driver is moved to rte_driver
  |- APIs for device hotplug (attach/detach) moved into EAL
  |- API rte_eal_pci_device_name added for PCI device naming
  |- vdev registration API introduced (rte_eal_vdrv_register,
  |  rte_eal_vdrv_unregister

- librte_crypto (v 1=>2)
  |- removed rte_cryptodev_create_unique_device_name API
  |- moved device naming to EAL

- librte_ethdev (v 4=>5)
  |- rte_eth_dev_type is removed
  |- removed dev_type from rte_eth_dev_allocate API
  |- removed API rte_eth_dev_get_device_type
  |- removed API rte_eth_dev_get_addr_by_port
  |- removed API rte_eth_dev_get_port_by_addr
  |- removed rte_cryptodev_create_unique_device_name API
  |- moved device naming to EAL

Also, deprecation notice from 16.07 has been removed and release notes for
16.11 added.

[1] http://dpdk.org/ml/archives/dev/2016-September/047087.html

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2016-11-06 20:53:23 +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
Reshma Pattan
bb900072ff pdump: revert PCI device name conversion
Earlier ethdev library created the device names in the
"bus:device.func" format hence pdump library implemented
its own conversion method for changing the user passed
device name format "domain🚌device.func" to "bus:device.func"
for finding the port id using device name using ethdev library
calls. Now after ethdev and eal rework
http://dpdk.org/dev/patchwork/patch/15855/,
the device names are created in the format "domain🚌device.func",
so pdump library conversion is not needed any more, hence removed
the corresponding code.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2016-10-26 21:54:38 +02:00
Slawomir Mrozowicz
8a9867a635 crypto/openssl: rename libcrypto to openssl
This patch replaces name "libcrypto" to "openssl" from file directories,
symbol prefixes and sub-names connected with old name.
Renamed poll mode driver files, test files, and documentations.
It is done to better name association with library because
the cryptography operations are using Openssl library crypto API.

Fixes: d61f70b4c9 ("crypto/libcrypto: add driver for OpenSSL library")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
2016-10-26 14:58:37 +02:00