Commit Graph

652 Commits

Author SHA1 Message Date
Jerin Jacob
c0583d98a9 eal: introduce macro for always inline
Different drivers use internal macros like force_inline for compiler
always inline feature.
Standardizing it through __rte_always_inline macro.

Verified the change by comparing the output binary file.
No difference found in the output binary file with this change.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-06-06 17:21:55 +02:00
Tiwei Bie
67064d6795 examples/exception_path: support FreeBSD
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-06-05 17:55:40 +02:00
Andrew Rybchenko
d432af7b5b examples/multi_process: remove unused variable
Fix broken build with -Werror=unused-but-set-variable

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2017-06-05 17:54:30 +02:00
Jerin Jacob
62a0e941b5 examples/vhost: fix uninitialized descriptor indexes
Fixing the below error by returning from the function early
when count == 0.

Issue flagged by GCC 7.1.1

examples/vhost/virtio_net.c:370:38: error: ‘desc_indexes[0]’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  rte_prefetch0(&vr->desc[desc_indexes[0]]);

Fixes: ca059fa5e2 ("examples/vhost: demonstrate the new generic APIs")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-06-05 14:28:32 +02:00
Jerin Jacob
35f30466d6 examples/qos_sched: suppress gcc 7.1.1 warning
This one is more of a compiler issue as application
checks the app_parse_opt_vals() return value.

Since this code is in slow path, adding a memset
to fix following "maybe-uninitialized" warning.

qos_sched/args.c: In function ‘app_parse_args’:
examples/qos_sched/args.c:254:32: error: ‘vals[0]’ may be
used uninitialized in this function [-Werror=maybe-uninitialized]
pconf->rx_port = (uint8_t)vals[0];
                            ~~~~^~~

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-06-05 14:27:01 +02:00
Jerin Jacob
1122ba9aa1 examples/performance-thread: add fall-through comments
This fixes compiler warnings with GCC 7.1.1

Fixes: d48415e1fe ("examples/performance-thread: add l3fwd-thread app")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-06-05 14:26:57 +02:00
Jerin Jacob
663d3bc6d6 examples/l3fwd: add switch fall-through comments
This fixes compiler warnings with GCC 7.1.1

Fixes: 268888b5b0 ("examples/l3fwd: modularize")
Fixes: 94c54b4158 ("examples/l3fwd: rework exact-match")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-06-05 14:26:51 +02:00
Gang Jiang
fa81d3b970 examples/vhost: fix socket path parsing
The return value of strnlen(s, maxlen) is never bigger than maxlen.

Fixes: 4796ad63ba ("examples/vhost: import userspace vhost application")

Signed-off-by: Gang Jiang <jiangg@mail.ustc.edu.cn>
2017-05-10 19:05:59 +02:00
Wei Dai
232dc830f2 examples/performance-thread: remove useless include
There is no function to refer any part of execinfo.h, so remove the
reference to it.
And there is no this file in musl. So need to remove it to support musl.

Signed-off-by: Wei Dai <wei.dai@intel.com>
2017-05-05 15:03:39 +02:00
Markos Chandras
939abaf96a examples/ethtool: fix link with ixgbe shared lib
When RTE_DEVEL_BUILD is unset, -rpath is unset.
So the ethtool app cannot link with ixgbe shared library
which is required by ethtool lib:

warning: librte_pmd_ixgbe.so.1, needed by
examples/ethtool/lib/x86_64-native-linuxapp-gcc/lib/librte_ethtool.so,
not found (try using -rpath or -rpath-link)

It is fixed by adding the library in the application link.

The library link is also improved to specify that this explicit link
to ixgbe is needed only in the shared lib mode.

Fixes: 077d223e25 ("examples/ethtool: use ixgbe public function")

Signed-off-by: Markos Chandras <mchandras@suse.de>
Acked-by: Remy Horton <remy.horton@intel.com>
Acked-by: Timothy Redaelli <tredaelli@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-05-01 22:03:37 +02:00
Andriy Berestovskyy
509f35d4c4 examples/load_balancer: fix Tx flush
Port ID is not an index from 0 to n_nic_ports, but rather a value
of nic_ports array.

