Extended xstats API in ethdev library to allow grouping of stats
logically so they can be retrieved per logical grouping managed
by the application.
Added new functions rte_eth_xstats_get_names_by_id and
rte_eth_xstats_get_by_id using additional arguments (in compare
to rte_eth_xstats_get_names and rte_eth_xstats_get) - array of ids
and array of values.
doc: add description for modified xstats API
Documentation change for new extended statistics API functions.
The old API only allows retrieval of *all* of the NIC statistics
at once. Given this requires a MMIO read PCI transaction per statistic
it is an inefficient way of retrieving just a few key statistics.
Often a monitoring agent only has an interest in a few key statistics,
and the old API forces wasting CPU time and PCIe bandwidth in retrieving
*all* statistics; even those that the application didn't explicitly
show an interest in.
The new, more flexible API allow retrieval of statistics per ID.
If a PMD wishes, it can be implemented to read just the required
NIC registers. As a result, the monitoring application no longer wastes
PCIe bandwidth and CPU time.
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
Revert patches to provide clear view for
upcoming changes. Reverted patches are listed below:
commit ea85e7d711 ("ethdev: retrieve xstats by ID")
commit a954495245 ("ethdev: get xstats ID by name")
commit 1223608adb ("app/proc-info: support xstats by ID")
commit 25e38f09af ("net/e1000: support xstats by ID")
commit 923419333f ("net/ixgbe: support xstats by ID")
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
This commit fixs segment fault when rte_eth_dev_close() is called on
a virtio dev more than once. Assigning zero after free to avoids
freed memory to be accessed again.
Fixes: 69c80d4ef8 ("net/virtio: allocate queue at init stage")
Cc: stable@dpdk.org
Signed-off-by: Huanle Han <hanxueluo@gmail.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
vhost since dpdk17.02 + qemu2.7 and above will cause failures of
new connection when negotiating to set MQ. (one queue pair works
well).
Because there exist some bugs in qemu code when introducing
VHOST_USER_PROTOCOL_F_REPLY_ACK to qemu. when dealing with the vhost
message VHOST_USER_SET_MEM_TABLE for the second time, qemu indeed
doesn't send the messge (The message needs to be sent only once)but
still will be waiting for dpdk's reply ack, then, qemu is always
freezing. DPDK code indeed works in the right way.
The feature VHOST_USER_PROTOCOL_F_REPLY_ACK has to be disabled
by default at the dpdk side in order to avoid the feature support of
DPDK + qemu at the same time. if doing like that, MQ can works well.
Cc: stable@dpdk.org
Reported-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
When parsing a CLI, all the CLI instances are checked
one by one. Even if an instance already matches the CLI,
the parsing will not stop for ambiguous check.
The problem is that the following check may change the
parsing result of the previous one even if the following
instance doesn't match.
Use a temporary validate for the parsing result when
trying to match an instance and only store the result
when it matches, so the previous result has no chance
to be changed.
Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit addresses the following errors:
In file included from build/include/rte_latencystats.h:43:0,
from /tmp/check-includes.sh.6580.c:1:
build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t'
[...]
In file included from /tmp/check-includes.sh.6580.c:1:0:
build/include/rte_latencystats.h:66:19: error: expected declaration
specifiers or '...' before '*' token
[...]
Fixes: 5cd3cac9ed ("latency: added new library for latency stats")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit addresses the following error:
In file included from /tmp/check-includes.sh.28023.c:1:0:
build/include/rte_bitrate.h:82:2: error: unknown type name 'uint8_t'
[...]
It also adds C++ awareness to rte_bitrate.h.
Fixes: 2ad7ba9a65 ("bitrate: add bitrate statistics library")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
This commit addresses the following compilation errors:
In file included from /tmp/check-includes.sh.21060.c:1:0:
build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t'
[...]
It also adds C++ awareness to rte_metrics.h.
Fixes: 349950ddb9 ("metrics: add information metrics library")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
This commit addresses the following compilation errors:
In file included from /tmp/check-includes.sh.8373.c:1:0:
build/include/rte_efd.h:133:9: error: unknown type name 'uint8_t'
[...]
Fixes: 56b6ef874f ("efd: new Elastic Flow Distributor library")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Exported headers must allow compilation with the strictest flags. This
commit addresses the following errors:
In file included from build/include/rte_eventdev_pmd.h:55:0,
from /tmp/check-includes.sh.25816.c:1:
build/include/rte_eventdev.h:908:8: error: struct has no named members
[-Werror=pedantic]
[...]
In file included from /tmp/check-includes.sh.25816.c:1:0:
build/include/rte_eventdev_pmd.h:65:35: error: ISO C does not permit named
variadic macros [-Werror=variadic-macros]
[...]
Fixes: 71f2384328 ("eventdev: introduce event driven programming model")
Fixes: 4f0804bbdf ("eventdev: implement the northbound APIs")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Exported headers must allow compilation with the strictest flags. This
commit addresses the following errors:
In file included from /tmp/check-includes.sh.20132.c:1:0:
build/include/rte_vhost.h:73:30: error: ISO C forbids zero-size array
'regions' [-Werror=pedantic]
[...]
Also:
- Add C++ awareness to rte_vhost.h for consistency with rte_eth_vhost.h.
- Move Linux includes into C++ block to prevent linking issues with
exported symbols.
- Update check-includes.sh following the removal of rte_virtio_net.h.
Finally, update check-includes.sh to ignore rte_vhost.h and rte_eth_vhost.h
from now on since the Linux headers they depend on are not clean enough:
In file included from /usr/include/linux/vhost.h:17:0,
from build/include/rte_vhost.h:43,
from build/include/rte_eth_vhost.h:44,
from /tmp/check-includes.sh.20132.c:1:
/usr/include/linux/virtio_ring.h: In function 'vring_init':
/usr/include/linux/virtio_ring.h:146:16: error: pointer of type 'void *'
used in arithmetic [-Werror=pointer-arith]
[...]
In file included from build/include/rte_vhost.h:43:0,
from build/include/rte_eth_vhost.h:44,
from /tmp/check-includes.sh.20132.c:1:
/usr/include/linux/vhost.h: At top level:
/usr/include/linux/vhost.h:73:3: error: ISO C99 doesn't support unnamed
structs/unions [-Werror=pedantic]
[...]
Fixes: eb32247457 ("vhost: export guest memory regions")
Fixes: a798beb47c ("vhost: rename header file")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
E-Tag and NVGRE pattern items have been added hastily without updating
documentation nor testpmd.
This commit also adds default masks for these items based on the ixgbe
implementation.
Fixes: 99e7003831 ("net/ixgbe: parse L2 tunnel filter")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
This commit addresses the following compilation errors:
In file included from build/include/rte_flow_driver.h:50:0,
from /tmp/check-includes.sh.1397.cc:1:
build/include/rte_flow.h:428:2: error: expected primary-expression before
'.' token
[...]
build/include/rte_flow.h:469:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]
In file included from build/include/rte_flow_driver.h:50:0,
from /tmp/check-includes.sh.1397.cc:1:
build/include/rte_flow.h:631:1: error: C99 designator 'label_tc_s' outside
aggregate initializer
[...]
build/include/rte_flow.h:631:1: error: initializer-string for array of
chars is too long [-fpermissive]
[...]
build/include/rte_flow.h:650:1: sorry, unimplemented: non-trivial
designated initializers not supported
[...]
C++ does not support the C99-style designated initializers used in this
file for the default item masks. While the resulting symbols are primarily
useful to PMDs (written in C), they are exposed as part of the public API
for documentation purposes and to assist application writers.
Considering that:
- using pre-C99 initialization style for compatibility with C++ would
render them difficult to understand (all struct members must be
initialized)
- using both initialization styles would be needlessly verbose
- not exposing them at all would defeat their purpose
- applications do not normally need these symbols at run time
This commit hides these symbols from C++ applications. Specific C++
initializers will be added later if necessary.
Fixes: 6de5c0f130 ("ethdev: define default item masks in flow API")
Fixes: 7cd048321d ("ethdev: add MPLS and GRE flow API items")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
This commit addresses the following errors:
In file included from /tmp/check-includes.sh.18889.c:1:0:
build/include/rte_net_crc.h:86:1: error: unknown type name 'uint32_t'
[...]
Fixes: 986ff526fb ("net: add CRC computation API")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
This commit addresses the following errors:
In file included from /tmp/check-includes.sh.681.c:1:0:
build/include/rte_mbuf_ptype.h:587:35: error: unknown type name 'uint32_t'
[...]
build/include/rte_mbuf_ptype.h:662:51: error: unknown type name 'size_t'
[...]
Fixes: 288541c8ff ("mbuf: add functions to dump packet type")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
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>
On i686 builds, the uin64_t type is 64-bits in size but is aligned to
32-bits only. This causes mbuf fields for rearm_data to not be 16-byte
aligned on 32-bit builds, which causes errors with some vector PMDs which
expect the rearm data to be aligned as on 64-bit.
Given that we cannot use the extra space in the data structures anyway, as
it's already used on 64-bit builds, we can just force alignment of the
physical address in the mbuf to 8-bytes in all cases. This has no effect on
64-bit systems, but fixes the updated PMDs on 32-bit.
Fixes: f4356d7ca1 ("net/i40e: eliminate mbuf write on rearm")
Fixes: f160666a10 ("net/ixgbe: eliminate mbuf write on rearm")
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
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>
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>
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>
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>
Change comments for rte_flow_validate() function to indicate that flow
rule collision and resource validation is optional for PMDs and
therefore the return codes may have different meanings.
Fixes: b1a4b4cbc0 ("ethdev: introduce generic flow API")
Signed-off-by: John Daley <johndale@cisco.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
The code should return the actual number of packets read.
Fixes: 5a99f208 ("port: support file descriptor")
Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Makes code a bit cleaner and type-aware.
Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
alloc_q and rx_q fifos holds physical address of the mbufs, and not able
to free those mbufs explicitly.
But kernel thread reads from rx_q and puts used mbufs into free_q (with
their virtual addresses.) And kernel thread stopped when application
close the /dev/kni file on exit. So rx_q has time to be consumed by
kernel thread but leak is technically possible.
Another fifo, alloc_q has physical addresses too, but all those coming
from same mempool provided by application, when application quit, all
mempool already returned back, so this leak can be ignored.
Added check and wait logic for rx_q to be sure kernel consumed the fifo,
an error message printed after some ammount of wait, and an explicit
mempool free added for alloc_q.
Fixes: 8451269e6d ("kni: remove continuous memory restriction")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
In the absence of traffic, it is possible for the bitrate moving average
to get stuck at a non-zero value, due to the calculated delta being less
than what an integer can represent.
Fixes: 2ad7ba9a65 ("bitrate: add bitrate statistics library")
Signed-off-by: Remy Horton <remy.horton@intel.com>
Occasionally, the distributor single-packet-at-a-time mode will
segfault because it inadvertently calls some burst mode code when
flushing packets.
This patch ensures that only the v20 (single mode) codepath is used, and
returns without falling through to the burst mode code.
Fixes: 775003ad2f ("distributor: add new burst-capable library")
Signed-off-by: David Hunt <david.hunt@intel.com>
Tested-by: Yong Liu <yong.liu@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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>
There is a new argument --xstats-ids and --xstats-name
in proc_info command line to retrieve statistics given by ids
and by name.
E.g. --xstats-ids="1,3,5,7,8"
E.g. --xstats-name rx_errors
ethdev: mark functions as deprecated
Functions rte_eth_xstats_get_all and rte_eth_xstats_get_names_all
are marked as deprecated
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Introduced new function: rte_eth_xstats_get_id_by_name
to retrieve xstats ids by its names.
doc: added release note
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Extended xstats API in ethdev library to allow grouping of stats
logically so they can be retrieved per logical grouping managed
by the application.
Changed existing functions rte_eth_xstats_get_names and
rte_eth_xstats_get to use a new list of arguments: array of ids
and array of values. ABI versioning mechanism was used to
support backward compatibility.
Introduced two new functions rte_eth_xstats_get_all and
rte_eth_xstats_get_names_all which keeps functionality of the
previous ones (respectively rte_eth_xstats_get and
rte_eth_xstats_get_names) but use new API inside.
test-pmd: add support for new xstats API retrieving by id in
testpmd application: xstats_get() and
xstats_get_names() call with modified parameters.
doc: add description for modified xstats API
Documentation change for modified extended statistics API functions.
The old API only allows retrieval of *all* of the NIC statistics
at once. Given this requires a MMIO read PCI transaction per statistic
it is an inefficient way of retrieving just a few key statistics.
Often a monitoring agent only has an interest in a few key statistics,
and the old API forces wasting CPU time and PCIe bandwidth in retrieving
*all* statistics; even those that the application didn't explicitly
show an interest in.
The new, more flexible API allow retrieval of statistics per ID.
If a PMD wishes, it can be implemented to read just the required
NIC registers. As a result, the monitoring application no longer wastes
PCIe bandwidth and CPU time.
Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Signed-off-by: Kuba Kozak <kubax.kozak@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
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>
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>
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>
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>
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>
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>
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>
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>