Fixes: af75078fec ("first public release")

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
2017-05-01 18:18:29 +02:00
Pablo de Lara
4175729d01 examples/l3fwd-power: fix Rx descriptor size
L3fwd power app monitors the RX queues to see if the polling frequency
should be adjusted (the busier the queue, the higher the frequency).
The app uses several thresholds in the ring to determine the frequency,
being 96 the highest one, when frequency should be highest.

The problem is that the difference between this value and the ring size
is not big enough (128 - 96 = 32 descriptors), which means that
if the descriptors are not replenished quick enough, queue might
not be busy, but the app would think that it is, because 96th descriptor
is set.

Therefore, by increasing this gap (increasing the RX ring size),
we make sure that this false measurement will not happen.

Fixes: b451aa39db ("examples/l3fwd-power: use DD bit rather than RX queue count")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
2017-05-01 17:58:51 +02:00
Jingjing Wu
ddc554ad28 examples/l3fwd-power: fix handling no Rx queue
If the number of rx queues is zero, it is meaningless to enable
rx interrupt. This patch fixes it.

Fixes: aee3bc79cc ("examples/l3fwd-power: enable one-shot Rx interrupt and polling switch")
Cc: stable@dpdk.org

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
2017-05-01 17:52:49 +02:00
Remy Horton
935439234b examples/l2fwd-keepalive: clean up shared mem on exit
This patch adds the unlinking/unmapping of shared host memory
on termination of l2fwd-keepalive. Previously it was only
cleaned on re-running of the example application.

Fixes: e64833f227 ("examples/l2fwd-keepalive: add sample application")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Tested-by: Roman Korynkevych <romanx.korynkevych@intel.com>
2017-05-01 16:42:07 +02:00
Remy Horton
91e89e477e examples/l2fwd-keepalive: add graceful exit
The l2fwd-keepalive example has infinite processing loops and as a
result the only way to exit it is via SIGINT/SIGTERM (e.g. Control-C).
The resulting shutdown is unclean, which is fixed by adding a signal
handler that causes the processing loops to break.

Fixes: e64833f227 ("examples/l2fwd-keepalive: add sample application")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Tested-by: Roman Korynkevych <romanx.korynkevych@intel.com>
2017-05-01 16:42:07 +02:00
Zhiyong Yang
ab69581b74 examples/multi_process: fix timer update
To miss updating the variable prev_tsc in function l2fwd_main_loop()
The patch fixes it.

Fixes: e2366e74e0 ("examples: use buffered Tx")
Cc: stable@dpdk.org

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2017-05-01 16:39:28 +02:00
Bruce Richardson
b7162fee88 examples/performance-thread: fix build on FreeBSD 10.0
While later releases in the FreeBSD 10 series have a CPU_COUNT macro
defined, FreeBSD 10.0 and 10.1 do not have this macro. Therefore we provide
a basic fallback implementation of the macro for platforms where it is not
defined.

Fixes: 433ba6228f ("examples/performance-thread: add pthread_shim app")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2017-05-01 16:10:03 +02:00
Pablo de Lara
d7acf6ba43 examples/l2fwd-crypto: fix packets array index
Fixes: c0f87eb525 ("cryptodev: change burst API to be crypto op oriented")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2017-04-28 17:46:19 +02:00
Bruce Richardson
1e6d5a9608 examples/performance-thread: fix compilation on Suse 11 SP2
Fixes following compilation error, using uint64_t type,
instead of int128_t unnecessarily:

In file included from ./common/lthread.c:82:0:
./common/lthread_timer.h: In function ‘_ns_to_clks’:
./common/lthread_timer.h:49:20: error: expected ‘=’, ‘,’, ‘;’,
 ‘asm’ or ‘__attribute__’ before ‘clkns’
compilation terminated due to -Wfatal-errors.

Fixes: 116819b9ed ("examples/performance-thread: add lthread subsystem")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2017-04-24 16:02:20 +02:00
Bruce Richardson
9aba2a3f3d examples/performance-thread: use a single build dir
When building any of the perf-thread examples, the output .o files were
placed in two separate directories for each app: the regular build dir and
a "common" build directory. This was due to the way the files to be built
were specified, using a relative path. Switching to use VPATH to find the
files causes Make to put all .o's into the one build directory.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-21 16:20:33 +02:00
Bruce Richardson
4cde45f36f examples/performance-thread: fix build on FreeBSD
This set of sample apps did not compile on FreeBSD due to use of a number
of Linux/glibc-specific APIs, or APIs which existed in different headers
on FreeBSD. Specifically, the following APIs has problems:
  * sched_getcpu() is a glibc extension, so use rte_lcore_id() on BSD
  * pthread_yield() returns int on Linux, but void on FreeBSD, so
    we have to create two slightly different copies of the function.
  * the type for managing cpu sets is cpuset_t on FreeBSD rather than
    cpu_set_t as on Linux, so use rte_cpuset_t from rte_lcore.h.
  * APIs for managing cpu affinity are in pthread_np.h on FreeBSD, rather
    than in pthread.h, also fixed by including rte_lcore.h

Fixes: 433ba6228f ("examples/performance-thread: add pthread_shim app")
Fixes: d48415e1fe ("examples/performance-thread: add l3fwd-thread app")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-21 16:20:16 +02:00
Bruce Richardson
b2f4f2e2a6 examples: fix build clean on FreeBSD
The "examples_clean" top-level build target calls "make clean" for each
individual example. However, for a number of those which were linux-only
examples, the "if" condition only had a dummy "all" target i.e. no "clean"
target, causing an error with examples_clean.

Fixes: 3417cd687e ("examples: ignore linux apps on bsd")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-21 16:19:54 +02:00
Hiroki Shirokura
4ae49092fb examples/performance-thread: support C++
Lthread is awesome but it doesn't support C++.
So I write patch to support lthread to support C++.
Added "extern C {}" to lthread-headers

Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
2017-04-21 02:39:05 +02:00
Qi Zhang
6fed57a3f4 examples/ethtool: disable promiscuous mode by default
Disable promiscuous mode by default since VLAN filter
does not work when promiscuous mode is enabled.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2017-04-21 02:24:31 +02:00
Andriy Berestovskyy
5e470a6654 examples: limit max frame size
Some PMDs do not support 9,5K jumbo frames, so the example fails.
Limit the frame size to the maximum supported by the underlying NIC.

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
2017-04-21 02:21:29 +02:00
Andriy Berestovskyy
0469250961 examples/ip_pipeline: avoid panic if link up/down not supported
Some PMDs (mostly VFs) do not provide link up/down functionality.

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:15:12 +02:00
Andriy Berestovskyy
b58c9c3677 examples/ip_pipeline: support more than 32 CPUs
At the moment ip_pipeline example uses 32 during the initialization,
which leads to an error on systems with more than 32 CPUs.

Signed-off-by: Andriy Berestovskyy <andriy.berestovskyy@caviumnetworks.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:15:03 +02:00
Shyam Kumar Shrivastav
d5faec799c examples/ip_pipeline: fix port range filtering
Firewall ACL definition need to use same input index for source and
destination ports as these are 16 bits and would fit in one ACL
field of 32 bits. This is required as per librte_acl API. Without this
UDP/TCP source and destination ports filtering (and for that
matter ICMP type/code filtering) does not work.

Signed-off-by: Shyam Kumar Shrivastav <shrivastav.shyam@gmail.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2017-04-21 02:10:20 +02:00
Pablo de Lara
c64457cb11 examples/l2fwd-crypto: fix padding calculation
For padding calculation, it is necessary to know if algorithm
is a block cipher or stream cipher algorithm, and know the
block size for the algorithm.

In the application, this block size should be only the
cipher block size, but if authentication was used too,
it was being overwritten by the authentication block size,
which is not needed.

Fixes: 27cf2d1b18 ("examples/l2fwd-crypto: discover capabilities")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2017-04-20 11:32:45 +02:00
Fan Zhang
d2797f51cc examples/l2fwd-crypto: add cryptodev mask option
Previously, l2fwd-crypto application did not give user the
flexibility to decide which crypto device(s) will be used.

In this patch, a new cryptodev_mask option is added to the
application. Same as portmask, the cryptodev_mask avails the
user to mask out the unwanted crypto devices in the system.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
2017-04-20 11:32:45 +02:00
Pablo de Lara
18f421f65b examples/l2fwd-crypto: fix AEAD tests when AAD is zero
For AEAD algorithms, additional authenticated data (AAD)
can be passed, but it is optional, so its size can be zero.
However, it is required to set this length to zero in the crypto
operation to avoid undefined behaviour.

Fixes: 617a7949c9 ("examples/l2fwd-crypto: parse AAD parameter")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2017-04-20 11:32:45 +02:00
Jeff Guo
60da774e6e examples: enable HW CRC strip by default
Since VF can not disable/enable HW CRC strip for non-DPDK PF drivers,
and kernel driver almost default enable that feature, if disable it in
example app's rxmode, VF driver will report the VF launch failure. So
this patch default to enable HW CRC strip to let VF launch successful.

Cc: stable@dpdk.org

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
2017-04-10 22:36:37 +02:00
Bruce Richardson
a894e13ede examples: enable build of performance-thread
The performance-thread example was not build by default in the make
examples build target. It will compile ok for x86_64 targets so add it to
the examples makefile list for that platform.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
2017-04-06 21:37:19 +02:00
Akhil Goyal
c5aa9617c0 examples/ipsec-secgw: attach session-qp
adding support for attaching session to queue pairs.
This is required as underlying crypto driver may only
support limited number of sessions per queue pair
if max_nb_sessions_per_qp > 0, session should be
attached to a particular qp.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2017-04-06 00:17:44 +02:00
Pablo de Lara
59c51be41c examples/dpdk-qat: remove app
Remove DPDK QAT sample app, in favour of the newer applications
that use the cryptodev library: ipsec-gw and l2fwd-crypto,
which has support for Intel QuickAssist devices.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-06 00:17:44 +02:00
Pablo de Lara
4790f99d2d examples/l2fwd-crypto: use cryptodev algorithm parser
L2fwd-crypto app was creating an array of strings for the
supported algorithms, which was different from the strings
that are now in cryptodev.

Use the new API in cryptodev to parse the string from the user,
to get the algorithm enum, instead, so it is not necessary to add
a new supported algorithm in the cryptodev library and this app.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2017-04-06 00:17:44 +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
Yuanhan Liu
ca059fa5e2 examples/vhost: demonstrate the new generic APIs
Now DPDK vhost lib has been generic enough, that it can be used to
implement any vhost-user drivers.

For example, this patch implements a very simple vhost-user net driver,
mainly for demonstrating how to use those generic vhost APIs.

And when the --builtin-net-driver option is used, the example virtio-net
driver code will be invoked, instead of the one provided from the vhost
library.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2017-04-01 10:49:47 +02:00
Yuanhan Liu
a798beb47c vhost: rename header file
Rename "rte_virtio_net.h" to "rte_vhost.h", to not let it be virtio
net specific.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
Yuanhan Liu
af14759181 vhost: introduce API to start a specific driver
We used to use rte_vhost_driver_session_start() to trigger the vhost-user
session. It takes no argument, thus it's a global trigger. And it could
be problematic.

The issue is, currently, rte_vhost_driver_register(path, flags) actually
tries to put it into the session loop (by fdset_add). However, it needs
a set of APIs to set a vhost-user driver properly:
  * rte_vhost_driver_register(path, flags);
  * rte_vhost_driver_set_features(path, features);
  * rte_vhost_driver_callback_register(path, vhost_device_ops);

If a new vhost-user driver is registered after the trigger (think OVS-DPDK
that could add a port dynamically from cmdline), the current code will
effectively starts the session for the new driver just after the first
API rte_vhost_driver_register() is invoked, leaving later calls taking
no effect at all.

To handle the case properly, this patch introduce a new API,
rte_vhost_driver_start(path), to trigger a specific vhost-user driver.
To do that, the rte_vhost_driver_register(path, flags) is simplified
to create the socket only and let rte_vhost_driver_start(path) to
actually put it into the session loop.

Meanwhile, the rte_vhost_driver_session_start is removed: we could hide
the session thread internally (create the thread if it has not been
created). This would also simplify the application.

NOTE: the API order in prog guide is slightly adjusted for showing the
correct invoke order.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
Yuanhan Liu
7c12903746 vhost: rename device ops struct
rename "virtio_net_device_ops" to "vhost_device_ops", to not let it
be virtio-net specific.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
Yuanhan Liu
aca49772f6 vhost: do not include net specific headers
Include it internally, at vhost.h.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
Yuanhan Liu
f53cf83980 vhost: drop the Rx and Tx queue macro
They are virtio-net specific and should be defined inside the virtio-net
driver.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:42:44 +02:00
Yuanhan Liu
93433b639d vhost: make notify ops per vhost driver
Assume there is an application both support vhost-user net and
vhost-user scsi, the callback should be different. Making notify
ops per vhost driver allow application define different set of
callbacks for different driver.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:40:13 +02:00
Yuanhan Liu
0917f9d1f0 vhost: use new APIs to handle features
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2017-04-01 10:40:13 +02:00
Wei Dai
201d52bc0d examples/ip_fragmentation: fix check of packet type
The packet_type in mbuf is not correctly filled by ixgbe 82599 NIC.
To use the ether_type in ethernet header to check packet type is
more reliaber.

Fixes: 3c0184cc0c ("examples: replace some offload flags with packet type")
Fixes: ab351fe1c9 ("mbuf: remove packet type from offload flags")
Cc: stable@dpdk.org

Reported-by: Fangfang Wei <fangfangx.wei@intel.com>
Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Fangfang Wei <fangfangx.wei@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-04-04 14:52:06 +02:00
Bruce Richardson
eb4562714f examples/quota_watermark: use ring space for watermarks
Now that the enqueue function returns the amount of space in the ring,
we can use that to replace the old watermark functionality. Update the
example app to do so, and re-enable it in the examples Makefile.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:32:20 +02:00
Bruce Richardson
ecaed092b6 ring: return remaining entry count when dequeuing
Add an extra parameter to the ring dequeue burst/bulk functions so that
those functions can optionally return the amount of remaining objs in the
ring. This information can be used by applications in a number of ways,
for instance, with single-consumer queues, it provides a max
dequeue size which is guaranteed to work.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:32:20 +02:00
Bruce Richardson
14fbffb0aa ring: return free space when enqueuing
Add an extra parameter to the ring enqueue burst/bulk functions so that
those functions can optionally return the amount of free space in the
ring. This information can be used by applications in a number of ways,
for instance, with single-producer queues, it provides a max
enqueue size which is guaranteed to work. It can also be used to
implement watermark functionality in apps, replacing the older
functionality with a more flexible version, which enables apps to
implement multiple watermark thresholds, rather than just one.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:32:04 +02:00
Bruce Richardson
cfa7c9e6fc ring: make bulk and burst return values consistent
The bulk fns for rings returns 0 for all elements enqueued and negative
for no space. Change that to make them consistent with the burst functions
in returning the number of elements enqueued/dequeued, i.e. 0 or N.
This change also allows the return value from enq/deq to be used directly
without a branch for error checking.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2017-03-29 22:25:37 +02:00